Documentation
¶
Overview ¶
Package markup turns the Markdown of nodes and proofs into HTML (spec 06.2).
It adds these things to CommonMark and GFM:
- [[slug]], [owner/slug], [[slug#anchor]] and [[slug|text]] link to a node, an area or a card, and [[al:slug]] links to a page of the algorithm site;
- [^n] cites the source n of the front matter, and {rule:...}, {std:...} and {since:...} are inline references;
- a block quote that starts with [!note], [!warning], [!pitfall], [!history], [!tip] or [!since v="..."] is a callout;
- $...$ is inline math, and $$...$$ or a ```math block is display math, which KaTeX renders at build time;
- a ```pseudo block is pseudocode with stable line ids (spec 06.4);
- other fenced blocks are highlighted with Chroma at build time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CalloutKinds = map[string]string{"note": "Note", "warning": "Warning", "pitfall": "Pitfall", "history": "History", "since": "Since", "tip": "Tip"}
CalloutKinds are the kinds of callout and their titles.
Functions ¶
func Highlight ¶
Highlight returns highlighted HTML for code in a language. It uses CSS classes, so that the light and the dark themes can share the markup.
func HighlightCSS ¶
func HighlightCSS() string
HighlightCSS returns the CSS of the light and the dark code themes.
Types ¶
type Options ¶
type Options struct {
Resolve Resolver
// Math renders formulas at build time. When it is nil, a formula is left as TeX between \( \) or \[ \], for a renderer in the browser.
Math MathFunc
// Sources is the number of sources in the front matter. A citation [^n] links to the source n, from 1 to Sources.
Sources int
// Since gives the version that added a feature, for {since:<slug>}.
Since func(slug string) (string, bool)
// RuleURL gives the URL of a rule of a language reference, for {rule:<owner>/<id>}. An empty URL gives no link.
RuleURL func(owner, id string) string
}
Options are the inputs of RenderWith.
type Result ¶
type Result struct {
HTML string
TOC []Heading
Missing []string // slugs of [[links]] that do not resolve
LineIDs []string // the line ids of the pseudocode blocks, in order
Sections []string // the texts of the level 2 headings, in order
MathErrors []string // the formulas that do not render (rule W07)
Cites []int // the numbers of the citations [^n], in order
BadCites []int // the citations with no source in the front matter (rule G02)
BadCallouts []string // the callouts of a kind that is not known
}
Result is the output of Render.
Click to show internal directories.
Click to hide internal directories.