Files
pkgs.lux/packages/markdown

markdown

A Markdown to HTML converter for Lux.

Install

lux pkg add markdown --git https://git.qrty.ink/blu/markdown

Usage

import markdown

fn main(): Unit with {Console} = {
    let html = markdown.toHtml("# Hello **world**")
    Console.print(html)
}

let _ = run main() with {}

API

toHtml(markdown: String): String

Convert a full markdown document to HTML.

inlineToHtml(text: String): String

Convert inline markdown only (bold, italic, links, etc.) without block-level processing.

escapeHtml(s: String): String

Escape HTML entities (&, <, >).

Supported Markdown

Block elements

  • Headings (# h1 through #### h4)
  • Paragraphs (auto-wrapped in <p>)
  • Fenced code blocks (``` with optional language)
  • Blockquotes (> text)
  • Unordered lists (- item)
  • Ordered lists (1. item)
  • Horizontal rules (---, ***, ___)
  • Images on their own line (![alt](src))
  • Raw HTML pass-through (lines starting with <)

Inline elements

  • Bold (**text**)
  • Italic (*text* or _text_)
  • Strikethrough (~~text~~)
  • Code (`code`)
  • Links ([text](url))
  • Images (![alt](src))
  • Raw HTML tags pass through

Special features

  • Headings inside list items (- ### Title renders correctly)
  • Nested inline formatting (**[bold link](url)**)
  • Code blocks with syntax highlighting class (language-*)
  • Recursive blockquote content processing

Running Tests

lux test.lux

Known Limitations

  • No nested lists (indented sub-items)
  • No reference-style links ([text][ref])
  • No tables
  • No task lists (- [ ] item)
  • The C backend does not support module imports; use the interpreter (lux) or include the source directly for compiled binaries

License

MIT