obsidian-dev-utils
Version:
This is the collection of useful functions that you can use for your Obsidian plugin development
25 lines (24 loc) • 1.18 kB
text/typescript
/**
* @packageDocumentation
*
* This module provides utility functions for working with Dataview links in Obsidian
*/
import type { DataviewInlineApi, Link } from './Dataview.mjs';
import type { PathOrFile } from './FileSystem.mjs';
/**
* Fixes the title of a file or folder note by generating a {@link Link} object with a proper title.
*
* @param dv - The DataviewInlineApi instance used to create the file link.
* @param pathOrFile - The file path for which the title is to be fixed.
* @param isFolderNote - A boolean indicating whether the file is a folder note. Defaults to `false`.
* If true, the title is derived from the folder name. Defaults to `false`.
* @returns A Link object with the corrected title.
*/
export declare function fixTitle(dv: DataviewInlineApi, pathOrFile: PathOrFile, isFolderNote?: boolean): Link;
/**
* Generates a string representation of a {@link Link} object that includes both the link text and the file path.
*
* @param link - The Link object to be converted to a string with its path.
* @returns A string representing the link in the format: "linkText (linkPath)".
*/
export declare function makeLinkWithPath(link: Link): string;