This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
md-pdf-rs/src/renderers/html_cleanup.rs

14 lines
543 B
Rust
Raw Normal View History

2017-09-05 21:33:31 +01:00
use renderers::{sciter_start, get_html, destroy_matching, destroy_at, find_first};
use config::Config;
pub fn html_cleanup(config: Config, input: String) -> Result<String, String> {
let mut root = sciter_start(input);
2017-09-05 21:33:31 +01:00
let mut head = find_first(&mut root, "head");
2017-09-05 21:36:41 +01:00
destroy_at(&mut head, 4); // Sciter doesnt like finding this style tag for some reason
2017-09-05 21:33:31 +01:00
destroy_matching(&mut head, "meta[content='text/css']");
destroy_matching(&mut head, "style");
destroy_matching(&mut head, "title");
return Ok(get_html(root));
}