From 0b585c760d7570e248f7dd340e98d9a605a68d64 Mon Sep 17 00:00:00 2001 From: alex <419725794@qq.com> Date: Tue, 23 May 2023 16:01:35 +0800 Subject: [PATCH] Stop rendering frontmatter --- main.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index d8adef3d..a2760a0d 100644 --- a/main.js +++ b/main.js @@ -1547,6 +1547,7 @@ class SmartConnectionsPlugin extends Obsidian.Plugin { let is_code = false; let char_accum = 0; const line_limit = limits.lines || file_lines.length; + let is_frontmatter = false; for (let i = 0; first_ten_lines.length < line_limit; i++) { let line = file_lines[i]; // if line is undefined, break @@ -1560,7 +1561,19 @@ class SmartConnectionsPlugin extends Obsidian.Plugin { line = line.slice(0, limits.chars_per_line) + "..."; } // if line is "---", skip - if (line === "---") + if (line === "---") { + // frontmatter ends + if (is_frontmatter) { + is_frontmatter = false; + } + // frontmatter starts + if (i === 0) { + is_frontmatter = true; + } + continue; + } + // if line is part of the frontmatter, skip + if (is_frontmatter) continue; // skip if line is empty bullet or checkbox if (['- ', '- [ ] '].indexOf(line) > -1)