aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
index ed9fa3c27..0a43b4f30 100644
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -106,6 +106,7 @@ module Text.Pandoc
, module Text.Pandoc.Templates
-- * Version
, pandocVersion
+ , jsonFilter
) where
import Text.Pandoc.Definition
@@ -190,3 +191,9 @@ writers = [("native" , writeNative)
,("rtf" , writeRTF)
,("org" , writeOrg)
]
+
+-- | Converts a transformation on the Pandoc AST into a function
+-- that reads and writes a JSON-encoded string. This is useful
+-- for writing small scripts.
+jsonFilter :: (Pandoc -> Pandoc) -> String -> String
+jsonFilter f = encodeJSON . f . decodeJSON