Skip to content

registerFoldHandlers

Makes the headings and the nested lists of rendered markdown foldable, the way they are in a Reading view: it adds Obsidian’s own collapse indicators and handles their clicks.

A folded heading hides every block after it up to the next heading of the same or a higher level; unfolding it shows them again, except those a folded heading among them still hides. A folded list item hides its nested lists. Call it again after the element is re-rendered: blocks that already have an indicator are left alone, and the click handler is registered only once per element.

Import:

import { registerFoldHandlers } from '@mnaoumov/obsidian-lib/rendered-markdown';

Signature:

function registerFoldHandlers(params: RegisterFoldHandlersParams): void

Parameters:

Parameter Type Description
params RegisterFoldHandlersParams The parameters.

Returns: void


Links to this page: