Clone in a terminal:
Commit 6d38bef
Johan Mattsson - 2026-03-03T20:57:12+00:00
6d38bef4c5b675b0e62f591b86616cdcb04cb2c3johan.mattsson.m@gmail.com

Move up example in readme

Changed files (1)

Diff

diff --git a/README.md b/README.mdindex fbd1dcd..3b04883 100644--- a/README.md+++ b/README.md@@ -3,64 +3,6 @@ `html!` is a declarative macro for generating HTML directly inside your Rust project. It expands at compile time into `String`. -## Concept--- Write HTML-like markup directly in Rust-- Embed Rust control flow with `<rust>`, plain Rust code, no DSL-- Emit markup dynamically using `<markup>`-- Interpolate variables and expressions-- Returns a `String`--## Interpolation Rules--### `$variable`--Inserts a variable and escapes HTML tags.--```rust-use kaja_html_macro::html;-let name = "<b>Johan</b>";--let html = html! {{-    <p>Hello $name</p>-}};-```--Output:--```html-<p>Hello &lt;b&gt;Johan&lt;/b&gt;</p>-```--### `$(expression)`--You can evaluate arbitrary Rust expressions:--- Function calls-- Arithmetic-- Method calls-- Complex expressions--Expressions are also automatically escaped.--```rust-use kaja_html_macro::html;--fn get_value() -> String {-    "42".to_string()-}--let test = 5;--let html = html! {{-    <div>-        <p>Value: $(get_value())</p>-        <p>Next: $(test + 1)</p>-    </div>-}};--```- ## Generating HTML strings with this Rust macro  Rust logic can be embedded inside `<rust>` blocks.@@ -125,6 +67,63 @@ fn child_component_simple_loop() -> String { - `$(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. +## Concept++- Write HTML-like markup directly in Rust+- Embed Rust control flow with `<rust>`, plain Rust code, no DSL+- Emit markup dynamically using `<markup>`+- Interpolate variables and expressions+- Returns a `String`++## Interpolation Rules++### `$variable`++Inserts a variable and escapes HTML tags.++```rust+use kaja_html_macro::html;+let name = "<b>Johan</b>";++let html = html! {{+    <p>Hello $name</p>+}};+```++Output:++```html+<p>Hello &lt;b&gt;Johan&lt;/b&gt;</p>+```++### `$(expression)`++You can evaluate arbitrary Rust expressions:++- Function calls+- Arithmetic+- Method calls+- Complex expressions++Expressions are also automatically escaped.++```rust+use kaja_html_macro::html;++fn get_value() -> String {+    "42".to_string()+}++let test = 5;++let html = html! {{+    <div>+        <p>Value: $(get_value())</p>+        <p>Next: $(test + 1)</p>+    </div>+}};+```+ ## Author and Contact - Written by Johan Mattsson - johan.mattsson.m@gmail.com

Contact

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