Hwaro::Models::HighlightConfig
Syntax highlighting configuration
Constants
Copy-to-clipboard runtime for pre[data-copy] blocks: one DOM pass
on DOMContentLoaded, appends a button, and copies the code's text on
click. An existing .code-block (named fences) or .code-wrapper
parent is reused as the positioning anchor — inserting a new wrapper
inside .code-block would break its .code-block > pre styling —
otherwise the
is wrapped in a fresh.code-wrapper. Copied text strips the baked-in.lnline-number gutter spans (server-modelinenos) so pasted code has no number prefixes. Theme-neutral — currentColor only, revealed on hover/focus — and small enough to inline, so no extra request in either highlight mode.
Constructors
Instance methods
Adds a copy-to-clipboard button to fenced code blocks (per-block
{copy=false}/{copy=true} overrides). Off by default so existing
output is byte-identical.
Adds a copy-to-clipboard button to fenced code blocks (per-block
{copy=false}/{copy=true} overrides). Off by default so existing
output is byte-identical.
Generate the CSS link tag for highlighting
sri_root (the build output directory) adds integrity to the
self-hosted tags; CDN tags never get one (their bytes are unknown).
base_path (the path of base_url, Config#base_path) prefixes the
local files, which are published under it on a subpath deploy.
Generate the JS script tag for highlighting. Server-side highlighting needs no JavaScript at all — unless the copy button is on, whose (dependency-free) runtime ships either way.
Directory (relative to the project root) of extra Chroma/Pygments XML grammars for server mode; see Content::Processors::CustomLexers. Unset by default, which loads nothing.
Directory (relative to the project root) of extra Chroma/Pygments XML grammars for server mode; see Content::Processors::CustomLexers. Unset by default, which loads nothing.
Global default for fence-level linenos (see FenceOptions): when
true, every fenced code block with a language gets line numbers
unless it opts out with a per-block {linenos=false}. Off by
default so existing output is unaffected.
Global default for fence-level linenos (see FenceOptions): when
true, every fenced code block with a language gets line numbers
unless it opts out with a per-block {linenos=false}. Off by
default so existing output is unaffected.
"server" (default) highlights at build time (Tartrazine lexers, hljs-compatible CSS classes) so no JavaScript ships; "client" injects Highlight.js and highlights in the browser — theme CSS keeps working either way.
"server" (default) highlights at build time (Tartrazine lexers, hljs-compatible CSS classes) so no JavaScript ships; "client" injects Highlight.js and highlights in the browser — theme CSS keeps working either way.
Generate both CSS and JS tags