Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: stop rendering frontmatter #219

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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