UpdateReferencesInContentParams
Params for updateReferencesInContent.
Import:
import type { UpdateReferencesInContentParams } from '@mnaoumov/obsidian-lib/link';Signature:
export interface UpdateReferencesInContentParamsProperties
| Property | Type | Description |
|---|---|---|
| abortSignal? | AbortSignal | The abort signal to control the execution of the function. |
| app | App | An Obsidian app instance. |
| content | string | A content to update the links in. |
| isEmptyEmbedAliasAllowed? | boolean | Whether to allow an empty alias for embeds. Applicable only if the result link style is LinkStyle.Markdown.If true: .If false: !. |
| linkPathStyle? | LinkPathStyle | A style of the link path. |
| linkStyle? | LinkStyle | A style of the link. |
| linkStyleProvider? | (reference: Reference) => LinkStyle | null | Decides the style of one link, overriding linkStyle for it. Returning null keeps linkStyle.Use it when one style for the whole content is wrong for some of its links. A caller forcing LinkStyle.Markdown over a note, for example, keeps a frontmatter wikilink a wikilink, because Obsidian reads a property value as a link only in that form. |
| newSourcePathOrFile | PathOrFile | A new source path or file. |
| offsetRange? | OffsetRange | A range within UpdateReferencesInContentParams.content, in character offsets, restricting the pass to the links inside it. When omitted, every link is visited. A link is updated only when it is **fully contained** in the range; one that merely overlaps it is left alone, because rewriting part of a link corrupts it. Both bounds are inclusive, so a range whose offsets coincide exactly with a link's does include that link. A reference that carries no position within the content — a frontmatter link, a multi-link frontmatter value entry, or any canvas reference — is never in range and is skipped whenever a range is supplied. |
| oldSourcePathOrFile? | PathOrFile | An old source path or file. |
| shouldEscapeAlias? | boolean | Whether to escape the alias. Applicable only if the result link style is LinkStyle.Markdown.If true: .If false: . |
| shouldIncludeAttachmentExtensionToEmbedAlias? | boolean | Whether to include the attachment extension in the embed alias. Applicable only if isEmptyEmbedAliasAllowed is false.If true: .If false: . |
| shouldSkipReference? | ((reference: Reference) => boolean) | null | A predicate choosing links to leave unchanged: for each reference it returns true for, the converter is not called, so the link stays byte-for-byte as written — its path, style, angle brackets and leading dot included. Use it to exclude links the caller decides on, for example by their resolved target path.Applied after the heading skip and the offset range. null behaves like an absent key, so a predicate factory that returns null when nothing is excluded can be passed straight through. |
| shouldSkipReferencesInHeadings? | boolean | Whether to leave every link inside a heading unchanged: it is neither converted nor restyled, so it stays byte-for-byte as written. A link in a heading is part of the heading's text, so rewriting it changes that text and breaks every #heading subpath pointing at the heading. See isReferenceInHeading. |
| shouldUpdateEmbedOnlyLinks? | boolean | Whether to update only embedded links. |
| shouldUpdateFileNameAlias? | boolean | Whether to update file name alias. |
| shouldUseAngleBrackets? | boolean | Indicates if the link should use angle brackets. Applicable only if linkStyle is LinkStyle.Markdown.If true: .If false: . |
| shouldUseLeadingDotForRelativePaths? | boolean | Indicates if the link should use a leading dot. Applicable only if linkPathStyle is LinkPathStyle.RelativePathToTheSource.If true: [[./relative/path/to/target]]If false: [[relative/path/to/target]] |
| shouldUseLeadingSlashForAbsolutePaths? | boolean | Indicates if the link should use a leading slash. Applicable only if linkPathStyle is LinkPathStyle.AbsolutePathInVault.If true: [[/absolute/path/to/target]]If false: [[absolute/path/to/target]] |
Links to this page: