1import { Controller } from "@hotwired/stimulus" 2 3export default class extends Controller { 4 connect() { 5 this.addAnchorLinks() 6 } 7 8 addAnchorLinks() { 9 const headings = this.element.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]") 10 11 headings.forEach((heading) => { 12 const id = heading.id 13 if (id) { 14 const anchor = document.createElement("a") 15 anchor.href = `#${id}` 16 anchor.className = "anchor" 17 anchor.title = "Jump to this heading" 18 anchor.setAttribute("aria-hidden", "true") 19 heading.insertBefore(anchor, heading.firstChild) 20 } 21 }) 22 } 23};
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.