Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.39k stars 316 forks source link

Get HTML from #382

Closed erossini closed 2 years ago

erossini commented 2 years ago

How can I get from EasyMDE the render HTML?

I have this code that raises a call to Blazor for every change.

easyMDE.codemirror.on("change", function () {
    dotNetObjectRef.invokeMethodAsync("UpdateInternalValue", easyMDE.value());
});

The value is the Markdown text. How can I get the rendered HTML code?

Thank you again, Enrico

Ionaru commented 2 years ago

The editor isn't really designed to output HTML, the markdown text is the content you want to save.

But if you really want to convert that to HTML you can use the marked package: marked.parse(easyMDE.value());