simple-rsx 0.1.9

A simple JSX-like syntax implementation for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
//! Simple RSX - A React-inspired JSX Library for Rust
//!
//! I created Simple RSX to bring the familiar feel of React's JSX to Rust projects. If you're coming
//! from a React background, you'll feel right at home. And if you're new to both, don't worry - I've made
//! it super intuitive while keeping all the type safety and performance benefits of Rust.
//!
//! # Why Simple RSX?
//!
//! I started this project while attempting to transit my [portfolio](https://elcharitas.wtf) from Next.js to Rust.
//! I wanted to keep my codebase as simple as possible, and I wanted to use Rust's powerful type system
//! to ensure that my components were always correct. I tried existing libraries like `yew` and `sycamore`,
//! but they were either too complex or didn't feel quite like React. And so, here we are.
//!
//! I know what you're thinking - "Another UI library?" But here's what makes Simple RSX special:
//!
//! - **React-like Syntax**: Write your templates using the `rsx!` macro - it's just like JSX!
//! - **Type Safety**: Get compile-time checks for your components and props
//! - **Zero Runtime Overhead**: All the magic happens at compile time
//! - **Familiar Patterns**: Components, props, fragments - all the React concepts you love
//!
//! # Let's Get Started!
//!
//! Here's a quick taste of what you can do:
//!
//! ```rust
//! use simple_rsx::*;
//!
//! // Create your first component - looks familiar, right?
//! let greeting = rsx!(
//!     <div class="greeting">
//!         <h1>Hello, {"World"}!</h1>
//!         <p>Welcome to Simple RSX</p>
//!     </div>
//! );
//!
//! // Turn it into HTML - perfect for server-side rendering (P.S: This to me is my favorite feature)
//! println!("{}", greeting);
//! ```
//!
//! # Features You'll Love
//!
//! ## JSX-style Elements - Write HTML, Get Rust
//!
//! ```rust
//! use simple_rsx::*;
//!
//! // Self-closing tags? Check!
//! let img = rsx!(<img src="image.jpg" alt="An image" />);
//!
//! // Nested elements? Of course!
//! let card = rsx!(
//!     <div class="card">
//!         <h2>Title</h2>
//!         <p>Content</p>
//!     </div>
//! );
//!
//! // Fragments? No problem! Just use <> and the children will be flattened
//! let fragment = rsx!(
//!     <>
//!         <h1>Title</h1>
//!         <p>No wrapper needed</p>
//!     </>
//! );
//! ```
//!
//! ## Dynamic Content - Make It Come Alive
//!
//! ```rust
//! use simple_rsx::*;
//!
//! let name = "World";
//! let count = 42;
//!
//! // Drop in any Rust expression with {}
//! let dynamic = rsx!(
//!     <div>
//!         <h1>Hello, {name}!</h1>
//!         <p>Count: {count}</p>
//!     </div>
//! );
//!
//! // Conditional rendering? Use the either! macro
//! let show = true;
//! let conditional = either!(show =>
//!     <p>Now you see me</p>
//! else
//!     <p>Now you don&apos;t</p>
//! );
//!
//! // Conditional classes? Easy!
//! let is_active = true;
//! let button = rsx!(
//!     <button class={if is_active { "active" } else { "" }}>
//!         Toggle
//!     </button>
//! );
//!
//! // Render lists with iterator magic
//! let items = vec!["A", "B", "C"];
//! let list = rsx!(
//!     <ul>
//!         {items.iter().map(|item| rsx!(<li>{item}</li>))}
//!     </ul>
//! );
//! ```
//!
//! ## Components and Props - Build Reusable UI
//!
//! ```rust
//! use simple_rsx::*;
//!
//! // Define your props - just like React's PropTypes
//! #[derive(Default)]
//! struct ButtonProps {
//!     text: String,
//!     variant: String,
//!     children: Vec<Node>,
//! }
//!
//! // Create a component - clean and simple
//! #[component]
//! fn Button(props: ButtonProps) -> Node {
//!     rsx!(
//!         <button class={format!("btn btn-{}", props.variant)}>
//!             {props.text}
//!             {props.children}
//!         </button>
//!     )
//! }
//!
//! // Use it anywhere!
//! let button = rsx!(
//!     <Button text="Click me" variant="primary">
//!         <span>"→"</span>
//!     </Button>
//! );
//! ```
//!
//! ## HTML Data attributes
//!
//! With simple RSX, HTML data attributes are the only props which do not get validated by the compiler.
//! This allows you to use any valid literal or expression in the value of a data attribute.
//!
//! ```rust
//! use simple_rsx::*;
//!
//! // Data attributes? No problem!
//! let element = rsx!(
//!     <div
//!         data_user="john"
//!         data_role="admin"
//!     />
//! );
//! ```
//!
pub mod dom;
pub mod signals;

use indexmap::IndexMap;
pub use simple_rsx_macros::{component, either, rsx};
use std::fmt::Display;

/// A trait for converting values into HTML attribute strings.
///
/// This trait is automatically implemented for any type that implements `ToString`,
/// making it easy to use various types as attribute values.
///
/// # Example
///
/// ```rust
/// use simple_rsx::*;
///
/// let element = rsx!(<div id="my-id" hidden={true} />);
/// ```
pub trait Attribute {
    fn value(&self) -> String;
}

/// A trait for handling optional attribute values.
///
/// This trait is automatically implemented for `Option<T>` where T implements `ToString`.
/// It allows for graceful handling of optional attributes, rendering them as empty strings when None.
///
/// # Example
///
/// ```rust
/// use simple_rsx::*;
///
/// let maybe_title = Some("Hello".to_string());
/// let element = rsx!(<div title={maybe_title} />);
/// ```
pub trait OptionAttribute {
    fn value(&self) -> String;
}

impl<T: ToString> Attribute for T {
    fn value(&self) -> String {
        self.to_string()
    }
}

impl<T: ToString> OptionAttribute for Option<T> {
    fn value(&self) -> String {
        match self {
            Some(t) => t.to_string(),
            None => String::new(),
        }
    }
}

/// Represents an HTML element with its tag name, attributes, and children.
///
/// Elements are the building blocks of the RSX tree structure. Each element
/// can have attributes (like class, id, etc.) and can contain other elements
/// or text nodes as children.
///
/// You typically won't create Elements directly, but rather use the `rsx!` macro:
///
/// ```rust
/// use simple_rsx::*;
///
/// let element = rsx!(
///     <div class="container">
///         <p>Hello world!</p>
///     </div>
/// );
/// ```
pub struct Element {
    tag: String,
    attributes: IndexMap<String, String>,
    children: Vec<Node>,
}

impl Element {
    /// Creates a new Element node with the specified tag name.
    ///
    /// # Example
    ///
    /// ```rust
    /// use simple_rsx::*;
    ///
    /// let element = Element::parse_tag("div");
    /// assert!(matches!(element, Node::Element(_)));
    /// ```
    pub fn parse_tag(tag: &str) -> Node {
        Node::Element(Element {
            tag: tag.to_string(),
            attributes: IndexMap::new(),
            children: Vec::new(),
        })
    }

    /// Sets an attribute on the element.
    ///
    /// # Example
    ///
    /// ```rust
    /// use simple_rsx::*;
    ///
    /// let mut node = Element::parse_tag("div");
    /// let mut element = node.as_element_mut().unwrap();
    /// element.set_attribute("class", "container");
    /// ```
    pub fn set_attribute(&mut self, name: &str, value: impl Attribute) {
        self.attributes.insert(name.to_string(), value.value());
    }

    /// Adds a child node to this element.
    ///
    /// # Example
    ///
    /// ```rust
    /// use simple_rsx::*;
    ///
    /// let mut parent_node = Element::parse_tag("div");
    /// let mut parent = parent_node.as_element_mut().unwrap();
    /// parent.append_child(Element::parse_tag("p"));
    /// ```
    pub fn append_child(&mut self, node: Node) {
        self.children.push(node);
    }
}

impl Node {
    /// Attempts to get a mutable reference to the underlying Element if this node is an Element.
    ///
    /// Returns None if the node is not an Element (e.g., if it's Text or Fragment).
    pub fn as_element_mut(&mut self) -> Option<&mut Element> {
        match self {
            Node::Element(el) => Some(el),
            _ => None,
        }
    }

    /// Adds a child node if this node is an Element.
    ///
    /// This method has no effect if the node is not an Element.
    pub fn append_child(&mut self, node: Node) {
        if let Node::Element(el) = self {
            el.children.push(node);
        }
    }
}

/// A trait for creating reusable components.
///
/// Components are the heart of RSX's reusability model. They allow you to create
/// custom elements with their own logic and state.
///
/// # Example
///
/// ```rust
/// use simple_rsx::*;
///
/// struct Card;
/// #[derive(Default)]
/// struct CardProps {
///     title: String,
///     children: Vec<Node>,
/// }
///
/// impl Component for Card {
///     type Props = CardProps;
///     fn render(props: Self::Props) -> Node {
///         rsx!(
///             <div class="card">
///                 <h2>{props.title}</h2>
///                 <div class="card-content">{props.children}</div>
///             </div>
///         )
///     }
/// }
/// ```
pub trait Component {
    /// The type of props this component accepts
    type Props;

    /// Renders the component with the given props
    fn render(props: Self::Props) -> Node;
}

/// Represents a node in the RSX tree.
///
/// Nodes are the fundamental building blocks of RSX. They can be:
/// - Elements (like `<div>` or `<p>`)
/// - Text content
/// - Fragments (groups of nodes)
/// - Comments
///
/// # Example
///
/// ```rust
/// use simple_rsx::*;
///
/// let text_node = Node::Text("Hello".to_string());
/// let element_node = Element::parse_tag("div");
/// let fragment = Node::Fragment(vec![text_node, element_node]);
/// ```
pub enum Node {
    /// An HTML element with a tag name, attributes, and children
    Element(Element),
    /// Plain text content
    Text(String),
    /// A group of nodes without a wrapper element
    Fragment(Vec<Node>),
    /// An HTML comment
    Comment(String),
    Empty,
}

impl From<String> for Node {
    fn from(value: String) -> Self {
        Node::Text(value)
    }
}

impl From<&String> for Node {
    fn from(value: &String) -> Self {
        Node::Text(value.to_string())
    }
}

impl From<&str> for Node {
    fn from(value: &str) -> Self {
        Node::Text(value.to_string())
    }
}

impl From<&&str> for Node {
    fn from(value: &&str) -> Self {
        Node::Text(value.to_string())
    }
}

impl<T> From<Vec<T>> for Node
where
    Node: From<T>,
{
    fn from(value: Vec<T>) -> Self {
        Node::Fragment(value.into_iter().map(|t| Node::from(t)).collect())
    }
}

impl<T: ToString> From<Option<T>> for Node {
    fn from(value: Option<T>) -> Self {
        match value {
            Some(t) => Node::Text(t.to_string()),
            _ => Node::Text("".to_string()),
        }
    }
}

impl From<&Vec<String>> for Node {
    fn from(value: &Vec<String>) -> Self {
        Node::Fragment(
            value
                .iter()
                .map(|item| Node::Text(item.to_string()))
                .collect(),
        )
    }
}

impl From<i32> for Node {
    fn from(value: i32) -> Self {
        Node::Text(value.to_string())
    }
}

impl From<u32> for Node {
    fn from(value: u32) -> Self {
        Node::Text(value.to_string())
    }
}

impl From<u64> for Node {
    fn from(value: u64) -> Self {
        Node::Text(value.to_string())
    }
}

impl FromIterator<u32> for Node {
    fn from_iter<T: IntoIterator<Item = u32>>(iter: T) -> Self {
        let mut result = Vec::new();
        for item in iter {
            result.push(Node::Text(item.to_string()));
        }
        Node::Fragment(result)
    }
}

impl FromIterator<u64> for Node {
    fn from_iter<T: IntoIterator<Item = u64>>(iter: T) -> Self {
        let mut result = Vec::new();
        for item in iter {
            result.push(Node::Text(item.to_string()));
        }
        Node::Fragment(result)
    }
}

impl FromIterator<i32> for Node {
    fn from_iter<T: IntoIterator<Item = i32>>(iter: T) -> Self {
        let mut result = Vec::new();
        for item in iter {
            result.push(Node::Text(item.to_string()));
        }
        Node::Fragment(result)
    }
}

impl From<f32> for Node {
    fn from(value: f32) -> Self {
        Node::Text(value.to_string())
    }
}

impl From<bool> for Node {
    fn from(value: bool) -> Self {
        Node::Text(value.to_string())
    }
}

impl<I, F, R> From<std::iter::Map<I, F>> for Node
where
    I: Iterator,
    F: FnMut(I::Item) -> R,
    R: Into<Node>,
    Vec<Node>: FromIterator<R>,
{
    fn from(iter: std::iter::Map<I, F>) -> Self {
        let nodes: Vec<Node> = iter.collect();
        Node::from(nodes)
    }
}

impl Display for Node {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Node::Element(el) => {
                write!(f, "<{}", el.tag)?;
                for (key, value) in &el.attributes {
                    write!(f, " {}=\"{}\"", key, value)?;
                }
                write!(f, ">")?;
                for child in &el.children {
                    write!(f, "{}", child)?;
                }
                write!(f, "</{}>", el.tag)?;
                Ok(())
            }
            Node::Text(text) => {
                write!(f, "{}", sanitize_html(text))?;
                Ok(())
            }
            Node::Fragment(nodes) => {
                for node in nodes {
                    write!(f, "{}", node)?;
                }
                Ok(())
            }
            Node::Comment(comment) => {
                write!(f, "<!--{}-->", comment)?;
                Ok(())
            }
            Node::Empty => {
                write!(f, "")?;
                Ok(())
            }
        }
    }
}

fn sanitize_html(input: &str) -> String {
    let mut result = String::new();
    for c in input.chars() {
        match c {
            '<' => {
                result.push_str("&lt;");
            }
            '>' => {
                result.push_str("&gt;");
            }
            '&' => {
                result.push_str("&amp;");
            }
            '"' => {
                result.push_str("&quot;");
            }
            '\'' => {
                result.push_str("&#39;");
            }
            '/' => {
                result.push_str("&#x2F;");
            }
            _ => {
                result.push(c);
            }
        };
    }
    result
}

macro_rules! derive_elements {
    (
        $(
            $(#[$tag_meta:meta])*
            $tag:ident {
                $(
                    $(#[$attr_meta:meta])*
                    $attr_name:ident : $attr_value:ty
                ),* $(,)?
            }
        )*
    ) => {
        $(
            #[allow(non_camel_case_types)]
            $(#[$tag_meta])*
            pub struct $tag;

            paste::paste! {
                #[derive(Default)]
                #[allow(non_snake_case)]
                pub struct [<HTML $tag:camel Element Props>] {
                    // Global HTML attributes

                    /// The id attribute specifies a unique id for an HTML element
                    pub id: String,

                    /// A unique key to identify the element
                    pub key: String,

                    /// The class attribute specifies one or more class names for an HTML element
                    pub class: String,

                    /// The child nodes of the element
                    pub children: Vec<Node>,

                    /// The style attribute specifies an inline CSS style for an element
                    pub style: String,

                    /// The title attribute specifies extra information about an element (displayed as a tooltip)
                    pub title: Option<String>,
                    /// The width attribute specifies the width of the image
                    pub width: Option<String>,
                    /// The height attribute specifies the height of the image
                    pub height: Option<String>,

                    /// Specifies whether an element is draggable or not
                    pub draggable: bool,

                    /// Specifies visibility of an element (hidden or visible)
                    pub hidden: bool,

                    /// Specifies a shortcut key to activate/focus an element
                    pub accesskey: String,

                    /// Specifies whether the content of an element is editable or not
                    pub contenteditable: bool,

                    /// Specifies the text direction for the content in an element
                    pub dir: String,

                    /// Specifies the tabbing order of an element (when the tab button is used)
                    pub tabindex: Option<i32>,

                    /// Specifies whether the element is to have its spelling and grammar checked
                    pub spellcheck: bool,

                    /// Specifies the language of the element's content
                    pub lang: String,

                    /// Specifies whether an element is translateable or not
                    pub translate: bool,

                    /// Controls whether and how text input is automatically capitalized
                    pub autocapitalize: String,

                    /// Specifies an inline CSS style for an element
                    pub role: String,

                    /// Custom data attributes (data-*)
                    pub r#data: std::collections::HashMap<String, String>,

                    // ARIA Accessibility attributes

                    /// Identifies the current element within a set
                    pub aria_current: String,

                    /// Defines a string value that labels the current element
                    pub aria_label: Option<String>,

                    /// Identifies the element that labels the current element
                    pub aria_labelledby: Option<String>,

                    /// Identifies the element that describes the current element
                    pub aria_describedby: Option<String>,

                    /// Indicates whether an element is expanded or collapsed
                    pub aria_expanded: bool,

                    /// Indicates the element that represents the current item within a container or set
                    pub aria_selected: bool,

                    /// Indicates whether the element is checked, unchecked, or represents mixed mode
                    pub aria_checked: String,

                    /// Indicates whether an element and its subtree are hidden
                    pub aria_hidden: bool,

                    /// Indicates the availability and type of interactive popup element
                    pub aria_haspopup: String,

                    /// Defines an element's role
                    pub aria_role: String,

                    // Element specific attributes
                    $(
                        pub $attr_name: $attr_value,
                    )*
                }

                impl [<HTML $tag:camel Element Props>] {
                    fn to_attributes(&self) -> IndexMap<String, String> {
                        #[allow(unused_mut)]
                        let mut attributes = IndexMap::new();
                        $(
                            if !self.$attr_name.value().is_empty() {
                                let mut key = stringify!($attr_name);
                                if let Some(last_char) = key.chars().last() {
                                    if last_char == '_' {
                                        key = &key[..key.len() - 1];
                                    }
                                }
                                attributes.insert(key.replace('_', "-"), self.$attr_name.value());
                            }
                        )*
                        if !self.id.value().is_empty() {
                            attributes.insert("id".to_string(), self.id.value());
                        }
                        if !self.class.value().is_empty() {
                            attributes.insert("class".to_string(), self.class.value());
                        }
                        if !self.style.value().is_empty() {
                            attributes.insert("style".to_string(), self.style.value());
                        }
                        if !self.title.value().is_empty() {
                            attributes.insert("title".to_string(), self.title.value());
                        }
                        if self.draggable {
                            attributes.insert("draggable".to_string(), "true".to_string());
                        }
                        if self.hidden {
                            attributes.insert("hidden".to_string(), "true".to_string());
                        }
                        if !self.accesskey.value().is_empty() {
                            attributes.insert("accesskey".to_string(), self.accesskey.value());
                        }
                        if self.contenteditable {
                            attributes.insert("contenteditable".to_string(), "true".to_string());
                        }
                        if !self.dir.value().is_empty() {
                            attributes.insert("dir".to_string(), self.dir.value());
                        }
                        if let Some(tabindex) = self.tabindex {
                            attributes.insert("tabindex".to_string(), tabindex.to_string());
                        }
                        if self.spellcheck {
                            attributes.insert("spellcheck".to_string(), "true".to_string());
                        }
                        if !self.lang.value().is_empty() {
                            attributes.insert("lang".to_string(), self.lang.value());
                        }
                        if self.translate {
                            attributes.insert("translate".to_string(), "true".to_string());
                        }
                        if !self.autocapitalize.value().is_empty() {
                            attributes.insert("autocapitalize".to_string(), self.autocapitalize.value());
                        }
                        if !self.role.value().is_empty() {
                            attributes.insert("role".to_string(), self.role.value());
                        }
                        if !self.aria_current.value().is_empty() {
                            attributes.insert("aria-current".to_string(), self.aria_current.value());
                        }
                        if !self.aria_label.value().is_empty() {
                            attributes.insert("aria-label".to_string(), self.aria_label.value());
                        }
                        if !self.aria_labelledby.value().is_empty() {
                            attributes.insert("aria-labelledby".to_string(), self.aria_labelledby.value());
                        }
                        if !self.aria_describedby.value().is_empty() {
                            attributes.insert("aria-describedby".to_string(), self.aria_describedby.value());
                        }
                        if self.aria_expanded {
                            attributes.insert("aria-expanded".to_string(), "true".to_string());
                        }
                        if self.aria_selected {
                            attributes.insert("aria-selected".to_string(), "true".to_string());
                        }
                        if !self.aria_checked.value().is_empty() {
                            attributes.insert("aria-checked".to_string(), self.aria_checked.value());
                        }
                        if self.aria_hidden {
                            attributes.insert("aria-hidden".to_string(), "true".to_string());
                        }
                        if !self.aria_haspopup.value().is_empty() {
                            attributes.insert("aria-haspopup".to_string(), self.aria_haspopup.value());
                        }
                        if !self.aria_role.value().is_empty() {
                            attributes.insert("aria-role".to_string(), self.aria_role.value());
                        }
                        // Add data-* attributes
                        for (key, value) in &self.r#data {
                            if key.starts_with("data_") {
                                attributes.insert(key.replace("_", "-"), value.clone());
                            } else {
                                attributes.insert(format!("data-{}", key), value.clone());
                            }
                        }

                        attributes
                    }
                }

                impl Component for $tag {
                    type Props = [<HTML $tag:camel Element Props>];

                    fn render(props: Self::Props) -> Node {
                        Node::Element(Element {
                            tag: stringify!($tag).to_string(),
                            attributes: props.to_attributes(),
                            children: props.children,
                        })
                    }
                }
            }
        )*
    };
}

pub mod elements {
    use super::*;
    derive_elements! {
        /// HTML `<html>` element - Root element of an HTML document
        html {
        }
        /// HTML `<body>` element - Represents the content of an HTML document
        ///
        /// Example:
        ///
        /// ```<body>Content goes here</body>```
        body {
        }
        /// HTML `<head>` element - Contains metadata about the document
        ///
        /// Example:
        ///
        /// ```<head><title>Document Title</title></head>```
        head {
        }
        /// HTML `<title>` element - Defines the title of the document
        ///
        /// Example:
        ///
        /// ```<title>Document Title</title>```
        title {
        }
        /// HTML `<meta` element - Provides metadata about the document
        ///
        /// Example:
        ///
        /// ```<meta charset="UTF-8">```
        meta {
            /// The character encoding of the document
            charset: String,
            /// The HTTP response status code
            http_equiv: String,
            /// The content of the document
            content: String,
            /// The name of the metadata
            name: String,
            /// The property of the metadata
            property: String,
        }
        /// HTML `<style>` element - Defines style information for a document
        ///
        /// Example:
        ///
        /// ```<style>body { background-color: #f0f0f0; }</style>```
        style {
        }
        /// HTML `<script>` element - Embeds executable code or data
        ///
        /// Example:
        ///
        /// ```<script src="script.js"></script>```
        script {
            /// The URL of the external script file
            src: String,
            /// The type of the script
            type_: String,
            /// The language of the script
            language: String,
            /// The character encoding of the script
            charset: String,
            /// The defer attribute specifies that the script will be executed after the document is finished parsing
            defer: bool,
            /// The async attribute specifies that the script will be executed asynchronously
            async_: bool,
        }
        /// HTML `<link>` element - Specifies relationships between the current document and an external resource
        ///
        /// Example:
        ///
        /// ```<link rel="stylesheet" href="style.css">```
        link {
            /// The relationship between the current document and the linked resource
            rel: String,
            /// The URL of the linked resource
            href: String,
            /// The type of the linked resource
            type_: String,
            /// The character encoding of the linked resource
            charset: String,
            /// crossorigin attribute specifies that the element will request a cross-origin Isolation of its browsing context
            crossorigin: String,
            /// The referrerpolicy attribute specifies the referrer policy for the linked resource
            referrerpolicy: String,
        }
        /// HTML `<div>` element - Container element for grouping and styling content
        ///
        /// Example:
        ///
        /// ```<div class="container">Content goes here</div>```
        div {
        }

        /// HTML `<p>` element - Represents a paragraph of text
        ///
        /// Example:
        ///
        /// ```<p>This is a paragraph of text.</p>```
        p {
        }

        /// HTML `<span>` element - Inline container for targeting text with styles
        ///
        /// Example:
        ///
        /// ```<span class="highlight">Highlighted text</span>```
        span {
        }

        /// HTML `<a>` element - Creates a hyperlink to other web pages or resources
        ///
        /// Example:
        ///
        /// ```<a href="https://example.com" target="_blank">Visit Example</a>```
        a {
            /// The href attribute specifies the URL of the page the link goes to
            /// Example: href="https://example.com"
            href: String,
            /// The target attribute specifies where to open the linked document
            /// Example: target="_blank" (opens in new tab)
            target: String,
            /// The rel attribute specifies the relationship between the current document and the linked document
            /// Example: rel="nofollow" (tells search engines not to follow this link)
            rel: String,
            /// The download attribute indicates the browser to download the URL instead of navigating
            /// Example: download="filename.pdf"
            download: String,
            /// The hreflang attribute specifies the language of the linked document
            /// Example: hreflang="en" (English)
            hreflang: String,
            /// The type attribute specifies the media type of the linked document
            /// Example: type="text/html"
            type_: String,
            /// The media attribute specifies what media/device the linked document is optimized for
            /// Example: media="print" (for print stylesheets)
            media: String,
            /// The referrerpolicy attribute specifies which referrer information to send
            /// Example: referrerpolicy="no-referrer"
            referrerpolicy: String,
            /// The ping attribute specifies URLs to be notified when the link is followed
            /// Example: ping="https://example.com/track"
            ping: String,
        }

        /// HTML `<h1>` element - First level heading (most important)
        ///
        /// Example:
        ///
        /// ```<h1>Main Page Title</h1>```
        h1 {
        }

        /// HTML `<h2>` element - Second level heading
        ///
        /// Example:
        ///
        /// ```<h2>Section Heading</h2>```
        h2 {
        }

        /// HTML `<h3>` element - Third level heading
        ///
        /// Example:
        ///
        /// ```<h3>Subsection Heading</h3>```
        h3 {
        }

        /// HTML `<h4>` element - Fourth level heading
        ///
        /// Example:
        ///
        /// ```<h4>Sub-subsection Heading</h4>```
        h4 {
        }

        /// HTML `<h5>` element - Fifth level heading
        ///
        /// Example:
        ///
        /// ```<h5>Minor Heading</h5>```
        h5 {
        }

        /// HTML `<h6>` element - Sixth level heading (least important)
        ///
        /// Example:
        ///
        /// ```<h6>Fine Detail Heading</h6>```
        h6 {
        }

        /// HTML `<img>` element - Embeds an image into the document
        ///
        /// Example:
        ///
        /// ```<img src="image.jpg" alt="Description of image">```
        img {
            /// The src attribute specifies the URL/path to the image
            /// Example: src="images/logo.png"
            src: String,
            /// The alt attribute provides alternative text for screen readers and if image fails to load
            /// Example: alt="Company Logo"
            alt: String,
            /// The loading attribute indicates how the browser should load the image
            /// Example: loading="lazy" (defers loading until it's near viewport)
            loading: String,
        }

        /// HTML `<br>` element - Produces a line break in text
        ///
        /// Example:
        ///
        /// ```<br>```
        br {}

        /// HTML `<hr>` element - Creates a horizontal rule (divider)
        ///
        /// Example:
        ///
        /// ```<hr>```
        hr {
        }

        /// HTML `<ul>` element - Unordered list with bullet points
        ///
        /// Example:
        ///
        /// ```<ul><li>Item 1</li><li>Item 2</li></ul>```
        ul {
            /// The type attribute specifies the bullet style (disc, circle, square)
            /// Example: type="square"
            type_: String,
        }

        /// HTML `<li>` element - List item within ordered or unordered lists
        ///
        /// Example:
        ///
        /// ```<li>List item content</li>```
        li {
            /// The value attribute specifies the start value of the list item (for ol)
            /// Example: value="3" (starts this item at number 3)
            value: Option<i32>,
        }

        /// HTML `<ol>` element - Ordered (numbered) list
        ///
        /// Example:
        ///
        /// ```<ol start="5" type="A"><li>Item E</li><li>Item F</li></ol>```
        ol {
            /// The type attribute specifies the numbering type (1, A, a, I, i)
            /// Example: type="A" (uses capital letters)
            type_: String,
            /// The start attribute specifies the start value of the list
            /// Example: start="5" (starts counting from 5)
            start: i32,
            /// The reversed attribute specifies that list should be in descending order
            /// Example: reversed (counts down instead of up)
            reversed: bool,
        }

        /// HTML `<table>` element - Creates a data table with rows and columns
        ///
        /// Example:
        ///
        /// ```<table border="1"><tr><th>Header</th></tr><tr><td>Data</td></tr></table>```
        table {
            /// The border attribute specifies the width of the border around the table
            /// Example: border="1" (1 pixel border)
            border: i32,
            /// The cellpadding attribute specifies the space between cell content and borders
            /// Example: cellpadding="5" (5 pixels of padding)
            cellpadding: i32,
            /// The cellspacing attribute specifies the space between cells
            /// Example: cellspacing="2" (2 pixels between cells)
            cellspacing: i32,
        }

        /// HTML `<tr>` element - Table row container
        ///
        /// Example:
        ///
        /// ```<tr><td>Cell 1</td><td>Cell 2</td></tr>```
        tr {
        }

        /// HTML `<td>` element - Table data cell
        ///
        /// Example:
        ///
        /// ```<td colspan="2">This cell spans two columns</td>```
        td {
            /// The colspan attribute specifies how many columns a cell should span
            /// Example: colspan="3" (cell spans 3 columns)
            colspan: i32,
            /// The rowspan attribute specifies how many rows a cell should span
            /// Example: rowspan="2" (cell spans 2 rows)
            rowspan: i32,
            /// The headers attribute associates data cells with header cells
            /// Example: headers="col1 row1" (associates with those header IDs)
            headers: String,
            /// The scope attribute specifies whether header cells are for rows or columns
            /// Example: scope="col" (header applies to whole column)
            scope: String,
        }

        /// HTML `<th>` element - Table header cell
        ///
        /// Example:
        ///
        /// ```<th scope="col">Column Header</th>```
        th {
            /// The colspan attribute specifies how many columns a cell should span
            /// Example: colspan="3" (header spans 3 columns)
            colspan: i32,
            /// The rowspan attribute specifies how many rows a cell should span
            /// Example: rowspan="2" (header spans 2 rows)
            rowspan: i32,
            /// The headers attribute associates data cells with header cells
            /// Example: headers="col1 row1" (associates with those header IDs)
            headers: String,
            /// The scope attribute specifies whether the header cell is for a row, column, etc.
            /// Example: scope="row" (header applies to whole row)
            scope: String,
        }

        /// HTML `<tbody>` element - Groups body content in a table
        ///
        /// Example:
        ///
        /// ```<table><tbody><tr><td>Data</td></tr></tbody></table>```
        tbody {
        }

        /// HTML `<thead>` element - Groups header content in a table
        ///
        /// Example:
        ///
        /// ```<table><thead><tr><th>Header</th></tr></thead><tbody>...</tbody></table>```
        thead {
        }

        /// HTML `<tfoot>` element - Groups footer content in a table
        ///
        /// Example:
        ///
        /// ```<table><thead>...</thead><tbody>...</tbody><tfoot><tr><td>Summary</td></tr></tfoot></table>```
        tfoot {
        }

        /// HTML `<form>` element - Container for interactive inputs to collect user data
        ///
        /// Example:
        ///
        /// ```<form action="/submit" method="post"><input type="text"><button type="submit">Submit</button></form>```
        form {
            /// The action attribute specifies where to send form data when submitted
            ///
            /// Example: action="/process-form.php"
            action: String,
            /// The method attribute specifies HTTP method for sending data (GET/POST)
            ///
            /// Example: method="post" (sends data in request body)
            method: String,
            /// The target attribute specifies where to display the response
            ///
            /// Example: target="_blank" (opens response in new tab)
            target: String,
            /// The enctype attribute specifies how form data should be encoded
            ///
            /// Example: enctype="multipart/form-data" (needed for file uploads)
            enctype: String,
            /// The novalidate attribute disables browser's built-in form validation
            ///
            /// Example: novalidate (skips validation)
            novalidate: bool,
            /// The autocomplete attribute controls browser autofill behavior
            ///
            /// Example: autocomplete="off" (disables autofill)
            autocomplete: String,
            /// The accept attribute specifies file types the server accepts (for file inputs)
            ///
            /// Example: accept=".jpg,.png" (accepts only those image formats)
            accept: String,
            /// Example: name="contact-form"
            name: String,
        }

        /// HTML `<input>` element - Creates interactive controls for forms
        ///
        /// Example:
        ///
        /// ```<input type="text" placeholder="Enter your name" required>```
        input {
            /// The type attribute specifies the input type (text, password, email, etc.)
            ///
            /// Example: type="email" (validates as email address)
            type_: String,
            /// The placeholder attribute shows hint text when field is empty
            ///
            /// Example: placeholder="Enter your email"
            placeholder: Option<String>,
            /// The required attribute makes the field mandatory
            ///
            /// Example: required (field must be filled)
            required: Option<bool>,
            /// The value attribute specifies the default/current value
            ///
            /// Example: value="Default text"
            value: Option<String>,
            /// The name attribute specifies the name of the input (for form submission)
            ///
            /// Example: name="email"
            name: String,
            /// The disabled attribute disables the input
            ///
            /// Example: disabled (user cannot interact with input)
            disabled: Option<bool>,
            /// The readonly attribute makes the input read-only
            ///
            /// Example: readonly (user cannot modify but can focus/select)
            readonly: Option<bool>,
            /// The min attribute specifies minimum value for number/date inputs
            ///
            /// Example: min="1" (number input minimum value)
            min: Option<String>,
            /// The max attribute specifies maximum value for number/date inputs
            ///
            /// Example: max="100" (number input maximum value)
            max: Option<String>,
            /// The pattern attribute specifies a regex pattern for validation
            ///
            /// Example: pattern="[0-9]{3}" (requires exactly 3 digits)
            pattern: Option<String>,
            /// The autocomplete attribute controls browser autofill for this field
            ///
            /// Example: autocomplete="current-password"
            autocomplete: Option<String>,
        }

        /// HTML `<textarea>` element - Multi-line text input control
        ///
        /// Example:
        ///
        /// ```<textarea rows="4" cols="50" placeholder="Your message here"></textarea>```
        textarea {
            /// The placeholder attribute shows hint text when field is empty
            /// Example: placeholder="Enter your comments"
            placeholder: String,
            /// The required attribute makes the field mandatory
            /// Example: required (must be filled before submission)
            required: bool,
            /// The value attribute specifies the default/current text content
            /// Example: value="Default text in the textarea"
            value: String,
            /// The rows attribute specifies visible number of text lines
            /// Example: rows="10" (shows 10 lines of text)
            rows: i32,
            /// The cols attribute specifies visible width in average characters
            /// Example: cols="40" (about 40 characters wide)
            cols: i32,
            /// The name attribute specifies the name of the textarea (for form submission)
            /// Example: name="comments"
            name: String,
            /// The disabled attribute disables the textarea
            /// Example: disabled (user cannot interact)
            disabled: bool,
            /// The readonly attribute makes the textarea read-only
            /// Example: readonly (user cannot modify but can focus/select)
            readonly: bool,
            /// The maxlength attribute specifies maximum character count
            /// Example: maxlength="500" (limits to 500 characters)
            maxlength: i32,
        }

        /// HTML `<button>` element - Clickable button control
        ///
        /// Example:
        ///
        /// ```<button type="submit">Click Me</button>```
        button {
            /// The type attribute specifies button function (submit, reset, button)
            /// Example: type="submit" (submits the form)
            type_: String,
            /// The value attribute specifies the value associated with the button
            /// Example: value="btn1" (for form processing)
            value: String,
            /// The disabled attribute disables the button
            /// Example: disabled (button cannot be clicked)
            disabled: bool,
            /// The name attribute specifies the name of the button (for form submission)
            /// Example: name="submit-button"
            name: String,
            /// The formaction attribute overrides form's action for this button
            /// Example: formaction="/alternative-submit"
            formaction: String,
            /// The formmethod attribute overrides form's method for this button
            /// Example: formmethod="get"
            formmethod: String,
        }

        /// HTML `<select>` element - Dropdown selection list
        ///
        /// Example:
        ///
        /// ```<select><option value="1">Option 1</option><option value="2">Option 2</option></select>```
        select {
            /// The multiple attribute allows selecting multiple options
            /// Example: multiple (user can select multiple items)
            multiple: bool,
            /// The disabled attribute disables the dropdown
            /// Example: disabled (user cannot interact)
            disabled: bool,
            /// The value attribute specifies the selected value
            /// Example: value="option2" (preselects this option)
            value: String,
            /// The name attribute specifies the name of the select (for form submission)
            /// Example: name="country"
            name: String,
            /// The size attribute specifies number of visible options
            /// Example: size="5" (shows 5 options at once)
            size: i32,
            /// The required attribute makes selection mandatory
            /// Example: required (user must select an option)
            required: bool,
        }

        /// HTML `<option>` element - Defines option in a select dropdown
        ///
        /// Example:
        ///
        /// ```<option value="blue" selected>Blue</option>```
        option {
            /// The value attribute specifies the value to be sent to server
            /// Example: value="NY" (value sent when this option is selected)
            value: String,
            /// The selected attribute preselects this option when page loads
            /// Example: selected (this option is selected by default)
            selected: bool,
            /// The disabled attribute makes this option unselectable
            /// Example: disabled (cannot be chosen)
            disabled: bool,
        }

        /// HTML `<label>` element - Caption for a form control
        ///
        /// Example:
        ///
        /// ```<label for="username">Username:</label><input id="username">```
        label {
            /// The for attribute connects the label to a form control by ID
            /// Example: for="email" (associates with input having id="email")
            for_: String,
        }

        /// HTML `<iframe>` element - Embeds another document within the current HTML document
        ///
        /// Example:
        ///
        /// ```<iframe src="https://example.com" title="Example Site"></iframe>```
        iframe {
            /// The src attribute specifies the URL of the embedded document
            /// Example: src="https://maps.google.com"
            src: String,
            /// The frameborder attribute specifies whether to display a border
            /// Example: frameborder="0" (no border)
            frameborder: String,
            /// The allow attribute specifies features allowed in the iframe
            /// Example: allow="camera; microphone" (permits access to these devices)
            allow: String,
            /// The allowfullscreen attribute allows iframe content to go fullscreen
            /// Example: allowfullscreen (allows fullscreen mode)
            allowfullscreen: bool,
            /// The sandbox attribute restricts iframe capabilities for security
            /// Example: sandbox="allow-scripts" (only allows scripts to run)
            sandbox: String,
        }

        /// HTML `<video>` element - Embeds video content in the document
        ///
        /// Example:
        ///
        /// ```<video src="movie.mp4" controls width="500">Video not supported</video>```
        video {
            /// The src attribute specifies URL/path of the video
            /// Example: src="videos/intro.mp4"
            src: String,
            /// The controls attribute displays video playback controls
            /// Example: controls (shows play/pause/volume controls)
            controls: bool,
            /// The autoplay attribute starts playing video automatically
            /// Example: autoplay (video plays when page loads)
            autoplay: bool,
            /// The loop attribute makes the video replay when finished
            /// Example: loop (continuously replays)
            loop_: bool,
            /// The poster attribute specifies an image shown before video plays
            /// Example: poster="thumbnail.jpg"
            poster: String,
            /// The muted attribute mutes the audio by default
            /// Example: muted (starts with no sound)
            muted: bool,
            /// The preload attribute hints how to preload the video
            /// Example: preload="auto" (preload entire video)
            preload: String,
            /// The playsinline attribute plays inline on iOS (instead of fullscreen)
            /// Example: playsinline (important for iPhone users)
            playsinline: bool,
        }

        /// HTML `<audio>` element - Embeds sound content in the document
        ///
        /// Example:
        ///
        /// ```<audio src="song.mp3" controls>Audio not supported</audio>```
        audio {
            /// The src attribute specifies URL/path of the audio file
            /// Example: src="audio/background-music.mp3"
            src: String,
            /// The controls attribute displays audio playback controls
            /// Example: controls (shows play/pause/volume controls)
            controls: bool,
            /// The autoplay attribute starts playing audio automatically
            /// Example: autoplay (audio plays when page loads)
            autoplay: bool,
            /// The loop attribute makes the audio replay when finished
            /// Example: loop (continuously replays)
            loop_: bool,
            /// The muted attribute mutes the audio by default
            /// Example: muted (starts with no sound)
            muted: bool,
            /// The preload attribute hints how to preload the audio
            /// Example: preload="none" (doesn't preload)
            preload: String,
        }

        /// HTML `<source>` element - Defines media resources for video/audio elements
        ///
        /// Example:
        ///
        /// ```<video><source src="movie.mp4" type="video/mp4"><source src="movie.webm" type="video/webm"></video>```
        source {
            /// The src attribute specifies URL/path of the media resource
            /// Example: src="audio/song.ogg"
            src: String,
            /// The type attribute specifies the MIME type of the resource
            /// Example: type="video/webm" (defines file format)
            type_: String,
            /// The media attribute specifies for which media the resource is intended
            /// Example: media="(min-width: 600px)" (responsive resources)
            media: String,
        }

        /// HTML `<canvas>` element - Container for graphics rendered with JavaScript
        ///
        /// Example:
        ///
        /// ```<canvas id="myCanvas" width="200" height="100">Your browser does not support canvas</canvas>```
        canvas {
        }

        /// HTML `<svg>` element - Container for SVG graphics
        ///
        /// Example:
        ///
        /// ```<svg viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="red" /></svg>```
        svg {
            /// The viewBox attribute defines coordinate system and aspect ratio
            /// Example: viewBox="0 0 800 600" (x, y, width, height)
            viewBox: String,
            /// The preserveAspectRatio attribute controls scaling behavior
            /// Example: preserveAspectRatio="xMidYMid meet" (center and scale)
            preserve_aspect_ratio: String,
            /// The xmlns attribute defines the XML namespace (required for standalone SVG)
            /// Example: xmlns="http://www.w3.org/2000/svg"
            xmlns: String,
            /// The fill attribute specifies the fill color
            /// Example: fill="#3498db" (blue fill)
            fill: String,
            /// The stroke attribute specifies the outline color
            /// Example: stroke="#e74c3c" (red outline)
            stroke: String,
            /// The stroke-width attribute specifies the width of the outline
            /// Example: stroke-width="3" (3 units thick)
            stroke_width: String,
            /// The stroke-linecap attribute specifies line end style
            /// Example: stroke-linecap="round" (rounded ends)
            stroke_linecap: String,
            /// The stroke-linejoin attribute specifies how line joins are rendered
            /// Example: stroke-linejoin="miter" (pointed corners)
            stroke_linejoin: String,
            /// The stroke-miterlimit attribute limits the length of miters
            /// Example: stroke-miterlimit="4" (limits pointy corners)
            stroke_miterlimit: String,
            /// The stroke-dasharray attribute creates dashed lines
            /// Example: stroke-dasharray="5,5" (5 units on, 5 units off)
            stroke_dasharray: String,
            /// The stroke-dashoffset attribute adjusts dash pattern start
            /// Example: stroke-dashoffset="10" (starts 10 units into pattern)
            stroke_dashoffset: String,
            /// The stroke-opacity attribute sets stroke transparency
            /// Example: stroke-opacity="0.5" (50% transparent)
            stroke_opacity: String,
            /// The fill-opacity attribute sets fill transparency
            /// Example: fill-opacity="0.7" (70% opaque)
            fill_opacity: String,
        }

        /// HTML `<path>` element - Defines a path in SVG graphics
        ///
        /// Example:
        ///
        /// ```<path d="M10 10 H 90 V 90 H 10 Z" fill="transparent" stroke="black" />```
        path {
            /// The d attribute defines the path to be drawn
            /// Example: d="M20,20 L80,20 L80,80 L20,80 Z" (square path)
            d: String,
            /// The fill attribute specifies the fill color
            /// Example: fill="#3498db" (blue fill)
            fill: String,
            /// The stroke attribute specifies the outline color
            /// Example: stroke="#e74c3c" (red outline)
            stroke: String,
            /// The stroke-width attribute specifies the width of the outline
            /// Example: stroke-width="3" (3 units thick)
            stroke_width: String,
            /// The stroke-linecap attribute specifies line end style
            /// Example: stroke-linecap="round" (rounded ends)
            stroke_linecap: String,
            /// The stroke-linejoin attribute specifies how line joins are rendered
            /// Example: stroke-linejoin="miter" (pointed corners)
            stroke_linejoin: String,
            /// The stroke-miterlimit attribute limits the length of miters
            /// Example: stroke-miterlimit="4" (limits pointy corners)
            stroke_miterlimit: String,
            /// The stroke-dasharray attribute creates dashed lines
            /// Example: stroke-dasharray="5,5" (5 units on, 5 units off)
            stroke_dasharray: String,
            /// The stroke-dashoffset attribute adjusts dash pattern start
            /// Example: stroke-dashoffset="10" (starts 10 units into pattern)
            stroke_dashoffset: String,
            /// The stroke-opacity attribute sets stroke transparency
            /// Example: stroke-opacity="0.5" (50% transparent)
            stroke_opacity: String,
            /// The fill-opacity attribute sets fill transparency
            /// Example: fill-opacity="0.7" (70% opaque)
            fill_opacity: String,
        }

        /// HTML `<rect>` element - Draws a rectangle in SVG
        ///
        /// Example:
        ///
        /// ```<rect x="10" y="10" width="100" height="50" fill="blue" />```
        rect {
            /// The x attribute specifies the x-coordinate of the rectangle
            /// Example: x="25" (25 units from the left)
            x: String,
            /// The y attribute specifies the y-coordinate of the rectangle
            /// Example: y="50" (50 units from the top)
            y: String,
            /// The rx attribute specifies the horizontal corner radius
            /// Example: rx="10" (rounded corners)
            rx: String,
            /// The ry attribute specifies the vertical corner radius
            /// Example: ry="10" (rounded corners)
            ry: String,
            /// The fill attribute specifies the fill color
            /// Example: fill="#2ecc71" (green fill)
            fill: String,
            /// The stroke attribute specifies the outline color
            /// Example: stroke="#27ae60" (darker green outline)
            stroke: String,
            /// The stroke-width attribute specifies the width of the outline
            /// Example: stroke-width="2" (2 units thick)
            stroke_width: String,
        }

        /// HTML `<circle>` element - Draws a circle in SVG
        ///
        /// Example:
        ///
        /// ```<circle cx="50" cy="50" r="40" fill="red" />```
        circle {
            /// The cx attribute specifies the x-coordinate of the center
            /// Example: cx="100" (center x at 100 units)
            cx: String,
            /// The cy attribute specifies the y-coordinate of the center
            /// Example: cy="100" (center y at 100 units)
            cy: String,
            /// The r attribute specifies the radius of the circle
            /// Example: r="75" (75 units radius)
            r: String,
            /// The fill attribute specifies the fill color
            /// Example: fill="#9b59b6" (purple fill)
            fill: String,
            /// The stroke attribute specifies the outline color
            /// Example: stroke="#8e44ad" (darker purple outline)
            stroke: String,
            /// The stroke-width attribute specifies the width of the outline
            /// Example: stroke-width="3" (3 units thick)
            stroke_width: String,
        }

        /// HTML `<ellipse>` element - Draws an ellipse in SVG
        ///
        /// Example:
        ///
        /// ```<ellipse cx="100" cy="50" rx="100" ry="50" fill="yellow" />```
        ellipse {
            /// The cx attribute specifies the x-coordinate of the center
            /// Example: cx="150" (center x at 150 units)
            cx: String,
            /// The cy attribute specifies the y-coordinate of the center
            /// Example: cy="75" (center y at 75 units)
            cy: String,
            /// The rx attribute specifies the horizontal radius
            /// Example: rx="100" (100 units horizontal radius)
            rx: String,
            /// The ry attribute specifies the vertical radius
            /// Example: ry="50" (50 units vertical radius)
            ry: String,
            /// The fill attribute specifies the fill color
            /// Example: fill="#f1c40f" (yellow fill)
            fill: String,
            /// The stroke attribute specifies the outline color
            /// Example: stroke="#f39c12" (darker yellow outline)
            stroke: String,
            /// The stroke-width attribute specifies the width of the outline
            /// Example: stroke-width="2" (2 units thick)
            stroke_width: String,
        }

        /// HTML `<line>` element - Draws a line in SVG
        ///
        /// Example:
        ///
        /// ```<line x1="0" y1="0" x2="100" y2="100" stroke="black" />```
        line {
            /// The x1 attribute specifies the x-coordinate of the start point
            /// Example: x1="10" (starts 10 units from left)
            x1: String,
            /// The y1 attribute specifies the y-coordinate of the start point
            /// Example: y1="10" (starts 10 units from top)
            y1: String,
            /// The x2 attribute specifies the x-coordinate of the end point
            /// Example: x2="200" (ends 200 units from left)
            x2: String,
            /// The y2 attribute specifies the y-coordinate of the end point
            /// Example: y2="200" (ends 200 units from top)
            y2: String,
            /// The stroke attribute specifies the line color
            /// Example: stroke="#34495e" (dark blue line)
            stroke: String,
            /// The stroke-width attribute specifies the width of the line
            /// Example: stroke-width="5" (5 units thick)
            stroke_width: String,
            /// The stroke-linecap attribute specifies line end style
            /// Example: stroke-linecap="round" (rounded ends)
            stroke_linecap: String,
            /// The stroke-dasharray attribute creates dashed lines
            /// Example: stroke-dasharray="10,5" (10 units on, 5 units off)
            stroke_dasharray: String,
        }

        /// HTML `<polyline>` element - Draws connected straight lines in SVG
        ///
        /// Example:
        ///
        /// ```<polyline points="20,20 40,25 60,40 80,120 120,140 200,180" stroke="orange" fill="none" />```
        polyline {
            /// The points attribute specifies coordinates for each point
            /// Example: points="0,0 50,50 100,25" (series of x,y pairs)
            points: String,
            /// The fill attribute specifies the fill color between lines
            /// Example: fill="none" (transparent fill)
            fill: String,
            /// The stroke attribute specifies the line color
            /// Example: stroke="#e67e22" (orange line)
            stroke: String,
            /// The stroke-width attribute specifies the width of the lines
            /// Example: stroke-width="3" (3 units thick)
            stroke_width: String,
            /// The stroke-linejoin attribute specifies how lines are joined
            /// Example: stroke-linejoin="round" (rounded corners)
            stroke_linejoin: String,
        }

        /// HTML `<polygon>` element - Draws a closed shape with straight lines in SVG
        ///
        /// Example:
        ///
        /// ```<polygon points="200,10 250,190 160,210" fill="green" />```
        polygon {
            /// The points attribute specifies coordinates for each point
            /// Example: points="50,50 150,50 100,150" (triangle coordinates)
            points: String,
            /// The fill attribute specifies the fill color of the shape
            /// Example: fill="#1abc9c" (teal fill)
            fill: String,
            /// The stroke attribute specifies the outline color
            /// Example: stroke="#16a085" (darker teal outline)
            stroke: String,
            /// The stroke-width attribute specifies the width of the outline
            /// Example: stroke-width="2" (2 units thick)
            stroke_width: String,
            /// The fill-rule attribute specifies how to fill shapes with holes
            /// Example: fill-rule="evenodd" (alternates fill for nested shapes)
            fill_rule: String,
        }

        /// HTML `<g>` element - Groups SVG elements together
        ///
        /// Example:
        ///
        /// ```<g transform="rotate(45 50 50)"><rect x="20" y="20" width="60" height="60" /></g>```
        g {
            /// The transform attribute applies transformations to the group
            /// Example: transform="translate(100,50) scale(2)" (moves and scales)
            transform: String,
            /// The fill attribute specifies the fill color for all elements in the group
            /// Example: fill="#3498db" (blue fill for all children)
            fill: String,
            /// The stroke attribute specifies the outline color for all elements in the group
            /// Example: stroke="#2980b9" (darker blue outline for all children)
            stroke: String,
        }

        /// HTML `<use>` element - Reuses an SVG element defined elsewhere
        ///
        /// Example:
        ///
        /// ```<r#use href="#myCircle" x="10" y="10" fill="blue" />```
        r#use {
            /// The href attribute specifies which element to reuse
            /// Example: href="#icon-star" (references element with id="icon-star")
            href: String,
            /// The x attribute specifies the x-coordinate where to place the reused element
            /// Example: x="100" (100 units from left)
            x: String,
            /// The y attribute specifies the y-coordinate where to place the reused element
            /// Example: y="50" (50 units from top)
            y: String,
        }

        /// HTML `<foreignObject>` element - Includes non-SVG elements inside SVG
        ///
        /// Example:
        ///
        /// ```<foreignObject x="20" y="20" width="160" height="160"><div>HTML content inside SVG</div></foreignObject>```
        foreignObject {
            /// The x attribute specifies the x-coordinate of the foreign object
            /// Example: x="25" (25 units from left)
            x: String,
            /// The y attribute specifies the y-coordinate of the foreign object
            /// Example: y="25" (25 units from top)
            y: String,
        }

        /// HTML `<defs>` element - Container for reusable SVG elements
        ///
        /// Example:
        ///
        /// ```<defs><circle id="myCircle" cx="5" cy="5" r="4" /></defs>```
        defs {
        }

        /// HTML `<linearGradient>` element - Defines a linear gradient for SVG fills
        ///
        /// Example:
        ///
        /// ```<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" style="stop-color:rgb(255,255,0)" /></linearGradient>```
        linearGradient {
            /// The x1 attribute defines the start point of the gradient (x-coordinate)
            /// Example: x1="0%" (starts at left edge)
            x1: String,
            /// The y1 attribute defines the start point of the gradient (y-coordinate)
            /// Example: y1="0%" (starts at top edge)
            y1: String,
            /// The x2 attribute defines the end point of the gradient (x-coordinate)
            /// Example: x2="100%" (ends at right edge)
            x2: String,
            /// The y2 attribute defines the end point of the gradient (y-coordinate)
            /// Example: y2="100%" (ends at bottom edge)
            y2: String,
            /// The gradientUnits attribute defines the coordinate system for the gradient
            /// Example: gradientUnits="userSpaceOnUse" (uses absolute coordinates)
            gradientUnits: String,
            /// The spreadMethod attribute defines how the gradient fills beyond its bounds
            /// Example: spreadMethod="reflect" (gradient reflects at boundaries)
            spreadMethod: String,
        }

        /// HTML `<stop>` element - Defines color transitions in gradients
        ///
        /// Example:
        ///
        /// ```<stop offset="0%" style="stop-color:rgb(255,0,0);stop-opacity:1" />```
        stop {
            /// The offset attribute defines where along the gradient this color appears
            /// Example: offset="50%" (color positioned halfway through gradient)
            offset: String,
            /// The stop-color attribute defines the color at this stop
            /// Example: stop-color="#3498db" (blue color)
            stop_color: String,
            /// The stop-opacity attribute defines the opacity at this stop
            /// Example: stop-opacity="0.5" (50% transparent)
            stop_opacity: String,
        }

        /// HTML `<radialGradient>` element - Defines a radial gradient for SVG fills
        ///
        /// Example:
        ///
        /// ```<radialGradient id="grad2" cx="50%" cy="50%" r="50%"><stop offset="0%" style="stop-color:red" /></radialGradient>```
        radialGradient {
            /// The cx attribute defines the x-coordinate of the center point
            /// Example: cx="50%" (center of the area horizontally)
            cx: String,
            /// The cy attribute defines the y-coordinate of the center point
            /// Example: cy="50%" (center of the area vertically)
            cy: String,
            /// The r attribute defines the radius of the gradient
            /// Example: r="75%" (extends to 75% of the reference area)
            r: String,
            /// The fx attribute defines the x-coordinate of the focal point
            /// Example: fx="60%" (focal point slightly right of center)
            fx: String,
            /// The fy attribute defines the y-coordinate of the focal point
            /// Example: fy="40%" (focal point slightly above center)
            fy: String,
            /// The fr attribute defines the radius of the focal point
            /// Example: fr="5%" (small focal point)
            fr: String,
            /// The gradientUnits attribute defines the coordinate system for the gradient
            /// Example: gradientUnits="objectBoundingBox" (relative to object)
            gradientUnits: String,
            /// The spreadMethod attribute defines how the gradient fills beyond its bounds
            /// Example: spreadMethod="pad" (uses edge color beyond boundaries)
            spreadMethod: String,
        }

        /// HTML `<mask>` element - Defines an area where SVG elements are partially or fully hidden
        ///
        /// Example:
        ///
        /// ```<mask id="myMask"><rect width="100%" height="100%" fill="white" opacity="0.5" /></mask>```
        mask {
            /// The maskUnits attribute specifies the coordinate system for mask positioning
            /// Example: maskUnits="userSpaceOnUse" (absolute coordinates)
            mask_units: String,
            /// The maskContentUnits attribute specifies the coordinate system for mask content
            /// Example: maskContentUnits="objectBoundingBox" (relative to object)
            mask_content_units: String,
            /// The x attribute specifies the x-coordinate of the mask
            /// Example: x="0" (starts at left edge)
            x: String,
            /// The y attribute specifies the y-coordinate of the mask
            /// Example: y="0" (starts at top edge)
            y: String,
        }
        /// HTML `<article>` element - Defines an independent, self-contained content
        ///
        /// Example:
        ///
        /// ```<article><h1>Article Title</h1><p>Article content goes here...</p></article>```
        article {
        }

        /// HTML `<aside>` element - Defines content aside from the page content
        ///
        /// Example:
        ///
        /// ```<aside><p>Sidebar content goes here...</p></aside>```
        aside {
        }

        /// HTML `<details>` element - Defines additional details that the user can view or hide
        ///
        /// Example:
        ///
        /// ```<details><summary>Click to view details</summary><p>Details content goes here...</p></details>```
        details {
        }

        /// HTML `<figcaption>` element - Defines a caption for a `<figure>` element
        ///
        /// Example:
        ///
        /// ```<figure><img src="image.jpg" alt="Image description" /><figcaption>Caption goes here...</figcaption></figure>```
        figcaption {
        }

        /// HTML `<figure>` element - Specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.
        ///
        /// Example:
        ///
        /// ```<figure><img src="image.jpg" alt="Image description" /><figcaption>Caption goes here...</figcaption></figure>```
        figure {
        }

        /// HTML `<footer>` element - Defines a footer for a document or section
        ///
        /// Example:
        ///
        /// ```<footer><p>Footer content goes here...</p></footer>```
        footer {
        }

        /// HTML `<header>` element - Defines a container for introductory content or a set of navigational links
        ///
        /// Example:
        ///
        /// ```<header><h1>Header content goes here...</h1></header>```
        header {
        }

        /// HTML `<main>` element - Specifies the main content of a document
        ///
        /// Example:
        ///
        /// ```<main><p>Main content goes here...</p></main>```
        main {
        }

        /// HTML `<mark>` element - Defines marked/highlighted text
        ///
        /// Example:
        ///
        /// ```<p>Some <mark>marked</mark> text.</p>```
        mark {
        }

        /// HTML `<nav>` element - Defines navigation links
        ///
        /// Example:
        ///
        /// ```<nav><a href="#home">Home</a> <a href="#about">About</a> <a href="#contact">Contact</a></nav>```
        nav {
        }

        /// HTML `<section>` element - Defines a section in a document
        ///
        /// Example:
        ///
        /// ```<section><h2>Section Title</h2><p>Section content goes here...</p></section>```
        section {
        }

        /// HTML `<summary>` element - Defines a visible heading for a `<details>` element
        ///
        /// Example:
        ///
        /// ```<details><summary>Click to view details</summary><p>Details content goes here...</p></details>```
        summary {
        }

        /// HTML `<time>` element - Defines a date/time
        ///
        /// Example:
        ///
        /// ```<p>Published on <time datetime="2023-08-01">August 1, 2023</time></p>```
        time {
            /// The datetime attribute specifies the date/time
            /// Example: datetime="2023-08-01" (August 1, 2023)
            datetime: String,
            /// The pubdate attribute specifies that the content is published
            /// Example: pubdate="pubdate" (content is published)
            pubdate: String,
        }

        /// HTML `<wbr>` element - Inserts a line break opportunity
        ///
        /// Example:
        ///
        /// ```<p>Here is a long word:<wbr>supercalifragilisticexpialidocious</p>```
        wbr {
        }

        /// HTML `<address>` element - Defines contact information for the author/owner of a document
        ///
        /// Example:
        ///
        /// ```<address>Contact us at <a href="mailto:="mail="mailto:EMAIL"EMAILample.com</a></address>```
        address {
        }

        /// HTML `<bdi>` element - Defines a term/name within a description list
        ///
        /// Example:
        ///
        /// ```<dl><dt><bdi>Name</bdi></dt><dd>John Doe</dd></dl>```
        bdi {
        }

        /// HTML `<bdo>` element - Overrides the current text direction
        ///
        /// Example:
        ///
        /// ```<p><bdo dir="rtl">This text is written from right to left</bdo></p>```
        bdo {
        }

        /// HTML `<cite>` element - Defines the title of a work
        ///
        /// Example:
        ///
        /// ```<p>To learn more about <cite>HTML</cite>, visit <a href="```<p>To learn more about <cite>HTML</cite>, visit <a href="URL_ADDRESS.w3.org/TR/html52/">W3C</a>.</p>```
        cite {
        }

        /// HTML `<dfn>` element - Defines a definition
        ///
        /// Example:
        ///
        /// ```<p>The <dfn>HTML</dfn> element is used to define a section in a document.</p>```
        dfn {
        }

        /// HTML `<em>` element - Defines emphasized text
        ///
        /// Example:
        ///
        /// ```<p>He is <em>very</em> angry.</p>```
        em {
        }

        /// HTML `<i>` element - Defines a part of text in an alternate voice or mood
        ///
        /// Example:
        ///
        /// ```<p><i>This text is in italics.</i></p>```
        i {
        }

        /// HTML `<kbd>` element - Defines keyboard input
        ///
        /// Example:
        ///
        /// ```<p>Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.</p>```
        kbd {
        }

        /// HTML `<meter>` element - Defines a scalar measurement within a known range (a gauge)
        ///
        /// Example:
        ///
        /// ```<meter value="75" min="0" max="100"></meter>```
        meter {
            /// The value attribute specifies the current value
            /// Example: value="75" (current value is 75)
            value: String,
            /// The min attribute specifies the minimum value
            /// Example: min="0" (minimum value is 0)
            min: String,
            /// The max attribute specifies the maximum value
            /// Example: max="100" (maximum value is 100)
            max: String,
            /// The low attribute specifies the low value
            /// Example: low="33" (low value is 33)
            low: String,
            /// The high attribute specifies the high value
            /// Example: high="66" (high value is 66)
            high: String,
            /// The optimum attribute specifies the optimum value
            /// Example: optimum="50" (optimum value is 50)
            optimum: String,
        }

        /// HTML `<output>` element - Defines the result of a calculation
        ///
        /// Example:
        ///
        /// ```<form><input type="number" id="num1" /><input type="number" id="num2" /><button onclick="calculate()">Calculate</button><output id="result"></output></form>```
        output {
        }

        /// HTML `<progress>` element - Defines the progress of a task
        ///
        /// Example:
        ///
        /// ```<progress value="75" max="100"></progress>```
        progress {
            /// The value attribute specifies the current value
            /// Example: value="75" (current value is 75)
            value: String,
            /// The max attribute specifies the maximum value
            /// Example: max="100" (maximum value is 100)
            max: String,
        }

        /// HTML `<q>` element - Defines a short inline quotation
        ///
        /// Example:
        ///
        /// ```<p><q>We are the so-called "Vikings" from the north.</q></p>```
        q {
        }

        /// HTML `<rp>` element - Defines a parenthesis for browsers that do not support `<ruby>`
        ///
        /// Example:
        ///
        /// ```<ruby><rb>漢</rb><rp>(</rp><rt>han</rt><rp>)</rp></ruby>```
        rp {
        }

        /// HTML `<rt>` element - Defines a ruby text
        ///
        /// Example:
        ///
        /// ```<ruby><rb>漢</rb><rt>han</rt></ruby>```
        rt {
        }

        /// HTML `<ruby>` element - Defines a ruby annotation (for East Asian typography)
        ///
        /// Example:
        ///
        /// ```<ruby><rb>漢</rb><rt>han</rt></ruby>```
        ruby {
        }

        /// HTML `<s>` element - Defines strikethrough text
        ///
        /// Example:
        ///
        /// ```<p>Price: <s>$100</s> $50</p>```
        s {
        }

        /// HTML `<samp>` element - Defines sample output from a computer program
        ///
        /// Example:
        ///
        /// ```<samp>Hello, World!</samp>```
        samp {
        }

        /// HTML `<small>` element - Defines smaller text
        ///
        /// Example:
        ///
        /// ```<p><small>This is some smaller text.</small></p>```
        small {
        }

        /// HTML `<strong>` element - Defines important text
        ///
        /// Example:
        ///
        /// ```<p><strong>This is important!</strong></p>```
        strong {
        }

        /// HTML `<sub>` element - Defines subscript text
        ///
        /// Example:
        ///
        /// ```<p>H<sub>2</sub>O</p>```
        sub {
        }

        /// HTML `<sup>` element - Defines superscript text
        ///
        /// Example:
        ///
        /// ```<p>X<sup>2</sup></p>```
        sup {
        }

        /// HTML `<var>` element - Defines a variable
        ///
        /// Example:
        ///
        /// ```<p>The area is <var>x</var> times <var>y</var>.</p>```
        var {
        }

        /// HTML `<template>` element - Defines a container for content that is not to be rendered when a page is loaded
        ///
        /// Example:
        ///
        /// ```<template><p>This content will not be rendered.</p></template>```
        template {
        }

        /// HTML `<u>` element - Defines text that should be rendered as underlined
        ///
        /// Example:
        ///
        /// ```<p><u>This text is underlined.</u></p>```
        u {
        }

        /// HTML `<noscript>` element - Defines content that is displayed to users with disabled scripts
        ///
        /// Example:
        ///
        /// ```<noscript><p>JavaScript is disabled.</p></noscript>```
        noscript {
        }

        /// HTML `<legend>` element - Defines a caption for a `<fieldset>` element
        ///
        /// Example:
        ///
        /// ```<fieldset><legend>Personal Information</legend><input type="text" name="name" /><input type="email" name="email" /></fieldset>```
        legend {
        }

        /// HTML `<optgroup>` element - Defines a group of related `<option>` elements in a `<select>` element
        ///
        /// Example:
        ///
        /// ```<select><optgroup label="Fruits"><option value="apple">Apple</option><option value="banana">Banana</option></optgroup><optgroup label="Vegetables"><option value="carrot">Carrot</option><option value="potato">Potato</option></optgroup></select>```
        optgroup {
            /// The label attribute specifies a label for the group
            /// Example: label="Fruits" (label for the group is "Fruits")
            label: String,
        }

        /// HTML `<dialog>` element - Defines a dialog box or other interactive component
        ///
        /// Example:
        ///
        /// ```<dialog><p>Dialog content goes here...</p><button onclick="closeDialog()">Close</button></dialog>```
        dialog {
            /// The open attribute specifies whether the dialog is open or closed
            /// Example: open="open" (dialog is open)
            open: String,
        }

        /// HTML `<blockquote>` element - Defines a section that is quoted from another source
        ///
        /// Example:
        ///
        /// ```<blockquote><p>This is a quote.</p><footer>- John Doe</footer></blockquote>```
        blockquote {
        }

        /// HTML `<dd>` element - Defines a description/value pair within a `<dl>` element
        ///
        /// Example:
        ///
        /// ```<dl><dt>Coffee</dt><dd>Black hot drink</dd><dt>Milk</dt><dd>White cold drink</dd></dl>```
        dd {
        }

        /// HTML `<dl>` element - Defines a description list
        ///
        /// Example:
        ///
        /// ```<dl><dt>Coffee</dt><dd>Black hot drink</dd><dt>Milk</dt><dd>White cold drink</dd></dl>```
        dl {
        }

        /// HTML `<dt>` element - Defines a term/name in a description list
        ///
        /// Example:
        ///
        /// ```<dl><dt>Coffee</dt><dd>Black hot drink</dd><dt>Milk</dt><dd>White cold drink</dd></dl>```
        dt {
        }

        /// HTML `<base>` element - Specifies the base URL/target for all relative URLs in a document
        ///
        /// Example:
        ///
        /// ```<base href="```<base href="URL_ADDRESS.example.com/" target="_blank">```
        base {
            /// The href attribute specifies the base URL
            /// ```<base href="URL_ADDR```<base href="URL_ADDRESS.example.com/" target="_blank">```
            href: String,
            /// The target attribute specifies the target for all relative URLs
            /// ```<base href="URL_ADDRESS.example.com/" target="_blank">```
            target: String,
        }
    }
}