diff options
| -rw-r--r-- | src/Text/Pandoc/App/CommandLineOptions.hs | 4 | ||||
| -rw-r--r-- | src/Text/Pandoc/Options.hs | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index 56c855e5f..b28013107 100644 --- a/src/Text/Pandoc/App/CommandLineOptions.hs +++ b/src/Text/Pandoc/App/CommandLineOptions.hs @@ -1023,8 +1023,8 @@ options = , Option "" ["webtex"] (OptArg (\arg opt -> do - let url' = fromMaybe "https://latex.codecogs.com/png.latex?" arg - return opt { optHTMLMathMethod = WebTeX $ T.pack url' }) + let url' = maybe defaultWebTeXURL T.pack arg + return opt { optHTMLMathMethod = WebTeX url' }) "URL") "" -- "Use web service for HTML math" diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index 34d48fc56..43df5c27f 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -32,6 +32,7 @@ module Text.Pandoc.Options ( module Text.Pandoc.Extensions , def , isEnabled , defaultMathJaxURL + , defaultWebTeXURL , defaultKaTeXURL ) where import Control.Applicative ((<|>)) @@ -114,7 +115,8 @@ instance FromJSON HTMLMathMethod where mburl <- m .:? "url" case method :: Text of "plain" -> return PlainMath - "webtex" -> return $ WebTeX $ fromMaybe "" mburl + "webtex" -> return $ WebTeX $ + fromMaybe defaultWebTeXURL mburl "gladtex" -> return GladTeX "mathml" -> return MathML "mathjax" -> return $ MathJax $ @@ -124,7 +126,7 @@ instance FromJSON HTMLMathMethod where _ -> fail $ "Unknown HTML math method " ++ show method) node <|> (case node of String "plain" -> return PlainMath - String "webtex" -> return $ WebTeX "" + String "webtex" -> return $ WebTeX defaultWebTeXURL String "gladtex" -> return GladTeX String "mathml" -> return MathML String "mathjax" -> return $ MathJax defaultMathJaxURL @@ -402,6 +404,9 @@ isEnabled ext opts = ext `extensionEnabled` getExtensions opts defaultMathJaxURL :: Text defaultMathJaxURL = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" +defaultWebTeXURL :: Text +defaultWebTeXURL = "https://latex.codecogs.com/png.latex?" + defaultKaTeXURL :: Text defaultKaTeXURL = "https://cdn.jsdelivr.net/npm/katex@latest/dist/" |
