Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rich Text Editor should not destroy markdown #9929

Closed
schlichtanders opened this issue Feb 12, 2024 · 6 comments
Closed

Rich Text Editor should not destroy markdown #9929

schlichtanders opened this issue Feb 12, 2024 · 6 comments
Labels
bug It's a bug desktop All desktop platforms editor high High priority issues

Comments

@schlichtanders
Copy link

schlichtanders commented Feb 12, 2024

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

  1. install the typogram plugin
  2. put the typogram example in a markdown note using Split Editor, save
```typogram
          +----+     o    |          o       *      *   .----------.
  *-+---. '-* -+-    |    v         ^         \    /    |.--------.|
    |   '--->   +----+  ->*<-      /   .-+->*<-o--+     |'------> ||
  <-'       *---+     |<----->|   +----' |  ^   \       '---------'|
                                         |__|    v      *----------'
```
  1. switch to Rich Text Editor, make a change somewhere else and save
  2. go back to Split Editor, you should already see the destroyed typogram example, save again
  3. 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

@schlichtanders schlichtanders added the bug It's a bug label Feb 12, 2024
@laurent22
Copy link
Owner

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)

@schlichtanders
Copy link
Author

schlichtanders commented Feb 13, 2024

@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

@laurent22
Copy link
Owner

laurent22 commented Feb 13, 2024

Would you mind sharing the whole note as a Markdown file so that we can see exactly how it looks?

@schlichtanders
Copy link
Author

try this one:

my markdown file

```typogram
          +----+     o    |          o       *      *   .----------.
  *-+---. '-* -+-    |    v         ^         \    /    |.--------.|
    |   '--->   +----+  ->*<-      /   .-+->*<-o--+     |'------> ||
  <-'       *---+     |<----->|   +----' |  ^   \       '---------'|
                                         |__|    v      *----------'
```

@laurent22 laurent22 reopened this Feb 19, 2024
@laurent22 laurent22 added desktop All desktop platforms editor high High priority issues labels Feb 19, 2024
@personalizedrefrigerator
Copy link
Collaborator

personalizedrefrigerator commented Mar 21, 2024

There is now an example available for how to make a renderer plugin work in the rich text editor:

const richTextEditorMetadata = `
<pre
class="joplin-source"
data-joplin-language="justtesting"
data-joplin-source-open="\`\`\`justtesting\n"
data-joplin-source-close="\`\`\`"
>${markdownIt.utils.escapeHtml(token.content)}</pre>
`;

return `
<div class="just-testing joplin-editable">
${richTextEditorMetadata}

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 #10178

@laurent22
Copy link
Owner

Since it's not something that we can fixed I reported it on the plugin repository: cwesson/joplin-plugin-typograms#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug desktop All desktop platforms editor high High priority issues
Projects
None yet
Development

No branches or pull requests

3 participants