zacharied / anki-content-injector

Anki add-on to "overlay" HTML/CSS/JS content on cards at review-time
3 stars 2 forks source link

anki-content-injector

Anki add-on ID: 166455199

Current version: 0.9

Overview

This is an add-on for Anki 2.1 that allows for a the insertion of arbitrary HTML, CSS, and JavaScript content into cards before they are displayed. It can be used in a similar fashion to Arthaey's similar add-on for Anki 2.0 to keep a global stylesheet whose rules are applied to every card. However, beyond its support of additional content types, it has a number of advantages over Arthaey's add-on:

Do note that this add-on makes no changes to the content of your cards; all changes are limited to when the card is being rendered. Be sure that your decks work without your injection files before sharing them with others!

Instructions

First, install the add-on from Anki's menu with the above ID.

Place any of the files _global.html, _global.css, and _global.js in your profile's collection.media directory. With default settings, these files will be injected into your cards.

There will be a new toggle for "Inject Global Content" in the Tools menu. This can be unchecked to stop the add-on from injecting the content, instead rendering the cards with only the layout on their template. In the card layout editor, there is also a new checkbox to toggle injection. This is a temporary toggle and applies only to the layout editor window.

Configuration

Support

The code for this project is on GitHub.

If you discover an error or have a request, submit an issue.

Feel free to write reviews on the add-on page but I cannot guarantee that I will check them; GitHub is the better way to get my attention.

Building & packaging

Please ignore this section if you just want to use the add-on. This is for add-on developers only.

All code is in the __init__.py file. The Makefile will create everything needed to upload the add-on to AnkiWeb. Since the release number is specified in the documentation, be sure to check out the appropriate version tag before building the add-on! Then, go to the AnkiWeb add-on portal and choose to update the add-on. Choose the created content-injector.zip archive as the add-on file, and then paste the contents of the new description.html into the description field.

License

This addon is licensed under the same license as Anki itself (GNU Affero General Public License 3).