Expand description
§Overview
domrs is a powerful library designed to streamline the creation and serialization of HTML, CSS and SVG documents.
domrs empowers developers with a concise and intuitive interface to effortlessly construct structured and visually appealing documents.
Key features:
-
HTML, CSS and SVG support: seamlessly build HTML web pages, stylized CSS documents and dynamic SVG graphics using Rust’s strong typing and safety.
-
Builder pattern: enjoy the convenience of a builder pattern for creating complex document structures, ensuring code readability and maintainability.
-
Serialization: effortlessly serialize created documents into standard-compliant HTML, CSS or SVG files, facilitating easy integration into web applications, storage or reporting tools.
With its ergonomic design and robust functionality, domrs offers a hassle-free solution for developers seeking a reliable tool to craft web-based documents within Rust projects. Whether you’re building a web app, generating dynamic graphics, or managing stylesheets, domrs provides the tools you need.
Get started with domrs today and unlock the potential for efficient document creation and serialization in Rust!
§Getting started
§Create HTML document
use domrs::HtmlDocument;
let html = HtmlDocument::new();
assert_eq!("<html/>\n", html.to_string());
§Create CSS stylesheet
use domrs::CssDocument;
let css = CssDocument::new();
assert_eq!("", css.to_string());
§Create SVG graphics
use domrs::SvgDocument;
let svg = SvgDocument::new();
assert_eq!("<svg/>", svg.to_string());
Macros§
- auto
- border
- css_num
- div
- em
- h1
- Creates
<h1>
HTML element. The section heading level 1 element. - h2
- Creates
<h2>
HTML element. The section heading level 2 element. - h3
- Creates
<h3>
HTML element. The section heading level 3 element. - h4
- Creates
<h4>
HTML element. The section heading level 4 element. - h5
- Creates
<h5>
HTML element. The section heading level 5 element. - h6
- Creates
<h6>
HTML element. The section heading level 6 element. - perc
- pt
- px
- span
- zero
Structs§
- CssBorder
- CssDeclaration
- CssDocument
- CssFont
Family - CssGroup
- CssNumber
- A structure representing the CSS number.
- CssRuleset
- A structure representing CSS ruleset.
- CssSelector
- A structure representing the CSS selector.
- CssSelector
Part - A structure representing a part of the CSS selector.
- Html
Attribute - A structure representing HTML attribute.
- Html
Body Element - A structure representing HTML
<body>
element. - Html
Document - A structure representing HTML document.
- Html
Element - A structure representing HTML element.
- Html
Head Element - A structure representing HTML
<head>
element. - Html
Link Element - A structure representing HTML
<link>
element. - Html
Style Element - A structure representing HTML
<style>
element. - SvgDocument
- A structure representing the outermost
svg
element of SVG document. - SvgNumber
- A structure representing the SVG number.
Enums§
- CssAt
Rule - An enumeration representing a CSS
@
rule. - CssBorder
Style - CssColor
- An enumeration representing CSS colors.
- CssElement
- A structure representing CSS element.
- CssFont
Generic Family - CssFont
Style - An enumeration representing a CSS font style.
- CssProperty
- CssUnit
- CssValue
- SvgAttribute
- An enumeration representing attributes used in SVG elements.
Constants§
- DEFAULT_
CSS_ INDENT - Default text indentation in CSS documents.
- DEFAULT_
CSS_ OFFSET - Default text offset in CSS documents.
- DEFAULT_
HTML_ DOCTYPE - Default
DOCTYPE
in HTML documents. - DEFAULT_
HTML_ INDENT - Default text indentation in HTML documents.
- DEFAULT_
HTML_ LANGUAGE - Default language for HTML documents.
- DEFAULT_
HTML_ NAMESPACE - Default namespace in HTML documents.
- DEFAULT_
HTML_ OFFSET - Default text offset in HTML documents.
- DEFAULT_
SVG_ INDENT - Default text indentation in SVG documents.
- DEFAULT_
SVG_ OFFSET - Default text offset in SVG documents.
Traits§
- ToText
- A trait for converting value to a textual representation with provided offset and indentation.