A modern, composable, and pretty HTML5 generator for Common Lisp with a focus on human-readable output.
Spinneret is a Common Lisp library for generating HTML5. It treats HTML as a document format, producing idiomatic, human-readable output that follows the HTML5 specification's coding style. The library emphasizes composability, allowing developers to easily refactor HTML generation into reusable functions and macros.
Common Lisp developers building web applications or generating HTML5 documents, particularly those who prioritize readable output and want to compose HTML generation logic flexibly. It's also suitable for projects using Parenscript for client-side HTML generation.
Developers choose Spinneret for its aggressive interpretation of Lisp forms as HTML, which simplifies common use cases while maintaining flexibility for advanced needs. Its unique selling points include seamless Parenscript integration for isomorphic HTML generation, built-in Markdown support, and the `deftag` macro for creating composable, extensible HTML abstractions.
Common Lisp HTML5 generator
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The deftag macro enables creating custom HTML elements that pass through unhandled attributes, facilitating easy refactoring and abstraction, as demonstrated with the input example in the README.
Default pretty-printing produces HTML that mimics hand-written code, with configurable styles via *html-style* for different rendering needs, ensuring output is idiomatic and debuggable.
Integration with Parenscript allows identical HTML generation semantics in Common Lisp and client-side JavaScript, supporting isomorphic web applications without code duplication.
By loading spinneret/cl-markdown, strings can be compiled as Markdown within HTML, simplifying inline formatting like links without cumbersome sexps, as shown in the examples.
get-html-path provides access to the document structure during generation, enabling adaptive components like tabulate that adjust based on nesting, enhancing flexibility.
Aggressive interpretation of Lisp forms as HTML can conflict with certain syntax, requiring :disable-html to escape, which adds complexity and potential for errors in mixed code.
In Parenscript, key features like with-html-string, get-html-path, and dynamic tags (:ATTRS, :TAG) are missing, limiting its utility for advanced client-side HTML generation.
The interpret-html-tree function is acknowledged as still under development and does not support all Spinneret syntax, reducing flexibility for runtime HTML manipulation.
Default validation warns about invalid tags and attributes, which might block custom framework attributes unless explicitly allowed via *unvalidated-attribute-prefixes*, adding configuration overhead.