This project is read-only.

How to Add Brushes to TheMonarch.SyntaxHighlighter

Topics: Administration, Writing modules
May 4, 2013 at 3:00 PM
I'm trying out TheMonarch.SyntaxHighlighter but I want to use a language that isn't supported out of the box, namely F#.

I've found two F# scripts that work with the plain Gorbatchev version of SyntaxHighlighter:

But when I look at the scripts in TheMonarch.SyntaxHighlighter\scripts\pretty\, I see they're in a different format.

What is the correct procedure for adding syntax support for a new language to TheMonarch.SyntaxHighlighter?
May 4, 2013 at 3:37 PM
TheMonarch.SyntaxHighligher doesn't use "Syntax Highlighter". I think the first version of it did, but for a while now it's been using Google prettify to provide syntax highlighting. So you'll have to find an F# syntax provider for google pretty. Looks like there already is one available here (not sure how good it is, I haven't tried it).

You can drop it into the /Scripts/pretty/ folder.
May 4, 2013 at 4:52 PM
Actually, I found the /Scripts/pretty folder already has a script called lang-ml.js, which covers both ML (the language F# derives from) and F#.

But I'm not seeing either "ml" or "fs" in the list of languages in the SyntaxHighlighter dialog in TinyMceDelux. If fact the list of languages doesn't seem to have much to do with what's in the /Scripts/pretty folder. How do I change the languages in dialog?
May 4, 2013 at 5:16 PM
Furthermore, if I edit the snippet as HTML in TinyMceDelux so it reads
<pre class="lang-ml"><code> let xmlReader = new XmlTextReader(fileStream) </code></pre> or
<pre class="lang-fs"><code> let xmlReader = new XmlTextReader(fileStream) </code></pre> I don't get correct syntax highlighting. For example, the word "let" should be highlighted as a keyword, but it's not.
May 4, 2013 at 6:14 PM
I think you've found a bug in the module. I think it's because we need to load prettify.js with url parameters to specify language packs to load (e.g., "prettify.js?lang=ml&lang=css").

I'll try to fix in the next week or two.
May 4, 2013 at 6:15 PM
Would you mind entering an issue in the github project?
May 4, 2013 at 11:34 PM

Done. Thanks.