joplin
joplin copied to clipboard
Rich Text Editor should not destroy markdown
Operating system
Linux
Joplin version
2.13.2
Desktop version info
Joplin 2.13.12 (prod, linux)
Client ID: c7dff86521c841b8b1f92fa6239cc51c Sync Version: 3 Profile Version: 44 Keychain Supported: No
Revision: e027cdc
OCR: 0.3.2 Outline: 1.5.13 Typograms: 1.0.0
Current behaviour
- install the typogram plugin
- put the typogram example in a markdown note using Split Editor, save
```typogram
+----+ o | o * * .----------.
*-+---. '-* -+- | v ^ \ / |.--------.|
| '---> +----+ ->*<- / .-+->*<-o--+ |'------> ||
<-' *---+ |<----->| +----' | ^ \ '---------'|
|__| v *----------'
```
- switch to Rich Text Editor, make a change somewhere else and save
- go back to Split Editor, you should already see the destroyed typogram example, save again
- go back to Rich Text Editor and see that it finally got destroyed.
Expected behaviour
Even though the Rich Text Editor does not support all plugins smoothly, it should not destroy such information, shouldn't it?
Logs
No response
This typogram contains valid Markdown elements so the RTE doesn't "destroy" it, it renders it. To prevent valid Markdown from being rendered, you need to wrap it in a code block (maybe that's something that the plugin needs to fix)
@laurent22 Please reopen, I think the issue got misunderstood.
Of course I fenced the typogram - the confusion arose because here in github the fences are not shown. I now managed to show them - see above
Would you mind sharing the whole note as a Markdown file so that we can see exactly how it looks?
try this one:
my markdown file
```typogram
+----+ o | o * * .----------.
*-+---. '-* -+- | v ^ \ / |.--------.|
| '---> +----+ ->*<- / .-+->*<-o--+ |'------> ||
<-' *---+ |<----->| +----' | ^ \ '---------'|
|__| v *----------'
```
There is now an example available for how to make a renderer plugin work in the rich text editor:
https://github.com/laurent22/joplin/blob/a59ad20bd57981a20f4fa3e66fde05ffe6a08367/packages/app-cli/tests/support/plugins/content_script/src/markdownItTestPlugin.ts#L27-L34
https://github.com/laurent22/joplin/blob/a59ad20bd57981a20f4fa3e66fde05ffe6a08367/packages/app-cli/tests/support/plugins/content_script/src/markdownItTestPlugin.ts#L36-L38
The data-joplin-language
, data-joplin-source-open
, data-joplin-source-close
, class="joplin-editable"
, and <pre class="joplin-source"
elements and attributes help Joplin reconstruct the original markdown that created the diagram.
Edit: See also https://github.com/laurent22/joplin/pull/10178
Since it's not something that we can fixed I reported it on the plugin repository: https://github.com/cwesson/joplin-plugin-typograms/issues/1