markdown_to_html
Convert Markdown text to HTML using CommonMark + GFM extensions (strikethrough, tables, autolinks, task lists).
Parameters
- inputstringone of
inputorsource_key - Literal Markdown string; supports
${ctx.key}interpolation. - source_keystringone of
inputorsource_key - Context key whose value contains the Markdown text.
- output_keystringdefault "html"
- Context key where the resulting HTML is stored.
- sanitizebooldefault false
- When
true, sanitize the HTML output with ammonia to remove unsafe tags/attributes.
Providing both
inputandsource_keyis an error.
Context Output
<output_key>(defaulthtml) — the generated HTML string.
Example
local flow = Flow.new("convert_markdown")
flow:step("render", nodes.markdown_to_html({
input = "# Hello\n\nThis is **bold** and ~~struck~~.",
sanitize = true,
output_key = "html"
}))
flow:step("done", nodes.log({
message = "HTML output: ${ctx.html}"
})):depends_on("render")
return flow