Anki Guide
Anki is a flashcard application available for desktop (Windows, macOS, Linux). It is primarily offline and syncing to online is possible, but optional.
There are also mobile versions for iOS (AnkiMobile, I think) and Android (AnkiDroid). iOS version is also made by the Anki creator, but Android is made by a different team.
Personally, I use Anki on Windows and Linux and AnkiDroid on a smartphone and a tablet.
To get started, go to HTML/JS/CSS - what are supported.
See also,
Wouldn't it be nice if some cards can have a special front side or back side?
Templating might be easier this way, similar to individual card-specific overrides.
Admittedly, I tried to create Rep2recall, which uses not only a fully online database (no syncing problems), but also utilizes Handlebars templating language, which is probably more powerful than mustache-ish templating used in Anki (where I can't totally replicate as well). A goal of the project was to allow programmatic manipulation as well.
There is also https://kitsun.io/ where I haven't tried much.