Skip to content

Commit

Permalink
Fix ignoring of YAML frontmatter
Browse files Browse the repository at this point in the history
Correctly handle the two valid frontmatter scenarios:

```
---
yaml: "with no empty lines preceding it"
---
```

and

```

---
yaml: "with empty lines preceding it"
---
```
  • Loading branch information
hadynz committed Feb 14, 2022
1 parent 8a9305a commit 836f2ad
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "obsidian-sidekick",
"name": "Sidekick",
"description": "A companion to identify hidden connections that match your tags and pages",
"version": "1.0.5",
"version": "1.0.6",
"minAppVersion": "0.13.8",
"author": "Hady Osman",
"authorUrl": "https://hady.geek.nz",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-sidekick",
"version": "1.0.5",
"version": "1.0.6",
"description": "A companion to identify hidden connections that match your tags and pages",
"main": "src/index.ts",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class Search {
private redactText(text: string): string {
return text
.replace(/```[\s\S]+?```/g, (m) => ' '.repeat(m.length)) // remove code blocks
.replace(/^\n+---[\s\S]+?---/g, (m) => ' '.repeat(m.length)) // remove yaml front matter
.replace(/^\n*?---[\s\S]+?---/g, (m) => ' '.repeat(m.length)) // remove yaml front matter
.replace(/#+([a-zA-Z0-9_]+)/g, (m) => ' '.repeat(m.length)) // remove hashtags
.replace(/\[(.*?)\]+/g, (m) => ' '.repeat(m.length)); // remove links
}
Expand Down

0 comments on commit 836f2ad

Please sign in to comment.