Skip to content

normalizePath

Normalizes a path so it can be used with the vault, exactly as Obsidian’s own does: backslashes and runs of slashes become a single /, leading and trailing slashes are stripped, a path left empty becomes the root /, a no-break space (U+00A0) or a narrow no-break space (U+202F) becomes a plain space, and the result is put in Unicode normalization form NFC.

Import:

import { normalizePath } from 'obsidian-test-mocks/obsidian';

Signature:

function normalizePath(path: string): string

Parameters:

Parameter Type Description
path string The path to normalize.

Returns: string — The normalized path.