AnkiWeb
- Votes
- 0 (👍 0 · 👎 0)
- Updated
- 2026-10-30
- Anki versions
- 26.09.2~
- Languages
- Python, JavaScript, JSON
- Description language
- en
AnkiWeb addon 70388912
Highlights program code syntax in the note editor with Pygments colors, inserting language-specific HTML at the cursor, with options for line numbers, CSS classes and per-deck language memory.
Open on AnkiWeb Ask about alternatives
active
No GitHub repository linked.
| Min Anki | Max Anki | Updated |
|---|---|---|
| 26.09.2 | + | 2026-10-30 |
Loading…
Inserts syntax-highlighted code snippets into Anki notes, letting users choose the programming language via toolbar button or hotkey, with configurable line numbers, centering, and CSS styling.
Adds one-click syntax highlighting to selected or pasted code in Anki's editor, with line numbers, customizable themes, CSS or inline highlighting, and hotkeys.
Dynamically syntax-highlights code in Anki card fields using Pygments filters, supporting specified, guessed, or field-based languages and triple-backtick snippets.
Adds syntax highlighting to code snippets using Pygments, with day/night-compatible colors for block and inline code, working in both desktop Anki and AnkiDroid.
Provides CSS-based syntax highlighting for code in Anki cards, including night mode, with batch template configuration.
Adds non-invasive automatic syntax highlighting to code blocks in Anki's editor preview and reviewer, auto-detecting languages or accepting manual class specifications, with configurable font size and color scheme.
SynHi highlights the syntax of program code in the note editor. It turns code into HTML with colors (generated by Pygments 2.17.2) and inserts the HTML into the field at the cursor position.
SynHi remembers the last used language, and by default the last used language of each deck.
Tools > SynHi Options ... opens the options:
These options are stored in the collection.
The add-on configuration (config.json, which Anki's add-on manager shows with the help text of config.md) has these advanced options; a change takes effect after Anki is restarted:
hotkey: the shortcut of the editor button. Default: Alt+s.limitToLangs: the languages in the language list. Every entry must be a Pygments lexer name. Default: ["Bash", "Go", "HTML", "Java", "JavaScript", "Python", "SQL"]. An empty list [] lists every language that Pygments knows.style: the Pygments style of the colors. Default: monokai.SynHi is a modified version of the add-on "Syntax Highlighting (NG)" (566351439). In current Anki editors the language list of Syntax Highlighting (NG) has no effect: the editor page has a Content Security Policy that blocks inline event handlers, so every code block is highlighted as Python. In SynHi the language list works again under that Content Security Policy, and the chosen language and the options are saved.
Installing SynHi switches off Syntax Highlighting (NG) automatically (the SynHi manifest lists it as a conflicting add-on). On first use, SynHi copies the settings of Syntax Highlighting (NG) that are stored in the collection, without changing them.
Tested on Anki 26.9.2. The SynHi manifest sets the minimum Anki version to 26.9.2 (min_point_version 260902). SynHi adds its button and language list to the editor aqt.editor.Editor (in Anki 26.9.2 this is aqt.editor_legacy.Editor), not to aqt.editor.NewEditor.
SynHi is based on the work of the authors of Syntax Highlighting (NG) and its earlier versions:
SynHi is licensed under the GNU Affero General Public License version 3 (GNU AGPLv3) with the Additional Terms in LICENSE.txt. The add-on package contains its complete source code. The notices of changes are in CHANGES-FORK.md and in the header of each changed file.
SynHi includes Pygments 2.17.2, which is licensed under the BSD 2-Clause license.