Add R language to TW5 highlight plugin

124 views
Skip to first unread message

instan...@gmail.com

unread,
Feb 27, 2016, 5:10:42 AM2/27/16
to tiddl...@googlegroups.com
The Highlight.js plugin does not come with highlighting for the R language.
The library itself has support for it.

How can I include it into TW5?

Jed Carty

unread,
Feb 27, 2016, 8:18:37 AM2/27/16
to TiddlyWiki
I had to do this for matlab. It isn't difficult but I remember there being some annoying syntax thing that came up somewhere. I didn't run into it while testing so maybe it won't be a problem.

Go to the download page here (https://highlightjs.org/download/) select the languages you want included in the plugin.
Click the download button.
In the downloaded zip file open up the file highlight.pack.js
In the tiddler $:/plugins/tiddlywiki/highlight/highlight.js
You want to replace everything between the first line
var hljs = require("$:/plugins/tiddlywiki/highlight/highlight.js");
and the last line
exports.hljs = hljs;
with the contents of highlight.pack.js

Then same the tiddler and reload your wiki. I didn't get an error doing it just now but I haven't tested it much.

instan...@gmail.com

unread,
Feb 28, 2016, 1:40:14 AM2/28/16
to TiddlyWiki
Thanks Jed, your answer works and helped me a lot.
Reply all
Reply to author
Forward
0 new messages