-
Notifications
You must be signed in to change notification settings - Fork 130
Header paragraph style
Pseudonium edited this page Apr 27, 2024
·
5 revisions
Regex line: ^#+(.+)\n*((?:\n(?:^[^\n#].{0,2}$|^[^\n#].{3}(?<!<!--).*))+)
- Create a file called
test.md
. - Paste the following contents into the file:
# Style This style is suitable for having the header as the front, and the answer as the back # Overall heading ## Subheading 1 You're allowed to nest headers within each other ## Subheading 2 It'll take the deepest level for the question ## Subheading 3 It'll even Span over Multiple lines, and ignore preceding whitespace
- In the plugin settings, paste the Regex line into the 'Custom Regexps' field associated with 'Basic'
- Ensure that the 'Regex' option is checked
- Click the Anki icon on the ribbon to run the plugin
- Run the script, and check 'Config' to open up the config file:
- Navigate to the "Custom Regexps" section
- Change the line
Basic =
to
Basic = ^#+(.+)\n*((?:\n(?:^[^\n#].{0,2}$|^[^\n#].{3}(?<!<!--).*))+)
- Save the config file
- Run the script on the file, with 'Regex' checked:
- You should see these cards in Anki:
If you'd like the effect of the header paragraph style, but only want it to add cards below a certain subheading level (e.g. 3 # or more), use the following regex:
- 2 or more -
^#{2,}(.+)\n*((?:\n(?:^[^\n#].{0,2}$|^[^\n#].{3}(?<!<!--).*))+)
- 3 or more -
^#{3,}(.+)\n*((?:\n(?:^[^\n#].{0,2}$|^[^\n#].{3}(?<!<!--).*))+)
- n or more -
^#{n,}(.+)\n*((?:\n(?:^[^\n#].{0,2}$|^[^\n#].{3}(?<!<!--).*))+)
, where you replace{n,}
with the value of the number n. E.g. if n was 4, it would read^#{4,}(.+)\n*((?:\n(?:^[^\n#].{0,2}$|^[^\n#].{3}(?<!<!--).*))+)