You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-17Lines changed: 23 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,22 +3,12 @@ Write HTML using Swift Macros.
3
3
## Why Use?
4
4
- Swift Macros are powerful and offer performance benefits to alternative libraries relying on runtime performance (middleware, rendering, result builders, etc)
5
5
- Alternative libraries may not fit all situations and may restrict how the html is generated or manipulated, or is prone to html errors (by human error or otherwise)
6
-
- HTML macros enforces safety by default, can be used anywhere, and compile directly to strings which can be easily manipulated
6
+
- HTML macros enforce safety, can be used anywhere, and compile directly to strings which are easily manipulated
7
7
- The compiled output is valid, minified html
8
-
## Syntax
9
-
- prepend the html element you want with the macro delimiter (`#<html element name>()`)
10
-
- create `html` element: `#html(innerHTML: [])`
11
-
- create `body` element: `#body()`
12
-
- create `div` element: `#div()`
13
-
- create `div` element with "dark" and "mode" classes: `#div(attributes: [.class(["dark", "mode"])])`
14
-
### Example
15
-
This html is compiled by the following code
16
-
```html
17
-
<!DOCTYPE html><html><body><divclass="dark mode"title="Hover over message"draggable="false"inputmode="email"hidden="hidden">Unconstrained text<div></div><a><div><abbr></abbr></div></a><div></div><buttondisabled></button><videoautoplaypreload="auto"src="ezclap"width="5"></video></div></body></html>
18
-
```
8
+
### Examples
19
9
```swift
20
-
let test:String=#html(innerHTML: [
21
-
#body(innerHTML: [
10
+
let test:String=#html([
11
+
#body([
22
12
#div(
23
13
attributes: [
24
14
.class(["dark", "mode"]),
@@ -27,10 +17,10 @@ let test:String = #html(innerHTML: [
0 commit comments