Hi - I've had a further play and got something working that is good enough for my needs. Here is what I did in case it helps anyone else trying to do something similar:
I edited $:/plugins/tiddlywiki/highlight/highlight.js instead of $:/plugins/tiddlywiki/highlight/highlightblock.js In highlight.js the languages are defined in blocks of code starting with hljs.registerLanguage. I just copied and pasted one of these blocks, named the language "r" and edited the words that I wanted to be highlighted, which are easy to spot within highlight.js. This seems to be stable and is working ok. So I have a workaround but it isn't using the official highlight.js R brush and I would love this to be included in a future version of TiddlyWiki . All the best, and thank you once again for TiddlyWiki. Brian On Saturday, May 7, 2016 at 5:08:21 PM UTC+1, Brian Moran wrote: > Hi Jeremy > > First - many thanks for TiddlyWiki, it truly is wonderful. > > I have followed your instructions posted here to try to add the language > 'R' into the highlight.js plugin in my copy of 5.1.11. Unfortunately this > results in the red Internal JavaScript Error message. > > I am pretty sure I followed your instructions to the letter but I assume > that I must have made a mistake. I can post the code I inserted (or an > extract - maybe just the start and end) if you or another member of the > TiddlyWiki group might be interested in looking at it...? > > It would be great to have R syntax highlighting in TiddlyWiki. > > All the best > > Brian > > > > On Sunday, September 13, 2015 at 9:44:26 AM UTC+1, Jeremy Ruston wrote: > >> Here's an approach that should let you hack additional language brushes >> into the preview of 5.1.10. It modifies one of the shadow tiddlers within >> the highlight plugin, which can cause problems with future upgrades; if >> that happens, remove the shadow tiddler override and then re-apply the >> technique described below. >> >> 1. Find the brush you want within the highlight.js GitHub repo in the >> "src/languages" folder: >> https://github.com/isagalaev/highlight.js/archive/8.8.0.zip >> 2. Copy the text of the language you want >> 3. Open the tiddler "$:/plugins/tiddlywiki/highlight/highlightblock.js" >> 4. Paste the following after the line "hljs.configure(...)": >> >> hljs.registerLanguage("<name_of_language>",<text_of_language_file>); >> >> Save the tiddler and restart. >> >> Let me know how you get on, >> >> Best wishes >> >> Jeremy. >> >> >> >> >> >> On Sat, Sep 12, 2015 at 6:59 PM, Bob Flandard <[email protected]> wrote: >> >>> Hello Danielo, >>> >>> I had a look at the plugin code and got about as far as realizing that >>> "hljs.registerLanguage" was the start of each new language. I thought about >>> hijacking one of the existing languages that I'm unlikely to need for its >>> intended purpose, but the minified code looked too impenetrable >>> (combination of stripped down JavaScript and beastly regular expressions). >>> >>> Did you have any joy with your attempts? and if so do you have any >>> pointers or time savers. >>> >>> The language I'm interested in is APDL from Ansys. Mainly the keywords >>> for many hundreds of commands; some start with "/" e.g /view, some with "*" >>> e.g *vget and others just normal "words" e.g save etc. >>> >>> Thanks, Bob >>> >> >> >> >> -- >> Jeremy Ruston >> mailto:[email protected] >> > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/00498f1b-2795-4fab-b250-1b5ada04e33e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

