Customizing CodeMirror - is there a way?

OS: all (macOS, windows); Joplin Version: 2.5.8

CodeMirror allows for some customization, via javascript calls for both the global context and for some modes, at least the vim mode.

I am not aware of a place where I can add user-specific code that would be called at the correct times to configure CodeMirror. Am I missing something?

If there currently is no such capability, I'll start a proposal over in the Features category.

I was wondering this myself the other day, I made a comment on github (which i won't link, its an old, closed PR that is a bit out of date) with the following:

Alternatively, and this might just be me speaking from pure naïvety, would be to expose the Codemirror config options as an "advanced" section within Joplin with the ability to activate or set certain CM flags to override the default behaviour. The benefit with that could be that it is purely handled by the users as "use at your own risk" type option like the CSS styling with no guarantee that it will remain stable or that the features are necessarily compatible.

Whether its is feasible or not I have no idea

I think it should be possible to expose these options via a content script.
Here's a sample plugin joplin/joplinMatchHighlighter.js at dev · laurent22/joplin · GitHub

It has access to the CodeMirror instance and can do whatever it wants with it.


Thanks! That looks like a feasible approach! I'll see if I can work with that.

(Sorry for the late acknowledgement -- I thought I had email notifications enabled, but didn't.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.