summaryrefslogtreecommitdiff
path: root/init.js
blob: a2e2572b94840102a9f8a4d75dfcd12ddee649fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
				});
			});
		});
	});
});