simple_rsx/lib.rs
1//! Simple RSX - A React-inspired JSX Library for Rust
2//!
3//! I created Simple RSX to bring the familiar feel of React's JSX to Rust projects. If you're coming
4//! from a React background, you'll feel right at home. And if you're new to both, don't worry - I've made
5//! it super intuitive while keeping all the type safety and performance benefits of Rust.
6//!
7//! # Why Simple RSX?
8//!
9//! I started this project while attempting to transit my [portfolio](https://elcharitas.wtf) from Next.js to Rust.
10//! I wanted to keep my codebase as simple as possible, and I wanted to use Rust's powerful type system
11//! to ensure that my components were always correct. I tried existing libraries like `yew` and `sycamore`,
12//! but they were either too complex or didn't feel quite like React. And so, here we are.
13//!
14//! I know what you're thinking - "Another UI library?" But here's what makes Simple RSX special:
15//!
16//! - **React-like Syntax**: Write your templates using the `rsx!` macro - it's just like JSX!
17//! - **Type Safety**: Get compile-time checks for your components and props
18//! - **Zero Runtime Overhead**: All the magic happens at compile time
19//! - **Familiar Patterns**: Components, props, fragments - all the React concepts you love
20//!
21//! # Let's Get Started!
22//!
23//! Here's a quick taste of what you can do:
24//!
25//! ```rust
26//! use simple_rsx::*;
27//!
28//! // Create your first component - looks familiar, right?
29//! let greeting = rsx!(
30//! <div class="greeting">
31//! <h1>Hello, {"World"}!</h1>
32//! <p>Welcome to Simple RSX</p>
33//! </div>
34//! );
35//!
36//! // Turn it into HTML - perfect for server-side rendering (P.S: This to me is my favorite feature)
37//! println!("{}", greeting);
38//! ```
39//!
40//! # Features You'll Love
41//!
42//! ## JSX-style Elements - Write HTML, Get Rust
43//!
44//! ```rust
45//! use simple_rsx::*;
46//!
47//! // Self-closing tags? Check!
48//! let img = rsx!(<img src="image.jpg" alt="An image" />);
49//!
50//! // Nested elements? Of course!
51//! let card = rsx!(
52//! <div class="card">
53//! <h2>Title</h2>
54//! <p>Content</p>
55//! </div>
56//! );
57//!
58//! // Fragments? No problem! Just use <> and the children will be flattened
59//! let fragment = rsx!(
60//! <>
61//! <h1>Title</h1>
62//! <p>No wrapper needed</p>
63//! </>
64//! );
65//! ```
66//!
67//! ## Dynamic Content - Make It Come Alive
68//!
69//! ```rust
70//! use simple_rsx::*;
71//!
72//! let name = "World";
73//! let count = 42;
74//!
75//! // Drop in any Rust expression with {}
76//! let dynamic = rsx!(
77//! <div>
78//! <h1>Hello, {name}!</h1>
79//! <p>Count: {count}</p>
80//! </div>
81//! );
82//!
83//! // Conditional rendering? Use the either! macro
84//! let show = true;
85//! let conditional = either!(show =>
86//! <p>Now you see me</p>
87//! else
88//! <p>Now you don't</p>
89//! );
90//!
91//! // Conditional classes? Easy!
92//! let is_active = true;
93//! let button = rsx!(
94//! <button class={if is_active { "active" } else { "" }}>
95//! Toggle
96//! </button>
97//! );
98//!
99//! // Render lists with iterator magic
100//! let items = vec!["A", "B", "C"];
101//! let list = rsx!(
102//! <ul>
103//! {items.iter().map(|item| rsx!(<li>{item}</li>))}
104//! </ul>
105//! );
106//! ```
107//!
108//! ## Components and Props - Build Reusable UI
109//!
110//! ```rust
111//! use simple_rsx::*;
112//!
113//! // Define your props - just like React's PropTypes
114//! #[derive(Default)]
115//! struct ButtonProps {
116//! text: String,
117//! variant: String,
118//! children: Vec<Node>,
119//! }
120//!
121//! // Create a component - clean and simple
122//! #[component]
123//! fn Button(props: ButtonProps) -> Node {
124//! rsx!(
125//! <button class={format!("btn btn-{}", props.variant)}>
126//! {props.text}
127//! {props.children}
128//! </button>
129//! )
130//! }
131//!
132//! // Use it anywhere!
133//! let button = rsx!(
134//! <Button text="Click me" variant="primary">
135//! <span>"→"</span>
136//! </Button>
137//! );
138//! ```
139//!
140//! ## HTML Data attributes
141//!
142//! With simple RSX, HTML data attributes are the only props which do not get validated by the compiler.
143//! This allows you to use any valid literal or expression in the value of a data attribute.
144//!
145//! ```rust
146//! use simple_rsx::*;
147//!
148//! // Data attributes? No problem!
149//! let element = rsx!(
150//! <div
151//! data_user="john"
152//! data_role="admin"
153//! />
154//! );
155//! ```
156//!
157pub mod dom;
158pub mod signals;
159
160use indexmap::IndexMap;
161pub use simple_rsx_macros::{component, either, rsx};
162use std::fmt::Display;
163
164/// A trait for converting values into HTML attribute strings.
165///
166/// This trait is automatically implemented for any type that implements `ToString`,
167/// making it easy to use various types as attribute values.
168///
169/// # Example
170///
171/// ```rust
172/// use simple_rsx::*;
173///
174/// let element = rsx!(<div id="my-id" hidden={true} />);
175/// ```
176pub trait Attribute {
177 fn value(&self) -> String;
178}
179
180/// A trait for handling optional attribute values.
181///
182/// This trait is automatically implemented for `Option<T>` where T implements `ToString`.
183/// It allows for graceful handling of optional attributes, rendering them as empty strings when None.
184///
185/// # Example
186///
187/// ```rust
188/// use simple_rsx::*;
189///
190/// let maybe_title = Some("Hello".to_string());
191/// let element = rsx!(<div title={maybe_title} />);
192/// ```
193pub trait OptionAttribute {
194 fn value(&self) -> String;
195}
196
197impl<T: ToString> Attribute for T {
198 fn value(&self) -> String {
199 self.to_string()
200 }
201}
202
203impl<T: ToString> OptionAttribute for Option<T> {
204 fn value(&self) -> String {
205 match self {
206 Some(t) => t.to_string(),
207 None => String::new(),
208 }
209 }
210}
211
212/// Represents an HTML element with its tag name, attributes, and children.
213///
214/// Elements are the building blocks of the RSX tree structure. Each element
215/// can have attributes (like class, id, etc.) and can contain other elements
216/// or text nodes as children.
217///
218/// You typically won't create Elements directly, but rather use the `rsx!` macro:
219///
220/// ```rust
221/// use simple_rsx::*;
222///
223/// let element = rsx!(
224/// <div class="container">
225/// <p>Hello world!</p>
226/// </div>
227/// );
228/// ```
229pub struct Element {
230 tag: String,
231 attributes: IndexMap<String, String>,
232 children: Vec<Node>,
233}
234
235impl Element {
236 /// Creates a new Element node with the specified tag name.
237 ///
238 /// # Example
239 ///
240 /// ```rust
241 /// use simple_rsx::*;
242 ///
243 /// let element = Element::parse_tag("div");
244 /// assert!(matches!(element, Node::Element(_)));
245 /// ```
246 pub fn parse_tag(tag: &str) -> Node {
247 Node::Element(Element {
248 tag: tag.to_string(),
249 attributes: IndexMap::new(),
250 children: Vec::new(),
251 })
252 }
253
254 /// Sets an attribute on the element.
255 ///
256 /// # Example
257 ///
258 /// ```rust
259 /// use simple_rsx::*;
260 ///
261 /// let mut node = Element::parse_tag("div");
262 /// let mut element = node.as_element_mut().unwrap();
263 /// element.set_attribute("class", "container");
264 /// ```
265 pub fn set_attribute(&mut self, name: &str, value: impl Attribute) {
266 self.attributes.insert(name.to_string(), value.value());
267 }
268
269 /// Adds a child node to this element.
270 ///
271 /// # Example
272 ///
273 /// ```rust
274 /// use simple_rsx::*;
275 ///
276 /// let mut parent_node = Element::parse_tag("div");
277 /// let mut parent = parent_node.as_element_mut().unwrap();
278 /// parent.append_child(Element::parse_tag("p"));
279 /// ```
280 pub fn append_child(&mut self, node: Node) {
281 self.children.push(node);
282 }
283}
284
285impl Node {
286 /// Attempts to get a mutable reference to the underlying Element if this node is an Element.
287 ///
288 /// Returns None if the node is not an Element (e.g., if it's Text or Fragment).
289 pub fn as_element_mut(&mut self) -> Option<&mut Element> {
290 match self {
291 Node::Element(el) => Some(el),
292 _ => None,
293 }
294 }
295
296 /// Adds a child node if this node is an Element.
297 ///
298 /// This method has no effect if the node is not an Element.
299 pub fn append_child(&mut self, node: Node) {
300 if let Node::Element(el) = self {
301 el.children.push(node);
302 }
303 }
304}
305
306/// A trait for creating reusable components.
307///
308/// Components are the heart of RSX's reusability model. They allow you to create
309/// custom elements with their own logic and state.
310///
311/// # Example
312///
313/// ```rust
314/// use simple_rsx::*;
315///
316/// struct Card;
317/// #[derive(Default)]
318/// struct CardProps {
319/// title: String,
320/// children: Vec<Node>,
321/// }
322///
323/// impl Component for Card {
324/// type Props = CardProps;
325/// fn render(props: Self::Props) -> Node {
326/// rsx!(
327/// <div class="card">
328/// <h2>{props.title}</h2>
329/// <div class="card-content">{props.children}</div>
330/// </div>
331/// )
332/// }
333/// }
334/// ```
335pub trait Component {
336 /// The type of props this component accepts
337 type Props;
338
339 /// Renders the component with the given props
340 fn render(props: Self::Props) -> Node;
341}
342
343/// Represents a node in the RSX tree.
344///
345/// Nodes are the fundamental building blocks of RSX. They can be:
346/// - Elements (like `<div>` or `<p>`)
347/// - Text content
348/// - Fragments (groups of nodes)
349/// - Comments
350///
351/// # Example
352///
353/// ```rust
354/// use simple_rsx::*;
355///
356/// let text_node = Node::Text("Hello".to_string());
357/// let element_node = Element::parse_tag("div");
358/// let fragment = Node::Fragment(vec![text_node, element_node]);
359/// ```
360pub enum Node {
361 /// An HTML element with a tag name, attributes, and children
362 Element(Element),
363 /// Plain text content
364 Text(String),
365 /// A group of nodes without a wrapper element
366 Fragment(Vec<Node>),
367 /// An HTML comment
368 Comment(String),
369 Empty,
370}
371
372impl From<String> for Node {
373 fn from(value: String) -> Self {
374 Node::Text(value)
375 }
376}
377
378impl From<&String> for Node {
379 fn from(value: &String) -> Self {
380 Node::Text(value.to_string())
381 }
382}
383
384impl From<&str> for Node {
385 fn from(value: &str) -> Self {
386 Node::Text(value.to_string())
387 }
388}
389
390impl From<&&str> for Node {
391 fn from(value: &&str) -> Self {
392 Node::Text(value.to_string())
393 }
394}
395
396impl<T> From<Vec<T>> for Node
397where
398 Node: From<T>,
399{
400 fn from(value: Vec<T>) -> Self {
401 Node::Fragment(value.into_iter().map(|t| Node::from(t)).collect())
402 }
403}
404
405impl<T: ToString> From<Option<T>> for Node {
406 fn from(value: Option<T>) -> Self {
407 match value {
408 Some(t) => Node::Text(t.to_string()),
409 _ => Node::Text("".to_string()),
410 }
411 }
412}
413
414impl From<&Vec<String>> for Node {
415 fn from(value: &Vec<String>) -> Self {
416 Node::Fragment(
417 value
418 .iter()
419 .map(|item| Node::Text(item.to_string()))
420 .collect(),
421 )
422 }
423}
424
425impl From<i32> for Node {
426 fn from(value: i32) -> Self {
427 Node::Text(value.to_string())
428 }
429}
430
431impl From<u32> for Node {
432 fn from(value: u32) -> Self {
433 Node::Text(value.to_string())
434 }
435}
436
437impl From<u64> for Node {
438 fn from(value: u64) -> Self {
439 Node::Text(value.to_string())
440 }
441}
442
443impl FromIterator<u32> for Node {
444 fn from_iter<T: IntoIterator<Item = u32>>(iter: T) -> Self {
445 let mut result = Vec::new();
446 for item in iter {
447 result.push(Node::Text(item.to_string()));
448 }
449 Node::Fragment(result)
450 }
451}
452
453impl FromIterator<u64> for Node {
454 fn from_iter<T: IntoIterator<Item = u64>>(iter: T) -> Self {
455 let mut result = Vec::new();
456 for item in iter {
457 result.push(Node::Text(item.to_string()));
458 }
459 Node::Fragment(result)
460 }
461}
462
463impl FromIterator<i32> for Node {
464 fn from_iter<T: IntoIterator<Item = i32>>(iter: T) -> Self {
465 let mut result = Vec::new();
466 for item in iter {
467 result.push(Node::Text(item.to_string()));
468 }
469 Node::Fragment(result)
470 }
471}
472
473impl From<f32> for Node {
474 fn from(value: f32) -> Self {
475 Node::Text(value.to_string())
476 }
477}
478
479impl From<bool> for Node {
480 fn from(value: bool) -> Self {
481 Node::Text(value.to_string())
482 }
483}
484
485impl<I, F, R> From<std::iter::Map<I, F>> for Node
486where
487 I: Iterator,
488 F: FnMut(I::Item) -> R,
489 R: Into<Node>,
490 Vec<Node>: FromIterator<R>,
491{
492 fn from(iter: std::iter::Map<I, F>) -> Self {
493 let nodes: Vec<Node> = iter.collect();
494 Node::from(nodes)
495 }
496}
497
498impl Display for Node {
499 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
500 match self {
501 Node::Element(el) => {
502 write!(f, "<{}", el.tag)?;
503 for (key, value) in &el.attributes {
504 write!(f, " {}=\"{}\"", key, value)?;
505 }
506 write!(f, ">")?;
507 for child in &el.children {
508 write!(f, "{}", child)?;
509 }
510 write!(f, "</{}>", el.tag)?;
511 Ok(())
512 }
513 Node::Text(text) => {
514 write!(f, "{}", sanitize_html(text))?;
515 Ok(())
516 }
517 Node::Fragment(nodes) => {
518 for node in nodes {
519 write!(f, "{}", node)?;
520 }
521 Ok(())
522 }
523 Node::Comment(comment) => {
524 write!(f, "<!--{}-->", comment)?;
525 Ok(())
526 }
527 Node::Empty => {
528 write!(f, "")?;
529 Ok(())
530 }
531 }
532 }
533}
534
535fn sanitize_html(input: &str) -> String {
536 let mut result = String::new();
537 for c in input.chars() {
538 match c {
539 '<' => {
540 result.push_str("<");
541 }
542 '>' => {
543 result.push_str(">");
544 }
545 '&' => {
546 result.push_str("&");
547 }
548 '"' => {
549 result.push_str(""");
550 }
551 '\'' => {
552 result.push_str("'");
553 }
554 '/' => {
555 result.push_str("/");
556 }
557 _ => {
558 result.push(c);
559 }
560 };
561 }
562 result
563}
564
565macro_rules! derive_elements {
566 (
567 $(
568 $(#[$tag_meta:meta])*
569 $tag:ident {
570 $(
571 $(#[$attr_meta:meta])*
572 $attr_name:ident : $attr_value:ty
573 ),* $(,)?
574 }
575 )*
576 ) => {
577 $(
578 #[allow(non_camel_case_types)]
579 $(#[$tag_meta])*
580 pub struct $tag;
581
582 paste::paste! {
583 #[derive(Default)]
584 #[allow(non_snake_case)]
585 pub struct [<HTML $tag:camel Element Props>] {
586 // Global HTML attributes
587
588 /// The id attribute specifies a unique id for an HTML element
589 pub id: String,
590
591 /// A unique key to identify the element
592 pub key: String,
593
594 /// The class attribute specifies one or more class names for an HTML element
595 pub class: String,
596
597 /// The child nodes of the element
598 pub children: Vec<Node>,
599
600 /// The style attribute specifies an inline CSS style for an element
601 pub style: String,
602
603 /// The title attribute specifies extra information about an element (displayed as a tooltip)
604 pub title: Option<String>,
605 /// The width attribute specifies the width of the image
606 pub width: Option<String>,
607 /// The height attribute specifies the height of the image
608 pub height: Option<String>,
609
610 /// Specifies whether an element is draggable or not
611 pub draggable: bool,
612
613 /// Specifies visibility of an element (hidden or visible)
614 pub hidden: bool,
615
616 /// Specifies a shortcut key to activate/focus an element
617 pub accesskey: String,
618
619 /// Specifies whether the content of an element is editable or not
620 pub contenteditable: bool,
621
622 /// Specifies the text direction for the content in an element
623 pub dir: String,
624
625 /// Specifies the tabbing order of an element (when the tab button is used)
626 pub tabindex: Option<i32>,
627
628 /// Specifies whether the element is to have its spelling and grammar checked
629 pub spellcheck: bool,
630
631 /// Specifies the language of the element's content
632 pub lang: String,
633
634 /// Specifies whether an element is translateable or not
635 pub translate: bool,
636
637 /// Controls whether and how text input is automatically capitalized
638 pub autocapitalize: String,
639
640 /// Specifies an inline CSS style for an element
641 pub role: String,
642
643 /// Custom data attributes (data-*)
644 pub r#data: std::collections::HashMap<String, String>,
645
646 // ARIA Accessibility attributes
647
648 /// Identifies the current element within a set
649 pub aria_current: String,
650
651 /// Defines a string value that labels the current element
652 pub aria_label: Option<String>,
653
654 /// Identifies the element that labels the current element
655 pub aria_labelledby: Option<String>,
656
657 /// Identifies the element that describes the current element
658 pub aria_describedby: Option<String>,
659
660 /// Indicates whether an element is expanded or collapsed
661 pub aria_expanded: bool,
662
663 /// Indicates the element that represents the current item within a container or set
664 pub aria_selected: bool,
665
666 /// Indicates whether the element is checked, unchecked, or represents mixed mode
667 pub aria_checked: String,
668
669 /// Indicates whether an element and its subtree are hidden
670 pub aria_hidden: bool,
671
672 /// Indicates the availability and type of interactive popup element
673 pub aria_haspopup: String,
674
675 /// Defines an element's role
676 pub aria_role: String,
677
678 // Element specific attributes
679 $(
680 pub $attr_name: $attr_value,
681 )*
682 }
683
684 impl [<HTML $tag:camel Element Props>] {
685 fn to_attributes(&self) -> IndexMap<String, String> {
686 #[allow(unused_mut)]
687 let mut attributes = IndexMap::new();
688 $(
689 if !self.$attr_name.value().is_empty() {
690 let mut key = stringify!($attr_name);
691 if let Some(last_char) = key.chars().last() {
692 if last_char == '_' {
693 key = &key[..key.len() - 1];
694 }
695 }
696 attributes.insert(key.replace('_', "-"), self.$attr_name.value());
697 }
698 )*
699 if !self.id.value().is_empty() {
700 attributes.insert("id".to_string(), self.id.value());
701 }
702 if !self.class.value().is_empty() {
703 attributes.insert("class".to_string(), self.class.value());
704 }
705 if !self.style.value().is_empty() {
706 attributes.insert("style".to_string(), self.style.value());
707 }
708 if !self.title.value().is_empty() {
709 attributes.insert("title".to_string(), self.title.value());
710 }
711 if self.draggable {
712 attributes.insert("draggable".to_string(), "true".to_string());
713 }
714 if self.hidden {
715 attributes.insert("hidden".to_string(), "true".to_string());
716 }
717 if !self.accesskey.value().is_empty() {
718 attributes.insert("accesskey".to_string(), self.accesskey.value());
719 }
720 if self.contenteditable {
721 attributes.insert("contenteditable".to_string(), "true".to_string());
722 }
723 if !self.dir.value().is_empty() {
724 attributes.insert("dir".to_string(), self.dir.value());
725 }
726 if let Some(tabindex) = self.tabindex {
727 attributes.insert("tabindex".to_string(), tabindex.to_string());
728 }
729 if self.spellcheck {
730 attributes.insert("spellcheck".to_string(), "true".to_string());
731 }
732 if !self.lang.value().is_empty() {
733 attributes.insert("lang".to_string(), self.lang.value());
734 }
735 if self.translate {
736 attributes.insert("translate".to_string(), "true".to_string());
737 }
738 if !self.autocapitalize.value().is_empty() {
739 attributes.insert("autocapitalize".to_string(), self.autocapitalize.value());
740 }
741 if !self.role.value().is_empty() {
742 attributes.insert("role".to_string(), self.role.value());
743 }
744 if !self.aria_current.value().is_empty() {
745 attributes.insert("aria-current".to_string(), self.aria_current.value());
746 }
747 if !self.aria_label.value().is_empty() {
748 attributes.insert("aria-label".to_string(), self.aria_label.value());
749 }
750 if !self.aria_labelledby.value().is_empty() {
751 attributes.insert("aria-labelledby".to_string(), self.aria_labelledby.value());
752 }
753 if !self.aria_describedby.value().is_empty() {
754 attributes.insert("aria-describedby".to_string(), self.aria_describedby.value());
755 }
756 if self.aria_expanded {
757 attributes.insert("aria-expanded".to_string(), "true".to_string());
758 }
759 if self.aria_selected {
760 attributes.insert("aria-selected".to_string(), "true".to_string());
761 }
762 if !self.aria_checked.value().is_empty() {
763 attributes.insert("aria-checked".to_string(), self.aria_checked.value());
764 }
765 if self.aria_hidden {
766 attributes.insert("aria-hidden".to_string(), "true".to_string());
767 }
768 if !self.aria_haspopup.value().is_empty() {
769 attributes.insert("aria-haspopup".to_string(), self.aria_haspopup.value());
770 }
771 if !self.aria_role.value().is_empty() {
772 attributes.insert("aria-role".to_string(), self.aria_role.value());
773 }
774 // Add data-* attributes
775 for (key, value) in &self.r#data {
776 if key.starts_with("data_") {
777 attributes.insert(key.replace("_", "-"), value.clone());
778 } else {
779 attributes.insert(format!("data-{}", key), value.clone());
780 }
781 }
782
783 attributes
784 }
785 }
786
787 impl Component for $tag {
788 type Props = [<HTML $tag:camel Element Props>];
789
790 fn render(props: Self::Props) -> Node {
791 Node::Element(Element {
792 tag: stringify!($tag).to_string(),
793 attributes: props.to_attributes(),
794 children: props.children,
795 })
796 }
797 }
798 }
799 )*
800 };
801}
802
803pub mod elements {
804 use super::*;
805 derive_elements! {
806 /// HTML `<html>` element - Root element of an HTML document
807 html {
808 }
809 /// HTML `<body>` element - Represents the content of an HTML document
810 ///
811 /// Example:
812 ///
813 /// ```<body>Content goes here</body>```
814 body {
815 }
816 /// HTML `<head>` element - Contains metadata about the document
817 ///
818 /// Example:
819 ///
820 /// ```<head><title>Document Title</title></head>```
821 head {
822 }
823 /// HTML `<title>` element - Defines the title of the document
824 ///
825 /// Example:
826 ///
827 /// ```<title>Document Title</title>```
828 title {
829 }
830 /// HTML `<meta` element - Provides metadata about the document
831 ///
832 /// Example:
833 ///
834 /// ```<meta charset="UTF-8">```
835 meta {
836 /// The character encoding of the document
837 charset: String,
838 /// The HTTP response status code
839 http_equiv: String,
840 /// The content of the document
841 content: String,
842 /// The name of the metadata
843 name: String,
844 /// The property of the metadata
845 property: String,
846 }
847 /// HTML `<style>` element - Defines style information for a document
848 ///
849 /// Example:
850 ///
851 /// ```<style>body { background-color: #f0f0f0; }</style>```
852 style {
853 }
854 /// HTML `<script>` element - Embeds executable code or data
855 ///
856 /// Example:
857 ///
858 /// ```<script src="script.js"></script>```
859 script {
860 /// The URL of the external script file
861 src: String,
862 /// The type of the script
863 type_: String,
864 /// The language of the script
865 language: String,
866 /// The character encoding of the script
867 charset: String,
868 /// The defer attribute specifies that the script will be executed after the document is finished parsing
869 defer: bool,
870 /// The async attribute specifies that the script will be executed asynchronously
871 async_: bool,
872 }
873 /// HTML `<link>` element - Specifies relationships between the current document and an external resource
874 ///
875 /// Example:
876 ///
877 /// ```<link rel="stylesheet" href="style.css">```
878 link {
879 /// The relationship between the current document and the linked resource
880 rel: String,
881 /// The URL of the linked resource
882 href: String,
883 /// The type of the linked resource
884 type_: String,
885 /// The character encoding of the linked resource
886 charset: String,
887 /// crossorigin attribute specifies that the element will request a cross-origin Isolation of its browsing context
888 crossorigin: String,
889 /// The referrerpolicy attribute specifies the referrer policy for the linked resource
890 referrerpolicy: String,
891 }
892 /// HTML `<div>` element - Container element for grouping and styling content
893 ///
894 /// Example:
895 ///
896 /// ```<div class="container">Content goes here</div>```
897 div {
898 }
899
900 /// HTML `<p>` element - Represents a paragraph of text
901 ///
902 /// Example:
903 ///
904 /// ```<p>This is a paragraph of text.</p>```
905 p {
906 }
907
908 /// HTML `<span>` element - Inline container for targeting text with styles
909 ///
910 /// Example:
911 ///
912 /// ```<span class="highlight">Highlighted text</span>```
913 span {
914 }
915
916 /// HTML `<a>` element - Creates a hyperlink to other web pages or resources
917 ///
918 /// Example:
919 ///
920 /// ```<a href="https://example.com" target="_blank">Visit Example</a>```
921 a {
922 /// The href attribute specifies the URL of the page the link goes to
923 /// Example: href="https://example.com"
924 href: String,
925 /// The target attribute specifies where to open the linked document
926 /// Example: target="_blank" (opens in new tab)
927 target: String,
928 /// The rel attribute specifies the relationship between the current document and the linked document
929 /// Example: rel="nofollow" (tells search engines not to follow this link)
930 rel: String,
931 /// The download attribute indicates the browser to download the URL instead of navigating
932 /// Example: download="filename.pdf"
933 download: String,
934 /// The hreflang attribute specifies the language of the linked document
935 /// Example: hreflang="en" (English)
936 hreflang: String,
937 /// The type attribute specifies the media type of the linked document
938 /// Example: type="text/html"
939 type_: String,
940 /// The media attribute specifies what media/device the linked document is optimized for
941 /// Example: media="print" (for print stylesheets)
942 media: String,
943 /// The referrerpolicy attribute specifies which referrer information to send
944 /// Example: referrerpolicy="no-referrer"
945 referrerpolicy: String,
946 /// The ping attribute specifies URLs to be notified when the link is followed
947 /// Example: ping="https://example.com/track"
948 ping: String,
949 }
950
951 /// HTML `<h1>` element - First level heading (most important)
952 ///
953 /// Example:
954 ///
955 /// ```<h1>Main Page Title</h1>```
956 h1 {
957 }
958
959 /// HTML `<h2>` element - Second level heading
960 ///
961 /// Example:
962 ///
963 /// ```<h2>Section Heading</h2>```
964 h2 {
965 }
966
967 /// HTML `<h3>` element - Third level heading
968 ///
969 /// Example:
970 ///
971 /// ```<h3>Subsection Heading</h3>```
972 h3 {
973 }
974
975 /// HTML `<h4>` element - Fourth level heading
976 ///
977 /// Example:
978 ///
979 /// ```<h4>Sub-subsection Heading</h4>```
980 h4 {
981 }
982
983 /// HTML `<h5>` element - Fifth level heading
984 ///
985 /// Example:
986 ///
987 /// ```<h5>Minor Heading</h5>```
988 h5 {
989 }
990
991 /// HTML `<h6>` element - Sixth level heading (least important)
992 ///
993 /// Example:
994 ///
995 /// ```<h6>Fine Detail Heading</h6>```
996 h6 {
997 }
998
999 /// HTML `<img>` element - Embeds an image into the document
1000 ///
1001 /// Example:
1002 ///
1003 /// ```<img src="image.jpg" alt="Description of image">```
1004 img {
1005 /// The src attribute specifies the URL/path to the image
1006 /// Example: src="images/logo.png"
1007 src: String,
1008 /// The alt attribute provides alternative text for screen readers and if image fails to load
1009 /// Example: alt="Company Logo"
1010 alt: String,
1011 /// The loading attribute indicates how the browser should load the image
1012 /// Example: loading="lazy" (defers loading until it's near viewport)
1013 loading: String,
1014 }
1015
1016 /// HTML `<br>` element - Produces a line break in text
1017 ///
1018 /// Example:
1019 ///
1020 /// ```<br>```
1021 br {}
1022
1023 /// HTML `<hr>` element - Creates a horizontal rule (divider)
1024 ///
1025 /// Example:
1026 ///
1027 /// ```<hr>```
1028 hr {
1029 }
1030
1031 /// HTML `<ul>` element - Unordered list with bullet points
1032 ///
1033 /// Example:
1034 ///
1035 /// ```<ul><li>Item 1</li><li>Item 2</li></ul>```
1036 ul {
1037 /// The type attribute specifies the bullet style (disc, circle, square)
1038 /// Example: type="square"
1039 type_: String,
1040 }
1041
1042 /// HTML `<li>` element - List item within ordered or unordered lists
1043 ///
1044 /// Example:
1045 ///
1046 /// ```<li>List item content</li>```
1047 li {
1048 /// The value attribute specifies the start value of the list item (for ol)
1049 /// Example: value="3" (starts this item at number 3)
1050 value: Option<i32>,
1051 }
1052
1053 /// HTML `<ol>` element - Ordered (numbered) list
1054 ///
1055 /// Example:
1056 ///
1057 /// ```<ol start="5" type="A"><li>Item E</li><li>Item F</li></ol>```
1058 ol {
1059 /// The type attribute specifies the numbering type (1, A, a, I, i)
1060 /// Example: type="A" (uses capital letters)
1061 type_: String,
1062 /// The start attribute specifies the start value of the list
1063 /// Example: start="5" (starts counting from 5)
1064 start: i32,
1065 /// The reversed attribute specifies that list should be in descending order
1066 /// Example: reversed (counts down instead of up)
1067 reversed: bool,
1068 }
1069
1070 /// HTML `<table>` element - Creates a data table with rows and columns
1071 ///
1072 /// Example:
1073 ///
1074 /// ```<table border="1"><tr><th>Header</th></tr><tr><td>Data</td></tr></table>```
1075 table {
1076 /// The border attribute specifies the width of the border around the table
1077 /// Example: border="1" (1 pixel border)
1078 border: i32,
1079 /// The cellpadding attribute specifies the space between cell content and borders
1080 /// Example: cellpadding="5" (5 pixels of padding)
1081 cellpadding: i32,
1082 /// The cellspacing attribute specifies the space between cells
1083 /// Example: cellspacing="2" (2 pixels between cells)
1084 cellspacing: i32,
1085 }
1086
1087 /// HTML `<tr>` element - Table row container
1088 ///
1089 /// Example:
1090 ///
1091 /// ```<tr><td>Cell 1</td><td>Cell 2</td></tr>```
1092 tr {
1093 }
1094
1095 /// HTML `<td>` element - Table data cell
1096 ///
1097 /// Example:
1098 ///
1099 /// ```<td colspan="2">This cell spans two columns</td>```
1100 td {
1101 /// The colspan attribute specifies how many columns a cell should span
1102 /// Example: colspan="3" (cell spans 3 columns)
1103 colspan: i32,
1104 /// The rowspan attribute specifies how many rows a cell should span
1105 /// Example: rowspan="2" (cell spans 2 rows)
1106 rowspan: i32,
1107 /// The headers attribute associates data cells with header cells
1108 /// Example: headers="col1 row1" (associates with those header IDs)
1109 headers: String,
1110 /// The scope attribute specifies whether header cells are for rows or columns
1111 /// Example: scope="col" (header applies to whole column)
1112 scope: String,
1113 }
1114
1115 /// HTML `<th>` element - Table header cell
1116 ///
1117 /// Example:
1118 ///
1119 /// ```<th scope="col">Column Header</th>```
1120 th {
1121 /// The colspan attribute specifies how many columns a cell should span
1122 /// Example: colspan="3" (header spans 3 columns)
1123 colspan: i32,
1124 /// The rowspan attribute specifies how many rows a cell should span
1125 /// Example: rowspan="2" (header spans 2 rows)
1126 rowspan: i32,
1127 /// The headers attribute associates data cells with header cells
1128 /// Example: headers="col1 row1" (associates with those header IDs)
1129 headers: String,
1130 /// The scope attribute specifies whether the header cell is for a row, column, etc.
1131 /// Example: scope="row" (header applies to whole row)
1132 scope: String,
1133 }
1134
1135 /// HTML `<tbody>` element - Groups body content in a table
1136 ///
1137 /// Example:
1138 ///
1139 /// ```<table><tbody><tr><td>Data</td></tr></tbody></table>```
1140 tbody {
1141 }
1142
1143 /// HTML `<thead>` element - Groups header content in a table
1144 ///
1145 /// Example:
1146 ///
1147 /// ```<table><thead><tr><th>Header</th></tr></thead><tbody>...</tbody></table>```
1148 thead {
1149 }
1150
1151 /// HTML `<tfoot>` element - Groups footer content in a table
1152 ///
1153 /// Example:
1154 ///
1155 /// ```<table><thead>...</thead><tbody>...</tbody><tfoot><tr><td>Summary</td></tr></tfoot></table>```
1156 tfoot {
1157 }
1158
1159 /// HTML `<form>` element - Container for interactive inputs to collect user data
1160 ///
1161 /// Example:
1162 ///
1163 /// ```<form action="/submit" method="post"><input type="text"><button type="submit">Submit</button></form>```
1164 form {
1165 /// The action attribute specifies where to send form data when submitted
1166 ///
1167 /// Example: action="/process-form.php"
1168 action: String,
1169 /// The method attribute specifies HTTP method for sending data (GET/POST)
1170 ///
1171 /// Example: method="post" (sends data in request body)
1172 method: String,
1173 /// The target attribute specifies where to display the response
1174 ///
1175 /// Example: target="_blank" (opens response in new tab)
1176 target: String,
1177 /// The enctype attribute specifies how form data should be encoded
1178 ///
1179 /// Example: enctype="multipart/form-data" (needed for file uploads)
1180 enctype: String,
1181 /// The novalidate attribute disables browser's built-in form validation
1182 ///
1183 /// Example: novalidate (skips validation)
1184 novalidate: bool,
1185 /// The autocomplete attribute controls browser autofill behavior
1186 ///
1187 /// Example: autocomplete="off" (disables autofill)
1188 autocomplete: String,
1189 /// The accept attribute specifies file types the server accepts (for file inputs)
1190 ///
1191 /// Example: accept=".jpg,.png" (accepts only those image formats)
1192 accept: String,
1193 /// Example: name="contact-form"
1194 name: String,
1195 }
1196
1197 /// HTML `<input>` element - Creates interactive controls for forms
1198 ///
1199 /// Example:
1200 ///
1201 /// ```<input type="text" placeholder="Enter your name" required>```
1202 input {
1203 /// The type attribute specifies the input type (text, password, email, etc.)
1204 ///
1205 /// Example: type="email" (validates as email address)
1206 type_: String,
1207 /// The placeholder attribute shows hint text when field is empty
1208 ///
1209 /// Example: placeholder="Enter your email"
1210 placeholder: Option<String>,
1211 /// The required attribute makes the field mandatory
1212 ///
1213 /// Example: required (field must be filled)
1214 required: Option<bool>,
1215 /// The value attribute specifies the default/current value
1216 ///
1217 /// Example: value="Default text"
1218 value: Option<String>,
1219 /// The name attribute specifies the name of the input (for form submission)
1220 ///
1221 /// Example: name="email"
1222 name: String,
1223 /// The disabled attribute disables the input
1224 ///
1225 /// Example: disabled (user cannot interact with input)
1226 disabled: Option<bool>,
1227 /// The readonly attribute makes the input read-only
1228 ///
1229 /// Example: readonly (user cannot modify but can focus/select)
1230 readonly: Option<bool>,
1231 /// The min attribute specifies minimum value for number/date inputs
1232 ///
1233 /// Example: min="1" (number input minimum value)
1234 min: Option<String>,
1235 /// The max attribute specifies maximum value for number/date inputs
1236 ///
1237 /// Example: max="100" (number input maximum value)
1238 max: Option<String>,
1239 /// The pattern attribute specifies a regex pattern for validation
1240 ///
1241 /// Example: pattern="[0-9]{3}" (requires exactly 3 digits)
1242 pattern: Option<String>,
1243 /// The autocomplete attribute controls browser autofill for this field
1244 ///
1245 /// Example: autocomplete="current-password"
1246 autocomplete: Option<String>,
1247 }
1248
1249 /// HTML `<textarea>` element - Multi-line text input control
1250 ///
1251 /// Example:
1252 ///
1253 /// ```<textarea rows="4" cols="50" placeholder="Your message here"></textarea>```
1254 textarea {
1255 /// The placeholder attribute shows hint text when field is empty
1256 /// Example: placeholder="Enter your comments"
1257 placeholder: String,
1258 /// The required attribute makes the field mandatory
1259 /// Example: required (must be filled before submission)
1260 required: bool,
1261 /// The value attribute specifies the default/current text content
1262 /// Example: value="Default text in the textarea"
1263 value: String,
1264 /// The rows attribute specifies visible number of text lines
1265 /// Example: rows="10" (shows 10 lines of text)
1266 rows: i32,
1267 /// The cols attribute specifies visible width in average characters
1268 /// Example: cols="40" (about 40 characters wide)
1269 cols: i32,
1270 /// The name attribute specifies the name of the textarea (for form submission)
1271 /// Example: name="comments"
1272 name: String,
1273 /// The disabled attribute disables the textarea
1274 /// Example: disabled (user cannot interact)
1275 disabled: bool,
1276 /// The readonly attribute makes the textarea read-only
1277 /// Example: readonly (user cannot modify but can focus/select)
1278 readonly: bool,
1279 /// The maxlength attribute specifies maximum character count
1280 /// Example: maxlength="500" (limits to 500 characters)
1281 maxlength: i32,
1282 }
1283
1284 /// HTML `<button>` element - Clickable button control
1285 ///
1286 /// Example:
1287 ///
1288 /// ```<button type="submit">Click Me</button>```
1289 button {
1290 /// The type attribute specifies button function (submit, reset, button)
1291 /// Example: type="submit" (submits the form)
1292 type_: String,
1293 /// The value attribute specifies the value associated with the button
1294 /// Example: value="btn1" (for form processing)
1295 value: String,
1296 /// The disabled attribute disables the button
1297 /// Example: disabled (button cannot be clicked)
1298 disabled: bool,
1299 /// The name attribute specifies the name of the button (for form submission)
1300 /// Example: name="submit-button"
1301 name: String,
1302 /// The formaction attribute overrides form's action for this button
1303 /// Example: formaction="/alternative-submit"
1304 formaction: String,
1305 /// The formmethod attribute overrides form's method for this button
1306 /// Example: formmethod="get"
1307 formmethod: String,
1308 }
1309
1310 /// HTML `<select>` element - Dropdown selection list
1311 ///
1312 /// Example:
1313 ///
1314 /// ```<select><option value="1">Option 1</option><option value="2">Option 2</option></select>```
1315 select {
1316 /// The multiple attribute allows selecting multiple options
1317 /// Example: multiple (user can select multiple items)
1318 multiple: bool,
1319 /// The disabled attribute disables the dropdown
1320 /// Example: disabled (user cannot interact)
1321 disabled: bool,
1322 /// The value attribute specifies the selected value
1323 /// Example: value="option2" (preselects this option)
1324 value: String,
1325 /// The name attribute specifies the name of the select (for form submission)
1326 /// Example: name="country"
1327 name: String,
1328 /// The size attribute specifies number of visible options
1329 /// Example: size="5" (shows 5 options at once)
1330 size: i32,
1331 /// The required attribute makes selection mandatory
1332 /// Example: required (user must select an option)
1333 required: bool,
1334 }
1335
1336 /// HTML `<option>` element - Defines option in a select dropdown
1337 ///
1338 /// Example:
1339 ///
1340 /// ```<option value="blue" selected>Blue</option>```
1341 option {
1342 /// The value attribute specifies the value to be sent to server
1343 /// Example: value="NY" (value sent when this option is selected)
1344 value: String,
1345 /// The selected attribute preselects this option when page loads
1346 /// Example: selected (this option is selected by default)
1347 selected: bool,
1348 /// The disabled attribute makes this option unselectable
1349 /// Example: disabled (cannot be chosen)
1350 disabled: bool,
1351 }
1352
1353 /// HTML `<label>` element - Caption for a form control
1354 ///
1355 /// Example:
1356 ///
1357 /// ```<label for="username">Username:</label><input id="username">```
1358 label {
1359 /// The for attribute connects the label to a form control by ID
1360 /// Example: for="email" (associates with input having id="email")
1361 for_: String,
1362 }
1363
1364 /// HTML `<iframe>` element - Embeds another document within the current HTML document
1365 ///
1366 /// Example:
1367 ///
1368 /// ```<iframe src="https://example.com" title="Example Site"></iframe>```
1369 iframe {
1370 /// The src attribute specifies the URL of the embedded document
1371 /// Example: src="https://maps.google.com"
1372 src: String,
1373 /// The frameborder attribute specifies whether to display a border
1374 /// Example: frameborder="0" (no border)
1375 frameborder: String,
1376 /// The allow attribute specifies features allowed in the iframe
1377 /// Example: allow="camera; microphone" (permits access to these devices)
1378 allow: String,
1379 /// The allowfullscreen attribute allows iframe content to go fullscreen
1380 /// Example: allowfullscreen (allows fullscreen mode)
1381 allowfullscreen: bool,
1382 /// The sandbox attribute restricts iframe capabilities for security
1383 /// Example: sandbox="allow-scripts" (only allows scripts to run)
1384 sandbox: String,
1385 }
1386
1387 /// HTML `<video>` element - Embeds video content in the document
1388 ///
1389 /// Example:
1390 ///
1391 /// ```<video src="movie.mp4" controls width="500">Video not supported</video>```
1392 video {
1393 /// The src attribute specifies URL/path of the video
1394 /// Example: src="videos/intro.mp4"
1395 src: String,
1396 /// The controls attribute displays video playback controls
1397 /// Example: controls (shows play/pause/volume controls)
1398 controls: bool,
1399 /// The autoplay attribute starts playing video automatically
1400 /// Example: autoplay (video plays when page loads)
1401 autoplay: bool,
1402 /// The loop attribute makes the video replay when finished
1403 /// Example: loop (continuously replays)
1404 loop_: bool,
1405 /// The poster attribute specifies an image shown before video plays
1406 /// Example: poster="thumbnail.jpg"
1407 poster: String,
1408 /// The muted attribute mutes the audio by default
1409 /// Example: muted (starts with no sound)
1410 muted: bool,
1411 /// The preload attribute hints how to preload the video
1412 /// Example: preload="auto" (preload entire video)
1413 preload: String,
1414 /// The playsinline attribute plays inline on iOS (instead of fullscreen)
1415 /// Example: playsinline (important for iPhone users)
1416 playsinline: bool,
1417 }
1418
1419 /// HTML `<audio>` element - Embeds sound content in the document
1420 ///
1421 /// Example:
1422 ///
1423 /// ```<audio src="song.mp3" controls>Audio not supported</audio>```
1424 audio {
1425 /// The src attribute specifies URL/path of the audio file
1426 /// Example: src="audio/background-music.mp3"
1427 src: String,
1428 /// The controls attribute displays audio playback controls
1429 /// Example: controls (shows play/pause/volume controls)
1430 controls: bool,
1431 /// The autoplay attribute starts playing audio automatically
1432 /// Example: autoplay (audio plays when page loads)
1433 autoplay: bool,
1434 /// The loop attribute makes the audio replay when finished
1435 /// Example: loop (continuously replays)
1436 loop_: bool,
1437 /// The muted attribute mutes the audio by default
1438 /// Example: muted (starts with no sound)
1439 muted: bool,
1440 /// The preload attribute hints how to preload the audio
1441 /// Example: preload="none" (doesn't preload)
1442 preload: String,
1443 }
1444
1445 /// HTML `<source>` element - Defines media resources for video/audio elements
1446 ///
1447 /// Example:
1448 ///
1449 /// ```<video><source src="movie.mp4" type="video/mp4"><source src="movie.webm" type="video/webm"></video>```
1450 source {
1451 /// The src attribute specifies URL/path of the media resource
1452 /// Example: src="audio/song.ogg"
1453 src: String,
1454 /// The type attribute specifies the MIME type of the resource
1455 /// Example: type="video/webm" (defines file format)
1456 type_: String,
1457 /// The media attribute specifies for which media the resource is intended
1458 /// Example: media="(min-width: 600px)" (responsive resources)
1459 media: String,
1460 }
1461
1462 /// HTML `<canvas>` element - Container for graphics rendered with JavaScript
1463 ///
1464 /// Example:
1465 ///
1466 /// ```<canvas id="myCanvas" width="200" height="100">Your browser does not support canvas</canvas>```
1467 canvas {
1468 }
1469
1470 /// HTML `<svg>` element - Container for SVG graphics
1471 ///
1472 /// Example:
1473 ///
1474 /// ```<svg viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="red" /></svg>```
1475 svg {
1476 /// The viewBox attribute defines coordinate system and aspect ratio
1477 /// Example: viewBox="0 0 800 600" (x, y, width, height)
1478 viewBox: String,
1479 /// The preserveAspectRatio attribute controls scaling behavior
1480 /// Example: preserveAspectRatio="xMidYMid meet" (center and scale)
1481 preserve_aspect_ratio: String,
1482 /// The xmlns attribute defines the XML namespace (required for standalone SVG)
1483 /// Example: xmlns="http://www.w3.org/2000/svg"
1484 xmlns: String,
1485 /// The fill attribute specifies the fill color
1486 /// Example: fill="#3498db" (blue fill)
1487 fill: String,
1488 /// The stroke attribute specifies the outline color
1489 /// Example: stroke="#e74c3c" (red outline)
1490 stroke: String,
1491 /// The stroke-width attribute specifies the width of the outline
1492 /// Example: stroke-width="3" (3 units thick)
1493 stroke_width: String,
1494 /// The stroke-linecap attribute specifies line end style
1495 /// Example: stroke-linecap="round" (rounded ends)
1496 stroke_linecap: String,
1497 /// The stroke-linejoin attribute specifies how line joins are rendered
1498 /// Example: stroke-linejoin="miter" (pointed corners)
1499 stroke_linejoin: String,
1500 /// The stroke-miterlimit attribute limits the length of miters
1501 /// Example: stroke-miterlimit="4" (limits pointy corners)
1502 stroke_miterlimit: String,
1503 /// The stroke-dasharray attribute creates dashed lines
1504 /// Example: stroke-dasharray="5,5" (5 units on, 5 units off)
1505 stroke_dasharray: String,
1506 /// The stroke-dashoffset attribute adjusts dash pattern start
1507 /// Example: stroke-dashoffset="10" (starts 10 units into pattern)
1508 stroke_dashoffset: String,
1509 /// The stroke-opacity attribute sets stroke transparency
1510 /// Example: stroke-opacity="0.5" (50% transparent)
1511 stroke_opacity: String,
1512 /// The fill-opacity attribute sets fill transparency
1513 /// Example: fill-opacity="0.7" (70% opaque)
1514 fill_opacity: String,
1515 }
1516
1517 /// HTML `<path>` element - Defines a path in SVG graphics
1518 ///
1519 /// Example:
1520 ///
1521 /// ```<path d="M10 10 H 90 V 90 H 10 Z" fill="transparent" stroke="black" />```
1522 path {
1523 /// The d attribute defines the path to be drawn
1524 /// Example: d="M20,20 L80,20 L80,80 L20,80 Z" (square path)
1525 d: String,
1526 /// The fill attribute specifies the fill color
1527 /// Example: fill="#3498db" (blue fill)
1528 fill: String,
1529 /// The stroke attribute specifies the outline color
1530 /// Example: stroke="#e74c3c" (red outline)
1531 stroke: String,
1532 /// The stroke-width attribute specifies the width of the outline
1533 /// Example: stroke-width="3" (3 units thick)
1534 stroke_width: String,
1535 /// The stroke-linecap attribute specifies line end style
1536 /// Example: stroke-linecap="round" (rounded ends)
1537 stroke_linecap: String,
1538 /// The stroke-linejoin attribute specifies how line joins are rendered
1539 /// Example: stroke-linejoin="miter" (pointed corners)
1540 stroke_linejoin: String,
1541 /// The stroke-miterlimit attribute limits the length of miters
1542 /// Example: stroke-miterlimit="4" (limits pointy corners)
1543 stroke_miterlimit: String,
1544 /// The stroke-dasharray attribute creates dashed lines
1545 /// Example: stroke-dasharray="5,5" (5 units on, 5 units off)
1546 stroke_dasharray: String,
1547 /// The stroke-dashoffset attribute adjusts dash pattern start
1548 /// Example: stroke-dashoffset="10" (starts 10 units into pattern)
1549 stroke_dashoffset: String,
1550 /// The stroke-opacity attribute sets stroke transparency
1551 /// Example: stroke-opacity="0.5" (50% transparent)
1552 stroke_opacity: String,
1553 /// The fill-opacity attribute sets fill transparency
1554 /// Example: fill-opacity="0.7" (70% opaque)
1555 fill_opacity: String,
1556 }
1557
1558 /// HTML `<rect>` element - Draws a rectangle in SVG
1559 ///
1560 /// Example:
1561 ///
1562 /// ```<rect x="10" y="10" width="100" height="50" fill="blue" />```
1563 rect {
1564 /// The x attribute specifies the x-coordinate of the rectangle
1565 /// Example: x="25" (25 units from the left)
1566 x: String,
1567 /// The y attribute specifies the y-coordinate of the rectangle
1568 /// Example: y="50" (50 units from the top)
1569 y: String,
1570 /// The rx attribute specifies the horizontal corner radius
1571 /// Example: rx="10" (rounded corners)
1572 rx: String,
1573 /// The ry attribute specifies the vertical corner radius
1574 /// Example: ry="10" (rounded corners)
1575 ry: String,
1576 /// The fill attribute specifies the fill color
1577 /// Example: fill="#2ecc71" (green fill)
1578 fill: String,
1579 /// The stroke attribute specifies the outline color
1580 /// Example: stroke="#27ae60" (darker green outline)
1581 stroke: String,
1582 /// The stroke-width attribute specifies the width of the outline
1583 /// Example: stroke-width="2" (2 units thick)
1584 stroke_width: String,
1585 }
1586
1587 /// HTML `<circle>` element - Draws a circle in SVG
1588 ///
1589 /// Example:
1590 ///
1591 /// ```<circle cx="50" cy="50" r="40" fill="red" />```
1592 circle {
1593 /// The cx attribute specifies the x-coordinate of the center
1594 /// Example: cx="100" (center x at 100 units)
1595 cx: String,
1596 /// The cy attribute specifies the y-coordinate of the center
1597 /// Example: cy="100" (center y at 100 units)
1598 cy: String,
1599 /// The r attribute specifies the radius of the circle
1600 /// Example: r="75" (75 units radius)
1601 r: String,
1602 /// The fill attribute specifies the fill color
1603 /// Example: fill="#9b59b6" (purple fill)
1604 fill: String,
1605 /// The stroke attribute specifies the outline color
1606 /// Example: stroke="#8e44ad" (darker purple outline)
1607 stroke: String,
1608 /// The stroke-width attribute specifies the width of the outline
1609 /// Example: stroke-width="3" (3 units thick)
1610 stroke_width: String,
1611 }
1612
1613 /// HTML `<ellipse>` element - Draws an ellipse in SVG
1614 ///
1615 /// Example:
1616 ///
1617 /// ```<ellipse cx="100" cy="50" rx="100" ry="50" fill="yellow" />```
1618 ellipse {
1619 /// The cx attribute specifies the x-coordinate of the center
1620 /// Example: cx="150" (center x at 150 units)
1621 cx: String,
1622 /// The cy attribute specifies the y-coordinate of the center
1623 /// Example: cy="75" (center y at 75 units)
1624 cy: String,
1625 /// The rx attribute specifies the horizontal radius
1626 /// Example: rx="100" (100 units horizontal radius)
1627 rx: String,
1628 /// The ry attribute specifies the vertical radius
1629 /// Example: ry="50" (50 units vertical radius)
1630 ry: String,
1631 /// The fill attribute specifies the fill color
1632 /// Example: fill="#f1c40f" (yellow fill)
1633 fill: String,
1634 /// The stroke attribute specifies the outline color
1635 /// Example: stroke="#f39c12" (darker yellow outline)
1636 stroke: String,
1637 /// The stroke-width attribute specifies the width of the outline
1638 /// Example: stroke-width="2" (2 units thick)
1639 stroke_width: String,
1640 }
1641
1642 /// HTML `<line>` element - Draws a line in SVG
1643 ///
1644 /// Example:
1645 ///
1646 /// ```<line x1="0" y1="0" x2="100" y2="100" stroke="black" />```
1647 line {
1648 /// The x1 attribute specifies the x-coordinate of the start point
1649 /// Example: x1="10" (starts 10 units from left)
1650 x1: String,
1651 /// The y1 attribute specifies the y-coordinate of the start point
1652 /// Example: y1="10" (starts 10 units from top)
1653 y1: String,
1654 /// The x2 attribute specifies the x-coordinate of the end point
1655 /// Example: x2="200" (ends 200 units from left)
1656 x2: String,
1657 /// The y2 attribute specifies the y-coordinate of the end point
1658 /// Example: y2="200" (ends 200 units from top)
1659 y2: String,
1660 /// The stroke attribute specifies the line color
1661 /// Example: stroke="#34495e" (dark blue line)
1662 stroke: String,
1663 /// The stroke-width attribute specifies the width of the line
1664 /// Example: stroke-width="5" (5 units thick)
1665 stroke_width: String,
1666 /// The stroke-linecap attribute specifies line end style
1667 /// Example: stroke-linecap="round" (rounded ends)
1668 stroke_linecap: String,
1669 /// The stroke-dasharray attribute creates dashed lines
1670 /// Example: stroke-dasharray="10,5" (10 units on, 5 units off)
1671 stroke_dasharray: String,
1672 }
1673
1674 /// HTML `<polyline>` element - Draws connected straight lines in SVG
1675 ///
1676 /// Example:
1677 ///
1678 /// ```<polyline points="20,20 40,25 60,40 80,120 120,140 200,180" stroke="orange" fill="none" />```
1679 polyline {
1680 /// The points attribute specifies coordinates for each point
1681 /// Example: points="0,0 50,50 100,25" (series of x,y pairs)
1682 points: String,
1683 /// The fill attribute specifies the fill color between lines
1684 /// Example: fill="none" (transparent fill)
1685 fill: String,
1686 /// The stroke attribute specifies the line color
1687 /// Example: stroke="#e67e22" (orange line)
1688 stroke: String,
1689 /// The stroke-width attribute specifies the width of the lines
1690 /// Example: stroke-width="3" (3 units thick)
1691 stroke_width: String,
1692 /// The stroke-linejoin attribute specifies how lines are joined
1693 /// Example: stroke-linejoin="round" (rounded corners)
1694 stroke_linejoin: String,
1695 }
1696
1697 /// HTML `<polygon>` element - Draws a closed shape with straight lines in SVG
1698 ///
1699 /// Example:
1700 ///
1701 /// ```<polygon points="200,10 250,190 160,210" fill="green" />```
1702 polygon {
1703 /// The points attribute specifies coordinates for each point
1704 /// Example: points="50,50 150,50 100,150" (triangle coordinates)
1705 points: String,
1706 /// The fill attribute specifies the fill color of the shape
1707 /// Example: fill="#1abc9c" (teal fill)
1708 fill: String,
1709 /// The stroke attribute specifies the outline color
1710 /// Example: stroke="#16a085" (darker teal outline)
1711 stroke: String,
1712 /// The stroke-width attribute specifies the width of the outline
1713 /// Example: stroke-width="2" (2 units thick)
1714 stroke_width: String,
1715 /// The fill-rule attribute specifies how to fill shapes with holes
1716 /// Example: fill-rule="evenodd" (alternates fill for nested shapes)
1717 fill_rule: String,
1718 }
1719
1720 /// HTML `<g>` element - Groups SVG elements together
1721 ///
1722 /// Example:
1723 ///
1724 /// ```<g transform="rotate(45 50 50)"><rect x="20" y="20" width="60" height="60" /></g>```
1725 g {
1726 /// The transform attribute applies transformations to the group
1727 /// Example: transform="translate(100,50) scale(2)" (moves and scales)
1728 transform: String,
1729 /// The fill attribute specifies the fill color for all elements in the group
1730 /// Example: fill="#3498db" (blue fill for all children)
1731 fill: String,
1732 /// The stroke attribute specifies the outline color for all elements in the group
1733 /// Example: stroke="#2980b9" (darker blue outline for all children)
1734 stroke: String,
1735 }
1736
1737 /// HTML `<use>` element - Reuses an SVG element defined elsewhere
1738 ///
1739 /// Example:
1740 ///
1741 /// ```<r#use href="#myCircle" x="10" y="10" fill="blue" />```
1742 r#use {
1743 /// The href attribute specifies which element to reuse
1744 /// Example: href="#icon-star" (references element with id="icon-star")
1745 href: String,
1746 /// The x attribute specifies the x-coordinate where to place the reused element
1747 /// Example: x="100" (100 units from left)
1748 x: String,
1749 /// The y attribute specifies the y-coordinate where to place the reused element
1750 /// Example: y="50" (50 units from top)
1751 y: String,
1752 }
1753
1754 /// HTML `<foreignObject>` element - Includes non-SVG elements inside SVG
1755 ///
1756 /// Example:
1757 ///
1758 /// ```<foreignObject x="20" y="20" width="160" height="160"><div>HTML content inside SVG</div></foreignObject>```
1759 foreignObject {
1760 /// The x attribute specifies the x-coordinate of the foreign object
1761 /// Example: x="25" (25 units from left)
1762 x: String,
1763 /// The y attribute specifies the y-coordinate of the foreign object
1764 /// Example: y="25" (25 units from top)
1765 y: String,
1766 }
1767
1768 /// HTML `<defs>` element - Container for reusable SVG elements
1769 ///
1770 /// Example:
1771 ///
1772 /// ```<defs><circle id="myCircle" cx="5" cy="5" r="4" /></defs>```
1773 defs {
1774 }
1775
1776 /// HTML `<linearGradient>` element - Defines a linear gradient for SVG fills
1777 ///
1778 /// Example:
1779 ///
1780 /// ```<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" style="stop-color:rgb(255,255,0)" /></linearGradient>```
1781 linearGradient {
1782 /// The x1 attribute defines the start point of the gradient (x-coordinate)
1783 /// Example: x1="0%" (starts at left edge)
1784 x1: String,
1785 /// The y1 attribute defines the start point of the gradient (y-coordinate)
1786 /// Example: y1="0%" (starts at top edge)
1787 y1: String,
1788 /// The x2 attribute defines the end point of the gradient (x-coordinate)
1789 /// Example: x2="100%" (ends at right edge)
1790 x2: String,
1791 /// The y2 attribute defines the end point of the gradient (y-coordinate)
1792 /// Example: y2="100%" (ends at bottom edge)
1793 y2: String,
1794 /// The gradientUnits attribute defines the coordinate system for the gradient
1795 /// Example: gradientUnits="userSpaceOnUse" (uses absolute coordinates)
1796 gradientUnits: String,
1797 /// The spreadMethod attribute defines how the gradient fills beyond its bounds
1798 /// Example: spreadMethod="reflect" (gradient reflects at boundaries)
1799 spreadMethod: String,
1800 }
1801
1802 /// HTML `<stop>` element - Defines color transitions in gradients
1803 ///
1804 /// Example:
1805 ///
1806 /// ```<stop offset="0%" style="stop-color:rgb(255,0,0);stop-opacity:1" />```
1807 stop {
1808 /// The offset attribute defines where along the gradient this color appears
1809 /// Example: offset="50%" (color positioned halfway through gradient)
1810 offset: String,
1811 /// The stop-color attribute defines the color at this stop
1812 /// Example: stop-color="#3498db" (blue color)
1813 stop_color: String,
1814 /// The stop-opacity attribute defines the opacity at this stop
1815 /// Example: stop-opacity="0.5" (50% transparent)
1816 stop_opacity: String,
1817 }
1818
1819 /// HTML `<radialGradient>` element - Defines a radial gradient for SVG fills
1820 ///
1821 /// Example:
1822 ///
1823 /// ```<radialGradient id="grad2" cx="50%" cy="50%" r="50%"><stop offset="0%" style="stop-color:red" /></radialGradient>```
1824 radialGradient {
1825 /// The cx attribute defines the x-coordinate of the center point
1826 /// Example: cx="50%" (center of the area horizontally)
1827 cx: String,
1828 /// The cy attribute defines the y-coordinate of the center point
1829 /// Example: cy="50%" (center of the area vertically)
1830 cy: String,
1831 /// The r attribute defines the radius of the gradient
1832 /// Example: r="75%" (extends to 75% of the reference area)
1833 r: String,
1834 /// The fx attribute defines the x-coordinate of the focal point
1835 /// Example: fx="60%" (focal point slightly right of center)
1836 fx: String,
1837 /// The fy attribute defines the y-coordinate of the focal point
1838 /// Example: fy="40%" (focal point slightly above center)
1839 fy: String,
1840 /// The fr attribute defines the radius of the focal point
1841 /// Example: fr="5%" (small focal point)
1842 fr: String,
1843 /// The gradientUnits attribute defines the coordinate system for the gradient
1844 /// Example: gradientUnits="objectBoundingBox" (relative to object)
1845 gradientUnits: String,
1846 /// The spreadMethod attribute defines how the gradient fills beyond its bounds
1847 /// Example: spreadMethod="pad" (uses edge color beyond boundaries)
1848 spreadMethod: String,
1849 }
1850
1851 /// HTML `<mask>` element - Defines an area where SVG elements are partially or fully hidden
1852 ///
1853 /// Example:
1854 ///
1855 /// ```<mask id="myMask"><rect width="100%" height="100%" fill="white" opacity="0.5" /></mask>```
1856 mask {
1857 /// The maskUnits attribute specifies the coordinate system for mask positioning
1858 /// Example: maskUnits="userSpaceOnUse" (absolute coordinates)
1859 mask_units: String,
1860 /// The maskContentUnits attribute specifies the coordinate system for mask content
1861 /// Example: maskContentUnits="objectBoundingBox" (relative to object)
1862 mask_content_units: String,
1863 /// The x attribute specifies the x-coordinate of the mask
1864 /// Example: x="0" (starts at left edge)
1865 x: String,
1866 /// The y attribute specifies the y-coordinate of the mask
1867 /// Example: y="0" (starts at top edge)
1868 y: String,
1869 }
1870 /// HTML `<article>` element - Defines an independent, self-contained content
1871 ///
1872 /// Example:
1873 ///
1874 /// ```<article><h1>Article Title</h1><p>Article content goes here...</p></article>```
1875 article {
1876 }
1877
1878 /// HTML `<aside>` element - Defines content aside from the page content
1879 ///
1880 /// Example:
1881 ///
1882 /// ```<aside><p>Sidebar content goes here...</p></aside>```
1883 aside {
1884 }
1885
1886 /// HTML `<details>` element - Defines additional details that the user can view or hide
1887 ///
1888 /// Example:
1889 ///
1890 /// ```<details><summary>Click to view details</summary><p>Details content goes here...</p></details>```
1891 details {
1892 }
1893
1894 /// HTML `<figcaption>` element - Defines a caption for a `<figure>` element
1895 ///
1896 /// Example:
1897 ///
1898 /// ```<figure><img src="image.jpg" alt="Image description" /><figcaption>Caption goes here...</figcaption></figure>```
1899 figcaption {
1900 }
1901
1902 /// HTML `<figure>` element - Specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.
1903 ///
1904 /// Example:
1905 ///
1906 /// ```<figure><img src="image.jpg" alt="Image description" /><figcaption>Caption goes here...</figcaption></figure>```
1907 figure {
1908 }
1909
1910 /// HTML `<footer>` element - Defines a footer for a document or section
1911 ///
1912 /// Example:
1913 ///
1914 /// ```<footer><p>Footer content goes here...</p></footer>```
1915 footer {
1916 }
1917
1918 /// HTML `<header>` element - Defines a container for introductory content or a set of navigational links
1919 ///
1920 /// Example:
1921 ///
1922 /// ```<header><h1>Header content goes here...</h1></header>```
1923 header {
1924 }
1925
1926 /// HTML `<main>` element - Specifies the main content of a document
1927 ///
1928 /// Example:
1929 ///
1930 /// ```<main><p>Main content goes here...</p></main>```
1931 main {
1932 }
1933
1934 /// HTML `<mark>` element - Defines marked/highlighted text
1935 ///
1936 /// Example:
1937 ///
1938 /// ```<p>Some <mark>marked</mark> text.</p>```
1939 mark {
1940 }
1941
1942 /// HTML `<nav>` element - Defines navigation links
1943 ///
1944 /// Example:
1945 ///
1946 /// ```<nav><a href="#home">Home</a> <a href="#about">About</a> <a href="#contact">Contact</a></nav>```
1947 nav {
1948 }
1949
1950 /// HTML `<section>` element - Defines a section in a document
1951 ///
1952 /// Example:
1953 ///
1954 /// ```<section><h2>Section Title</h2><p>Section content goes here...</p></section>```
1955 section {
1956 }
1957
1958 /// HTML `<summary>` element - Defines a visible heading for a `<details>` element
1959 ///
1960 /// Example:
1961 ///
1962 /// ```<details><summary>Click to view details</summary><p>Details content goes here...</p></details>```
1963 summary {
1964 }
1965
1966 /// HTML `<time>` element - Defines a date/time
1967 ///
1968 /// Example:
1969 ///
1970 /// ```<p>Published on <time datetime="2023-08-01">August 1, 2023</time></p>```
1971 time {
1972 /// The datetime attribute specifies the date/time
1973 /// Example: datetime="2023-08-01" (August 1, 2023)
1974 datetime: String,
1975 /// The pubdate attribute specifies that the content is published
1976 /// Example: pubdate="pubdate" (content is published)
1977 pubdate: String,
1978 }
1979
1980 /// HTML `<wbr>` element - Inserts a line break opportunity
1981 ///
1982 /// Example:
1983 ///
1984 /// ```<p>Here is a long word:<wbr>supercalifragilisticexpialidocious</p>```
1985 wbr {
1986 }
1987
1988 /// HTML `<address>` element - Defines contact information for the author/owner of a document
1989 ///
1990 /// Example:
1991 ///
1992 /// ```<address>Contact us at <a href="mailto:="mail="mailto:EMAIL"EMAILample.com</a></address>```
1993 address {
1994 }
1995
1996 /// HTML `<bdi>` element - Defines a term/name within a description list
1997 ///
1998 /// Example:
1999 ///
2000 /// ```<dl><dt><bdi>Name</bdi></dt><dd>John Doe</dd></dl>```
2001 bdi {
2002 }
2003
2004 /// HTML `<bdo>` element - Overrides the current text direction
2005 ///
2006 /// Example:
2007 ///
2008 /// ```<p><bdo dir="rtl">This text is written from right to left</bdo></p>```
2009 bdo {
2010 }
2011
2012 /// HTML `<cite>` element - Defines the title of a work
2013 ///
2014 /// Example:
2015 ///
2016 /// ```<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>```
2017 cite {
2018 }
2019
2020 /// HTML `<dfn>` element - Defines a definition
2021 ///
2022 /// Example:
2023 ///
2024 /// ```<p>The <dfn>HTML</dfn> element is used to define a section in a document.</p>```
2025 dfn {
2026 }
2027
2028 /// HTML `<em>` element - Defines emphasized text
2029 ///
2030 /// Example:
2031 ///
2032 /// ```<p>He is <em>very</em> angry.</p>```
2033 em {
2034 }
2035
2036 /// HTML `<i>` element - Defines a part of text in an alternate voice or mood
2037 ///
2038 /// Example:
2039 ///
2040 /// ```<p><i>This text is in italics.</i></p>```
2041 i {
2042 }
2043
2044 /// HTML `<kbd>` element - Defines keyboard input
2045 ///
2046 /// Example:
2047 ///
2048 /// ```<p>Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.</p>```
2049 kbd {
2050 }
2051
2052 /// HTML `<meter>` element - Defines a scalar measurement within a known range (a gauge)
2053 ///
2054 /// Example:
2055 ///
2056 /// ```<meter value="75" min="0" max="100"></meter>```
2057 meter {
2058 /// The value attribute specifies the current value
2059 /// Example: value="75" (current value is 75)
2060 value: String,
2061 /// The min attribute specifies the minimum value
2062 /// Example: min="0" (minimum value is 0)
2063 min: String,
2064 /// The max attribute specifies the maximum value
2065 /// Example: max="100" (maximum value is 100)
2066 max: String,
2067 /// The low attribute specifies the low value
2068 /// Example: low="33" (low value is 33)
2069 low: String,
2070 /// The high attribute specifies the high value
2071 /// Example: high="66" (high value is 66)
2072 high: String,
2073 /// The optimum attribute specifies the optimum value
2074 /// Example: optimum="50" (optimum value is 50)
2075 optimum: String,
2076 }
2077
2078 /// HTML `<output>` element - Defines the result of a calculation
2079 ///
2080 /// Example:
2081 ///
2082 /// ```<form><input type="number" id="num1" /><input type="number" id="num2" /><button onclick="calculate()">Calculate</button><output id="result"></output></form>```
2083 output {
2084 }
2085
2086 /// HTML `<progress>` element - Defines the progress of a task
2087 ///
2088 /// Example:
2089 ///
2090 /// ```<progress value="75" max="100"></progress>```
2091 progress {
2092 /// The value attribute specifies the current value
2093 /// Example: value="75" (current value is 75)
2094 value: String,
2095 /// The max attribute specifies the maximum value
2096 /// Example: max="100" (maximum value is 100)
2097 max: String,
2098 }
2099
2100 /// HTML `<q>` element - Defines a short inline quotation
2101 ///
2102 /// Example:
2103 ///
2104 /// ```<p><q>We are the so-called "Vikings" from the north.</q></p>```
2105 q {
2106 }
2107
2108 /// HTML `<rp>` element - Defines a parenthesis for browsers that do not support `<ruby>`
2109 ///
2110 /// Example:
2111 ///
2112 /// ```<ruby><rb>漢</rb><rp>(</rp><rt>han</rt><rp>)</rp></ruby>```
2113 rp {
2114 }
2115
2116 /// HTML `<rt>` element - Defines a ruby text
2117 ///
2118 /// Example:
2119 ///
2120 /// ```<ruby><rb>漢</rb><rt>han</rt></ruby>```
2121 rt {
2122 }
2123
2124 /// HTML `<ruby>` element - Defines a ruby annotation (for East Asian typography)
2125 ///
2126 /// Example:
2127 ///
2128 /// ```<ruby><rb>漢</rb><rt>han</rt></ruby>```
2129 ruby {
2130 }
2131
2132 /// HTML `<s>` element - Defines strikethrough text
2133 ///
2134 /// Example:
2135 ///
2136 /// ```<p>Price: <s>$100</s> $50</p>```
2137 s {
2138 }
2139
2140 /// HTML `<samp>` element - Defines sample output from a computer program
2141 ///
2142 /// Example:
2143 ///
2144 /// ```<samp>Hello, World!</samp>```
2145 samp {
2146 }
2147
2148 /// HTML `<small>` element - Defines smaller text
2149 ///
2150 /// Example:
2151 ///
2152 /// ```<p><small>This is some smaller text.</small></p>```
2153 small {
2154 }
2155
2156 /// HTML `<strong>` element - Defines important text
2157 ///
2158 /// Example:
2159 ///
2160 /// ```<p><strong>This is important!</strong></p>```
2161 strong {
2162 }
2163
2164 /// HTML `<sub>` element - Defines subscript text
2165 ///
2166 /// Example:
2167 ///
2168 /// ```<p>H<sub>2</sub>O</p>```
2169 sub {
2170 }
2171
2172 /// HTML `<sup>` element - Defines superscript text
2173 ///
2174 /// Example:
2175 ///
2176 /// ```<p>X<sup>2</sup></p>```
2177 sup {
2178 }
2179
2180 /// HTML `<var>` element - Defines a variable
2181 ///
2182 /// Example:
2183 ///
2184 /// ```<p>The area is <var>x</var> times <var>y</var>.</p>```
2185 var {
2186 }
2187
2188 /// HTML `<template>` element - Defines a container for content that is not to be rendered when a page is loaded
2189 ///
2190 /// Example:
2191 ///
2192 /// ```<template><p>This content will not be rendered.</p></template>```
2193 template {
2194 }
2195
2196 /// HTML `<u>` element - Defines text that should be rendered as underlined
2197 ///
2198 /// Example:
2199 ///
2200 /// ```<p><u>This text is underlined.</u></p>```
2201 u {
2202 }
2203
2204 /// HTML `<noscript>` element - Defines content that is displayed to users with disabled scripts
2205 ///
2206 /// Example:
2207 ///
2208 /// ```<noscript><p>JavaScript is disabled.</p></noscript>```
2209 noscript {
2210 }
2211
2212 /// HTML `<legend>` element - Defines a caption for a `<fieldset>` element
2213 ///
2214 /// Example:
2215 ///
2216 /// ```<fieldset><legend>Personal Information</legend><input type="text" name="name" /><input type="email" name="email" /></fieldset>```
2217 legend {
2218 }
2219
2220 /// HTML `<optgroup>` element - Defines a group of related `<option>` elements in a `<select>` element
2221 ///
2222 /// Example:
2223 ///
2224 /// ```<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>```
2225 optgroup {
2226 /// The label attribute specifies a label for the group
2227 /// Example: label="Fruits" (label for the group is "Fruits")
2228 label: String,
2229 }
2230
2231 /// HTML `<dialog>` element - Defines a dialog box or other interactive component
2232 ///
2233 /// Example:
2234 ///
2235 /// ```<dialog><p>Dialog content goes here...</p><button onclick="closeDialog()">Close</button></dialog>```
2236 dialog {
2237 /// The open attribute specifies whether the dialog is open or closed
2238 /// Example: open="open" (dialog is open)
2239 open: String,
2240 }
2241
2242 /// HTML `<blockquote>` element - Defines a section that is quoted from another source
2243 ///
2244 /// Example:
2245 ///
2246 /// ```<blockquote><p>This is a quote.</p><footer>- John Doe</footer></blockquote>```
2247 blockquote {
2248 }
2249
2250 /// HTML `<dd>` element - Defines a description/value pair within a `<dl>` element
2251 ///
2252 /// Example:
2253 ///
2254 /// ```<dl><dt>Coffee</dt><dd>Black hot drink</dd><dt>Milk</dt><dd>White cold drink</dd></dl>```
2255 dd {
2256 }
2257
2258 /// HTML `<dl>` element - Defines a description list
2259 ///
2260 /// Example:
2261 ///
2262 /// ```<dl><dt>Coffee</dt><dd>Black hot drink</dd><dt>Milk</dt><dd>White cold drink</dd></dl>```
2263 dl {
2264 }
2265
2266 /// HTML `<dt>` element - Defines a term/name in a description list
2267 ///
2268 /// Example:
2269 ///
2270 /// ```<dl><dt>Coffee</dt><dd>Black hot drink</dd><dt>Milk</dt><dd>White cold drink</dd></dl>```
2271 dt {
2272 }
2273
2274 /// HTML `<base>` element - Specifies the base URL/target for all relative URLs in a document
2275 ///
2276 /// Example:
2277 ///
2278 /// ```<base href="```<base href="URL_ADDRESS.example.com/" target="_blank">```
2279 base {
2280 /// The href attribute specifies the base URL
2281 /// ```<base href="URL_ADDR```<base href="URL_ADDRESS.example.com/" target="_blank">```
2282 href: String,
2283 /// The target attribute specifies the target for all relative URLs
2284 /// ```<base href="URL_ADDRESS.example.com/" target="_blank">```
2285 target: String,
2286 }
2287 }
2288}