Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

⚡️Syntax Highlighter

AnkiWeb Page | Code : 272582198

banner_shigeyuki_2

For quick syntax highlighting of code in Anki's Editor. Select the code and press the ⚡️electric button to auto add highlighting. (or paste from the clipboard)

alt text

Credit

This add-on is a fixed and Custmized version for Anki25+ of the addon "Syntax Highlighting (NG)" and "Syntax Highlighting for Code", originally created by Tiago Barroso, Tim Rae, Aristotelis P. Glutanimate, C A. Cavallo, and credit goes to them (AGPL). Syntax highlighting is executed by bundling pygments (BSD).

How to use

This customized version includes support for the latest Anki 25.04+, user interface enhancements, code updates and optimizations. Added functions to auto add CSS, select line numbers, etc.

Select the code or paste from the clipboard.
alt text alt text

Option

alt text

Line number

  • Show line numbers
    • Show numbers at the beginning of each line of code.
  • Always input start line number
    • If this option is enabled, you can input the start line number in the dialog that pops up when you run the syntax.
  • Default line number
    • Sets the default line start number.

alt text

Center code fragments

  • Change whether code is left-aligned or centered.

default to last language used per deck

  • Auto save and use the last used programming language for each deck.

Font Size

  • Change the font size of the code. You can also change it by editing the HTML directly.

Hotkey

  • Sets a shortcut key to run a highlight.

Enable CSS classes

Enable this option to highlight using CSS instead of inline highlighting.

alt text

  • CSS mode can be easily changed with the theme option, and can be auto change in night mode and light mode. Inline mode is not possible.
  • CSS is auto added to the notetype style when syntax is added.
  • CSS mode does not show highlight colors in the editor, but in the reviewer or previewer. Default inline highlighting can show color in the editor.
  • Default inline highlighting has colors embedded in HTML, so you cannot change the theme like in CSS mode.
  • The auto-generated CSS files are auto saved in the media folder.

Language

alt text

  • You can select which languages to display in the drop box in the editor, and rearrange them by dragging and dropping.

StyleSample

alt text

  • You can view a sample of syntax highlighting and change the default theme.
  • Inline mode is the default highlighting. The highlight is embedded and cannot be changed later.
  • If CSS mode is enabled, you can set light mode and night mode themes respectively. All highlighting will be changed when the theme is changed.

Enable CSS Note Type

CSS mode automatically adds CSS to the card. This option allows you to batch remove or add CSS added to the note type style. If you are not using the CSS mode option this option does nothing.

alt text

  • All-ON, All OFF button
    • Batch select or deselect note types.
  • Batch Update Notetypes button
    • Press this button to batch add or remove CSS.
    • Note that the optional Save button does not save NoteType changes.
    • Note type changes cannot be canceled with the optional Cancel button, but can be undone in a batch with Anki's Undo.
    • This option edits all note types at once, so if you are concerned I recommend making backups of your decks before running this option.
    • CSS can be added or removed manually, only this one line is needed. -> @import url("_shigeSyntax.css");




💖Please Support Shige's Anki add-ons development!

Hi thank you for using this add-on, I'm Shigeඞ! I'm looking for supporters for my add-ons development, because I like Anki! So far I fixed and customized 60+ discontinued add-ons and created 30+ new add-ons. If you support my volunteer development you will get 14 add-ons for patrons only and 15 game themes included in AnkiArcade ($5/month). If you have any ideas or requests feel free to send them to me, thanks! :D

patrons_banner
Get Patrons only addons | Patrons Q and A | Contact

[ Special Thanks ]
So far I received donations from 432 patrons and without their support I never could develop this, thank you very much!🙏

Patrons: Arthur Bookstein Haruka Luis Alberto, Letona Quispe 07951350313540 Lily Tim Daniel Kohl-Fink Kyle Mondlak NamelessGO ElAnki Ernest Chan GP O'Byrne KM Jonathan Contreras Abhi S Jesse Asiedu Matthew Hartford Tobias Klös K Isabel Guan Peasant of Anki findus161 ellie tarek Jake Stucki Juan Salgado iuventius Patrick ellis Keeler Kime Kurt Grabow Matheus Chagas Fahim Shaik Augusto Stein Ashok Rajpurohit mootcourt Yaeerrrrrr Svel1989 Christopher Lam NoirHassassin qiting zeng Morgan Torres Kaitlyn Bowler Elisabeth Barber Tae Lee Steven Banner David C Gabriel Vinicio Guedes sab hoque Lis Y. Ythalo Vlogs Ketan Pal Aurora Dzurko Kolorophyll Tyler Schulte Mac gus forester Douglas Beeman Heidi Leonora Lomoki Akporyoe Gabriel Farrugia Bryn Price Xiuxuan Wang Temi Jide Ansel Ng Haley Schwarz Woody Ujwal Chadha pie_is_good Iggi Jeanna J P K Cole Krueger Wei Sean Voiers Austin Regal Robert Malone Jk Andrew Yang CunningPotato Mia Aayush Bhatawadekar Stellate ggl Cubli Tina Weingarten Aydin Herik Azfar Hussain Victor Evangelista Adrine Oleksandr Pashchenko Orlando Frey kenken Take Root Osasere Osula Kylie Alex D Carly Burdorf Aaron Buckley oiuhroiehg Sebastian Bellotti Nandani Patel ...full list



🚨Report

If you have any problems or requests feel free to send them to me.

  1. 👍️Rate Comment : You can contact me anonymously, and AnkiWeb will send you an email when I reply, a high rating increases priority of development.
  2. 👩‍🚀Reddit : You can request me to repair broken Add-ons.
  3. 🌟AnkiForums : You can request me to repair broken Add-ons, and it is ideal for open discussions.
  4. 🐙Github : Makes it easier to track problems.
  5. 💖Patreon DM : Response will be prioritized.

📥 How do I install this add-on?

  1. This add-on works with Anki for desktop (it does not work on mobile). Download Anki from the official website if you haven't already.
  2. Copy and paste the add-on code ( 272582198 ) into Anki and you can install it. ( Menu -> Tools -> Add-ons -> Get Add-ons -> Code [ add-on code ] )
  3. When I develop bug fixes, create new features, or compatibility for New Anki, I will notify you and you can install it.
  4. Add-ons will be broken when the official Anki gets a major update, so if you like this add-on please support my volunteer development by rating, sharing, and donating. Thank you!

Click here and please Rate this add-on, Thank you! :-)
Please rate this