block by nitaku 10640487

Showdown

Full Screen

A simple test for the showdown.js library. A web page author can define the content by writing it in markdown, then have it automagically converted into HTML.

The implementation makes use of <script> tags in a not-so-standard fashion, specifying text/x-markdown as the script type. By using standard query selectors, the code finds all the script tags containing markdown, then invokes showdown.js to convert the content into HTML. The <script> tag is then replaced by a <div> tag, containing all the generated HTML.

Older browser can have a hard time executing this code, because of query selectors (see caniuse.com). Another way of implementing it can make use of jQuery, d3.js or other, higher-level DOM manipulation libraries.

index.html