From fce9815f412631febb1f93dd36c35572be06478d Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 4 Feb 2023 08:35:16 +0000 Subject: feat: mathjax latex rendering --- src/gemini_to_html.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/gemini_to_html.rs') 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 -- cgit v1.2.3