Forum Syntax Highlighting for .tid Files

I’m sure this is has been thought about already, but what is involved in making a syntax highlighter for the forum for .tid files? I know there is tid highlighter for VSCode, but I have no idea if any part of that is applicable to use on the forum.

This is default highlighting using the ```...``` code fence:

<$list filter="[tag[Complete]">
<div><view field=caption><$view field=title/></$view></div>

Which isn’t bad for a default.

For those that don’t know, you can specify the language of the highlighting in the fencce like this:

```ruby
require "nokogiri"
puts"Hello, World!"
```

which render as

require "nokogiri"
puts"Hello, World!"

Ah I see https://highlightjs.org/ is used so there’s a place to start.

It seems extra languages for highlight.js can be added via a Discourse plugin: Hack to install a new language for Highlight.JS on a hosted discourse - #7 by pmusaraj - tips & tricks - Discourse Meta

highlight.js doesn’t have a highlighter for tiddler files. … It is a completly different mechanism than used by VSCode.

The problem with TW syntax is, that we allow HTML as a subset of the wiki language and we have our own HTML-like widget syntax.

BUT

A good starting point would be the markdown highlighter defined for highlightjs. … It uses the html-highlighter as a submodule and defines the rest of the markdown syntax with regexp based rules.

The widget-syntax will be tricky but similar to the html/xml highlighter. … So we will need to create a 3 in 1 highlighter.

Replying to come back to this one. I wrote the TW syntax highlighting for VSCode and have intended to come back to review the highlight.js stuff. :slight_smile:

1 Like

I am looking forward to it