AnkiWeb
- Rating
- 30 (π 24 Β· π 6)
- Updated
- 2023-09-01
- Anki versions
- 2.1.66~
- Description language
- en
AnkiWeb addon 904999275
Enables adding and editing Anki notes in extended CommonMark Markdown via editor fields or a separate window, with CodeMirror editing, extensions, and configurable conversion.
Open on AnkiWeb GitHub Forum topic Ask about alternatives
abandoned
| Min Anki | Max Anki | Updated |
|---|---|---|
| 2.1.50 | 2.1.55 | 2023-09-01 |
| 2.1.56 | 2.1.66+ | 2023-09-01 |
Loadingβ¦
Processes <amd>-delimited card content as Markdown at review or in-place, with preview, batch conversion, shortcuts; currently unmaintained.
Create Markdown-enabled sticky notes on Anki review screens with live preview, images/GIFs, presets, templates, export, keyboard shortcuts, and JSON syncing via media.
Creates Sentence Translation note types and cards for translating sentences both ways and learning target word order, with a GUI for editing word correspondences.
Adds inline audio/video from URLs or local files with FFmpeg conversion, per-element playback controls in reviewer, clipboard insertion shortcuts, and orphaned media cleanup.
Enables editing Anki cards using Markdown, with a patch applied so the original add-on works on Anki version 25.
Inserts HTML tables via a dialog or by converting selected markdown-like text, with configurable shortcut and styling, but not for editing existing tables.
Anki (GitHub) addon (GitHub) that allows adding and editing notes in extended CommonMark Markdown, either directly in the editor fields ("field input mode", similar to the core rich and plain text edit interface) or by opening a separate window to edit a specific field or the entire note ("window input mode").


The editor DOM and internal functioning which Markdown input depends on changed in Anki version 2.1.56. The current version of Markdown input ships with both 2.1.56+ compatible code as well as the last release targeted at 2.1.55. Going forward no updates/fixes will be made to the legacy code, any development/bug fixes will be in the 2.1.56+ code.
<p> tags (which are not used by the Anki editor). Furthermore there is no spec on the conversion from HTML to Markdown. This makes conversion tricky and there is risk for loss of information when cycling HTML β Markdown β HTML.Conversion to/from HTML is done through unified Markdown functions hast-util-from/to-html hast-util-to-mdast/mdast-util-to-hast and mdast-util-to/from-markdown which are CommonMark compliant. The following changes/extensions has been made in the addon:
Markdown uses <p> tags to mark paragraphs, these are replaced with <br> tags instead to match the Anki editor.
Markdown has a concept of lists being "tight" or "loose" which results in list items being wrapped in <p> tags or not. This has been replaced with HTML .markdown-tight or .markdown-loose classes to allow styling, example:
ul.markdown-loose > li, ol.markdown-loose > li {padding-top: 10px; padding-bottom: 10px;}
ul.markdown-tight > li, ol.markdown-tight > li {padding: 0px}
Spec <em>sample</em> (*sample*) and <strong>sample</strong> (**sample**) are swapped to <i> and <b> to match the Anki editor.
Markdown syntax extensions (set to true or "some vale" to enable, false to disable):
Subscript: true for ~sample~ subscript
Superscript: truefor ^sample^ superscript
Underline: true for _sample_ underline (spec Markdown is <em>, disable to revert to spec).
Strikethrough: "double" for ~~sample~~ strikthrough ("single" supports single tilde, incompatible with subscript above).
Inline media: truefor Inline Media directive, e.g. :audio(im-xyz.ogg){loop auto_front}/:video(im-xyz.ogg){loop auto_front height=200}.
Definition lists: true for Defintion lists (not available in the core Anki editor).
Table stle: Table syntax, "gfm"/"extended":
| A | GFM |
| :---- | ----: |
| table | ! |
<thead> generated):| :--: | ----: |
| A | table |
| with | rows |
Table newline: Symbol to replace hard line break (<br>) inside table cells (newline characters are normally not allowed inside Markdown table cells)fences: Optional fencing pipes (i.e. at start and end of each row).The editor used is CodeMirror 6 with the following configurations:
Ctrl+F, note: the Anki editor eats Ctrl+F, set to other shortcut in config or remap the Anki editor shortcuts with Customize Keyboard Shortcuts or similar.Ctrl+Shift+Z - For some reason I am unable to get Ctrl+Alt+Shift+C to work (the default Anki keyboard shortcut)Ctrl+Shift+c (with multiple selections this will cloze each incrementally)cm.css into user_files subdirectory and customize. Consider using --var(xyz) to use the Anki colors from the current theme (i.e. follows light/dark mode).config.json, see config.json and CodeMirror documentation for further information. Available functions to map are all in @codemirror/commands, @codemirror/search and custom commands clozeNext, clozeCurrent, joinLines.caseSensitive, regexp, wholeWord).rich text, markdown or rich text/markdown, default rich text).true) or just toggle Markdown input (false). (default true)Ctrl+Alt+X)Ctrl+PgDown and Ctrl+PgUp)true)parent, last or WidthxHeight, default parent)note editing mode the fields are separated by HTML comments (e.g. <!-- Front -->) and content will be inserted into the correspondingly named field. (note or field, default note)Field input, note that the default shortcut, Ctrl+M conflicts with Mathjax shortcuts, remap one of them.Window input.Converter. See mdastToMarkdown for Markdown format options.CodeMirror. See CodeMirror documentation how to configure.Browser sort field option (default true) instead uses content of first level 1 heading (if existing).<nop>) them in Customize Keyboard Shortcut (the new Anki editor grabs the shortcuts on the JavaScript side).<h1/2/3/etc>, <table> <ul/ol> etc.) to the note template.cm.css (styling of CodeMirror and syntax highlighting) into a user_files subdirectory in the addon directory and modify that file (it will be given precedence and not be overwritten on addon update).To achieve a note editing friendly interface consider using:
CSS Injector - Change default editor styles to modify the editor interface for smaller margins, for instance something like this will give a slicker, VS Code inspired, editor interface:
/* editor.css */
div > div.editor-field {
border-radius: unset;
border: none !important;
box-shadow: none !important;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 5px;
}
div:not(:nth-child(1)) > .field-container {
border-top: 1px solid var(--border);
}
.editor-toolbar .button-toolbar {
border: none;
padding: 7px 7px 0px 7px;
margin: 0px;
}
.editor-field {
--fg: #3b3b3b;
--selected-bg: #ADD6FF80;
}
.night_mode .editor-field {
--fg: #d4d4d4;
--selected-bg: #ADD6FF26;
}
body {
--fg: #3b3b3b;
--canvas: #ffffff;
--canvas-elevated: #ffffff;
--border: #CECECE;
--border-focus: 1px solid #3794ff;
}
body.night_mode {
--fg: #858585;
--canvas: #1e1e1e;
--canvas-elevated: #1e1e1e;
--border: #474747;
--border-focus: 1px solid #3794ff;
}
and
/* field.css */
anki-editable.night_mode {
color: var(--fg);
font-size: 18px;
}
Sidebar table to move the note/card table to the side for increased editing space, esp. with Markdown input``Autohide toolbar set to true
Browser Maximize/Hide Table/Editor/Sidebar to toggle hiding the sidebar with a keyboard shortcut (e.g. Ctrl+Shift+B)
Functionality split into different classes to facilitate reuse:
Note editor fields.Ctrl-Shift-j to join lines, make inline Markdown syntax configurable, make several options configurable, bug fixes.config.json appropriately, add buttons/badges, restructure configuration.json.config bug.Ubuntu 22.04 LTS) and macOS (tested in a really slow VM High Sierra).rich text/markdown field default configuration option, add list continuation thanks to David C..Table style to Tables, add code block syntax highlighting, add Browser sort field option, add styling of cloze tags in the Markdown editor.