Documentation
¶
Overview ¶
Package render parses markdown to HTML using goldmark with GFM features and source-line annotations used by the browser scroll-sync client.
Index ¶
Constants ¶
const CSSCommon = `` /* 3656-byte string literal not displayed */
CSSCommon holds the shared markdown body styling.
const CSSDark = `` /* 390-byte string literal not displayed */
CSSDark holds the dark theme CSS custom properties.
const CSSLight = `` /* 390-byte string literal not displayed */
CSSLight holds the light theme CSS custom properties.
Variables ¶
var Alerts goldmark.Extender = alertsExtension{}
Alerts is the goldmark extension that recognises GitHub-style alerts.
var KindAlert = ast.NewNodeKind("Alert")
KindAlert is the ast.NodeKind for Alert.
Functions ¶
func BuildPage ¶
BuildPage wraps an HTML body in the full preview page template.
theme selects the color palette: "dark" (default) or "light". wsPort > 0 embeds the WebSocket scroll/reload client; pass 0 for the static CLI preview, which omits the WebSocket script entirely. extraCSS is appended after the default CSS so it wins via cascade. colemak swaps the in-page nav keys from j/k/l to n/e/i.
func RenderBody ¶
RenderBody reads filepath, strips YAML frontmatter, and renders it to an HTML body with data-line="N" attributes (1-indexed) on every block-level open tag whose origin can be traced to a source line.
On read error, it returns an HTML <p>Error reading file: ...</p> body and a non-nil error so callers can decide whether to surface the failure.
func RenderBytes ¶
RenderBytes is RenderBody for already-loaded content. Useful for tests and in-memory callers.