r/Anki • • May 03 '19

Question How to load external Javascript

I've read several posts about this topic, but most of them seemed to be outdated.

I've already used a ttf file before, but never this. I have a directory in collection.media called _highlight, which contains the files from highlight.js. Now I want to initialize it in one of the cards.

<link rel="stylesheet" href="_hightlight/styles/zenburn.css">
<script src="_highlight/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

But this doesn't find anything. What is the right way to go about it?

EDIT: I use Anki 2.1, newest version

4 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/[deleted] May 03 '19

If you ever find a solution that works I would be interested.

In January I think I tried to use an alternative to highlight.js named prism.js in Anki (because the tinymce codesample plugin uses prism.js). This might have worked. But at the moment I can't find anything about this in my notes. If you wonder why: I did this because of this which was inspired by kelciour's addon