reuseman / flashcards-obsidian

🎴 An Anki plugin for Obsidian.md
MIT License
872 stars 86 forks source link

Listed tags in Font matter are not rendered. #117

Open jaxxor44 opened 1 year ago

jaxxor44 commented 1 year ago

It seems any tags in listed form (as is shown in an example on the Obsidian help page) are not rendered into anki as tags.

Have font matter data in a similar format:

tags: 
  - "TestC"
  - testA

render cards like normal.

its expected that anki will list these tags (and sub tags) on all flash cards rendered on this page.

Markdown used

---
tags: 
  - "TestC"
  - testA
cards-deck: test
---
# test
>[!info] card
>This is a ==test== card.

Confirmed using plugin version 1.6.3

putzwasser commented 1 year ago

The problem is the parseGlobalTags function which uses this regex:

/(?:cards-)?tags: ?(.*)/im

it doesn't account for YAML lists, yet.

A better approach would be to use the obsidian.parseFrontMatterEntry function to parse obsidian.parseFrontMatterEntry(frontmatter, "cards-tags") and/or obsidian.parseFrontMatterEntry(frontmatter, "tags"). I guess the rule should be: use the regular tags field if no cards-tag field is present.

Side note: cards-tags should be mentioned in the wiki.