Documentation
¶
Overview ¶
Package markdown renders Markdown with YAML front matter. It is shared by the content package, which renders collections at runtime, and by the code generator, which renders +page.md routes, so both produce the same HTML.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CodeCSS ¶
CodeCSS returns the CSS for highlighted code blocks in a chroma style, such as "github" or "dracula" (https://xyproto.github.io/splash/docs/).
Types ¶
type Document ¶
type Document struct {
// HTML is the rendered body.
HTML string `json:"html"`
// Headings lists the h2 to h4 headings in order.
Headings []Heading `json:"headings"`
// Words counts the words of the text.
Words int `json:"words"`
// ReadingMinutes estimates the reading time at 200 words a minute, at
// least 1.
ReadingMinutes int `json:"readingMinutes"`
// Excerpt is the first paragraph as plain text.
Excerpt string `json:"excerpt"`
}
Document is rendered Markdown.
func Parse ¶
Parse decodes the front matter into v (a pointer to a struct or map) and renders the body. v may be nil.
func RenderSafe ¶
RenderSafe renders Markdown from untrusted sources: raw HTML is replaced with a comment, and links with javascript: URLs are dropped.
Click to show internal directories.
Click to hide internal directories.