Types for representing a structured document

Version on this page:
LTS Haskell 13.21:
Stackage Nightly 2019-05-18:
Latest on Hackage:

See all snapshots pandoc-types appears in

BSD-3-Clause licensed by John MacFarlane

Text.Pandoc.Definition defines the Pandoc data structure, which is used by pandoc to represent structured documents. This module used to live in the pandoc package, but starting with pandoc 1.7, it has been split off, so that other packages can use it without drawing in all of pandoc's dependencies, and pandoc itself can depend on packages (like citeproc-hs) that use them.

Text.Pandoc.Builder provides functions for building up Pandoc structures programmatically.

Text.Pandoc.Generic provides generic functions for manipulating Pandoc documents.

Text.Pandoc.Walk provides faster, nongeneric functions for manipulating Pandoc documents.

Text.Pandoc.JSON provides functions for serializing and deserializing a Pandoc structure to and from JSON.



* Put NFData in scope for ghc < 7.10.
* Reduce deepseq lower bound for ghc < 7.10.


* For ghc < 7.10, constrain deepseq-generics to >= 0.2, which no
longer exprots NFData from deepseq. Add deepseq dependency.


* Bump upper bound for deepseq-generics, QuickCheck, criterion.
* Implement QuickCheck shrinking for Inlines and Blocks (Alexander Krotov).


* Declare the ToMetaValue instance for String as OVERLAPPING (#46).


* Bump upper bounds for aeson, base.
* Allow building on older ghc versions (George Wilson).
* Text.Pandoc.Arbitrary: generate SoftBreaks and LineBreaks
(Alexander Krotov).
* Pad table rows up to maximum row length, to guarantee that
all rows have the same number of columns
(see jgm/pandoc#4059, Francesco Occhipinti).
* Make String an instance of ToMetaValue (Alexander Krotov).


* Fix compiler warnings.


* Import Semigroups when needed rather than using CPP.
* Bump criterion upper bound.


* Add Semigroup instances for Pandoc, Meta, Inlines, Blocks
(if base >= 4.9). This is needed for the library to compile
with ghc 8.4.
* Bumped criterion upper bound.


* Bumped upper bounds for criterion and QuickCheck.


* Added Walkable instances for `[Inline] Inline` and `[Block] Block`.


* Provide default implementation for walk (Albert Krewinkel).
The implementations for `walk` and `walkM` are very similar, so a
default method is provided which implements the former in terms of the
latter. This change should not affect performance, as the `Identity`
functor, which is used in the default definition, is a newtype that
should be eliminated at compile time. (This requires a dependency
on transformers for ghc 7.8.x.)
* Force optimizations when compiling Walk module (Albert Krewinkel).
* Add `Applicative m` to the context of walkM (Albert Krewinkel).
The acceptance of AMP makes this a natural change.
* Add `Walkable [Block]` and `Walkable [Inline]` instances (Albert
* Factored out duplicate code in Walk.
* Added benchmark.
* Text.Pandoc.JSON: Use `walk` instead of `bottomUp` in the
`ToJSONFilter` instance for `a -> [a]`. Note that behavior will be
slightly different, since bottomUp's treatment of a function `[a] -> [a]`
is to apply it to each sublist of a list, while walk applies it only to
maximal sublists. Usually the latter behavior is what is wanted, and the
former can be simulated when needed. But there may be existing filters
that need to be rewritten in light of the new behavior.


* Better consistency in simpleTable and table (jgm/pandoc#3648).
If `headers` is empty, we populate it with empty cells, using the rows
to determine number of columns. We also ensure that there are numcols
alignments and column widths.
* Make sure Div and Span occur in Arbitrary instances.
* Bump dependency upper bounds.
* Removed unused mapConst.


* Allow aeson 1.1.
* Added tests for Walk (originally from pandoc).
* Renamed README ->, fix link (Kolen Cheung).


* Re-add Functor constraint to walkM, needed for ghc 7.8.
* Turn off redundant-constraints warning for Walk (for ghc 8.0.1+).
* Added necessary Data.Traversable import.
* Allow HUnit 1.5.


* More ghc 7.8 compatibility imports.


* Added a necessary import from Data.Monoid (for ghc 7.8).


* Fix compiler warnings around Data.Monoid import on some platforms.


* Remimplement json encoding of inlines manually (Jesse Rosenthal).
This is the first step to doing manual encoding and decoding of pandoc
JSON. This will replace the current generic deriving, which can be a
moving target.
* Move Arbitrary instances for types from pandoc (Jesse Rosenthal).
* Remove empty arrays for leaf elements (Jesse Rosenthal).
Elements with no children (Space, SoftBreak, LineBreak, HorizontalRule,
Null) previously had an empty array for their "c" value. We remove that
here. This is a breaking change for the JSON format.
* New toplevel JSON format with api-version (Jesse Rosenthal). The version
number is the pandoc-types version. The toplevel format was previously:

[{"unMeta": META}, [BLOCKS]]

It is now:

"pandoc-api-version" : [MAJ, MIN, REV],
"meta" : META,
"blocks": BLOCKS

Decoding fails if the major and minor version numbers don't match.
* Add simple quickcheck tests to verify that roundtrip works properly
(Jesse Rosenthal).
* Add a LineBlock block element (Albert Krewinkel).
* Add explicit unit tests for encoding and decoding (Jesse Rosenthal).
* Fixed warnings in Walk, Builder.
* Test with travis and appveyor.


* Allow aeson 1.0.*.


* Allow aeson 0.11.*.
* Export pandocTypesVersion from Text.Pandoc.Definition.


* Use deepseq instead of deepseq-generics. deepseq now allows deriving
generic NFData instances, so we don't need deepseq-generics.
* Removed unneeded instance, use OVERLAPPING pragma for ghc 7.10.
* Added CPP so that deepseq-generics is used for ghc < 7.10.
* Added tested-with, generate .travis.yml using make_travis_yml.hs
* Added stack.yaml


* Added Attr field to Image and Link.
* Added SoftBreak constructor to Inline
comments powered byDisqus