std/markdown/html

std/markdown/src/html.trb

HTML output, as its own step over the tree: the HTML the CommonMark specification's examples expect, which is commonmark.js's and cmark's, and GitHub's for tables.

extend MarkdownDocument

extend MarkdownDocument

Adds html to a document, to render it as HTML.

Examples

var inlines: List<MarkdownInline> = []
inlines.append MarkdownInline.Text("Hello")
const block = MarkdownBlock BlockContent.Paragraph(inlines)
var blocks: List<MarkdownBlock> = []
blocks.append block
const document = MarkdownDocument blocks
print document.html()

fn html

fn html(): String

The document as HTML: the front matter is not part of it.

fn safeHtml

fn safeHtml(): String

The document as HTML for text that is not trusted: raw HTML, a block or a span, is written as escaped text, so it shows in the page and does nothing, and a link or image destination with a javascript:, vbscript: or data: scheme is written empty. The rest is what html() writes.

Examples

var inlines: List<MarkdownInline> = []
inlines.append MarkdownInline.Html("<b>")
const block = MarkdownBlock BlockContent.Paragraph(inlines)
var blocks: List<MarkdownBlock> = []
blocks.append block
const document = MarkdownDocument blocks
print document.safeHtml()