[][src]Crate html_index

Over the years the HTML spec has added lots of new capabilities in a backwards compatible fashion. This means that even if something from the 90's might still work in today's browsers, it might not always be the most efficient.

This crate makes it easy to build performant HTML without needing to remember all boilerplate involved.


The http-types feature enables a Builder::into() conversion for http_types::Response. This feature is enabled by default.

If you are not using other http-types ecosystem crates, you can disable the feature:

html-index = { version = "*", default-features = false }


let res = html_index::Builder::new()
    .raw_body("<body>hello world</body>")
println!("{}", res);

Which generates:

<!DOCTYPE html>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="preload" as="style" href="/bundle.css" onload="this.rel='stylesheet'">
    <script src="/bundle.js" defer></script>
  <body>hello world</body>



Create a new HTML builder.



Create a new Builder instance.