From 53eee71b3295ad41e4b73e056ca18336b7d2d7c0 Mon Sep 17 00:00:00 2001 From: Martijn Date: Thu, 27 Jun 2024 19:33:36 +0200 Subject: [PATCH] fix: don't show tags as links closes #63 --- main.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.ts b/main.ts index eeae6bf..1ee35f3 100644 --- a/main.ts +++ b/main.ts @@ -405,7 +405,8 @@ class DocumentRenderer { this.removeFrontMatter(node); } - this.replaceInternalLinks(node); + this.replaceLinksOfClass(node, 'internal-link'); + this.replaceLinksOfClass(node, 'tag'); this.makeCheckboxesReadOnly(node); this.removeCollapseIndicators(node); this.removeButtons(node); @@ -436,12 +437,12 @@ class DocumentRenderer { .forEach(node => node.remove()); } - private replaceInternalLinks(node: HTMLElement) { - node.querySelectorAll('a.internal-link') + private replaceLinksOfClass(node: HTMLElement, className: string) { + node.querySelectorAll(`a.${className}`) .forEach(node => { const textNode = node.parentNode!.createEl('span'); textNode.innerText = node.getText(); - textNode.className = 'internal-link'; + textNode.className = className; node.parentNode!.replaceChild(textNode, node); }); }