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:

  1. Import quikdown from a CDN (or from your bundler).
  2. Call quikdown(markdownString) — returns an HTML string.
  3. Set it as innerHTML on 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.