From 6e922ee2ea4ef6b93d625bc18c2068b3e338d059 Mon Sep 17 00:00:00 2001 From: Mara Date: Thu, 14 Jul 2022 20:26:48 +0200 Subject: [PATCH] feat: adding multiple possibility to remove part links --- mkdocsPublisher/utils/utils.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mkdocsPublisher/utils/utils.ts b/mkdocsPublisher/utils/utils.ts index da6d0e3a..9a86e744 100644 --- a/mkdocsPublisher/utils/utils.ts +++ b/mkdocsPublisher/utils/utils.ts @@ -44,12 +44,14 @@ async function createLink(file: TFile, settings: MkdocsPublicationSettings, meta } baseLink = checkSlash(baseLink); if (settings.linkRemover.length > 0){ - filepath = filepath.replace(settings.linkRemover, '') + const tobeRemoved = settings.linkRemover.split(',') + for (const part of tobeRemoved) { + if (part.length > 0) { + filepath = filepath.replace(part.trim(), '') + } + } } - const url = encodeURI(baseLink + filepath) - new Notice( - (t("copylinkMsg") as StringFunc)(file.name) - ) + const url = encodeURI(baseLink + filepath.replace(".md", '')) await navigator.clipboard.writeText(url); return;