summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2025-01-15 09:57:16 +1300
committerBen Bridle <ben@derelict.engineering>2025-01-15 09:57:16 +1300
commit4476a2ed495b712449987299aab8453456c5a748 (patch)
tree563f26bb59a359fde07fd292d78db7454a5c47d3
parentbf40ff75a7bb428af30b9377f013df3d6bbe641b (diff)
downloadtoaster-4476a2ed495b712449987299aab8453456c5a748.zip
Add line breaks to math blocks
Math blocks are used when you have multiple lines of equations. Instead of requiring the user to insert a `\\` line break after every line, line breaks are now added automatically.
-rw-r--r--src/generate_html.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/generate_html.rs b/src/generate_html.rs
index 7b12b30..d6624b8 100644
--- a/src/generate_html.rs
+++ b/src/generate_html.rs
@@ -175,7 +175,7 @@ pub fn document_to_html(document: &MarkdownDocument, page: &Page, website: &Webs
}
Block::Fragment { language, content } => {
match language.as_str() {
- "math" => html!("<div class='math'>{content}</div>"),
+ "math" => html!("<div class='math'>{}</div>", content.replace("\n", " \\\\\n")),
"embed-html" => html!("{content}"),
"embed-css" => wrap!("style", html!("{content}")),
"embed-javascript"|"embed-js" => wrap!("script", html!("{content}")),