Skip to content

findNotePriorityRank

Finds how highly a note ranks in the priority list.

An entry matches in one of four ways, picked by its shape so that one list can express all of them:

  • property:name — the note’s frontmatter has name; property:name=value also compares the value. - /regular expression/ — tested against the note’s path. - .ext — the note’s path ends with it, case-insensitively. This is the form the request asked for. - anything else — a path from the vault root, matching the vocabulary of the include / exclude path settings.

When a note matches several entries the longest one decides its rank, so the most specific entry wins and the order of the list is left to express priority. Without this an Excalidraw note could never rank below a plain markdown one: drawing.excalidraw.md also ends with .md, so .md above .excalidraw.md — the very example the request is built on — would tie instead of resolving. Equal-length matches fall to the earlier entry.

Import:

import { findNotePriorityRank } from 'obsidian-dev-utils/obsidian/note-priority';

Signature:

function findNotePriorityRank(params: FindNotePriorityRankParams): number

Parameters:

ParameterTypeDescription
paramsFindNotePriorityRankParamsThe parameters for finding the rank.

Returns: number — The index of the most specific matching entry, or NO_PRIORITY_MATCH when none match.


Links to this page: