PageSourceSearch

https://betterstack.com/assets/articles_controllers/code_controller-a3b80b9c.js

js betterstack.com collected 2026-10-09 23:00:32 UTC 403 bytes, 13 lines download raw bytes

1import { Controller } from '@hotwired/stimulus'
2
3const highlightBarOffset = 8
4
5export default class extends Controller {
6  connect() {
7    // set highlight width to scrollable content width
8    const contentWidth = `${this.element.scrollWidth - highlightBarOffset}px`
9    for (const highlight of this.element.querySelectorAll('.code-highlight')) {
10      highlight.style.width = contentWidth
11    }
12  }
13}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.