← Back to support

How to use Source Code Highlighting

Use a Code field

You do not need to write a custom HTML layout to highlight source code in a current deck.

  1. Create a deck and choose "Browse all" in the deck-type picker.
  2. Select "Code (Production)" and choose the programming language.
  3. Create the deck, then add cards with code and an explanation.

For an existing deck you own, open "Edit Deck" and add or configure a Code field. Choose its language and the sides on which it should appear, then save.

Legacy HTML layouts

Older decks can still use a custom layout such as:

<code data-lang="javascript">{{code}}</code>

The placeholder must match the card's field name. Keep HTML-sensitive code escaped when editing raw HTML. See Layouts for the difference between current fields and legacy templates.