Thanks to visit codestin.com
Credit goes to lib.rs

9 releases (4 breaking)

Uses new Rust 2024

0.6.1 Nov 9, 2025
0.6.0 Nov 9, 2025
0.5.2 Nov 9, 2025
0.4.1 Oct 31, 2025
0.2.0 Jul 17, 2025

#1756 in Rust patterns

AGPL-3.0-or-later

36KB
780 lines

🐈‍⬛ nanoneo

Super simple parser and "compiler" for turning a lisp-like DSL into HTML.

Here's a small example:

(text "<!DOCTYPE html>") ; using a raw string for the doctype is fine
(html
  (head
    ; everything that belongs in the head element
    (title (text "Document"))

    (meta ("charset" "UTF-8"))
    (meta ("name" "viewport") ("content" "width=device-width, initial-scale=1.0"))
    (meta ("http-equiv" "X-UA-Compatible") ("content" "ie=edge"))

    (link ("rel" "stylesheet") ("href" "#")))

  (body
    ; the actual body only starts here
    (span ("style" "color: red") (text "Hello, world!"))))

This yields:

<!-- formatted to for viewing ease... this comment is also not included -->
<!DOCTYPE html>
<html>
    <head>
        <title>Document</title>
        <meta charset="UTF-8" />
        <meta content="width=device-width, initial-scale=1.0" name="viewport" />
        <meta content="ie=edge" http-equiv="X-UA-Compatible" />
        <link rel="stylesheet" href="#" />
    </head>
    <body>
        <span style="color: red">Hello, world!</span>
    </body>
</html>

Syntax

nanoneo has some super simple syntax helpers:

  • You can create raw HTML elements using (text "...") or (tag' "...")
  • You can add attributes using (attr "key" "value") or ("key" "value")
  • Whitespace is ignored (except for in parenthesis), so you can format however you'd like
    • The only formatting rule is there must be a space after tag names, and everything must be in parenthesis!
    • Parenthesis and strings must also be properly closed

License

nanoneo is licensed under the AGPL-3.0.

Dependencies

~0–1MB
~19K SLoC