From 8f40a8295b31c70e2bb595b6e91304f7cfd9567a Mon Sep 17 00:00:00 2001 From: KyleUltimate Date: Mon, 28 Apr 2025 19:17:48 +0800 Subject: [PATCH] fix: make css into another file --- src/export/output.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/export/output.rs b/src/export/output.rs index 1090553..febfa2f 100644 --- a/src/export/output.rs +++ b/src/export/output.rs @@ -240,26 +240,37 @@ let originalHeight = {height}; ) } }; - let html = format!( - r#" - + let style = match self.output_format { + OutputFormat::Pdf => String::new(), + OutputFormat::Html => format!( + " + " + ), + }; + let html = format!( + r" + +{style} {html_body} {html_script} -"# +" ); 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",