Ready-to-play prototype: Syntax-Highlighting Tiny Editor

55 views
Skip to first unread message

Charlie Veniot

unread,
Sep 16, 2022, 8:10:44 PM9/16/22
to TiddlyWiki
Attachment: Download and drag into TiddlyWiki.com for import of three tiddlers.
  • Charlie's Syntax Highlighting Tiny Editor (this is the meaty one)
  • Charlie's Syntax Highlighting Tiny Editor Info (just "about" info shown in a details element in the meaty tiddler)
  • Charlie's Syntax Highlighting Tiny Editor Toolbar Button (adds an "alternative edit button" to tiddler toolbars; use it to edit a tiddler with the tiny editor displayed in a modal window)
Very early going, all about the "architecture" with one thing getting highlighted to start with.

Nothing particularly useful just yet.  Good enough for working proof of concept and fun code to study for anybody who wants to get into the weeds.

Some Screenshots:

The toolbar button to open the tiny editor:

(no-fuss-no-muss standard edit button with a pastel-coloured background to distinguish it)
Screenshot 2022-09-16 9.02.14 PM.png

Editing the "Saving" tiddler with the tiny editor:

(highlighting the first part of widgets)

Screenshot 2022-09-16 9.03.18 PM.png
SyntaxHighlightingTinyEditor.json

Charlie Veniot

unread,
Sep 17, 2022, 12:18:02 PM9/17/22
to TiddlyWiki
Latest version (attached) highlights wikilinks.

Something to test and keep in mind: parsing through the text and highlighting things is a sequential process.  Gotta watch out for syntax processing further down the process messing up syntax highlighting done earlier in the process.


Screenshot 2022-09-17 1.13.42 PM.png

SyntaxHighlightingTinyEditor.json

Charlie Veniot

unread,
Sep 17, 2022, 10:51:22 PM9/17/22
to TiddlyWiki
Latest version highlights quotation blocks.  (with color purple and, to try out, overline for the opening <<< and underline for the closing <<<

I am not getting too caught up in color selections just yet.  Everything is about architectural components right now.  Color choices for later, along with a proper GUI to adjust the colors.

Download the attachment and drag into tiddlywiki.com to play.

In this screenshot, the editor is showing the bottom-most content (the quotes) in the HelloThere tiddler.

Screenshot 2022-09-17 11.44.32 PM.png

SyntaxHighlightingTinyEditor.json

History Buff

unread,
Sep 19, 2022, 7:23:40 PM9/19/22
to TiddlyWiki
Hi Charlie,

I played around with your editor a tiny bit today. There seems to be some sort of issue with word wrapping. If I narrow the window, the issue goes away. 

Damon

Screenshot 2022-09-19 162240.png

History Buff

unread,
Sep 19, 2022, 7:28:02 PM9/19/22
to TiddlyWiki
Other than the word wrapping issue, I like it better than the http://sideeditor.tiddlyspot.com/. It seems more flexible in some ways.

Damon

Charlie Veniot

unread,
Sep 19, 2022, 7:33:38 PM9/19/22
to TiddlyWiki
G'day Damon,

Good catch!  This editor has two layers: the edit widget in the bottom layer and div on the top layer.

The div on the top layer provides the syntax coloring.

It looks like the div and the editor are handling wrapping differently.  I'll do some digging and see if I can find the CSS magic to fix things.

Much appreciated !

Charlie Veniot

unread,
Sep 19, 2022, 7:37:52 PM9/19/22
to TiddlyWiki
There's a lot of search-replace regexp going on, and it is pretty tricky.

I think best to not have this thing as a plugin that supplants the standard TiddlyWiki tiddler editor, and best to rather have it as a secondary side editor.

If you have any thoughts about that, please share.

Next on my mind is syntax colouring for bold, italic, underline.  I'm on the fence: just color the start and end tags, or color them and all the text in between.  I'm going to be hemming and hawing on that for another bit.

Charlie Veniot

unread,
Sep 19, 2022, 9:17:16 PM9/19/22
to TiddlyWiki
I think I fixed the wrapping problem.  Well, I at least fixed a problem if not that one.

The highlighting setup for widgets (the "opening" part of widgets) was buggy, but seems to be A-1 in this updated version.

I've also added highlight of the wiki codes for text formatting: bold, italic, underline, strikethrough, superscript, and subscript.  Just highlighting the codes and not the content between the codes.

Latest version attached, for download and dragging into TiddlyWiki.com to import the three tiddlers.

SyntaxHighlightingTinyEditor.json

History Buff

unread,
Sep 20, 2022, 5:36:48 PM9/20/22
to TiddlyWiki
Hey Charlie,

Played around with it for a few minutes this afternoon. The wrapping issue is definitely fixed. I want to spend much more time testing it, but don't have time right now.

Charlie Veniot

unread,
Sep 20, 2022, 5:58:42 PM9/20/22
to TiddlyWiki
Slow and steady is my cup o' tea.

I'm not the kind to win any races.  As long as we have a sense of heading in the right general direction, then I am a happy camper.

Little doses of testing/communication/work/whatever as sanity/insanity breaks is my philosophy.

Thanks for giving the latest a spin with that use case.

Cheers !

Reply all
Reply to author
Forward
0 new messages