Documentation
¶
Overview ¶
Package markdown renders Markdown for the terminal. It wraps glamour for the styling and adds OSC 8 hyperlinks so URLs stay clickable.
Index ¶
Constants ¶
const DefaultWidth = 80
DefaultWidth is the word wrap used when the caller has no width of its own.
Variables ¶
This section is empty.
Functions ¶
func Hyperlink ¶
Hyperlink wraps text in an OSC 8 terminal hyperlink sequence, returning it unchanged when there is no URL to link to.
func LinkifyURLs ¶
LinkifyURLs wraps bare URLs in OSC 8 hyperlink sequences, leaving URLs that already sit inside one alone.
func Render ¶
Render renders Markdown as styled terminal output wrapped to width. It falls back to the Markdown source when glamour cannot be set up, so a rendering problem costs formatting rather than the message itself.
Only htmlutil.ToMarkdown can produce the Markdown this accepts: the type is the provenance, so a string from anywhere else cannot reach glamour. The Markdown is still treated as untrusted on the way in and the output is checked on the way out: see prepareSource and contain. One consequence worth knowing is that `&` is always literal here — an entity reference in the source is shown as the characters it was written with, because the HTML it came from already decoded the entities that were meant to be decoded.
Types ¶
This section is empty.