Skip to content

rebasePathOntoFolder

Rebases a path from one folder onto another.

Used to work out where a linked attachment ends up once its whole unit folder has moved, so the link can be pointed at the file’s new home rather than at where the folder used to be.

Import:

import { rebasePathOntoFolder } from 'obsidian-dev-utils/obsidian/attachment-unit-folder';

Signature:

function rebasePathOntoFolder(params: RebasePathOntoFolderParams): string | null

Parameters:

ParameterTypeDescription
paramsRebasePathOntoFolderParamsThe parameters for rebasing the path.

Returns: string | null — The rebased path, or null when the path does not sit inside the old folder.


Links to this page: