UpdateLinksInFileParams
Params for updateLinksInFile.
Import:
import type { UpdateLinksInFileParams } from '@mnaoumov/obsidian-lib/link';Signature:
export interface UpdateLinksInFileParams extends ProcessOptionsExtends: ProcessOptions
Properties
| Property | Type | Description |
|---|---|---|
| app | App | An Obsidian app instance. |
| 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? | (link: Reference) => LinkStyle | undefined | Decides the style of one link, overriding linkStyle for it. Returning undefined keeps linkStyle.Use it when one style for the whole file 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 file to update the links in. |
| offsetRange? | OffsetRange | A range within the file's 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 file's 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. The offsets are into the content this function reads from the vault. Before reading, it saves any unsaved editor buffer for the file, so a range taken from an open editor via Editor.posToOffset is valid. The caller owns only the case where the buffer changes between computing the range and this call. |
| oldSourcePathOrFile? | PathOrFile | An old path of the file. |
| pluginNoticeComponent | null | PluginNoticeComponent | Plugin notice component used to show the timeout notice. When null, no timeout notice is shown regardless of ProcessOptions.shouldShowTimeoutNotice; the timeout is only logged.(Inherited from ProcessOptions) |
| resourceLockComponent | null | ResourceLockComponent | An resource-lock component used to lock the file's editor read-only for the duration of processing. The lock is reference-counted, so it composes with any outer operation-level lock on the same note. (Inherited from ProcessOptions) |
| shouldEscapeAlias? | boolean | Whether to escape the alias. Applicable only if the result link style is LinkStyle.Markdown.If true: .If false: . |
| shouldFailOnMissingFile? | boolean | Whether to fail if the file is missing or deleted. (Inherited from ProcessOptions) |
| shouldIncludeAttachmentExtensionToEmbedAlias? | boolean | Whether to include the attachment extension in the embed alias. Applicable only if isEmptyEmbedAliasAllowed is false.If true: .If false: . |
| shouldShowTimeoutNotice? | boolean | Whether to show a timeout notice. (Inherited from ProcessOptions) |
| 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: