Sync local packages into the registry repo and update index.json and README.md to include all 9 packages.
83 lines
1.8 KiB
Markdown
83 lines
1.8 KiB
Markdown
# markdown
|
|
|
|
A Markdown to HTML converter for [Lux](https://github.com/thebrandonlucas/lux).
|
|
|
|
## Install
|
|
|
|
```bash
|
|
lux pkg add markdown --git https://git.qrty.ink/blu/markdown
|
|
```
|
|
|
|
## Usage
|
|
|
|
```lux
|
|
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 (``)
|
|
- Raw HTML pass-through (lines starting with `<`)
|
|
|
|
### Inline elements
|
|
- **Bold** (`**text**`)
|
|
- *Italic* (`*text*` or `_text_`)
|
|
- ~~Strikethrough~~ (`~~text~~`)
|
|
- `Code` (`` `code` ``)
|
|
- [Links](url) (`[text](url)`)
|
|
- Images (``)
|
|
- 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
|
|
|
|
```bash
|
|
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
|