var script document createElement script script type text javascript script src https cdnjs cloudflare com ajax libs showdown 1 9 1 showdown min js document head appendChild script window onload function var converter new showdown Converter console log converter var text hello markdown input var html converter makeHtml text output console log html var script document createElement script script type text javascript script src https cdnjs cloudflare com ajax libs showdown 1 9 1 showdown min js document head appendChild script document body style height 100pt window onload function var converter new showdown Converter console log converter const text A Title Once upon a time var html converter makeHtml text console log html let div document createElement div div innerHTML html document body appendChild div var style document createElement style style type text css var css border 0px solid blue margin 0 line height 14pt font size 14pt padding 0 style innerHTML css document body appendChild style var script document createElement script script type text javascript script src https cdnjs cloudflare com ajax libs showdown 1 9 1 showdown min js document head appendChild script document body style height 100pt window onload function var converter new showdown Converter console log converter const text A Title Once upon a time n Bold words or just big var html converter makeHtml text console log html let div document createElement div div innerHTML html div style margin 10pt document body appendChild div var style document createElement style style type text css var css border 0px solid blue margin 0 line height 14pt font size 14pt padding 0 h1 h2 h3 h4 p display inline style innerHTML css document body appendChild style var script document createElement script script type text javascript script src https cdnjs cloudflare com ajax libs showdown 1 9 1 showdown min js document head appendChild script document body style height 200pt let divin document createElement textarea divin contentEditable true divin style border 1px solid blue divin style width 100 divin style height 100pt divin innerHTML type in text divin placeholder type in text document body appendChild divin let divout document createElement div divout contentEditable true divout style border 1px solid green divout style height 100pt divout innerHTML outputted markup to html document body appendChild divout window onload function var converter new showdown Converter console log converter divin onkeyup function let text divin value var html converter makeHtml text replaceAll n br divout innerHTML String html console log text html end onload emojis and underline extra options to the configure var script document createElement script script type text javascript script src https cdnjs cloudflare com ajax libs showdown 1 9 1 showdown min js document head appendChild script document body style height 100pt window onload function var converter new showdown Converter emoji true underline true converter setFlavor github newline to br console log converter const text A Title smile everyone loves a smiley Once upon a __time__ balloon var html converter makeHtml text console log html let div document createElement div div innerHTML html document body appendChild div 1 Add the prettify library so that any pre code tags are automatically highlighted The only criteria is that prettyprint is added i e class prettyprint should be added to any pre or code tags to enable syntax highlighting var scripta document createElement script scripta type text javascript scripta src https cdn rawgit com google code prettify master loader run_prettify js document head appendChild scripta 2 Adding showdown library so markdown can be converted to html var script document createElement script script type text javascript script src https cdnjs cloudflare com ajax libs showdown 1 9 1 showdown min js document head appendChild script 3 Add extra extension to showdown to enable code to be highlighted using prettify i e this extra extension means that code blocks will have the prettyprint added to the output look at the generated html to see the extra bits var script2 document createElement script script2 type text javascript script2 src https cdn jsdelivr net npm showdown prettify 1 3 0 dist showdown prettify min js document head appendChild script2 document body style height 200pt window onload function var converter new showdown Converter extensions prettify converter setFlavor github newline to br console log converter const text A Title There was a frog called froggy pre code let a 2 for let i 0 i 2 i print bbb code pre End of code block var html converter makeHtml text console log html let div document createElement div div innerHTML html document body appendChild div
o html document body appendChild divout window onload function var converter new showdown Converter console log converter divin onkeyup function let text divin value var html converter makeHtml text replaceAll n br divout innerHTML String html console log text html end onload emojis and underline extra options to the configure var script document createElement script script type text javascript script src https cdnjs cloudflare com ajax libs showdown 1 9 1 showdown min js document head appendChild script document body style height 100pt window onload function var converter new showdown Converter emoji true underline true converter setFlavor github newline to br console log converter const text A Title smile everyone loves a smiley Once upon a __time__ balloon var html converter makeHtml text console log html let div document createElement div div innerHTML html document body appendChild div 1 Add the prettify library so that any pre code tags are automatically highlighted The only criteria is that prettyprint is added i e class prettyprint should be added to any pre or code tags to enable syntax highlighting var scripta document createElement script scripta type text javascript scripta src https cdn rawgit com google code prettify master loader run_prettify js document head appendChild scripta 2 Adding showdown library so markdown can be converted to html var script document createElement script script type text javascript script src https cdnjs cloudflare com ajax libs showdown 1 9 1 showdown min js document head appendChild script 3 Add extra extension to showdown to enable code to be highlighted using prettify i e this extra extension means that code blocks will have the prettyprint added to the output look at the generated html to see the extra bits var script2 document createElement script script2 type text javascript script2 src https cdn jsdelivr net npm showdown prettify 1 3 0 dist showdown prettify min js document head appendChild script2 document body style height 200pt window onload function var converter new showdown Converter extensions prettify converter setFlavor github newline to br console log converter const text A Title There was a frog called froggy pre code let a 2 for let i 0 i 2 i print bbb code pre End of code block var html converter makeHtml text console log html let div document createElement div div innerHTML html document body appendChild div