[Release] Codemirror6 Plugin

The problem with using list-ops and toggle is that if the starting value of the config tiddler is say codemirror, you will end up with a value of codemirror edit and a non-functioning editor.

Recommend something more along these lines:

\whitespace trim

[img width=16 [$:/plugins/oeyoews/tiddlywiki-codemirror-6/icon]]

<$let
	type={{{ [<currentTiddler>get[type]else[text/vnd.tiddlywiki]] }}}
	configTitle=`$:/config/EditorTypeMappings/$(type)$`
	currentEditor={{{ [<configTitle>get[text]] }}}
>
	<$action-setfield $tiddler=<<configTitle>> text={{{ [<currentEditor>match[codemirror-6]] :then[[text]] :else[[codemirror-6]] }}} />
</$let>
1 Like

The filter for “type is empty” is traditionally like this [<targetTiddler>!has[type]] it does not matter if the field exists, just that it is empty.

  • Exists and has a value [<targetTiddler>has[type]]
  • And [has:field[type]]` is exists whether empty or not.

Yeah, so I changed the first <currentTiddler>get[type] to <targetTiddler>get[type]

@oeyoews

  1. Can we have collapsible regions?

  2. Can I set properties/config from wikitext? IOW, in CM5, all settings were global seetings in control panel. It would be nice to set style settings using CSS from wikitext and CM6 uses inherit where possible:

<div class="my-fonts-wrapping-line-numbers-etc">
  <$edit ...>
</div>

@BurningTreeC It is a bit disconcerting to see that the plugin settings UI code has been reused almost verbatim from Streams with no attribution. See:

  1. My TiddlyWiki — a non-linear personal web notebook and
  2. https://github.com/saqimtiaz/streams/blob/main/LICENSE

Perhaps more importantly, it doesn’t work particularly well either in my opinion as it does not make use of the grouping feature, leading to a single very long list.

Yes, the configuration list is getting longer and longer, up to 40 items, and grouping is indeed a good idea, but I am not good at writing wikitext, so I have no idea of ​​refactoring yet. I currently use code to automatically generate these configuration files.

https://github.com/oeyoews/tiddlywiki-codemirror6/blob/main/scripts/generateConfig.ts

Sorry @saqimtiaz, I haven’t seen the UI interface of the streams plug-in before, and I don’t know its source.

ps: the streams tab looks reasonable as a group

image

Sorry if this has been covered earlier, but is there a way to enable smart indent in CM6? So if I add a new line from an already indented line, it gets indented the same amount? Very useful quality of life feature for me and I’m sure others.

1 Like

For markdown, this feature is available out of the box, powered by lang-markdown, in lang-tiddlywiki there is still a lot of work to be done, smart-indent is one of them, but unfortunately, I don’t have time recently Write it. Maybe you can imitate lang-markdown. But it will take a lot of time.

Screenity video - Jan 26, 2024

maybe can write a codemirror6 extension to support it.

Has anyone tested the autolist plugin in codemirror?

I haven’t used this plugin before, but I tested it and it seems to work well with cm6

Support mermaid types completion.

Since we’re on the topic if indentions in codemirror, I was curious if collapsible sections by indention was being considered, similar to how visual studio code or notepad++ does it.

As far as I know, vscode and codemirror both use syntax trees to identify whether they can be folded, not through simple indentation. I am not familiar with nodepad++, and I have almost never used it.

Ah, then I was mistaken. And I used NP++ a decent amount a while back, and I thought it also had that feature, but I could br mistaken.

codemirror6 plugin 1.4.5 fixes the style problem that the page cannot scroll after the edited tiddler is switched to editor fullscreen and exited directly. It is recommended to update

This may be a good idea, but colapsing tiddlywiki script elements could also be as useful. eg fold a widget into its first line or parameters, hiding its content and close tag.

1 Like

In theory it can be done by lang-tiddlywiki