testHighlightPassesAHashWithNoName
A # with no name after it (JSX text read as code, or code that doesn't parse) is highlighted as itself and the
scan goes on: TypeScript's scanner takes no characters for it, which once kept highlight there forever (a forge
page that hung its process).
import { highlight } from "#codebase/tcmts/cli/pages"; import assert from "node:assert/strict"; export const testHighlightPassesAHashWithNoName = () => { for (const text of ["#", "a # b", "const P = () => <p>#{r.namespace} 😀#</p>;"]) { const html = highlight(text, [], new Set()); const plain = html .replace(/<[^>]+>/g, "") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, '"') .replace(/'/g, "'") .replace(/&/g, "&"); assert.equal(plain, text); } }