A test for markdownhere, a minuscule library that let showdown.js automatically do its magic on all elements marked with class x-mdhere
.
Just set the class on HTML elements you want to fill in with Markdown, and include both showdown.js
and markdownhere.js
(place the latter in a script tag right before the end of the body, to have it run when the DOM is ready).
Please be aware that Markdown code cannot be indented as its containing HTML element, because indentation is used in Markdown to define code blocks.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Markdown here!</title>
<script src="showdown.js"></script>
<style>
body {
font-family: sans-serif;
}
</style>
</head>
<body class="x-mdhere">
# Markdown here!
This page is written in [Markdown](//en.wikipedia.org/wiki/Markdown).
You can add *emphasis*, **more emphasis**, write ordered or unordered lists...
1. Like
2. This
3. One
...and...
- This
- One
...while maintaining a perfectly readable code (just try `Ctrl+U` to view the source code for this page).
</body>
<script src="//wafi.iit.cnr.it/webvis/markdownhere/markdownhere.js"></script>
</html>