ivo Welch ivo Welch - 7 days ago 4x
Markdown Question

markdown in browser via showdown

I am wondering whether I can create my new website in markdown instead of in html. showdown.js at https://github.com/coreyti/showdown seems to be a plugin that can do this.

I am thinking something like

<script type="text/javascript" src="/js/showdown-starter.js" />
<link rel="StyleSheet" href="mystylesheet.css" type="text/css" />


# Welcome

Hello. Welcome to my website.


Presumably, the client javascript would transform this into html that the browser likes.


Sure you can.

Here's an example how:

<div id="content">
# Welcome

Hello.  Welcome to my **website**.
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.4.0/showdown.min.js"></script>
var conv = new showdown.Converter();
var txt = document.getElementById('content').innerHTML;
document.getElementById('content').innerHTML = conv.makeHtml(txt);