Version0.15.0Verifiednot yet verifiedLicenseBSD-3-Clause
Readme
sigil-sxml
SXML processing library for Sigil. Convert between S-expression representations of XML/HTML and serialized markup strings.
Usage
(import (sigil sxml))
;; Convert SXML to HTML
(sxml->html '(div (@ (class "main"))
(h1 "Hello")
(p "Welcome to " (strong "Sigil") ".")))
; => "<div class=\"main\"><h1>Hello</h1><p>Welcome to <strong>Sigil</strong>.</p></div>"
;; Void elements handled automatically
(sxml->html '(img (@ (src "photo.jpg"))))
; => "<img src=\"photo.jpg\">"
;; Convert SXML to XML (self-closing void elements)
(sxml->xml '(item (@ (id "1")) "Content"))
; => "<item id=\"1\">Content</item>"Parsing XML
(import (sigil sxml reader))
;; Parse XML string to SXML
(xml->sxml "<div class=\"main\"><p>Hello</p></div>")
; => (div (@ (class "main")) (p "Hello"))
;; Parse multiple top-level elements
(xml->sxml* "<p>One</p><p>Two</p>")
; => ((p "One") (p "Two"))Element Inspection
(sxml-tag '(div (@ (class "box")) "content")) ; => div
(sxml-attributes '(div (@ (id "main")) "text")) ; => ((id "main"))
(sxml-content '(div (@ (id "main")) "hello" "world")) ; => ("hello" "world")
(sxml-attr-ref '(div (@ (id "main"))) 'id) ; => "main"
(sxml-attr-set '(div "text") 'id "main") ; => (div (@ (id "main")) "text")Features
- SXML to HTML with automatic void element handling and text escaping
- SXML to XML with self-closing element support
- XML parser with streaming/incremental parsing support
- Element inspection for querying tags, attributes, and content
- Raw HTML pass-through via
(*raw* "...")nodes
Dependencies
- sigil-stdlib
Build
sigil build
sigil testLicense
BSD-3-Clause
Clone
$ git clone https://codeberg.org/sigil/sigil-sxml
Releases
v0.15.0 — latest by version, released 7 Jul 2026
All releases — 3 tags in this repository.
Source
One page per file, and every line has a permalink.
Recent commitsAtom
7 Julcommit
Re-lock to sigil-stdlib 0.17.3
5a4f0432
11 Juncommit
26 Aprcommit
ee9a0010
26 Aprcommit
26 Aprcommit
1 Aprcommit
1 Aprcommit
31 Marcommit
9a81e9e9
31 Marcommit
bab40784
1 Marcommit
55a7d284
25 Febcommit
25 Febcommit
22 Febcommit
06a48dd7
20 Febcommit
19 Febcommit
17 Febcommit
a44635ab
15 Febcommit
14 Jancommit
c86aa7bd
12 Jancommit
The last 20 commits keep a page here. Everything older lives in the clone.