Checkbox to enable line numbers in each tiddler

I’ve created a tiddler - tagged with $:/tags/EditTemplate to have a checkbox:

<div class="showLine">
<$checkbox tiddler="$:/config/codemirror/lineNumbers" field="text" checked="true" unchecked="false" default="false"> Zeilennummerierung </$checkbox>

I’d like to see the line numbers immediately when checking - a “refresh” is needed in the background to become active… How to do that?

What CSS is needed to have the checkbox in each tiddler always on the same position?

This code doesn’t work for all tiddlers:

.showLine {
   position: absolute;
   left: 53em;
   bottom: -1.55em;
   font-size: 0.6em;


I think that’s a bug in the codemirror editor widget. It should automatically refresh when there are any changes to the configuration tiddler changes.

The codemirror editor is an “edit engine” that is selected by the edit-factory and initialized with the edit-text widget.

Additional parameters can only be set, when the editor instance is activated, with code-mirror config tiddlers.

Showing line numbers is a configuration of the codemirror library when the cm-object is instantiated. So it’s not possible to update it dynamically at the moment.

You need to modify the edit-template. There are probably several posts here in the forum that talk about adding elements to the edit-template

But as I wrote already. You’ll need a close / open anyway at the moment

Thanks for feedback - I hope, it will be fixed.

hmmm, I think, that wont probably happen any time soon. The edit-widget is responsible to instantiate the editors depending on the tiddler type-field.

As you can see with the parameters it does not have any idea about cm-options at the moment. … I does pass on every additional parameter to the “child editors”

But atm the codemirror-editor has no code to evaluate these additional parameters.

I think it would be straight forward to create a new parameter eg: configChanged that would force the the edit-widget to initialize itself again.

I did have a short look at the code and it seems to be a bit tricky There are already some functions that do similar things. …

So care has to be taken since we have 3 text editors at the moment. “simple”, “framed” and “codemirror”. All of them have to implement the change :confused: So it triples the work that has to be done.

IMO you should file a bug report: Sign in to GitHub · GitHub so it won’t be forgotten

Perhaps a work around would be to create a button to change the setting, save and reload the wiki. Perhaps with a confirmation before reload using ActionConfirmWidget
you may want to set default tiddlers to include retain story tiddlers [list[$:/StoryList]] so the currently open tiddlers appear on reload.

There is no need to reload the wiki. Only close and open the tiddler.

In the past I added an action navigate action to a button, would this do this. If one uses the extended edit buttons plugin to save without closing do something similar?

  • it would be worth trying.

It’s the initialisation of the cm-editor that passes the new config data to the widget. So as long as it is visible it will not change.

Thanks for feedback @pmario, @TW_Tones

I see, it is not that easy…

My intention was, to have a checkbox to enable line numbers.

  1. Initial, I had the issue to see the line numbers:
    I found the reason: ( Problem with LineNumbers using CodeMirror )
    Changing in $:/ControlPanel -> Advanced -> Editor Type -> text/vnd.tiddlywiki from comptext to codemirror will show the line numbers.

  2. I had no idea, how to change 2 values with 1 checkbox:

    • Enable line numbers: $:/config/codemirror/lineNumbers from false to true
    • $:/config/EditorTypeMappings/text/vnd.tiddlywiki from comptext to codemirror

    So I decided to remove the plugin " $:/plugins/snowgoon88/edit-comptext" in my wiki.
    Now I was able with the checkbox to activate / deactivate the line numbers with all the issues mentioned in this topic - except of the correct CSS for the position of the checkbox.

  3. Today I recognized, that the subsume Plugin “” isn’t working anymore.

→ Conclution: subsume needs edit-comptext plugin → installed again…

Is there a way to have in edit mode in each tiddler a checkbox to enable line numbers on demand? → One click instead of changing values manually…


The following advice is generic and independent from the code mirror issue, but could help you solve it.

Checkboxes by their nature are typically two state toggles, you can now use the additional actions parameter to trigger additional actions on click, checked and unchecked.

  • However you could also create two buttons, only one showing for each state or with a little coding develop a single button using the toggle or cycle operators.
  • If you have a working button/pair as mentioned above, tagging it/them with the tag $:/tags/EditToolbar will put it at the top right alongside done and close while in edit mode.

I did create a GH issue: Codemirror edit mode should allow setting changes that take effect immediately. No close / re-open needed #7274