fix: make css into another file

This commit is contained in:
KyleUltimate 2025-04-28 19:17:48 +08:00
parent 262b2af3e7
commit 8f40a8295b

View File

@ -240,26 +240,37 @@ let originalHeight = {height};
)
}
};
let html = format!(
r#"
<html>
let style = match self.output_format {
OutputFormat::Pdf => String::new(),
OutputFormat::Html => format!(
"
<head>
<style>
{css}
</style>
</head>
"
),
};
let html = format!(
r"
<html>
{style}
<body>
{html_body}
{html_script}
</body>
</html>"#
</html>"
);
let html_path = self.content_manager.persist_file("index.html", html.as_bytes())?;
let css_path = self.content_manager.persist_file("styles.css", css.as_bytes())?;
match self.output_format {
OutputFormat::Pdf => {
ThirdPartyTools::weasyprint(&[
"-s",
css_path.to_string_lossy().as_ref(),
"--presentational-hints",
"-e",
"utf8",