Skip to content

Commit

Permalink
Fix for issue 116
Browse files Browse the repository at this point in the history
  • Loading branch information
TfTHacker committed Apr 12, 2024
1 parent 157b497 commit 15845e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default class SNWPlugin extends Plugin {
// Turns on and off the SNW reference counters in Reading mode
toggleStateSNWMarkdownPreview(): void {
if (this.settings.displayInlineReferencesMarkdown && this.showCountsActive && this.markdownPostProcessor === null) {
this.markdownPostProcessor = this.registerMarkdownPostProcessor((el, ctx) => markdownPreviewProcessor(el, ctx));
this.markdownPostProcessor = this.registerMarkdownPostProcessor((el, ctx) => markdownPreviewProcessor(el, ctx), 100);
} else {
if (!this.markdownPostProcessor) {
console.log('Markdown post processor is not registered');
Expand Down
2 changes: 1 addition & 1 deletion src/ui/headerRefCount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function processHeader(mdView: MarkdownView) {
if (incomingLinks[0]?.excludedFile === true) incomingLinksCount = 0;

// if no incoming links, check if there is a header and remove it. In all cases, exit roturin
if (incomingLinksCount < plugin.settings.minimumRefCountThreshold) {
if (incomingLinksCount < 1) {
if (mdView.contentEl.querySelector('.snw-header-count-wrapper')) mdView.contentEl.querySelector('.snw-header-count-wrapper')?.remove();
return;
}
Expand Down
4 changes: 3 additions & 1 deletion src/view-extensions/references-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class snwChildComponent extends MarkdownRenderChild {
const minRefCountThreshold = plugin.settings.minimumRefCountThreshold;
const transformedCache = getSNWCacheByFile(this.currentFile);

// The following line addresses a conflict with the popular Tasks plugin.
if (this.containerEl.querySelectorAll('.contains-task-list').length > 0) return;
if (transformedCache?.cacheMetaData?.frontmatter?.['snw-file-exclude'] === true) return;

if (transformedCache?.blocks || transformedCache.embeds || transformedCache.headings || transformedCache.links) {
Expand Down Expand Up @@ -170,7 +172,7 @@ class snwChildComponent extends MarkdownRenderChild {
}

if (plugin.settings.enableRenderingLinksInMarkdown && transformedCache?.links) {
this.containerEl.querySelectorAll('a.internal-link:not(.snw-link-preview)').forEach((element) => {
this.containerEl.querySelectorAll('a.internal-link').forEach((element) => {
const link = parseLinkTextToFullPath(element.getAttribute('data-href'));
for (const value of transformedCache.links) {
if (
Expand Down

0 comments on commit 15845e1

Please sign in to comment.