std::encoding::markdownMarkdown to HTML conversion.
Convert Markdown text to HTML. Supports CommonMark syntax with an optional sanitized mode that strips potentially dangerous HTML.
import std.encoding.markdown;
fn main() {
let html = markdown.to_html("# Hello\n\nWorld");
println(html); // "<h1>Hello</h1>\n<p>World</p>\n"
}
to_htmlConvert a Markdown string to HTML.
import std.encoding.markdown;
fn main() {
let html = markdown.to_html("**bold** text");
}
to_html_safeConvert a Markdown string to sanitized HTML.
Strips raw HTML tags and potentially dangerous content from the output, making it safe to embed in web pages.
import std.encoding.markdown;
fn main() {
let safe = markdown.to_html_safe("Click <script>alert(1)</script>");
}