aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--src/gemini_to_html.rs13
-rw-r--r--src/response.rs10
3 files changed, 20 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 885a60d..27bfa64 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@
[package]
name = "september"
version = "0.2.2"
-authors = ["Fuwn <[email protected]>"]
+authors = ["Fuwn <[email protected]>"]
edition = "2021"
description = "A simple and efficient Gemini-to-HTTP proxy."
readme = "README.md"
diff --git a/src/gemini_to_html.rs b/src/gemini_to_html.rs
index ec19cec..ee723b7 100644
--- a/src/gemini_to_html.rs
+++ b/src/gemini_to_html.rs
@@ -20,7 +20,14 @@ use std::env::var;
use germ::ast::Node;
use gmi::url::Url;
-use markly::to_html;
+
+fn to_html(text: &str) -> String {
+ if text.contains('$') {
+ text.to_string()
+ } else {
+ markly::to_html(text)
+ }
+}
fn link_from_host_href(url: &Url, href: &str) -> String {
format!(
@@ -64,7 +71,9 @@ pub fn gemini_to_html(
href = link_from_host_href(url, &href);
}
- if var("PROXY_BY_DEFAULT").unwrap_or_else(|_| "true".to_string()).to_lowercase()
+ if var("PROXY_BY_DEFAULT")
+ .unwrap_or_else(|_| "true".to_string())
+ .to_lowercase()
== "true"
&& href.contains("gemini://")
&& !surface
diff --git a/src/response.rs b/src/response.rs
index ce1ad4c..547cf12 100644
--- a/src/response.rs
+++ b/src/response.rs
@@ -156,9 +156,15 @@ pub async fn default(
));
}
- if var("MATHJAX").unwrap_or_else(|_| "true".to_string()).to_lowercase() == "true" {
+ if var("MATHJAX")
+ .unwrap_or_else(|_| "true".to_string())
+ .to_lowercase()
+ == "true"
+ {
html_context.push_str(
- "<script type=\"#text/javascript\" id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>",
+ r#"<script type="text/javascript" id="MathJax-script" async
+ src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
+ </script>"#,
);
}