← All showcases

markdown — a Markdown → HTML converter

Source on GitHub ↗

Turns Markdown into a complete, styled HTML page. The block layer (headings, lists, fenced code, blockquotes, rules, paragraphs) is recognised line by line; the inline layer (**bold**, *italic*, `code`, [links](url), ![images](url)) is a Raku grammar with an actions class that emits HTML directly.

Run it

build/rakupp showcase/markdown/md2html.raku showcase/markdown/sample.md > out.html
cat notes.md | build/rakupp showcase/markdown/md2html.raku > notes.html
# or compile a standalone binary:
build/rakupp --exe -o md2html showcase/markdown/md2html.raku

It reads a file argument or stdin, and writes a self-contained page (inline CSS, no external assets) to stdout.

Example

Input:

## Features
A small **Markdown** converter written in *Raku*, parsing with a real `grammar`.

- **bold**, *italic*, and `inline code`
- [links](https://github.com/ash/rakupp)

Output (the body, indented for readability):

<h2>Features</h2>
<p>A small <strong>Markdown</strong> converter written in <em>Raku</em>,
   parsing with a real <code>grammar</code>.</p>
<ul><li><strong>bold</strong>, <em>italic</em>, and <code>inline code</code></li>
<li><a href="https://github.com/ash/rakupp">links</a></li></ul>

See sample.md for a fuller document exercising every construct.

Supported

BlocksInline
####### headings**bold**
- / * / + unordered lists*italic*
1. ordered lists`code`
``` fenced code[text](url) links
> blockquotes![alt](url) images
--- / *** rulesHTML-escaped text
blank-line-separated paragraphs

How it works