aboutsummaryrefslogtreecommitdiff
path: root/src/gemini_to_html.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-02-04 08:35:16 +0000
committerFuwn <[email protected]>2023-02-04 08:35:16 +0000
commitfce9815f412631febb1f93dd36c35572be06478d (patch)
treec929796baf144e8d223528b1cfdf5b110fdf8caa /src/gemini_to_html.rs
parentfeat: mathjax (diff)
downloadseptember-0.2.2.tar.xz
september-0.2.2.zip
feat: mathjax latex renderingv0.2.2
Diffstat (limited to 'src/gemini_to_html.rs')
-rw-r--r--src/gemini_to_html.rs13
1 files changed, 11 insertions, 2 deletions
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