summaryrefslogtreecommitdiff
path: root/init.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-05-17 18:47:21 +0300
committerAndrew Dolgov <[email protected]>2020-05-17 18:47:21 +0300
commit1077abdddae0e9068820c5630525b94c0e173831 (patch)
treeb70d9bb9670daff6a03500c8d3dd8fb1c67b5701 /init.js
initial
Diffstat (limited to 'init.js')
-rw-r--r--init.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/init.js b/init.js
new file mode 100644
index 0000000..a2e2572
--- /dev/null
+++ b/init.js
@@ -0,0 +1,25 @@
+require(['dojo/_base/kernel', 'dojo/ready', 'dojo/request/script'], function (dojo, ready, script) {
+ ready(function() {
+ script.get("plugins.local/highlightjs/highlight.pack.js",
+ {checkString: 'hljs'}).then(() => {
+
+ console.log('hljs loaded', hljs)
+
+ PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) {
+ row.querySelectorAll("code").forEach((elem) => {
+ console.log('about to highlight', elem);
+
+ hljs.highlightBlock(elem);
+ });
+ });
+
+ PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function(row) {
+ row.querySelectorAll("code").forEach((elem) => {
+ console.log('about to highlight', elem);
+
+ hljs.highlightBlock(elem);
+ });
+ });
+ });
+ });
+});