Skip to content

Commit

Permalink
fix: don't show tags as links
Browse files Browse the repository at this point in the history
closes #63
  • Loading branch information
Martijn committed Jun 27, 2024
1 parent 0b67b52 commit 53eee71
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
}
Expand Down

0 comments on commit 53eee71

Please sign in to comment.