From a8696e088efedf310929bc4e01eded36d41414b1 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Wed, 11 Feb 2026 16:48:43 +0200 Subject: Update docs --- src/dompa/nodes.cljc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/dompa/nodes.cljc') diff --git a/src/dompa/nodes.cljc b/src/dompa/nodes.cljc index 7e8f769..73bc11f 100644 --- a/src/dompa/nodes.cljc +++ b/src/dompa/nodes.cljc @@ -96,17 +96,24 @@ "Creates a new function with `name` that outputs HTML. Optionally accepts a docstring between the name and the argument vector. + + Functions created with `defhtml` can be nested and composed with each other. Example usage: ```clojure + (defhtml greeting [who] + ($ :span who)) + (defhtml about-page - \"Renders the about page for the given person.\" + \"Renders the about page.\" [who] ($ :div - ($ \"hello \" who))) + \"Hello, \" + (greeting who))) (about-page \"world\") + ;;=> \"
Hello, world
\" ``` " [name & args-and-elements] @@ -182,13 +189,17 @@ (first nodes)))) (defn $ - "Creates a new node + "Creates a new node. + Children can be passed directly - strings, numbers, and other values + are automatically converted to text nodes. Nil values are filtered out. + Usage: ```clojure - ($ :div - ($ \"hello world\" )) + ($ :div \"hello world\") + ($ :div {:class \"container\"} \"Hello, \" name \"!\") + ($ :<> \"one\" \"two\" \"three\") ```" [& opts] (if (keyword? (first opts)) -- cgit v1.2.3