Skip to main content

Function: codeBlock()

codeBlock(contents, language?, attributes?): string

Defined in: lib/markdown.ts:211

Function to create a code block.

Parameters​

contents​

string

The code to include in the block.

language?​

string

The language the code is written in.

attributes?​

Record<string, string>

Optional key-value attributes to include in the code fence (e.g. { title: "app.ts" } renders as ```ts title="app.ts").

Returns​

string

Markdown code block.