Markdown support for code blocks and inline code

AnkiWeb addon 1844938046

Converts backticks in the Anki editor into HTML code tags for inline code and code blocks, supporting language classes for syntax highlighting.
AI-generated summary; may contain mistakes.

formatting

Open on AnkiWeb GitHub Find alternatives

AnkiWeb

Votes
11 (πŸ‘ 10 Β· πŸ‘Ž 1)
Updated
2023-10-20
Anki versions
2.1.65~
License
Not found (this does not mean that the addon has no license)
Virus scan
No ClamAV match A match does not prove malware. No match does not prove that the code is safe.
Languages
Python
Description language
en

Maintenance

abandoned

  • Last update or commit: 2023-10-20 (1108 days before the snapshot).

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.02.1.65+2023-10-20
History across monthly snapshots

Loading…

Similar addons

Simple Markdown

Converts Markdown notes to HTML automatically after editing, with an optional manual conversion button and configurable Markdown extensions such as fenced code blocks.

formatting

8 votes 41% approval πŸ‘ 6 Β· πŸ‘Ž 2 ⭐ 3 Anki 25.02.5~ Updated 2025-11-21
Typst Math in Anki

Converts Typst math code into MathML or SVG for Anki flashcards, offering inline and block editors plus a replace function for $...$ equations.

formattingshortcuts

1 votes 21% approval πŸ‘ 1 Β· πŸ‘Ž 0 ⭐ 20 Anki 26.05~ Updated 2026-07-12
Better Markdown Anki

Renders Anki flashcards with enhanced markdown, LaTeX math, syntax highlighting, theme-aware styling, and interactive cloze toggles via React-based note types.

formattingappearancecard-templatescloze

25 votes 65% approval πŸ‘ 21 Β· πŸ‘Ž 4 ⭐ 31 Anki 2.1.66~ Updated 2026-10-15

Description

Easy Code Blocks/Tags for Anki

Convert backticks to HTML <code> tags in the Anki editor.

This makes the Anki editor parse backticks as Markdown.

  • Single backticks: (`x == 2`) will be converted like so <code>x == 2</code>.
  • Triple backticks: (```x == 2```) will be converted like so <pre><code>x == 2</pre></code>.

Append a newline-delimited, alphanumeric string to a triple backtick to add a class.

   \```php
   echo "hi";
   \```

(Note the newline after php!) This will be converted to:

   <pre><code class="language-php">echo "hi";</code></pre>

Also works with <br> instead of "raw" newline, since the Anki editor automatically inserts <br>

   \```php<br>
   echo "hi";
   \```

Many popular JS-based syntax highlighters (highlight.js, prismjs) can automatically detect what language you're using, but sometimes you have to be explicit and specify the language yourself.

FWIW, to install a syntax highlighter:

  1. Copy the downloaded JS code into your collection.media directory (for example, highlight.min.js)
  2. Prefix the JS library name with _ (for example, highlight.min.js -> _highlight.min.js)
    1. This is so Anki doesn't try to delete it since it's not being referenced by any field
  3. Copy an associated CSS file for styling and also prefix it with an _ (e.g., _github-dark.min.css)
  4. Edit your cards to call the JS library and load the CSS like so:
<link rel="stylesheet" href="_github-dark.min.css">
<script src="_highlight.min.js"></script>
<script>hljs.highlightAll();</script>

A few notes

  • The text in the editor is updated automatically when you...
    1. Jump to a new field
    2. Or save/submit your edits (Ctrl-Enter or click "save")
  • The text displayed in the editor is NOT updated automatically
    • The new text will be shown next time you view the card in the editor (in the browser, you can hit Ctrl-n, Ctrl-p to go to the next card and back to "refresh" it).

Next steps

  1. Add a hotkey to insert a pair of backticks and a hotkey to insert a pair of triple backticks
  2. Add a UI button to insert a pair of backticks and a UI button to insert a pair of triple backticks
  3. Make the hotkeys and UI buttons work on selected text