online-markdown-editor
online-markdown-editor copied to clipboard
Saving Preview to HTML
Is it possible to save the preview to HTML? How could that be done?
The rendered HTML—at least when it's not syntax-highlighted—is pretty basic, so you could just write a JavaScript function that copies the HTML code from the preview and replaces it. If I have the time I'll do that, should be a matter of minutes.
I have been trying for days without success. My problem is how to bind the #preview DOM element to a hidden field so that I will use the hidden field to get the data in the preview div element and save it to database.
I have attempted everything I could in JQuery. From appending to a hidden form element, to cloning the #preview div to the hidden from element with no success. See sample below:
$("#ArticleBody").append($("div#preview").clone());
Maybe I need to ask this question differently. When I submit my form, data submitted from the textarea shows the other markdown characters, eg "Article\r\n-------\r\n\r\nThis is sample C# \r\n\r\n if(user.identity.name = mark)\r\n {\r\n _reposity.save()\r\n }"
However, as you can see above, the C# code is not marked down, as such, the code is saved into the database without the pre delimiters. Is this the normal behaviour?
How to parse tables well?
title | des | remark |
---|---|---|
test | test2 | nothing |
@baigao2015 Tables do not seem to be enabled by default in the version of showdown.js
that is used here. It'd need an update of showdown and the flag to be enabled.
OK, thanks.