Many of the Functionalities and Plugins in Joplin are not supported in the WYSIWYG Editor. This is a problem when switching between editors because things like HTML formatting or special formatting for plugins is lost. This is written in the Documentation:
For a start, most Markdown plugins will not be compatible. If you open a Markdown note that makes use of such plugin in the Rich Text editor, it is likely you will lose the plugin special formatting. The only supported plugins are the "fenced" plugins - those that wrap a section of text in triple backticks (for example, KaTeX, Mermaid, etc. are working). You can see a plugin's compatibility on the Markdown config screen.
I think that I have a really simple solution for this problem: Add a fenced block that will be treated and rendered like the rest of the note, but that can't be changed by the WYSIWYG Editor.
This would make it possible to put HTML formatting or code for plugins in that fenced block and have them show up in all editors, but prevent them from getting changed by the WYSIWYG Editor.
In short: Adding a fenced block that is treated as normal markdown would (as I understand it) make all Markdown Plugins compatible with the WYSIWYG Editor and also make it possible to use HTML styling without fear that it will be lost when switching between editors.
This solution is already implemented for several plugins, such as Katex or Mermaid, but it's not really simple. Sometimes it's difficult to know what part of a rendered note should be preserved, especially for third-party plugins.
Sometimes it's difficult to know what part of a rendered note should be preserved, especially for third-party plugins.
I think that exactly this problem could be solved by letting the user decide what to put in this protected block.
Example: The Table of Contents plugin is not compatible with the Rich-Text Editor. If you switch between editors, the [toc] gets replaced by links to sections which don't update automatically.
As a solution, I was thinking about something like this:
here is normal markdown
'''markdown-protected
[toc]
the markdown in this fenced block can not be changed by the Rich-Text Editor, it will only be rendered
'''
here is normal markdown again
The sections that should not be changed are put in a fenced / “protected” block. Everything in this protected block will be rendered by the Rich Text Editor and plugins, but it will not be changed (like what we have right now with the KaTeX fenced block, only instead for generic markdown). When switching between editors, the [toc] won't be lost.
This would solve the problem and make all plugins compatible with the Rich Text Editor (meaning their special formatting won’t be lost when switching editors).
I hope this example shows what I meant and why I think this feature would have such a big impact on the usefulness of plugins and Joplin itself. I really hope this is something that could be implemented.
Hmm, that would solve the problem but i feel that's troublesome to have to manually specify these tags every time.
I feel that's there's probably just a few plugins that people really care about, like indeed the toc plugin, as it often comes back in discussion.
In that case, maybe we could just patch it so that it support the rt/md switch like I've done for mermaid and katex. That way we solve it for everyone, without having to manually fence blocks of markup.
that would solve the problem but i feel that's troublesome to have to manually specify these tags every time.
It would be a bit annoying, but not as much as it is right now to add the [toc] again every time the note changes. If I could just put it in a protected fenced block, that would be fine for me.
Patching the TOC Plugin to work with switching between Editors would of course be great, but I still think that having the option to manually fence blocks of markup would be worth it.
It would make smaller or older Plugins compatible for the people who want to use them without the need to patch every plugin that has ever been written.
Also it would make it possible to use formatting that would normally be lost when switching Editors.
One example where it would be useful is the Function Plot Plugin. It works in split view, but not in the Rich Text Editor and as soon as you switch notes or do anything in the Rich Text Editor, the formatting is lost. The Function Plot Plugin even uses a fenced block, but apparently it is not recognised by Joplin.
The Rich Text editor is very convenient and works great for me, but it makes it annoying to use the TOC plugin and impossible to use the Function Plot Plugin. Right now I basically only switch away from the Rich Text editor to fix stuff like the TOC Plugin.
Do you know how hard it would be to add this feature?