# HSX HSX (Hypertext S-expression) is a simple yet powerful HTML5 generation library for Common Lisp. This project is a fork of [ailisp/flute](https://github.com/ailisp/flute/). ## Warning This software is still ALPHA quality. The APIs likely change. Please check the [release notes](https://github.com/skyizwhite/hsx/releases). ## Introduction HSX allows you to generate HTML using S-expressions, providing a more Lisp-friendly way to create web content. By using the `hsx` macro, you can define HTML elements and their attributes in a concise and readable manner. ## Getting Started ### Basic Usage Use the `hsx` macro to create HTML elements. Attributes are specified using a property list following the element name, and child elements are nested directly within. ```lisp (hsx (div :id "example" :class "container" (h1 "Welcome to HSX") (p "This is an example paragraph."))) ``` This generates: ```html
This is an example paragraph.
Condition not met!
First paragraph.
Second paragraph.
``` ## Creating Components You can define reusable components with the `defcomp` macro. Components are functions that can take keyword arguments and properties. ```lisp (defcomp card (&key title children) (hsx (div :class "card" (h1 title) children))) ``` Or using a property list: ```lisp (defcomp card (&rest props) (hsx (div :class "card" (h1 (getf props :title)) (getf props :children)))) ``` Usage example: ```lisp (hsx (card :title "Card Title" (p "This is a card component."))) ``` Generates: ```htmlThis is a card component.