Junk in the copied text from the visual editor


When I copy text using the visual editor I always get some junk in the text, quite dangerous when using the copied text in the terminal

copied from the visual editor
btrfs rescue zero-log /dev/<devicename>

copied from the regular markdown editor
btrfs rescue zero-log /dev/<devicename>

Actual markdown

That's not junk, those are HTML entity codes. The WYSIWYG editor processes text differently than the Markdown editor. You should use the Markdown editor if you want to see the plain text that you're copying or pasting.

Yes, but this text was copied from the web from an HTML page, and when I copy from the HTML page I do not see any "entity codes" when pasted in the terminal. Don't you think this should be improved given that from the user's perspective it is functionally wrong? Why should the user care about these unseen codes (in the rendering editor)? Maybe that is technically how it happens but in reality I doubt not many people like this behavior.

I can't speak for the developer. But to quote the Joplin website, the Rich Text WYSIWG editor is "still Markdown under the hood." What I have seen from using the Rich Text editor is that when you paste things into it, it "interprets" what you paste in order to keep it as valid Markdown and/or HTML.

I believe the reason it converts the angle brackets to HTML entity codes is because otherwise anything reading the Markdown file (such as a program that converts a Markdown file into HTML, such as Pandoc) might have issues with something like <devicename> and interpret it as some kind of HTML, since HTML is all about angle brackets. Or, the resultant HTML file created from the Markdown file, interpreted by an internet browser, might be rendered incorrectly. Or, the HTML might just have errors.

The Rich Text editor also puts escape characters in front of dashes, for example, because in Markdown a dash is an HTML list item, but if you're pasting something with a dash at the front of a line, you probably just want to paste that dash literally, not an HTML list item. So the Rich Text editor escapes the pasted dashes.

The whole point of Markdown is to easily write something human-readable that can later be converted into valid HTML. So from what I can tell, what the Rich Text editor is doing is making sure that any pasted items still look like what they were originally but are still valid Markdown/HTML. ​

But maybe there could be something like a "Paste plain text" keyboard shortcut and/or context menu option, either as part of Joplin or, if that's beyond Joplin's scope, as a plugin.

For now, though, switching to the Markdown editor when pasting will ensure that what you paste is pasted literally and not converted into valid Markdown or valid HTML.

1 Like

It's Ctrl+Shift+V on Windows and Linux, I assume it's Cmd+Shift+v on macOS. It probably would be helpful to have in the right click context menu, just to help users find it.

Well, the markdown editor is still the markdown editor under the hood, is not it? It behaves properly, but the visual editor does not. In my opinion the default behavior should be what a regular user expects which is when she copies it, what she pastes is what she sees. Someone needing to copy special underlying codes will be much of a rarity than a general rule.

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