Skip to content

appendCodeBlock

Appends a code block to the given DocumentFragment or HTMLElement, styled to match Obsidian’s rendered-markdown inline code.

Import:

import { appendCodeBlock } from '@mnaoumov/obsidian-lib/html-element';

Signature:

function appendCodeBlock(element: HTMLElement | DocumentFragment, code: string): void

Parameters:

Parameter Type Description
element HTMLElement | DocumentFragment The DocumentFragment or HTMLElement to append the code block to.
code string The code to be displayed in the code block.

Returns: void