function

bun.markdown.html

function html(
input: string | ArrayBufferLike | TypedArray<ArrayBufferLike> | DataView<ArrayBufferLike>,
options?: Options
): string;

Render markdown to an HTML string.

@param input

The markdown string or buffer to render

@param options

Parser options

@returns

An HTML string

const html = Bun.markdown.html("# Hello **world**");
// "<h1>Hello <strong>world</strong></h1>\n"

// With options
const html = Bun.markdown.html("## Hello", { headings: { ids: true } });
// '<h2 id="hello">Hello</h2>\n'