Examples ›
Track 1 — Parser ›
Example 1
Hello world
The simplest possible quikdown example. Import the parser, render markdown into a div. Less than 10 lines of code.
The complete code
<div id="out"></div>
<script type="module">
import quikdown from 'https://unpkg.com/quikdown';
document.getElementById('out').innerHTML = quikdown(`
# Hello, quikdown!
This is **markdown**, parsed in your browser
in less than ten lines of code.
- Lists work
- So do \`code spans\`
- And [links](https://github.com/deftio/quikdown)
`);
</script>
Live result
What's happening
That's it. Three steps:
- Import
quikdownfrom a CDN (or from your bundler). - Call
quikdown(markdownString)— returns an HTML string. - Set it as
innerHTMLon a target element.
The parser is XSS-safe by default. HTML in your markdown is escaped, and URL schemes like javascript: in links are sanitized away.