Sync local packages into the registry repo and update index.json and README.md to include all 9 packages.
1.8 KiB
1.8 KiB
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 (
# h1through#### 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 (
) - Raw HTML pass-through (lines starting with
<)
Inline elements
- Bold (
**text**) - Italic (
*text*or_text_) Strikethrough(~~text~~)Code(`code`)- Links (
[text](url)) - Images (
) - Raw HTML tags pass through
Special features
- Headings inside list items (
- ### Titlerenders 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