温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/bun/markdown/html
点击访问原文链接

function html | Bun module | Bun

function html | Bun module | BunBuildDocsReferenceGuidesBlogDiscord/Bun/markdown/htmlFhtml

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Bun/markdown/htmlFhtml

function

markdown.htmlfunction html(input: string | ArrayBufferLike | TypedArrayArrayBufferLike> | DataViewArrayBuffer>,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**");
// "Hello world\n"

// With options
const html = Bun.markdown.html("## Hello", { headings: { ids: true } });
// 'Hello\n'
Referenced typesclass ArrayBuffer

Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.

readonly [Symbol.toStringTag]: stringreadonly byteLength: number

Read-only. The length of the ArrayBuffer (in bytes).

resize(newByteLength?: number): void;

Resizes the ArrayBuffer to the specified size (in bytes).

MDN

resize(byteLength: number): ArrayBuffer;

Resize an ArrayBuffer in-place.

slice(begin: number,end?: number): ArrayBuffer;

Returns a section of an ArrayBuffer.

transfer(newByteLength?: number): ArrayBuffer;

Creates a new ArrayBuffer with the same byte content as this buffer, then detaches this buffer.

MDN

transferToFixedLength(newByteLength?: number): ArrayBuffer;

Creates a new non-resizable ArrayBuffer with the same byte content as this buffer, then detaches this buffer.

MDN

interface Options

Options for configuring the markdown parser.

By default, GFM extensions (tables, strikethrough, task lists) are enabled.

autolinks?: boolean | { email: boolean; url: boolean; www: boolean }

Enable autolinks. Pass true to enable all autolink types (URL, WWW, email), or an object to enable individually.

// Enable all autolinks
{ autolinks: true }
// Enable only URL and email autolinks
{ autolinks: { url: true, email: true } }
collapseWhitespace?: boolean

Collapse whitespace in text content. Default: false.

hardSoftBreaks?: boolean

Treat soft line breaks as hard line breaks. Default: false.

headings?: boolean | { autolink: boolean; ids: boolean }

Configure heading IDs and autolink headings. Pass true to enable both heading IDs and autolink headings, or an object to configure individually.

// Enable both heading IDs and autolink headings
{ headings: true }
// Enable only heading IDs
{ headings: { ids: true } }
latexMath?: boolean

Enable LaTeX math ($inline$ and $$display$$). Default: false.

noHtmlBlocks?: boolean

Disable HTML blocks. Default: false.

noHtmlSpans?: boolean

Disable inline HTML spans. Default: false.

noIndentedCodeBlocks?: boolean

Disable indented code blocks. Default: false.

permissiveAtxHeaders?: boolean

Allow ATX headers without a space after #. Default: false.

strikethrough?: boolean

Enable GFM strikethrough (~~text~~). Default: true.

tables?: boolean

Enable GFM tables. Default: true.

function html | Bun module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for function bun.markdown.html | Bun