Closed badlydrawnrob closed 8 years ago
Default hljs.initHighlightingOnLoad();
doesn't work on iOS app. I have no idea why! Luckily, thanks to this thread, the below seems to work :+1: ... for now at least.
hljs.initHighlighting.called = false;
hljs.initHighlighting();
When opening cards in the Mac app, it takes a while to close down. Hopefully this won't impact performance of the app.
Also refer to this issue for an alternative method suggested by the plugin's creator:
var blocks = document.querySelectorAll('pre code:not(.hljs)');
Array.prototype.forEach.call(blocks, hljs.highlightBlock);
Changed the above code also to reflect this edit
Correct code snippet below, requires hljs.
var blocks = document.querySelectorAll('pre code:not(.hljs)');
Array.prototype.forEach.call(blocks, hljs.highlightBlock);
This seems to only affect the front card, not the reverse. Seems to work fine on iOS, works on browse mode on Mac OS (if a little buggy) but doesn't seem to work in drill mode on Mac OS.
Ok so progress so far using unminified highlights shim, with script and calling script on only the front card:
hljs.initHighlightingOnLoad();
browse -> cards ...
on front and reverse.
drill mode
at allvar blocks = document.querySelectorAll('pre code:not(.hljs)');
Array.prototype.forEach.call(blocks, hljs.highlightBlock);
hljs.initHighlighting.called = false;
hljs.initHighlighting();
browse -> cards ...
, doesn't work on, but works if you place either calling script on the reverse card too)
drill mode
at allMac app console log, not particularly helpful
Anki[9545]: JS error on line 7567: SyntaxError: Parse error
Anki[9545]: JS error on line 0: ReferenceError: Can't find variable: hljs
Anki[9545]: JS error on line 7567: SyntaxError: Parse error
Anki[9545]: JS error on line 0: ReferenceError: Can't find variable: hljs
Closing this as #21 is infinitely easier to mantain. Too many bugs.
Currently using highlight.js shim and copy and paste html via Marked App viewer (right-click, copy and paste in Anki html view). Also see Marked App html exporting):
To do: