Skip to content

Commit

Permalink
Stop rendering frontmatter
Browse files Browse the repository at this point in the history
  • Loading branch information
yan42685 committed May 23, 2023
1 parent 7937e63 commit 0b585c7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 0b585c7

Please sign in to comment.