summaryrefslogtreecommitdiffstats
path: root/src/Zettel/Math.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Zettel/Math.hs')
-rw-r--r--src/Zettel/Math.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Zettel/Math.hs b/src/Zettel/Math.hs
index e693e83..49d6420 100644
--- a/src/Zettel/Math.hs
+++ b/src/Zettel/Math.hs
@@ -8,7 +8,7 @@
-- Portability : POSIX
module Zettel.Math where
-import Text.Pandoc.Definition (Inline (..))
+import Text.Pandoc.Definition (Inline (..), Block (..))
import Text.Pandoc.Walk (walk)
import Zettel.Types
@@ -19,5 +19,11 @@ wrapMath = concatMap f
f m@(Math _ _) = [RawInline "markdown" "{{< math >}}", m, RawInline "markdown" "{{< /math >}}"]
f a = [a]
+wrapMathLatex :: Block -> Block
+wrapMathLatex r@(RawBlock t b)
+ | t == "latex" = RawBlock "markdown" $ "{{< math >}}\n" <> b <> "{{< /math >}}"
+ | otherwise = r
+wrapMathLatex r = r
+
wrapZettelGraph :: ZettelGraph -> ZettelGraph
-wrapZettelGraph = walk wrapMath
+wrapZettelGraph = walk wrapMathLatex . walk wrapMath