When content is copy pasted to the editor, the getMarkdown() returns HTML only instead of markdown
Get HTML and Get Markdown buttonsgetMarkdown() always return markdown. And, 'preferably', getHtml() removes unnecessary formatting
Check video below:

@rrjanbiah Thanks for the detailed explanation. This is a specification and Markdown allows the html inline <span> tag, so <span> is maintained when pasting.
@seonim-ryu Thank you! Are there any quick workarounds for the current version?
even i dont like those tags in markdown, and i could not find a fix.
Hence I use this code as my own code as a workaround:
editor.on("change",function(data) {
let mdtext = editor.getMarkdown();
cleanedup_mdtext = mdtext;
cleanedup_mdtext = cleanedup_mdtext.replace(/<[\/]?span[^>]*>/g, "");
cleanedup_mdtext = cleanedup_mdtext.replace(/<br[\s\/]*>/g, "");
cleanedup_mdtext = cleanedup_mdtext.replace(/<[\/]?u>/g, "");
if ( cleanedup_mdtext !== mdtext ) {
//console.log(cleanedup_mdtext);
//console.log(mdtext);
//console.log("------");
editor.setMarkdown(cleanedup_mdtext);
}
});
@ankanani Thanks for sharing! Much appreciated
I'm having a similar issue where lists are rendered by getMarkdown() as <li> HTML elements instead of markdown -, and newlines rendered as <br> instead of just a blank line. It seems that the function is returning a mix of HTML and markdown. This only occurs when something has been pasted into the editor. Working on a repro case in case it is the same issue.
Ok, found an example. Copying and pasting this comment into the editor will result in a mystery <br> being inserted after What, as returned by getMarkdown(). I wouldn't really expect the getMarkdown function to return any HTML at all but especially when the origin content is all markdown.
What
Why
If there is anything I can do to help just let me know.