Skip to content

Commit

Permalink
fix matching html content as obsidian tags
Browse files Browse the repository at this point in the history
addresses ObsidianToAnki#536 

This regex matches obsidian tag style `#my-tag` only if it's not part of an HTML expression, e.g. from ObsidianToAnki#536, `&ObsidianToAnki#39;` will be matched and skipped over.
  • Loading branch information
kai-kea committed Feb 27, 2024
1 parent feb3db2 commit 5a3d78a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const TAG_PREFIX:string = "Tags: "
export const TAG_SEP:string = " "
export const ID_REGEXP_STR: string = String.raw`\n?(?:<!--)?(?:ID: (\d+).*)`
export const TAG_REGEXP_STR: string = String.raw`(Tags: .*)`
const OBS_TAG_REGEXP: RegExp = /#(\w+)/g
const OBS_TAG_REGEXP: RegExp = /(?:&#\d+;)|#(\w+)/g

const ANKI_CLOZE_REGEXP: RegExp = /{{c\d+::[\s\S]+?}}/
export const CLOZE_ERROR: number = 42
Expand Down

0 comments on commit 5a3d78a

Please sign in to comment.