Skip to content

normalizeLinkName

Normalizes a link name for comparison: lowercased, with every run of two or more spaces collapsed into one.

Obsidian treats [[some alias]] and [[Some Alias]] as naming the same note, so a lookup that resolves a wikilink by basename or alias has to compare in this space. Every plugin answering that question must use this function rather than a copy of it: two copies that disagree do not fail a build or a test, they make the same link resolve to a different note depending on which plugins are installed.

Only the space character is collapsed. Tabs and other whitespace are kept as they are.

Import:

import { normalizeLinkName } from 'obsidian-dev-utils/obsidian/link-name';

Signature:

function normalizeLinkName(name: string): string

Parameters:

Parameter Type Description
name string The raw basename or alias.

Returns: string — The name in normalized space.