Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client side html markdown conversion

I've been trying to create a client side editor which allows the end user to create content in html or markdown. The user has two tabs for switching between the two. I managed to find some javascript that converts markdown to html, so if a user has been writing markdown and switches to the html tab, the html equivilant is shown. I haven't been able to find a javascript that converts html to markdown, only a python script.

The python script is obviously server side. The tabs are just hyperlinks with script in there. Is there any way I can convert the markdown html when the user clicks the tab?

like image 619
DNN Avatar asked Mar 14 '10 20:03

DNN


1 Answers

The currently accepted answer actually tells you to do it on the server-side.

To really do client-side conversion, you could try one of these libraries (in order of popularity, measured by GitHub stars):

  • marked
  • showdown
  • markdown-it
  • markdown-js
  • reMarked.js
like image 142
Lucio Paiva Avatar answered Sep 20 '22 13:09

Lucio Paiva