Module
marksy/html
src/marksy/html.pookaDress the syntax tree in HTML without asking it to parse itself again. Raw HTML and links have separate policies: escaping tags alone does not make a javascript link safe. Trusted publishing can preserve raw markup; the default leaves it visible as text.
assert html.escape("<owl>") == "<owl>"
API reference
enum RawHtml
RawHtml.Escape
RawHtml.Preserve
RawHtml.Omit
class Options(raw_html: RawHtml, allow_unsafe_urls: Bool)
raw_html: RawHtml
INFERRED
marksy/html.RawHtmlallow_unsafe_urls: Bool
INFERRED
Bool
INFERRED
fn(marksy/html.RawHtml, Bool) -> marksy/html.Optionsdefaults() -> Options
INFERRED
fn() -> marksy/html.OptionsSafe defaults for application rendering. CommonMark conformance uses an explicit Preserve policy because the specification includes raw HTML.
escape(source: String) -> String
INFERRED
fn(String) -> Stringrender(document: ast.Document) -> String
INFERRED
fn(marksy/ast.Document) -> StringRender with escaped raw HTML and restricted URL destinations.
assert html.render(marksy.parse("# Owl")) == "<h1>Owl</h1>\n"
render_with(document: ast.Document, options: Options) -> String
INFERRED
fn(marksy/ast.Document, marksy/html.Options) -> StringSelect HTML policy independently from the Markdown extensions.
let policy = html.Options(html.RawHtml.Preserve, False)
let page = marksy.parse("a <b>small</b> owl")
assert html.render_with(page, policy) == "<p>a <b>small</b> owl</p>\n"
inlines(content: List(ast.Inline), options: Options) -> String
INFERRED
fn(List(marksy/ast.Inline), marksy/html.Options) -> String