- Home
- 💡 Simple card
- 🔎 Missing! card
- 🖍️ Draw! card
- 🧑🎨 Add color to your code
- 🧑🎓 The professional way
You can mark any inline code string
field with bold or italic buttons in the Anki editor for basic highlighting. It uses simple HTML5 tags to add colour to your code.
- Bold:
<b>
or<strong>
- Italic:
<i>
or<em>
For regular string
fields, such as ★ Title
you can highlight a code section by wrapping your text in a code
tag. Something like this:
<!-- ★ Title card field is wrapped in a `h1` -->
<code>{ string = <b>"bold"</b>, italic = <i>42</i> }</code>
- View our default colour themes.
- We use Markdown rendered
code block
s for our pretty colours.- Beginners can use this helpful online tool;
If you know how to use
npm
, 🧑🎓 it's more fun with a compiler
Basic colours are fine for small lines of code, but you'll probably want to go full colour next. Wherever you see a code block
, Anki Programming Flashcards provide pretty colours (CSS), and we generate your highlighted code using Markdown and Pandoc. Here's how:
- Write your code as Markdown fenced code blocks,
- Convert Markdown to HTML5 online,
- Add a card in Anki,
- Choose a
code block
field, - Add your rendered HTML,
- Press the
A𝐴
button (Toggle Visual Editor ⌘⇧X
) to preview your code, - Repeat the process — save your card!
That's it. You're done. Simple, right?!
For quick customisations, view this file:
source
│
└───style
│
└───base
│
└───variables
breezedark.less
The easiest way to change the colors for the code string
and code block
fields is to edit the --color-code-bold
, --color-code-italic
, and --color-code-dark-*
variables in your Anki cards. This will overwrite the defaults.
If you're a beginner, here's how to change colours.
- You'll have the latest Anki flashcards release.
- In the Anki app menu, go to
Manage Note Types
. - Select the
Anki flashcards: ...
Note Type. - Select the
Cards
button. - Select the
Styling
option. - Copy our
--color-code
variables frombreeze.dark.less
. - Add them to the bottom of the
Styling
box, and edit them. - Repeat for all Anki flashcard card types
So far we've learned how to use colours, but every time you update Anki Programming Flashcards (in Anki), you'll lose your changes. We can do better!
Let's do things the professional way, because 🧑🎓 it's more fun with a compiler!
Once you've levelled up your programming skills and the words "clone", "fork", "npm
" and "terminal" don't scare you, you're just about ready to do something interesting: let's keep our custom themes up-to-date, save our changes, create cards at lightning speed offline with Markdown, all with a few little handy tools ...