Syntax Highlighting for Code

AnkiWeb addon 1463041493

Inserts syntax-highlighted code snippets into Anki notes, with language selection, configurable line numbers, centering, CSS classes, and per-deck language memory.
AI-generated summary; may contain mistakes.

card-creationformattingfork-or-reupload

Open on AnkiWeb GitHub Ask about alternatives

AnkiWeb

Rating
257 (👍 208 · 👎 49)
Updated
2018-10-07
Anki versions
unknown
Description language
en

Maintenance

abandoned

  • Last update or commit was 982 days before the snapshot (2024-01-23).

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.0–2018-10-07
History across monthly snapshots

Loading…

Similar addons

FHighlight - Dynamic Code Highlighting

Adds dynamic syntax highlighting for code during Anki review via custom template filter using Pygments, without modifying notes, with language guessing and triple-backtick snippets.

formattingcard-templates

Rating 4 👍 4 · 👎 0 ⭐ 0 Anki 2.1.66~ Updated 2023-10-08
Syntax Highlighting (NG)

Inserts syntax-highlighted code snippets into Anki flashcards, with a Python 3 port, unit tests, and support for the latest Anki versions.

formattingfork-or-reupload

Rating 44 👍 41 · 👎 3 ⭐ 34 Anki 23.10.1~ Updated 2024-07-19

README

<p align="center"><img src="screenshots/screenshot_python.png"></p>

<h2 align="center">Syntax Highlighting for Anki</h2>

<p align="center"> <a title="Latest (pre-)release" href="https://github.com/glutanimate/syntax-highlighting/releases"><img src ="https://img.shields.io/github/release-pre/glutanimate/syntax-highlighting.svg?colorB=brightgreen"></a> <a title="License: GNU AGPLv3" href="https://github.com/glutanimate/syntax-highlighting/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-GNU AGPLv3-green.svg"></a> <a title="Rate on AnkiWeb" href="https://ankiweb.net/shared/info/1463041493"><img src="https://glutanimate.com/logos/ankiweb-rate.svg"></a> <br> <a title="Buy me a coffee :)" href="https://ko-fi.com/X8X0L4YV"><img src="https://img.shields.io/badge/ko--fi-contribute-%23579ebd.svg"></a> <a title="Support me on Patreon :D" href="https://www.patreon.com/bePatron?u=7522179"><img src="https://img.shields.io/badge/patreon-support-%23f96854.svg"></a> <a title="Follow me on Twitter" href="https://twitter.com/intent/user?screen_name=glutanimate"><img src="https://img.shields.io/twitter/follow/glutanimate.svg"></a> </p>

Allows you to insert syntax-highlighted code snippets into the spaced-repetition flashcard app Anki.

Table of Contents <!-- omit in toc -->

<!-- MarkdownTOC levels="1,2,3" -->

<!-- /MarkdownTOC -->

Installation

AnkiWeb <!-- omit in toc -->

The easiest way to install Syntax Highlighting is through AnkiWeb.

Manual installation <!-- omit in toc -->

Please click on the entry corresponding to your Anki version:

<details>

<summary><i>Anki 2.1</i></summary>

  1. Make sure you have the latest version of Anki 2.1 installed. Earlier releases (e.g. found in various Linux distros) do not support .ankiaddon packages.
  2. Download the latest .ankiaddon package from the releases tab (you might need to click on Assets below the description to reveal the download links)
  3. From Anki's main window, head to Tools → Add-ons
  4. Drag-and-drop the .ankiaddon package onto the add-ons list
  5. Restart Anki

</details>

<details>

<summary><i>Anki 2.0</i></summary>

  1. Go to Tools → Add-ons → Open add-ons folder
  2. Find and delete the Syntax Highlighting.py file if it already exists.
  3. See if you can find a syntax_highlighting folder. If so:
    1. If the folder contains a meta.json file, copy the file to a safe location. This will allow you to preserve your current settings.
    2. Proceed to delete the syntax_highlighting folder
  4. Download and extract the latest Anki 2.0 add-on release from the releases tab (you might need to click on Assets below the description to reveal the download links)
  5. Move the extracted Syntax Highlighting.py and syntax_highlighting into the add-ons folder
  6. Optional: Place the meta.json file back into the directory if you created a copy beforehand.
  7. Restart Anki

</details>

Documentation

For further information on the use of this add-on please check out the description text for AnkiWeb.

Building

With Anki add-on builder installed:

git clone https://github.com/glutanimate/syntax-highlighting.git
cd syntax-highlighting
aab build

For more information on the build process please refer to aab's documentation.

Contributing

Contributions are welcome! Please review the contribution guidelines on how to:

  • Report issues
  • File pull requests
  • Support the project as a non-developer

License and Credits

Syntax Highlighting is

Copyright © 2012-2015 Tiago Barroso

Copyright © 2015 Tim Rae

Copyright © 2018-2019 Aristotelis P. (Glutanimate)

Syntax Highlighting is based on Syntax Highlighting for Code by Tiago Barroso. All credit for the original add-on goes to him. A major thanks is also due for Tim Rae, who extended the original add-on with CSS support.

The present fork and update to Anki 2.1 was made possible through the generous support of a fellow Anki user who would like to remain anonymous.

Syntax Highlighting ships with the following third-party open-source software:

  • Pygments v2.2.0. Copyright (c) 2006-2017 by the Pygments Team. Licensed under the BSD license.

Syntax Highlighting is free and open-source software. The add-on code that runs within Anki is released under the GNU AGPLv3 license, extended by a number of additional terms. For more information please see the LICENSE file that accompanied this program.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.


<b> <div align="center">The continued development of this add-on is made possible <br>thanks to my <a href="https://www.patreon.com/glutanimate">Patreon</a> and <a href="https://ko-fi.com/X8X0L4YV">Ko-Fi</a> supporters. <br>You guys rock ❤️ !</div> </b>