You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also be careful when importing other people's decks (or using plugins), especially if they include javascript.
The demo/ files are for preview purposes only.
Internal notes on Mustache.js
You can safely ignore this section if you're not wanting to create your own templates.
The themes/demo/ card is similar but not the same to themes/cards/. It's just for show.
Mustache escapes HTML by default to avoid malicious code. You can unescape it with {{{ triple brackets }}}
Mustache requires {{{ ... }}} triple brackets and escaped json to render our HTML data properly. This is not supported in Anki as it uses similar, but not the same, template language. The demo files are for preview and styling purposes only. If you want to edit these demo/ files, you can use an online tool to escape your json. ↩
The text was updated successfully, but these errors were encountered:
- delete stylus
- install less
- convert stylus to less/css
- convert $variables to var(--variables)
- delete twig hack
- use print-first.css file (until I convert to less)
- copy variables from print-first-css
- minor edit to --spacing- variables
badlydrawnrob
changed the title
Using mustache for live demo (unescape JSON data)
Using safe HTML, avoiding javascript, and {{{ mustache }}} templates
Aug 16, 2024
TL;DR
demo/
files are for preview purposes only.Internal notes on
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.{{{☆ Syntax}}}
Triple brackets are used, to unescape json html in the live demo cardsjson
and compile with{{{ mustache }}}
.1" "
) in json must be escaped before they're compiled.Footnotes
Mustache requires
{{{ ... }}}
triple brackets and escaped json to render our HTML data properly. This is not supported in Anki as it uses similar, but not the same, template language. The demo files are for preview and styling purposes only. If you want to edit thesedemo/
files, you can use an online tool to escape your json. ↩The text was updated successfully, but these errors were encountered: