From 836f2adfeb63a02c48821d7a4c9592d7f5bd2051 Mon Sep 17 00:00:00 2001 From: Hady Osman Date: Mon, 14 Feb 2022 23:34:52 +1300 Subject: [PATCH] Fix ignoring of YAML frontmatter Correctly handle the two valid frontmatter scenarios: ``` --- yaml: "with no empty lines preceding it" --- ``` and ``` --- yaml: "with empty lines preceding it" --- ``` --- manifest.json | 2 +- package.json | 2 +- src/search/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 0768b62..ec9f6a5 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/package.json b/package.json index 6b8dd3b..bb86d11 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/search/index.ts b/src/search/index.ts index 1abc6d3..7dfd658 100644 --- a/src/search/index.ts +++ b/src/search/index.ts @@ -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 }