Notepad++ Syntax Highlighting for Tiddlywiki

As requested in a different thread, here is my syntax highlighting for Notepad++ that I did for Tiddlywiki. It’s not perfect, but it does the job. I had to include it as code because Talk wouldn’t allow me to upload an xml file.

My typical work flow is that I copy code from Tiddlywiki into Notepad++ and then edit it from there (or create new code from scratch in Notepad++). I will then copy and paste that into Tiddlywiki. I find the indentation capabilities, find/replace, tabs, line numbering, and other functionality very helpful in Notepad++. It’s also free which is a big ++. One can also compare different versions of the same code within Notepad++ which is very handy.

Notepad++ also makes editing the syntax highlighting fairly easy. If you’d like to try this out, save the code into an xml file (e.g., tiddlywiki.xml) to your computer and then import it into Notepad++ under Language / User Defined Language. You can then tweak the formatting as you wish.

This workflow is certainly not for everybody, but it works for me.

<NotepadPlus>
    <UserLang name="Tiddlywiki" ext="tid" udlVersion="2.1">
        <Settings>
            <Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="2" />
            <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Comments">00&lt;!-- 01 02--&gt; 03/* 04*/</Keywords>
            <Keywords name="Numbers, prefix1">#</Keywords>
            <Keywords name="Numbers, prefix2">0x</Keywords>
            <Keywords name="Numbers, extras1"></Keywords>
            <Keywords name="Numbers, extras2"></Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1">( ) &lt; &gt; = $ [ ] { } - \ &quot; ! : / # ; &lt;&lt; &gt;&gt; &quot; &quot;&quot;&quot; %</Keywords>
            <Keywords name="Operators2"></Keywords>
            <Keywords name="Folders in code1, open"></Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close"></Keywords>
            <Keywords name="Folders in code2, open"></Keywords>
            <Keywords name="Folders in code2, middle"></Keywords>
            <Keywords name="Folders in code2, close"></Keywords>
            <Keywords name="Folders in comment, open"></Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close"></Keywords>
            <Keywords name="Keywords1">set vars wikify button define edit action creaatetiddler basetitle deletetiddler end list import macrocall mode deletefield default reveal link sendmessage setfield transclude</Keywords>
            <Keywords name="Keywords2">tiddler field class tag size tooltip split first last title placeholder currentTiddler tags sort reverse all description search sortan nsort indexes tagging has field tags get caption all backlinks else join sort first last prefix suffix split splitbefore removeprefix removesuffix addprefix addsuffix variable text type checked unchecked subfilter filter</Keywords>
            <Keywords name="Keywords3">details div span style class ol li margin padding font size weight width background top bottom overflow white space column gap rule summary height block inline start end align shadow border indent spacing display color</Keywords>
            <Keywords name="Keywords4"></Keywords>
            <Keywords name="Keywords5"></Keywords>
            <Keywords name="Keywords6"></Keywords>
            <Keywords name="Keywords7"></Keywords>
            <Keywords name="Keywords8"></Keywords>
            <Keywords name="Delimiters">00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" fgColor="646464" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="808080" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="16780303" />
            <WordsStyle name="LINE COMMENTS" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="16780303" />
            <WordsStyle name="NUMBERS" fgColor="646464" bgColor="FFFFFF" fontName="URL" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="03BE86" bgColor="FFFFFF" fontName="no" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="008BCE" bgColor="FFFFFF" fontName="4" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="8080FF" bgColor="FFFFFF" fontName="yes" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="&#xE770;&#xDCFD;&#x0157;" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="yes" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="FF8040" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="&#x2F80;&#xDCDA;&#x0157;" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="C10061" bgColor="FFFFFF" fontName="557" fontStyle="0" nesting="16780303" />
            <WordsStyle name="DELIMITERS2" fgColor="808080" bgColor="FFFFFF" fontName="&#xF9A8;&#xB854;&#x1300;&#x8800;&#x44A0;&#xDCF8;&#x0157;" fontStyle="0" nesting="16780295" />
            <WordsStyle name="DELIMITERS3" fgColor="FF8040" bgColor="FFFFFF" fontName="&#x3910;&#xDCF8;&#x0157;" fontStyle="0" nesting="16780295" />
            <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="&#x0003;" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="&#x3B40;&#xDCF8;&#x0157;" fontStyle="0" nesting="3087" />
            <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="&#x0003;" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="&#x4178;3&#x7F00;" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="&#xC420;&#xDCFE;&#x0157;" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>

6 Likes

Thanks @HistoryBuff ! I’ll try it soon. :slight_smile:

Oh… just spotted a typo…

image

2 Likes

Thanks @HistoryBuff this has long being overdue, I will have a look today, but in the past I used a firefox plugin, which I will look for again that allows editing any text area in an external editor, and once saved updates that text area, it was not compatible with Code Mirror. I used it with NotePad ++ until I started to make a pile of supporting editor toolbar buttons and because I did not have the syntax highlighting.

This is a great opportunity to develop this as far as we can, a community effort, and once establish perhaps we can look at using this information to build an effective in wiki, “tiddlywiki script syntax checker”.

Thanks for noticing that. Fixed.

<NotepadPlus>
    <UserLang name="Tiddlywiki" ext="tid" udlVersion="2.1">
        <Settings>
            <Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="2" />
            <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Comments">00&lt;!-- 01 02--&gt; 03/* 04*/</Keywords>
            <Keywords name="Numbers, prefix1">#</Keywords>
            <Keywords name="Numbers, prefix2">0x</Keywords>
            <Keywords name="Numbers, extras1"></Keywords>
            <Keywords name="Numbers, extras2"></Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1">( ) &lt; &gt; = $ [ ] { } - \ &quot; ! : / # ; &lt;&lt; &gt;&gt; &quot; &quot;&quot;&quot; %</Keywords>
            <Keywords name="Operators2"></Keywords>
            <Keywords name="Folders in code1, open"></Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close"></Keywords>
            <Keywords name="Folders in code2, open"></Keywords>
            <Keywords name="Folders in code2, middle"></Keywords>
            <Keywords name="Folders in code2, close"></Keywords>
            <Keywords name="Folders in comment, open"></Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close"></Keywords>
            <Keywords name="Keywords1">set vars wikify button define edit action createtiddler basetitle deletetiddler end list import macrocall mode deletefield default reveal link sendmessage setfield transclude</Keywords>
            <Keywords name="Keywords2">tiddler field class tag size tooltip split first last title placeholder currentTiddler tags sort reverse all description search sortan nsort indexes tagging has field tags get caption all backlinks else join sort first last prefix suffix split splitbefore removeprefix removesuffix addprefix addsuffix variable text type checked unchecked subfilter filter</Keywords>
            <Keywords name="Keywords3">details div span style class ol li margin padding font size weight width background top bottom overflow white space column gap rule summary height block inline start end align shadow border indent spacing display color</Keywords>
            <Keywords name="Keywords4"></Keywords>
            <Keywords name="Keywords5"></Keywords>
            <Keywords name="Keywords6"></Keywords>
            <Keywords name="Keywords7"></Keywords>
            <Keywords name="Keywords8"></Keywords>
            <Keywords name="Delimiters">00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" fgColor="646464" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="808080" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="16780303" />
            <WordsStyle name="LINE COMMENTS" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="16780303" />
            <WordsStyle name="NUMBERS" fgColor="646464" bgColor="FFFFFF" fontName="URL" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="03BE86" bgColor="FFFFFF" fontName="no" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="008BCE" bgColor="FFFFFF" fontName="4" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="8080FF" bgColor="FFFFFF" fontName="yes" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="&#xE770;&#xDCFD;&#x0157;" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="yes" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="FF8040" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="&#x2F80;&#xDCDA;&#x0157;" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="C10061" bgColor="FFFFFF" fontName="557" fontStyle="0" nesting="16780303" />
            <WordsStyle name="DELIMITERS2" fgColor="808080" bgColor="FFFFFF" fontName="&#xF9A8;&#xB854;&#x1300;&#x8800;&#x44A0;&#xDCF8;&#x0157;" fontStyle="0" nesting="16780295" />
            <WordsStyle name="DELIMITERS3" fgColor="FF8040" bgColor="FFFFFF" fontName="&#x3910;&#xDCF8;&#x0157;" fontStyle="0" nesting="16780295" />
            <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="&#x0003;" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="&#x3B40;&#xDCF8;&#x0157;" fontStyle="0" nesting="3087" />
            <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="&#x0003;" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="&#x4178;3&#x7F00;" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="&#xC420;&#xDCFE;&#x0157;" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>

1 Like

Do you know why/where the setting is that’s making it semi-transparent? If I make a start on a complete new “TW” language, it doesn’t do that. I noticed that some of your color values carry an alpha channel, but not all of them. Driving me crazy trying to find it…

The one thing about Notepad++ which may turn some folks off is that you can’t make a user defined language the default when opening a new tab. It will automatically detect the language when a file with an extension of tid is opened. Am I addressing your question?

As far as some colors using alpha channel, I’ll have to look at that later. I’m on my phone at the moment.

Well, I still can’t find it. It’s like it’s a global setting, in CSS it would be like everything is set at 50% opacity:

* { opacity: 0.5; }

If you’re not seeing that, perhaps it’s something weird after copy/saving your “tiddlywiki.xml” text from above.

But don’t sweat it, I used yours as a guide and wrote my own :sunglasses: :nerd_face:

Glad you were able to do something with it. After looking through it a bit, I think I just happened to pick colors that weren’t fully saturated. I just went with what was pleasing to me. However, I have decided to tweak things a bit. Thanks a lot. :face_with_raised_eyebrow:

1 Like

I’m finding this quite useful:

2 Likes

This is awesome, thanks for sharing :grin:

This makes me wanna look into doing something similar in VS codium, and while i know there are some preset TW languages in vsc, im curious if i can do what the markdown languages in vsc do where it formats the text when the correct syntax is used per the selected language :thinking: