Skip to content

XMarkdown

Render an Anki field in Markdown format during review.

Install & Use

In Anki’s card template editor:

  1. Add the script tag to your templates.
  • Add it to the Front Template.
  • If your Back Template does not include {{FrontSide}}, also add the same script tag to the Back Template.
html
<script src="https://cdn.jsdelivr.net/npm/@anki-eco/extensions/dist/xmarkdown.js" defer></script>
  1. Add a hidden block for any field you want to render as Markdown:
html
<div data-xmd hidden>{{Front}}</div>
  1. If you also want the answer to be Markdown, add another block on the back template:
html
{{FrontSide}}
<hr id="answer" />

<div data-xmd hidden>{{Back}}</div>

Optional: custom class

If you want a class on the rendered container, add data-xmd-class:

html
<div data-xmd data-xmd-class="custom-class" hidden>{{Front}}</div>

Example: paste Markdown from an LLM

In Anki’s note editor, you can paste a Markdown-formatted reply from an LLM directly into your field (e.g. Front or Back). For example:

md
# Key points

- One
- Two

```js
console.log('hello');
```

With XMarkdown enabled in your template, the field will be rendered as Markdown while reviewing.

Feedback

If you have any questions or suggestions, please submit them on GitHub or discuss at Discord.

If you find it helpful, please consider Sponsoring us or giving it a star 🌟: GitHub

Last updated: