Documentation
¶
Overview ¶
Package render is the single rendering pipeline shared by `mdoc print` and `mdoc open`. It turns a parsed document + resolved theme into the final HTML string that paged.js will paginate inside Chromium.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// VendorBase is the URL prefix from which paged.js + KaTeX assets load.
// Examples: "/_/vendor" for the preview server, or a file:// URL when
// the print pipeline extracts vendor files to a temp directory.
VendorBase string
// BaseHref controls how relative URLs inside the document resolve.
// Typically a file:// URL to the document's directory for print, or
// the server origin for preview.
BaseHref string
// HeadInject is extra HTML appended to <head>, e.g. live-reload glue.
HeadInject htmltmpl.HTML
// Version is reported as System.Version inside templates.
Version string
}
Options configure where browser-visible asset URLs point.
type SystemData ¶
SystemData are values made available to templates that aren't part of the document's own frontmatter (timestamps, mdoc version, etc.).
type ThemeData ¶
type ThemeData struct {
Title string
Author string
Tags []string
Page document.Page
Data map[string]any
Body htmltmpl.HTML
System SystemData
}
ThemeData is what theme templates and the markdown body template see.
func RenderThemed ¶
func RenderThemed(doc *document.Document, thm *theme.Theme, opts Options) (string, ThemeData, error)
RenderThemed runs the markdown body template, Markdown -> HTML, and the theme template — but NOT the shell wrap. The result is the themed HTML snippet that paged.js will paginate. Used by the preview server, which hosts its own copy of paged.js on the client side.