html-index
cargo install html-index

html-index

Generate an HTML index.

by mild-times

0.3.4 (see all)License:MIT OR Apache-2.0
cargo install html-index
Readme

html-index

crates.io version build status downloads docs.rs docs

Generate an HTML index.

Why?

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.

Examples

Basic

extern crate html_index;

pub fn main() {
  let res = html_index::Builder::new()
    .raw_body("<body>hello world</body>")
    .script("/bundle.js")
    .style("/bundle.css")
    .build();
  println!("{}", res);
}

Which generates:

<!DOCTYPE html>
<html>
  <head>
    <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>
  </head>
  <body>hello world</body>
</html>

Installation

$ cargo add html-index

Safety

This crate uses #![deny(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

Contributing

Want to join us? Check out our "Contributing" guide and take a look at some of these issues:

References

None.

License

MIT OR Apache-2.0

GitHub Stars

20

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

3

OPEN ISSUES

2

OPEN PRs

0
VersionTagPublished
0.3.4
2yrs ago
0.3.3
2yrs ago
0.3.2
2yrs ago
0.3.1
2yrs ago
No alternatives found
No tutorials found
Add a tutorial