FHighlight - Dynamic Code Highlighting

AnkiWeb addon 1339779080

Dynamically syntax-highlights code in Anki card fields using Pygments filters, supporting specified, guessed, or field-based languages and triple-backtick snippets.
AI-generated summary; may contain mistakes.

formattingcard-templates

Open on AnkiWeb GitHub Find alternatives

AnkiWeb

Votes
4 (πŸ‘ 4 Β· πŸ‘Ž 0)
Updated
2023-10-08
Anki versions
2.1.66~
License
AGPL-3.0 (from the license file in the package)
Virus scan
No ClamAV match A match does not prove malware. No match does not prove that the code is safe.
Languages
Python, CSV, JSON
Description language
en

Maintenance

abandoned

  • Last update or commit: 2023-11-02 (1095 days before the snapshot).
  • Test files: 1.
  • GitHub Actions workflows: 2.
  • Commits in the last year: 0.
  • Issues: 0 open, 0 closed.
  • Pull requests: 1 open, 1 merged.

GitHub

Repository
abdnh/anki-fhighlight Β· more by abdnh
Stars
⭐ 0 · forks 0 · open issues 1
Last commit
2023-10-08
License
AGPL-3.0
Languages
Python, HTML, Makefile
Tests
1

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.452.1.66+2023-10-08
History across monthly snapshots

Loading…

Similar addons

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

This add-on mainly adds syntax highlighting for code via a custom filter which you put in your card templates.

This uses the Pygments library like glutanimate's Syntax Highlighting for Code add-on. The main difference is that this add-on highlights code dynamically when it's shown in the reviewing screen, and doesn't modify the notes themselves. This has the disadvantage that syntax highlighting will not work without the add-on (i.e. it won't work on mobile platforms), but might make it easier to dynamically modify some highlighting parameters.

How to use

Put the add-on's filter in your card template like this:

{{highlight lang=python:Front}}

The lang option specifies the programming language. See Pygments documentation for a list of all supported languages. You can alternatively omit the option to make the add-on try to guess the language from the field text using Pygments' guess_lexer function.

You can also dynamically specify the language for each note by prefixing the value of the lang option with #:

{{highlight lang=#lang_field:Front}}

Here the value of the option (lang_field) is interpreted as a field name where the language identifier is stored in your notes.

You can also use the following filter to list all supported languages:

{{highlight-list-lexers:}}

There is also a more flexible option for highlighting code snippets in fields without having to modify your templates. Enclose code snippets in the triple backticks like this:

print('hello world!')

You can also omit the language here.

Changelog

See CHANGELOG.md for a list of changes.

Support & feature requests

Please post any questions, bug reports, or feature requests in the support page or the issue tracker. If you want priority support for your feature/help request, I'm available for hire. You can get in touch from the aforementioned pages, via email or on Fiverr.

Support me

Consider supporting me if you like my work:

Buy Me A Coffee

I'm also available for freelance add-on development on Fiverr:

README

FHighlight - Dynamic Code Highlighting for Anki

An Anki add-on that mainly adds syntax highlighting for code via a custom filter which you put in your card templates.

This uses the Pygments library like glutanimate's Syntax Highlighting for Code add-on. The main difference is that this add-on highlights code dynamically when it's shown in the reviewing screen, and doesn't modify the notes themselves. This has the disadvantage that syntax highlighting will not work without the add-on (i.e. it won't work on mobile platforms), but might make it easier to dynamically modify some highlighting parameters.

How to use

Put the add-on's filter in your card template like this:

{{highlight lang=python:Front}}

The lang option specifies the programming language. See Pygments documentation for a list of all supported languages. You can alternatively omit the option to make the add-on try to guess the language from the field text using Pygments' guess_lexer function.

You can also dynamically specify the language for each note by prefixing the value of the lang option with #:

{{highlight lang=#lang_field:Front}}

Here the value of the option (lang_field) is interpreted as a field name where the language identifier is stored in your notes.

You can also use the following filter to list all supported languages:

{{highlight-list-lexers:}}

There is also a more flexible option for highlighting code snippets in fields without having to modify your templates. Enclose code snippets in the triple backticks like this:

```python
print('hello world!')
```

You can also omit the language here.

Download

You can download the add-on from AnkiWeb: 1339779080

Changelog

See CHANGELOG.md for a list of changes.

Support & feature requests

Please post any questions, bug reports, or feature requests in the support page or the issue tracker.

If you want priority support for your feature/help request, I'm available for hire. You can get in touch from the aforementioned pages, via email or on Fiverr.

Support me

Consider supporting me if you like my work:

Buy Me A Coffee

I'm also available for freelance add-on development on Fiverr: