Fix mathjax include

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/18/head
trivernis 4 years ago
parent e50d73a880
commit 4c0d4c560c
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

2
Cargo.lock generated

@ -2315,7 +2315,7 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]] [[package]]
name = "snekdown" name = "snekdown"
version = "0.33.0" version = "0.33.1"
dependencies = [ dependencies = [
"asciimath-rs", "asciimath-rs",
"base64 0.12.3", "base64 0.12.3",

@ -1,6 +1,6 @@
[package] [package]
name = "snekdown" name = "snekdown"
version = "0.33.0" version = "0.33.1"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
license-file = "LICENSE" license-file = "LICENSE"

@ -154,16 +154,17 @@ impl ToHtml for Document {
writer.write(style)?; writer.write(style)?;
writer.write("</style>".to_string())?; writer.write("</style>".to_string())?;
for stylesheet in &self.stylesheets {
let mut stylesheet = stylesheet.lock();
let data = std::mem::replace(&mut stylesheet.data, None);
if let Some(data) = data {
if self.config.lock().features.include_mathjax { if self.config.lock().features.include_mathjax {
writer.write(format!( writer.write(format!(
"<script id=\"MathJax-script\" type=\"text/javascript\" async src={}></script>", "<script id=\"MathJax-script\" type=\"text/javascript\" async src={}></script>",
MATHJAX_URL MATHJAX_URL
))?; ))?;
} }
for stylesheet in &self.stylesheets {
let mut stylesheet = stylesheet.lock();
let data = std::mem::replace(&mut stylesheet.data, None);
if let Some(data) = data {
writer.write("<style>".to_string())?; writer.write("<style>".to_string())?;
writer.write(minify(String::from_utf8(data).unwrap().as_str()))?; writer.write(minify(String::from_utf8(data).unwrap().as_str()))?;
writer.write("</style>".to_string())?; writer.write("</style>".to_string())?;

Loading…
Cancel
Save