Skip to content

findDuplicateCaptions

Finds the captions declared by more than one button.

The suite addresses a button by its caption — it collects the captions that mounted and clicks the button carrying each one — so two buttons sharing a caption collapse into one: the second is never clicked, and the note reads as declaring a button that never rendered.

Import:

import { findDuplicateCaptions } from 'obsidian-dev-utils/script-utils/demo-vault-buttons';

Signature:

function findDuplicateCaptions(captions: readonly string[]): string[]

Parameters:

Parameter Type Description
captions readonly string[] A note’s button captions.

Returns: string[] — Each caption occurring more than once, listed once, in order of first repeat.