Commit05a42c4cRecorded31 Mar 2026Repositorysigil-markdown
Add README with usage docs and API reference
Changed
README.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)Diff
README.mdadded
@@ -0,0 +1,76 @@
+1
# sigil-markdown+2
+3
A CommonMark-style Markdown parser for [Sigil](https://codeberg.org/sigil/sigil) with YAML front matter support. Produces SXML output for use with `(sigil sxml)`.+4
+5
## Features+6
+7
- CommonMark-style Markdown parsing+8
- YAML front matter extraction+9
- SXML AST output+10
- PEG-based inline parsing+11
+12
### Supported syntax+13
+14
| Element | Syntax |+15
|-----------------|-------------------------------------|+16
| Headers | `# H1` through `###### H6` |+17
| Paragraphs | Blank-line separated text |+18
| Code blocks | Fenced (```) or indented (4 spaces) |+19
| Blockquotes | `> quoted text` |+20
| Unordered lists | `- item`, `* item`, `+ item` |+21
| Ordered lists | `1. item`, `2. item` |+22
| Horizontal rule | `---`, `***`, `___` |+23
| Tables | `| col | col |` with separator |+24
| Inline code | `` `code` `` |+25
| Bold | `**bold**` or `__bold__` |+26
| Italic | `*italic*` or `_italic_` |+27
| Links | `[text](url)` |+28
| Images | `` |+29
+30
## Usage+31
+32
```scheme+33
(import (sigil markdown))+34
+35
;; Parse a Markdown string to SXML+36
(markdown->sxml "# Hello\n\nWorld")+37
;; => (document (h1 "Hello") (p "World"))+38
+39
;; Parse a Markdown file+40
(markdown-file->sxml "README.md")+41
+42
;; Front matter is parsed into SXML attributes+43
(markdown->sxml "---\ntitle: Hello\n---\n\n# Content")+44
;; => (document (@ (title "Hello")) (h1 "Content"))+45
```+46
+47
## API+48
+49
- `markdown->sxml` - Parse a Markdown string to SXML+50
- `markdown-file->sxml` - Parse a Markdown file to SXML+51
- `parse-front-matter` - Extract YAML front matter from text+52
- `parse-blocks` - Lower-level block parser+53
- `parse-inline` - Lower-level inline parser+54
+55
## Dependencies+56
+57
- [sigil-stdlib](https://codeberg.org/sigil/sigil) - Sigil standard library+58
- [sigil-peg](https://codeberg.org/sigil/sigil-peg) - PEG parsing library+59
+60
## Development+61
+62
Build with local dependency redirects:+63
+64
```sh+65
sigil build --redirects dev-redirects.sgl+66
```+67
+68
Run tests:+69
+70
```sh+71
sigil test --redirects dev-redirects.sgl+72
```+73
+74
## License+75
+76
BSD-3-Clause