TLDR; Surround your content with <amd> to let it be processed as Markdown.
No conversion needs to be done in the editor. If desired, you can also make the convertion directly to the note on editor, just use the context menu to do it in-place.
(Prefer to check the documentation on GitHub. It's better formatted there and likely more up to date: https://github.com/ssricardo/anki-plugins/blob/master/anki-markdown/README.md)
[If you don't know Markdown, checkout the link above (in the end)]
This addon makes it possible to process cards (or parts of them) as Markdown.
While editing or adding cards, write it in plain text. No formatting is done in this view.
Then, when reviewing the card, it is interpreted as markdown and converted to formatted text (HTML actually).
Other option is to convert the content in-place during the edition, either getting a clean text or producing HTML.<br>
These operations may also be executed in batch.
Usage
You need to identify the area(s) that the add-on should work on.
This is done using a markup tag: <amd>.
On the HTML code, put the tags <amd> and </amd> around the area to be processed.
Example:
<amd>{{Example}}</amd>
This might be done either in the Card Type level (recommended) or in parts of a given card (in card edition).
Markdown-formatter won't process the entire cards, only the delimited areas.
Format the entire card type
Add those tags into Card's template (in Card Type Configuration):
Format part of a card
In the Editro, use the HTML Editor (from Anki) for the fields that you wish to use Markdown. Otherwise, Anki will format it as HTML and some hidden character would prevent the content from being a valid MD.
( Previously
> In the editor there is a button Markdown to activate/deactivate the Markdown mode.
When enabled this will tell Anki that the text being edited is pre-formatted and should not be escaped. Otherwise, Anki converts the text to HTML .
)
The default shorcut is Ctrl+Shift+K (may be changed in Configurations).
This won't convert the Markdown to HTML yet!
While editing, it's also possible to check the Markdown being produced using the Preview:
The conversion
There are 2 modes to make the add-on convert the content:
In runtime
Save the card with the pre-formatted text and use the <amd> tag around the content.
During the review, this content will be converted and showed as HTML (it won't be stored as HTML).
This mode is the existing one since version 1.
In place
In the editor, use the context menu (right click) to invoke the processing immediately. There are 2 options:
- Convert to MD
- Convert to HTML
The other option on this menu is to wrap the selected content with <amd>.
The default shorcut to show the menu is Ctrl+Shift+M.
Batch
These 2 conversion operations above may be done in batch mode.
This is available in: Browse -> Notes Menu -> Markdown Addon
Configuration
The following customization are available:
- Shortcut Edit
- Shortcut Menu
- Show markdown button
- Enable preview
Bugs / Suggestions / more...
Please, feel free to make suggestions and open issues about possible bugs found.
That and the source code are available on: Github
Last Updates
3.3 | 04/02/2022
- Make the addon compatible with new Anki Editor
3.2 | 22/02/2021
- Add support for blockquote (starting line with
>)
- Make preview resizable
- Make it compatible with upcoming changes on fill-the-blanks add-on
- Fix bug to use its css styles on review
3.1 | 28/04/2020
- Error fix: duplicating fields
- Add support for shortcuts: italic and bold
About
Addon developed by ssricardo.
Check out more of my addons on https://github.com/ssricardo/anki-plugins</amd>
There is another similar add-on for MD. It's based on the old Power Format Pack, you may check out which one fits better your needs.
For me, I prefer to store my cards with plain text, just like we do with normal markdown files. So, I don't like to have it converted to HTML and locked already in the editor. Also the thing about handling the copy/paste from web browser is useful...