badlydrawnrob/anki

Using mustache for live demo (unescape JSON data)

badlydrawnrob opened this issue · 0 comments

TL;DR

Anki field templates and Mustache.js

Mustache javascript library is the closest representation of the Anki app field templates that I can find. It's not exactly the same as the docs so beware of bugs.

We can generate live card previews that are compiled from the demo/ folder and the .json file populates the content. The Anki cards that live in the Anki app are generated in cards/ (the demo/ folder is just for show!)

  • {{{☆ Syntax}}} Triple brackets are used, to unescape json html in the live demo cards
    • Without it, syntax blocks are interpreted as strings (not raw html)
    • HTML, or speech marks (" ") in json must be escaped before they're compiled.
  • Triple brackets will not work in the Anki app
  • I'd advise you to stick to plain Markdown and HTML in the Anki App, javascript can break things.
  • Also be careful when importing other people's decks, especially if they include javascript.