Codemirror multiple overlay modes and or modes

Great work on Joplin and the extensibility

So I decided to work on my own plugins, I want to improve the markdown experience similar to some other plugins (add only what is missing) as a plugin, my work focus is on Markdown only.

I face an issue if I test my modifications with other plugins which as well change similar behavior, like the Rich Markdown Plugin and Joplin Enhancement Plugin

The Markdown editor is heavily reloading (all overlays and mods) and finally one wins and gets shown (may my or may some of the plugin) or sometimes nothing works and original Joplin Markdown is shown.

Is there a way to multiplex the codemirror modes? May in one single plugin in it eventually it works but in different?

Can anyone direct my search? I appreciate everything in advance.

Greetings Sebastian

I can't speak for how the Enhancement Plugin works, but rich markdown only adds overlays, so there shouldn't be any contention with your additions. You might find conflict with the base-mode depending on what you're doing. Older versions of rich markdown did switch the mode without issues, so I'm not certain what could be causing the issues you're seeing.

In terms of multiplexing modes, it's definitely possible, and you can use the codemirror multiplex plugin to do it. You can also checkout Joplins built in mode which multiplexes markdown and stex (also adding new features into the mix).

If you have some code to share, I can take a look and maybe find something that could be causing the refreshes.


thank you for your replay @CalebJohn, yes, I do have a test repository with a working plugin. I try out some enhancements done by Zettlr it is a quite nice piece of open source markdown editor.

I as well discovered that multiple CSS stacked by installing more than one plugin customizing codemirror behavior could interfere with each other and may the order is not defined which comes first, or I don't know how to define an order.

Ok, I will have a look into how Joplin does the multiplexing, may I can find some hints for me.

I discovered most of the wired behavior by installing the enhancement plugin, then It starts to flicker and do some UI flickering (may the CSS topic)

For the CSS you can't control the order that it's loaded, but you can use specialization of the css rules to ensure that your changes stick. For example

instead of

.omega_block {
  color: blue;

You can try

div.omega_block {
  color: blue;

to ensure that your rule will always win out. As a last resort you can also use the !important to give your rules priority.


div.omega_block {
  color: blue !important;

ok, yes i am a CSS newbi ( I am a C# DevOps but typescript/node/CSS are a new experience for me. I will try this to ensure it works like i expect.

I do want to avoid multiple renderings and flickiring UI, at all :slight_smile:

Thank you for your hints in the right direction.