diff options
author | Joe Hermaszewski <git@monoid.al> | 2018-04-20 19:09:51 +0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-08-17 20:50:45 -0700 |
commit | 822a071bb2ef8bfca0af74e3cc501a3346e47ae9 (patch) | |
tree | 840204eec76420ba2e767924bf1643721541ee9f /src | |
parent | 1b668657632c58964e8d7df42ea88e5ea6abfb1e (diff) | |
download | pandoc-822a071bb2ef8bfca0af74e3cc501a3346e47ae9.tar.gz |
Haddock Writer: Use proper format for latex math in haddock (#4571).
Inline math in `\(..\)`, display math in `\[..\]`, tex is now used.
Previously we'd "fake it with unicode" and fall back to tex when
that didn't work. But as of
https://github.com/haskell/haddock/commit/3f50b955324bd4b42f88a421f0203bc46a3ccf64
haddock supports latex math.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/Haddock.hs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/Haddock.hs b/src/Text/Pandoc/Writers/Haddock.hs index 75b8c78dc..6cb720489 100644 --- a/src/Text/Pandoc/Writers/Haddock.hs +++ b/src/Text/Pandoc/Writers/Haddock.hs @@ -45,7 +45,6 @@ import Text.Pandoc.Options import Text.Pandoc.Pretty import Text.Pandoc.Shared import Text.Pandoc.Templates (renderTemplate') -import Text.Pandoc.Writers.Math (texMathToInlines) import Text.Pandoc.Writers.Shared type Notes = [[Block]] @@ -250,11 +249,10 @@ inlineToHaddock _ (Code _ str) = return $ "@" <> text (escapeString str) <> "@" inlineToHaddock _ (Str str) = return $ text $ escapeString str -inlineToHaddock opts (Math mt str) = do - let adjust x = case mt of - DisplayMath -> cr <> x <> cr - InlineMath -> x - adjust <$> (lift (texMathToInlines mt str) >>= inlineListToHaddock opts) +inlineToHaddock _ (Math mt str) = + return $ case mt of + DisplayMath -> cr <> "\\[" <> text str <> "\\]" <> cr + InlineMath -> "\\(" <> text str <> "\\)" inlineToHaddock _ il@(RawInline f str) | f == "haddock" = return $ text str | otherwise = do |