Documentation
¶
Overview ¶
Package highlight wraps Chroma so the rest of the project doesn't import it directly. RenderLines returns one HTML fragment per source line — the caller composes the row + gutter table itself (this is the GitHub-classic / Forgejo / Gitea pattern; chroma's own table mode is bypassed for layout-control reasons documented in RenderLines).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CSS ¶
func CSS() string
CSS returns the `<style>`-wrappable CSS for the highlight theme so the operator can serve it once at /static/css/chroma.css. Generated from BOTH the light (`github`) and dark (`github-dark`) Chroma styles so blob views render correctly under either theme. Each block is gated by `[data-theme="…"]` (the layout sets that on <html>) so only one set of rules is active per view. Without the dark variant the blob viewer renders code on a light background regardless of the page's theme — invisible text in dark mode.
func LanguageGuess ¶
LanguageGuess returns the human-readable language name (or "Text" fallback) for display in the blob viewer's header.
func RenderLines ¶
RenderLines tokenizes source via Chroma and returns one HTML fragment per line, with no surrounding `<pre>`/`<code>`/table. The caller composes the gutter + line table itself (S33 blob refactor).
Per-line splitting respects multi-line tokens: a docstring or block comment that spans 5 lines yields 5 fragments, each with the open `<span class="…">` re-emitted at the start and a `</span>` closer at the end, so every fragment is independently well-formed and the surrounding row table can intersperse other markup safely.
`filename` only drives lexer selection; the returned fragments don't reference it.
Types ¶
This section is empty.