Skip to content

feat: parse and validate frontmatter metadata#28

Open
MarkoSagadin wants to merge 2 commits into
Mochitto:mainfrom
MarkoSagadin:feature/frontmatter
Open

feat: parse and validate frontmatter metadata#28
MarkoSagadin wants to merge 2 commits into
Mochitto:mainfrom
MarkoSagadin:feature/frontmatter

Conversation

@MarkoSagadin
Copy link
Copy Markdown
Collaborator

It is now expected that every markdown document contains frontmatter
block with three required fields:

  • deck_name,
  • note_type_basic and
  • note_type_clozes

tags and no_tabs fields are optional. Currently only no_tabs field is
actually used.

Closes: #11

Note

This PR was branched out from #27 PR. #27 should be first merged, and then this PR will show valid changes.

@MarkoSagadin MarkoSagadin changed the title Feature/frontmatter feat: parse and validate frontmatter metadata Feb 22, 2025
@Mochitto Mochitto moved this from Backlog to In Progress in Markdown2Anki Feb 25, 2025
With this change is now possible to disable presence of tabs, by adding
the below frontmatter snippet to the top of the markdown file:

---
no_tabs: True
---

If present then:
- 'L', 'R', '-', '+' tab flags are ignored, only 'F' and 'B' matter.
- Tab labels don't matter

To avoid possible styling interference two new classes were created:
body and body__content. They are a direct copy of the  tab__body and
tab__body_content classes, only that their display property is set to
'flex' instead of none.

The python code now generates the html out of markdown as it would
normally and wraps content in the above two mentioned containers.
That way no tab-related styling is present.

Finally, all the changes in the main.ts make the presence of the
.tab_group selector optional. If not found then no extra logic is
enabled and content is present on single page.
It is now expected that every markdown document contains frontmatter
block with three required fields:
- deck_name,
- note_type_basic and
- note_type_clozes

tags and no_tabs fields are optional. Currently only no_tabs field is
actually used.

Closes: Mochitto#11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Adding metadata to markdown input files

2 participants