You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function decodeHtmlEntities(text: string): string {
textArea.innerHTML = text;
return textArea.value;
}
export function getText(editor: Editor): string {
let html = editor?.getHTML();
console.log('HTML before conversion:', html);
if (html) {
const converter = new showdown.Converter();
let _text = converter.makeMarkdown(html);
console.log('Markdown after conversion:', _text);
_text = decodeHtmlEntities(_text);
console.log('Text after decoding HTML entities:', _text);
// need to check for @<span data-type="mention" data-id="62fbac0c1fcd4f036e1679b7" data-label="Ben">Ben</span>
// and replace with <@62fbac0c1fcd4f036e1679b7> where the id is the data-id
_text = _text.replace(/@<span data-type="mention" data-id="(.+?)" data-label="(.+?)">(.+?)<\/span>/g, '<@$1>');
return _text;
}
return '';
}
HTML before conversion: <p>This is _ underscore <em> star and ^$&#</em>$*(>?.,\</p>
Markdown after conversion: This is _ underscore * star and ^$&#$\*(>?.,\
Text after decoding HTML entities: This is _ underscore * star and ^$&#$\*(>?.,\
For some reason, on underscores and stars and some other characters I get escaping backslashes injected when converting it to markdown. I have not found any settings that allow me to get the markdown from showdown. Can anyone tell me how to do this? Post processing it seems a bit dirty. Appreciate any feedback
The text was updated successfully, but these errors were encountered:
Hey everyone,
I am having an issue with showdown.
For some reason, on underscores and stars and some other characters I get escaping backslashes injected when converting it to markdown. I have not found any settings that allow me to get the markdown from showdown. Can anyone tell me how to do this? Post processing it seems a bit dirty. Appreciate any feedback
The text was updated successfully, but these errors were encountered: