Clone in a terminal:
Commit 2a6d2f5
Johan Mattsson - 2026-03-05T16:04:17+00:00
2a6d2f54bbe1082d806a88bda84b7784ad17e969johan.mattsson.m@gmail.com

Update examples

Changed files (2)

Diff

diff --git a/README.md b/README.mdindex 1d54c4e..cbb5f9b 100644--- a/README.md+++ b/README.md@@ -15,9 +15,9 @@ use kaja_html_macro::html;  fn parent() -> String {     let content = html! {{-        <div>+        <section>             <include child_component_simple_loop() />-        </div>+        </section>     }};     content }@@ -26,19 +26,17 @@ fn child_component_simple_loop() -> String {     let content = html! {{         <h1>Hello From Nested Component</h1> -        <div>-            <ul>-                <rust>-                    for i in 1..=3 {-                        let element_id = format!("list item {:?}", i);--                        <markup>-                            <li>Simple $element_id</li>-                        </markup>-                    }-                </rust>-            </ul>-        </div>+        <ul>+            <rust>+                for i in 1..=3 {+                    let element_id = format!("list item {:?}", i);++                    <markup>+                        <li>Simple $element_id</li>+                    </markup>+                }+            </rust>+        </ul>     }};     content }@@ -47,17 +45,15 @@ fn child_component_simple_loop() -> String { ## Output  ```html-<div>-  <h1>Hello From Nested Component</h1>--  <div>+<section>+    <h1>Hello From Nested Component</h1>+         <ul>-      <li>Simple list item 1</li>-      <li>Simple list item 2</li>-      <li>Simple list item 3</li>+        <li>Simple list item 1</li>+        <li>Simple list item 2</li>+        <li>Simple list item 3</li>     </ul>-  </div>-</div>+</section> ```  ## Variables and Functions in the Markupdiff --git a/src/lib.rs b/src/lib.rsindex a9080b0..ce6d284 100644--- a/src/lib.rs+++ b/src/lib.rs@@ -45,10 +45,23 @@ use proc_macro_error::proc_macro_error; /// }}; /// ``` ///+/// # Result+/// ```html+/// <div>+///     <h1>Header</h1>+///     <ul>+///         <li>List item 1</li>+///         <li>List item 2</li>+///         <li>List item 3</li>+///     </ul>+/// </div>+/// ```+/// /// ## Variables and Functions in the Markup /// /// - `$variable_name` – insert content of the variable and escape tags. /// - `$(get_value())` – insert string from the get_value function and escape tags.+/// - `$(self.something)` – insert value something from struct self and escape tags. /// - `$(x + 2)` – compute x + 2 and add the content to the html string, escaped if needed. /// - `<include some_other_component() />` – insert trusted HTML content from the function some_other_component, html tags are allowed. #[proc_macro_error]

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112