Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Tidier HTML Example For Rust

This is a test to see if tider will work with just snippets. The goal was to see if it can be used without automatically closing tags, but I don't see a way to do that. (That makes sense based off what Tidy is designed to do. I was just looking to see if it had the option)

rust
```cargo
[dependencies]
tidier = "0.5.2"
```

use tidier::{Doc, FormatOptions};


fn main() {
  let html = r#"<div><p>Usage example</p>"#;
  match do_format(&html) {
    Ok(html) => println!("{}", html),
    Err(e) => println!("{}", e)
  }
}

fn do_format(html: &str) -> Result<String, tidier::Error> {
  let opts = FormatOptions::new()
    .tabs(true)
    .strip_comments(true)
    .wrap(60);
  let doc = Doc::new(html, false)?;
  let output = doc.format(&opts)?;
  Ok(output)
}
results start

Footnotes And References