toJSONFilter convert a function into a filter that reads pandoc's JSON serialized output from stdin, transforms it by walking the AST and applying the specified function, and serializes the result as JSON to stdout.
For a straight transformation, use a function of type a -> a or
a -> IO a where a = Block, Inline, Pandoc, Meta, or MetaValue.
If your transformation needs to be sensitive to the script's arguments,
use a function of type [String] -> a -> a (with a constrained as above).
The [String] will be populated with the script's arguments.
An alternative is to use the type Maybe Format -> a -> a.
This is appropriate when the first argument of the script (if present)
will be the target format, and allows scripts to behave differently
depending on the target format. The pandoc executable automatically
provides the target format as argument when scripts are called using
the `--filter` option.
Methods
toJSONFilter :: a -> m ()
Instances6ToJSONFilter
(ToJSONFilter m a, MonadIO m) => ToJSONFilter m (Maybe Format -> a)Defined in pandoc-types-1.23.1 · Text.Pandoc.JSON(ToJSONFilter m a, MonadIO m) => ToJSONFilter m ([String] -> a)Defined in pandoc-types-1.23.1 · Text.Pandoc.JSON(Walkable [a] Pandoc, MonadIO m) => ToJSONFilter m (a -> [a])Defined in pandoc-types-1.23.1 · Text.Pandoc.JSON(Walkable [a] Pandoc, MonadIO m) => ToJSONFilter m (a -> m [a])Defined in pandoc-types-1.23.1 · Text.Pandoc.JSON(Walkable a Pandoc, MonadIO m) => ToJSONFilter m (a -> a)Defined in pandoc-types-1.23.1 · Text.Pandoc.JSON(Walkable a Pandoc, MonadIO m) => ToJSONFilter m (a -> m a)Defined in pandoc-types-1.23.1 · Text.Pandoc.JSON