diff --git a/MANUAL.txt b/MANUAL.txt
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -1,7 +1,7 @@
 ---
 title: Pandoc User's Guide
 author: John MacFarlane
-date: August 20, 2021
+date: October 22, 2021
 ---
 
 # Synopsis
@@ -142,11 +142,11 @@
 contains images), [`hyperref`], [`xcolor`],
 [`ulem`], [`geometry`] (with the `geometry` variable set),
 [`setspace`] (with `linestretch`), and
-[`babel`] (with `lang`).  The use of `xelatex` or `lualatex` as
+[`babel`] (with `lang`).  If `CJKmainfont` is set, [`xeCJK`]
+is needed.  The use of `xelatex` or `lualatex` as
 the PDF engine requires [`fontspec`].  `lualatex` uses
-[`selnolig`]. `xelatex` uses [`polyglossia`] (with `lang`),
-[`xecjk`], and [`bidi`] (with the `dir` variable set). If the
-`mathspec` variable is set, `xelatex` will use [`mathspec`]
+[`selnolig`]. `xelatex` uses [`bidi`] (with the `dir` variable set).
+If the `mathspec` variable is set, `xelatex` will use [`mathspec`]
 instead of [`unicode-math`].  The [`upquote`] and [`microtype`]
 packages are used if available, and [`csquotes`] will be used
 for [typography] if the `csquotes` variable or metadata field is
@@ -197,7 +197,7 @@
 [`weasyprint`]: https://weasyprint.org
 [`wkhtmltopdf`]: https://wkhtmltopdf.org
 [`xcolor`]: https://ctan.org/pkg/xcolor
-[`xecjk`]: https://ctan.org/pkg/xecjk
+[`xeCJK`]: https://ctan.org/pkg/xecjk
 [`xurl`]: https://ctan.org/pkg/xurl
 [`selnolig`]: https://ctan.org/pkg/selnolig
 
@@ -730,6 +730,16 @@
     document in standalone mode. If no *VAL* is specified, the
     key will be given the value `true`.
 
+`--sandbox`
+
+:   Run pandoc in a sandbox, limiting IO operations in readers
+    and writers to reading the files specified on the command line.
+    Note that this option does not limit IO operations by
+    filters or in the production of PDF documents.  But it does
+    offer security against, for example, disclosure of files
+    through the use of `include` directives.  Anyone using
+    pandoc on untrusted user input should use this option.
+
 `-D` *FORMAT*, `--print-default-template=`*FORMAT*
 
 :   Print the system default template for an output *FORMAT*. (See `-t`
@@ -962,7 +972,9 @@
 :   Specify whether footnotes (and references, if `reference-links` is
     set) are placed at the end of the current (top-level) block, the
     current section, or the document. The default is
-    `document`. Currently only affects the markdown writer.
+    `document`. Currently this option only affects the
+    `markdown`, `muse`, `html`, `epub`, `slidy`, `s5`, `slideous`,
+    `dzslides`, and `revealjs` writers.
 
 `--markdown-headings=setext`|`atx`
 
@@ -1172,11 +1184,15 @@
         - Title and Content
         - Section Header
         - Two Content
+        - Comparison
+        - Content with Caption
+        - Blank
 
         For each name, the first layout found with that name will be used.
         If no layout is found with one of the names, pandoc will output a
         warning and use the layout with that name from the default reference
-        doc instead.
+        doc instead. (How these layouts are used is described in [PowerPoint
+        layout choice](#powerpoint-layout-choice).)
 
         All templates included with a recent version of MS PowerPoint
         will fit these criteria. (You can click on `Layout` under the
@@ -1185,8 +1201,8 @@
         You can also modify the default `reference.pptx`: first run
         `pandoc -o custom-reference.pptx --print-default-data-file
         reference.pptx`, and then modify `custom-reference.pptx`
-        in MS PowerPoint (pandoc will use the first four layout
-        slides, as mentioned above).
+        in MS PowerPoint (pandoc will use the layouts with the names
+        listed above).
 
 `--epub-cover-image=`*FILE*
 
@@ -1472,6 +1488,7 @@
    22 PandocUnknownWriterError
    23 PandocUnsupportedExtensionError
    24 PandocCiteprocError
+   25 PandocBibliographyError
    31 PandocEpubSubdirectoryError
    43 PandocPDFError
    44 PandocXMLError
@@ -2172,7 +2189,7 @@
     and AsciiDoc metadata; repeat as for `author`, above
 
 `subject`
-:   document subject, included in ODT, PDF, docx and pptx metadata
+:   document subject, included in ODT, PDF, docx, EPUB, and pptx metadata
 
 `description`
 :   document description, included in ODT, docx and pptx metadata. Some
@@ -2799,7 +2816,7 @@
 
 `toc-title`
 :   title of table of contents (works only with EPUB,
-    HTML, opendocument, odt, docx, pptx, beamer, LaTeX)
+    HTML, revealjs, opendocument, odt, docx, pptx, beamer, LaTeX)
 
 [pandoc-templates]: https://github.com/jgm/pandoc-templates
 
@@ -3732,8 +3749,8 @@
 A term may have multiple definitions, and each definition may
 consist of one or more block elements (paragraph, code block,
 list, etc.), each indented four spaces or one tab stop.  The
-body of the definition (including the first line, aside from the
-colon or tilde) should be indented four spaces. However, as with
+body of the definition (not including the first line)
+should be indented four spaces. However, as with
 other Markdown lists, you can "lazily" omit indentation except
 at the beginning of a paragraph or other block element:
 
@@ -5123,7 +5140,8 @@
 #### Extension: `attributes` ####
 
 Allows attributes to be attached to any inline or block-level
-element.  The syntax for the attributes is the same as that
+element when parsing `commonmark`.
+The syntax for the attributes is the same as that
 used in [`header_attributes`][Extension: `header_attributes`].
 
 - Attributes that occur immediately after an inline
@@ -5781,8 +5799,8 @@
 the hierarchy that is followed immediately by content, and not another
 heading, somewhere in the document. In the example above, level-1 headings
 are always followed by level-2 headings, which are followed by content,
-so the slide level is 2.  This default can be overridden using
-the `--slide-level` option.
+so the slide level is 2. This default can be overridden using the
+`--slide-level` option.
 
 The document is carved up into slides according to the following
 rules:
@@ -5806,20 +5824,63 @@
     subsequent slide with the same title (for beamer).
 
   * A title page is constructed automatically from the document's title
-    block, if present.  (In the case of beamer, this can be disabled
+    block, if present. (In the case of beamer, this can be disabled
     by commenting out some lines in the default template.)
 
 These rules are designed to support many different styles of slide show. If
 you don't care about structuring your slides into sections and subsections,
-you can just use level-1 headings for all each slide. (In that case, level-1
-will be the slide level.) But you can also structure the slide show into
-sections, as in the example above.
+you can either just use level-1 headings for all slides (in that case, level 1
+will be the slide level) or you can set `--slide-level=0`.
 
 Note:  in reveal.js slide shows, if slide level is 2, a two-dimensional
 layout will be produced, with level-1 headings building horizontally
-and level-2 headings building vertically.  It is not recommended that
-you use deeper nesting of section levels with reveal.js.
+and level-2 headings building vertically. It is not recommended that
+you use deeper nesting of section levels with reveal.js unless you set
+`--slide-level=0` (which lets reveal.js produce a one-dimensional layout
+and only interprets horizontal rules as slide boundaries).
 
+### PowerPoint layout choice
+
+When creating slides, the pptx writer chooses from a number of pre-defined
+layouts, based on the content of the slide:
+
+Title Slide
+:   This layout is used for the initial slide, which is generated and
+    filled from the metadata fields `date`, `author`, and `title`, if
+    they are present.
+
+Section Header
+:   This layout is used for what pandoc calls “title slides”, i.e.
+    slides which start with a header which is above the slide level in
+    the hierarchy.
+
+Two Content
+:   This layout is used for two-column slides, i.e. slides containing a
+    div with class `columns` which contains at least two divs with class
+    `column`.
+
+Comparison
+:   This layout is used instead of “Two Content” for any two-column
+    slides in which at least one column contains text followed by
+    non-text (e.g. an image or a table).
+
+Content with Caption
+:   This layout is used for any non-two-column slides which contain text
+    followed by non-text (e.g. an image or a table).
+
+Blank
+:   This layout is used for any slides which only contain blank content,
+    e.g. a slide containing only speaker notes, or a slide containing
+    only a non-breaking space.
+
+Title and Content
+:   This layout is used for all slides which do not match the criteria
+    for another layout.
+
+These layouts are chosen from the default pptx reference doc included with
+pandoc, unless an alternative reference doc is specified using
+`--reference-doc`.
+
 ## Incremental lists
 
 By default, these writers produce lists that display "all at once."
@@ -5858,9 +5919,6 @@
 Both methods allow incremental and nonincremental lists to be mixed
 in a single document.
 
-Note: Neither the `-i/--incremental` option nor any of the
-methods described here currently works for PowerPoint output.
-
 ## Inserting pauses
 
 You can add "pauses" within a slide by including a paragraph containing
@@ -5996,44 +6054,65 @@
 `allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
 `shrink`, `standout`, `noframenumbering`.
 
-## Background in reveal.js and beamer
+## Background in reveal.js, beamer, and pptx
 
-Background images can be added to self-contained reveal.js slideshows and
-to beamer slideshows.
+Background images can be added to self-contained reveal.js slide shows,
+beamer slide shows, and pptx slide shows.
 
-For the same image on every slide, use the  configuration
-option `background-image` either in the YAML metadata block
-or as a command-line variable. (There are no other options in
-beamer and the rest of this section concerns reveal.js slideshows.)
+### On all slides (beamer, reveal.js, pptx)
 
-For reveal.js, you can instead use the reveal.js-native option
-`parallaxBackgroundImage`. You can also set `parallaxBackgroundHorizontal`
-and `parallaxBackgroundVertical` the same way and must also set
-`parallaxBackgroundSize` to have your values take effect.
+With beamer and reveal.js, the configuration option `background-image` can be
+used either in the YAML metadata block or as a command-line variable to get the
+same image on every slide.
 
-To set an image for a particular reveal.js slide, add
-`{data-background-image="/path/to/image"}`
-to the first slide-level heading on the slide (which may even be empty).
+For pptx, you can use a [reference doc](#option--reference-doc) in which
+background images have been set on the [relevant
+layouts](#powerpoint-layout-choice).
 
+#### `parallaxBackgroundImage` (reveal.js)
+
+For reveal.js, there is also the reveal.js-native option
+`parallaxBackgroundImage`, which can be used instead of `background-image` to
+produce a parallax scrolling background. You must also set
+`parallaxBackgroundSize`, and can optionally set `parallaxBackgroundHorizontal`
+and `parallaxBackgroundVertical` to configure the scrolling behaviour. See the
+[reveal.js documentation](https://revealjs.com/backgrounds/#parallax-background)
+for more details about the meaning of these options.
+
 In reveal.js's overview mode, the parallaxBackgroundImage will show up
 only on the first slide.
 
-Other reveal.js background settings also work on individual slides, including
-`data-background-size`, `data-background-repeat`, `data-background-color`,
-`data-transition`, and `data-transition-speed`.
+### On individual slides (reveal.js, pptx)
 
-To add a background image to the automatically generated title slide, use the
-`title-slide-attributes` variable in the YAML metadata block. It must contain
-a map of attribute names and values.
+To set an image for a particular reveal.js or pptx slide, add
+`{background-image="/path/to/image"}` to the first slide-level heading on the
+slide (which may even be empty).
 
-See the [reveal.js documentation](https://revealjs.com/backgrounds/) for more
-details.
+As the [HTML writers pass unknown attributes
+through](#extension-link_attributes), other reveal.js background settings also
+work on individual slides, including `background-size`, `background-repeat`,
+`background-color`, `transition`, and `transition-speed`. (The `data-` prefix
+will automatically be added.)
 
-For example in reveal.js:
+Note: `data-background-image` is also supported in pptx for consistency with
+reveal.js – if `background-image` isn’t found, `data-background-image` will be
+checked.
 
+### On the title slide (reveal.js, pptx)
+
+To add a background image to the automatically generated title slide for
+reveal.js, use the `title-slide-attributes` variable in the YAML metadata block.
+It must contain a map of attribute names and values. (Note that the `data-`
+prefix is required here, as it isn’t added automatically.)
+
+For pptx, pass a [reference doc](#option--reference-doc) with the background
+image set on the “Title Slide” layout.
+
+### Example (reveal.js)
+
 ```
 ---
-title: My Slideshow
+title: My Slide Show
 parallaxBackgroundImage: /path/to/my/background_image.png
 title-slide-attributes:
     data-background-image: /path/to/title_image.png
@@ -6044,7 +6123,7 @@
 
 Slide 1 has background_image.png as its background.
 
-## {data-background-image="/path/to/special_image.jpg"}
+## {background-image="/path/to/special_image.jpg"}
 
 Slide 2 has a special image for its background, even though the heading has no content.
 ```
@@ -6110,7 +6189,12 @@
     language if nothing is specified.
 
 `subject`
-  ~ A string value or a list of such values.
+  ~ Either a string value, or an object with fields `text`, `authority`,
+    and `term`, or a list of such objects. Valid values for `authority`
+    are either a [reserved authority value] (currently `AAT`, `BIC`,
+    `BISAC`, `CLC`, `DDC`, `CLIL`, `EuroVoc`, `MEDTOP`, `LCSH`, `NDC`,
+    `Thema`, `UDC`, and `WGS`) or an absolute IRI identifying a custom
+    scheme. Valid values for `term` are defined by the scheme.
 
 `description`
   ~ A string value.
@@ -6160,6 +6244,7 @@
     - `scroll-axis`: `vertical`|`horizontal`|`default`
 
 [MARC relators]: https://loc.gov/marc/relators/relaterm.html
+[reserved authority value]: https://idpf.github.io/epub-registries/authorities/
 [`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
 
 ## The `epub:type` attribute
@@ -6199,6 +6284,7 @@
 seriespage                        frontmatter
 foreword                          frontmatter
 preface                           frontmatter
+frontispiece                      frontmatter
 appendix                          backmatter
 colophon                          backmatter
 bibliography                      backmatter
@@ -6540,23 +6626,35 @@
 2. Several input formats (including HTML, Org, and RST) support `include`
    directives that allow the contents of a file to be included in the
    output. An untrusted attacker could use these to view the contents of
-   files on the file system.
+   files on the file system.  (Using the `--sandbox` option can
+   protect against this threat.)
 
-3. If your application uses pandoc as a Haskell library (rather than
+3. Several output formats (including RTF, FB2, HTML with
+   `--self-contained`, EPUB, Docx, and ODT) will embed encoded
+   or raw images into the output file.  An untrusted attacker
+   could exploit this to view the contents of non-image files on the
+   file system.  (Using the `--sandbox` option can protect
+   against this threat, but will also prevent including images in
+   these formats.)
+
+4. If your application uses pandoc as a Haskell library (rather than
    shelling out to the executable), it is possible to use it in a mode
    that fully isolates pandoc from your file system, by running the
    pandoc operations in the `PandocPure` monad. See the document
    [Using the pandoc API](https://pandoc.org/using-the-pandoc-api.html)
    for more details.
 
-4. Pandoc's parsers can exhibit pathological performance on some
+5. Pandoc's parsers can exhibit pathological performance on some
    corner cases.  It is wise to put any pandoc operations under
    a timeout, to avoid DOS attacks that exploit these issues.
    If you are using the pandoc executable, you can add the
    command line options `+RTS -M512M -RTS` (for example) to limit
-   the heap size to 512MB.
+   the heap size to 512MB.  Note that the `commonmark` parser
+   (including `commonmark_x` and `gfm`) is much less vulnerable
+   to pathological performance than the `markdown` parser, so
+   it is a better choice when processing untrusted input.
 
-5. The HTML generated by pandoc is not guaranteed to be safe.
+6. The HTML generated by pandoc is not guaranteed to be safe.
    If `raw_html` is enabled for the Markdown input, users can
    inject arbitrary HTML.  Even if `raw_html` is disabled,
    users can include dangerous content in URLs and attributes.
diff --git a/cabal.project b/cabal.project
--- a/cabal.project
+++ b/cabal.project
@@ -1,4 +1,5 @@
 packages: pandoc.cabal
 tests: True
 flags: +embed_data_files
+constraints: aeson >= 2.0.1.0
 
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,6 +1,455 @@
 # Revision history for pandoc
 
-## pandoc 2.14.2 (provisional)
+## pandoc 2.15 (NODATE)
+
+  * Add `--sandbox` option  (#5045).
+
+    + Add sandbox feature for readers.  When this option is used,
+      readers and writers only have access to input files (and
+      other files specified directly on command line).  This restriction
+      is enforced in the type system.
+    + Filters, PDF production, custom writers are unaffected.  This
+      feature only insulates the actual readers and writers, not
+      the pipeline around them in Text.Pandoc.App.
+    + Note that when `--sandboxed` is specified, readers won't have
+      access to the resource path, nor will anything have access to
+      the user data directory.
+
+  * `--self-contained`: Fix bug that caused everything to be made a data
+    URI (#7635, #7367).  We only need to use data URIs in certain cases, but
+    due to a bug they were being used always.
+
+  * Pandoc will now fall back to latin1 encoding for inputs that can't be
+    read as UTF-8.  This is what it did previously for content fetched
+    from the web and not marked as to content type. It makes sense to do
+    the same for local files.  In this case a `NotUTF8Encoded` warning
+    will be issued, indicating that pandoc is interpreting the input as latin1.
+
+  * Markdown reader:
+
+    + Don't parse links or bracketed spans as citations (#7632).
+      Previously pandoc would parse `[link to (@a)](url)` as a
+      citation; similarly `[(@a)]{#ident}`.  This is undesirable.  One should
+      be able to use example references in citations, and even if `@a` is
+      not defined as an example reference, `[@a](url)` should be a link
+      containing an author-in-text citation rather than a normal citation
+      followed by literal `(url)`.
+    + Fix interaction of `--strip-comments` and list parsing (#7521).
+      Use of `--strip-comments` was causing tight lists to be rendered as
+      loose (as if the comment were a blank line).
+    + Fix parsing bug for math in bracketed spans and links (#7623).
+      This affects math with unbalanced brackets (e.g. `$(0,1]$`)
+      inside links, images, bracketed spans.
+    + Fix code blocks using `--preserve-tabs` (#7573).  Previously they
+      did not behave as the equivalent input with spaces would.
+
+  * DocBook reader:
+
+    + Honor linenumbering attribute (Samuel Tardieu).
+    The attribute DocBook `linenumbering="numbered"` on code blocks
+    maps to the `numberLines` class internally.
+
+  * LaTeX reader:
+
+    + Implement siunitx v3 commands (#7614).
+      We support `\unit`, `\qty`, `\qtyrange`, and `\qtylist`
+      as synonynms of `\si`, `\SI`, `\SIrange`, and `\SIlist`.
+    + Properly handle `\^` followed by group closing (#7615).
+    + Recognize that `\vadjust` sometimes takes "pre" (#7531).
+    + Ignore (and gobble parameters of) CSLReferences environment (#7531).
+      Otherwise we get the parameters as numbers in the output.
+    + Restrict `\endinput` to current file (Simun Schuster).
+
+  * RST reader: handle escaped colons in reference definitions (#7568).
+
+  * HTML reader:
+
+    + Handle empty tbody element in table (#7589).
+
+  * Ipynb reader (Kolen Cheung):
+
+    + Get cell output mime from `raw_mimetype` in addition to `format`.
+      (`format` is what the spec calls for, but `raw_mimetype` is
+      often used in practice; see jupyter/nbformat#229).
+    + Add more formats that can be handled as "raw" cells.
+    + Fix mime type for `rst`.
+    + Support `text/markdown`, which is now a supported mime type for raw
+      output (#7561).
+
+  * RTF reader:
+
+    + Support `\binN` for binary image data.
+    + If doc begins with {\rtf1 ... } only parse its contents.
+      Some documents seem to have non-RTF (e.g. XML) material after the
+      `{\rtf1 ... }` group.
+    + Ignore `\pgdsc` group.  Otherwise we get style names treated as test.
+    + Better handling of `\*` and bookmarks.  We now ensure that groups
+      starting with `\*` never cause text to be added to the document.
+      In addition, bookmarks now create a span between the start
+      and end of the bookmark, rather than an empty span.
+
+  * Docx reader:
+
+    + Avoid blockquote when parent style has more indent (Milan Bracke).
+      When a paragraph has an indentation different from the parent (named)
+      style, it used to be considered a blockquote. But this only makes sense
+      when the paragraph has more indentation. So this commit adds a check
+      for the indentation of the parent style.
+    + Fix handling of empty fields (Milan Bracke).  Some fields only
+      have an `instrText` and no content, Pandoc didn't understand these,
+      causing other fields to be misunderstood because it seemed like
+      a field was still open when it wasn't.
+    + Implement PAGEREF fields (Milan Bracke).  These fields, often used
+      in tables of contents, can be a hyperlink.
+    + Fix handling of nested fields (Milan Bracke).  Fields delimited by
+      `fldChar` elements can contain other fields. Before, the nested
+      fields would be ignored, except for the end, which would be
+      considered the end of the parent field.
+    + Add placeholder for word diagram instead of just omitting it (Ezwal).
+
+  * Org reader:
+
+    + Don't parse a list as first item in a list item (#7557).
+    + Allow an initial `:PROPERTIES:` drawer to add to metadata (#7520).
+
+  * Docx writer:
+
+    + Make id used in `native_numbering` predictable (#7551).
+    If the image has the id IMAGEID, then we use the id ref_IMAGEID
+    for the figure number.  This allows one to create a filter that
+    adds a figure number with figure name, e.g.
+    `<w:fldSimple w:instr=" REF ref_superfig "><w:r><w:t>Figure X</w:t>
+    </w:r></w:fldSimple>`.
+    If an image lack an id, an id of the form `ref_fig1` is used.
+  + Ensure we have unique ids for `wp:docPr` and `pic:cNvPr` elements
+    (#7527, #7503).
+  + Handle SVG images (#4058).  This change has several parts:
+    - In Text.Pandoc.App, if the writer is docx, we fill the media
+      bag and attempt to convert any SVG images to PNG, adding these
+      to the media bag.  The PNG backups have the same filenames as
+      the SVG images, but with an added .png extension.  If the conversion
+      cannot be done (e.g. because rsvg-convert is not present),
+      a warning is omitted.
+    - In Text.Pandoc.Writers.Docx, we now use Word 2016's syntax for
+      including SVG images. If a PNG fallback is present in the media bag,
+      we include a link to that too.
+
+  * Powerpoint writer (Emily Bourke):
+
+    + Add support for more layouts (#5097).  Up til now, four layouts
+      were supported: "Title Slide" (used for the automatically generated
+      metadata slide), "Section Header" (used for headings above slide
+      level), "Two Column" (used when there's a columns div), "Title and
+      Content" (used for all other slides).  We now support three
+      additional layouts: "Comparison", "Content with Caption", and
+      "Blank".  The manual describes the logic that determines which
+      layout is used for a slide.  Layouts may be customized in the
+      reference doc.
+    + Support specifying slide background images using a `background-image`
+      attribute on the slide's heading.  Only the "stretch" mode is supported,
+      and the background image is centred around the slide in the image's
+      larger axis, matching the observed default behaviour of PowerPoint.
+    + Add support for incremental lists (through same methods as in
+      other slide writers) (#5689).
+    + Copy embedded fonts from reference doc.
+    + Include all themes in output archive.
+    + Fix list level numbering (#4828, #4663).  In PowerPoint,
+      the content of a top-level list is at the same level as the content
+      of a top-level paragraph: the only difference is that a list style
+      has been applied.  Previously, the writer incremented the paragrap
+      h level on each list, turning what should be top-level lists into
+      second-level lists.
+    + Line up list continuation paragraphs.  This commit
+      changes the `marL` and `indent` values used for plain paragraphs
+      and numbered lists, and changes the spacing defined in the
+      reference doc master for bulleted lists.  For paragraphs, there is
+      now a left-indent taken from the `otherStyle` in the master.
+      For numbered lists, the number is positioned where the text would be
+      if this were a plain paragraph, and the text is indented to the next
+      level. This means that continuation paragraphs line up nicely with
+      numbered lists.  Existing reference docs may need to be modified so
+      that `otherStyle` and `bodyStyle` indent levels match, for this
+      feature to work with them.
+    + Consolidate text runs when possible (jgm).  This slims down the output
+      files by avoiding unnecessary text run elements.
+    + Support footers in the reference doc.
+      There is one behaviour which may not be immediately obvious: if the
+      reference doc specifies a fixed date (i.e. not automatically updating),
+      and there’s a date specified in the metadata for the document, the
+      footer date is replaced by the metadata date.
+    + Fix presentation rel numbering.  Before now, the numbering of `rId`s
+      was inconsistent when making the presentation XML and when making
+      the presentation relationships XML.
+    + Don’t add relationships unnecessarily.  Before now, for any layouts
+      added to the output from the default reference doc, the relationships
+      were unconditionally added to the output. However, if there was already
+      a layout in slideMaster1 at the same index then that results in
+      duplicate relationships.
+    + If slide level is 0, don't insert a slide break between a heading
+      and a following table, "columns" div, or paragraph starting
+      with an image.
+    + Fix capitalisation of `notesMasterId`.
+    + Restructure tests.
+
+  * Asciidoc writer:
+
+    + Translate numberLines attribute to `linesnum` switch (Samuel Tardieu).
+    + Improve escaping for `--` in URLs (#7529).
+
+  * LaTeX writer:
+
+    + Make babel use more idiomatic (#7604, hseg).  Use babel's
+      bidi implementation.  Import babel languages individually instead
+      of as package options.  Move `header-includes` to after
+      `babel` setup so it can be modified.
+    + Use babel, not polyglossia, with xelatex.  Previously polyglossia
+      worked better with xelatex, but that is no longer the case, so
+      we simplify the code so that babel is used with all latex
+      engines.  This involves a change to the default LaTeX template.
+
+  * Markdown writer:
+
+    + Avoid bad wraps at the Doc Text level.  Previously we tried to
+      do this at the Inline list level, but it makes more sense to
+      intervene on breaking spaces at the Doc Text level.
+    + Use `underline` class rather than `ul` for underline.
+      This only affects output with `bracketed_spans` enabled.
+      The markdown reader parses spans with either `.ul` or `.underline` as
+      Underline elements, but we're moving towards preferring the latter.
+
+  * RST writer:
+
+    + Properly handle anchors to ids with spaces or leading underscore
+      (#7593).  In this cases we need the quoted form, e.g.
+      ```
+      .. _`foo bar`:
+
+      .. _`_foo`:
+      ```
+      Side note: rST will "normalize" these identifiers anyway,
+      ignoring the underscore.
+
+  * HTML writer:
+
+    + Render `\ref` and `\eqref` as inline math, not display (see #7589).
+    + Pass through `\ref` and `\eqref` if MathJax is used (#7587).
+    + Pass through inline math environments with KaTeX.
+    + Support `--reference-location` for HTML output (#7461,
+      Francesco Mazzoli).
+    + Set "hash" to True by default (for reveal.js) (#7574).  See #6968
+      where the motivation for setting "hash" to True is explained.
+
+  * Native writer:  Use pretty-show to format native output (#7580).
+    Previously we used our own homespun formatting.  But this produces
+    over-long lines that aren't ideal for diffs in tests.
+    Performance is slower by about a factor of 10, but this isn't
+    really a problem because native isn't suitable as a serialization
+    format. (For serialization you should use json, because the reader
+    is so much faster than native.)
+
+  * Org writer:
+
+    + Don't indent contents of code blocks.  We previously indented them
+      by two spaces, following a common convention.  Since the convention
+      is fading, and the indentation is inconvenient for copy/paste, we are
+      discontinuing this practice.
+    + Update list of supported source languages in org writer (#5440).
+
+  * Ipynb writer (Kolen Cheung):
+
+    + Improve round trip identity for raw cell output.
+      See jupyter/nbformat#229.  The Jupyter ecosystem, including nbconvert,
+      lab and notebook, deviated from their own spec in nbformat, where
+      they used the key `raw_mimetype` instead of `format`.  Moreover,
+      the mime-type of rst used in Jupyter deviated from that suggested by
+      https://docutils.sourceforge.io/FAQ.html and is defined as
+      `text/restructuredtext` when chosen from "Raw NBConvert Format" in
+      Jupyter.  The new behavior should matche the real world usage better,
+      hence improving the round-trip "identity" in raw-cell.
+    + Add more formats that can be handled as "raw" cells.
+
+  * EPUB writer:
+
+    + Add EPUB3 subject metadata (authority/term) (nuew).
+      This adds the ability to specify EPUB 3 `authority` and `term` specific
+      refinements to the `subject` tag. Specifying a plain `subject` tag in
+      metadata will function as before.
+    + Treat epub:type "frontispiece" as front matter (#7600).
+
+  * reveal.js template: Fix line numbers in source code (#7634).
+    We need `overflow: visible` for these to work, and reveal's
+    default css disables this.  So we re-enable it in the default template.
+
+  * Text.Pandoc.Writers.Shared:
+
+    + Export `splitSentences` as a Doc Text transform [API change].
+      Use this in man/ms.  We used to attempt automatic sentence
+      splitting in man and ms output, since sentence-ending
+      periods need to be followed by two spaces or a newline in
+      these formats.  But it's difficult to do this reliably at
+      the level of `[Inline]`.
+
+  * Text.Pandoc.Translations: small revisions for compatibility
+    with aeson 2.
+
+  * Don't prepend `file://` to `--syntax-definition` on Windows (#6374).
+    This was a fix for a problem in skylighting, but this
+    problem doesn't exist now that we've moved from HXT to xml-conduit.
+
+  * Text.Pandoc.Extensions:
+
+    + Add `Ext_footnotes` to default `gfm` etxensions.  Now `gfm`
+      supports footnotes.
+    + Alphabetize Extension constructors (also affects `--list-extensions`).
+
+  * Text.Pandoc.Citeproc.Util: Better implementation of `splitStrWhen`.
+    Previously the citeproc code had two less efficient
+    implementations.
+
+  * Update documentation for definition_list extension (#7594).
+    In 2015, we relaxed indentation requirements for the first
+    line of a definition (see commit d3544dc and issue #2087), but
+    the documnentation wasn't updated to reflect the change.
+
+  * Text.Pandoc.Citeproc.BibTeX: Fix expansion of special strings in series
+    e.g. `newseries` or `library` (#7591).  Expansion should not happen
+    when these strings are protected in braces, or when they're
+    capitalized.
+
+  * Text.Pandoc.Logging: add `NotUTF8Encoded` constructor to `LogMessage`
+    [API change].
+
+  * Text.Pandoc.App.FormatHeuristics: remove `.tei.xml` extension for TEI
+    (#7630).  This never worked, because `takeExtension`
+    only returns `.xml`.  So it won't be missed if we remove it.
+
+  * Text.Pandoc.Image:
+
+    + Generalize `svgToPng` to MonadIO.
+    + `svgToPng`, change first parameter from WriterOptions to Int.
+
+  * Text.Pandoc.Class:
+
+    + Add `readStdinStrict` method to PandocMonad [API change].
+    + Generalize type of `extractMedia` [API change].
+      It was uselessly  restricted to PandocIO, instead of any
+      instance of PandocMonad and MonadIO.
+
+  * Text.Pandoc.Class.PandocIO: derive MonadCatch, MonadThrow, MonadMask.
+    This allows us to use `withTempDir` [API change].
+
+  * Add module Text.Pandoc.Class.Sandbox, defining
+   `sandbox`.  Exported via Text.Pandoc.Class. [API change]
+
+  * Text.Pandoc.Filter:  Generalize type of `applyFilters`
+    from PandocIO to any instance of MonadIO and PandocMonad [API change].
+
+  * Text.Pandoc.PDF: generalize type of `makePDF`:
+    instead of PandocIO, it can be used in any instance of
+    PandocMonad, MonadIO, and MonadMask [API change].
+
+  * Lua subsystem and custom writers: generalize types from PandocIO
+    to any instance of PandocMonad and MonadIO [API change].
+    The type of `runLua` is now
+
+        (PandocMonad m, MonadIO m) =>
+        LuaE PandocError a -> m (Either PandocError a)
+
+    The change from `Lua` to `LuaE PandocError` is due to the switch to
+    hslua-2.0; see next item.
+
+  * Lua modules (Albert Krewinkel):
+
+    + Switch to hslua-2.0.  The new HsLua version takes a somewhat different
+      approach to marshalling and unmarshalling, relying less on typeclasses
+      and more on specialized types. This allows for better performance and
+      improved error messages.  Furthermore, new abstractions allow to
+      document the code and exposed functions.
+    + Marshal Version values, Inline elements, Attr elements,
+      and Pandoc elements as userdata.
+    + Remove deprecated inline constructors `DoubleQuoted`,
+      `SingleQuoted`, `DisplayMath`, and `InlineMath`.
+    + Attr values are no longer normalized when assigned to an Inline
+      element property.
+    + It's no longer possible to access parts of Inline elements via
+      numerical indexes. E.g., `pandoc.Span('test')[2]` used to give
+      `pandoc.Str 'test'`, but yields `nil` now. This was undocumented
+      behavior not intended to be used in user scripts. Use named properties
+      instead.
+    + Accessing `.c` to get a JSON-like tuple of all components no longer
+      works. This was undocumented behavior.
+    + Only known properties can be set on an element value. Trying to set a
+      different property will now raise an error.
+    + Adds a new `pandoc.AttributeList()` constructor, which creates the
+      associative attribute list that is used as the third component of
+      `Attr` values. Values of this type can often be passed to constructors
+      instead of `Attr` values.
+    + Convert IOErrors to PandocErrors in `pandoc.pipe` function (#7523).
+
+  * Text.Pandoc.PDF:  Previously we had to run `runIOorExplode` inside
+    `withTempDir`.  Now that PandocIO is an instance of MonadMask, this is
+    no longer necessary.
+
+  * Text.Pandoc.App:
+
+    + Reorganize to make it easier to limit IO in main loop.
+      Previously we used liftIO fairly liberally.  The code has
+      been restructured to avoid this.
+    + Move output-file writing out of PandocMonad action.
+
+  * Text.Pandoc.App.OutputSettings: Generalize some types
+    so we can run this with any instance of PandocMonad and MonadIO,
+    not just PandocIO.
+
+  * Use `simpleFigure` builder in readers  and `SimpleFigure`
+    pattern synonym in writers (Aner Lucero).
+
+  * Allow time 1.12.
+
+  * Use skylighting-0.12, skylighting-core-0.12.
+    This fixes highlighting issues with typescript, scala, and other
+    syntaxes that include keyword lists from different syntaxes.
+
+  * Use citeproc 0.6, commonmark 0.2.2.1, commonmark-extensions 0.2.2,
+    texmath 0.12.3.2, ipynb 0.1.0.2.  (These changes also allow
+    building with aeson >= 2.)
+
+  * Require doclayout >= 0.3.1.1.  This fixes recognition of "real widths"
+    of emoji characters, which is important for tabular layout.
+
+  * Cut out over 100K of fat in epub test golden files.
+
+  * Make `test/epub/wasteland.epub` valid.
+
+  * Add missing `%` on some command tests.
+    This prevented `--accept` from working properly.
+
+  * Command tests: raise error if command doesn't begin with `%`.
+
+  * OOXML tests: use pretty-printed form to display diffs.
+    Otherwise everything is on one line and the diff is uninformative.
+
+  * Fix compareXML helper in Tests.Writers.OOXML.
+    Given how it is used, we were getting "mine" and "good"
+    flipped in the test results.
+
+  * MANUAL.txt:
+
+    + Clarify `attributes` extension support (William Lupton).
+    + Document formats affected by `--reference-location`.
+    + Document error code 25
+    + Add some more info regarding `--slide-level=0` (Salim B).
+    + Add more to security section of manual.
+    + Mention support of `title-toc` (#7171, Christophe Dervieux).
+
+  * doc/lua-filters.md:
+
+    + Add missing type for Image title (Quinn).
+    + Improve order of Image fields (Quinn).
+    + Rephrase pandoc.path docs (#7548, Quinn).
+    + Do not leak working directory in TikZ filter (Jeroen de Haas).
+
+## pandoc 2.14.2 (2021-08-21)
 
   * Allow `--slide-level=0` (#7476). When the slide level is set
     to 0, headings won't be used at all in splitting the document
diff --git a/data/pandoc.lua b/data/pandoc.lua
--- a/data/pandoc.lua
+++ b/data/pandoc.lua
@@ -281,56 +281,15 @@
   return {inlines, blocks}
 end
 
---- Split a string into it's words, using whitespace as separators.
-local function words (str)
-  local ws = {}
-  for w in str:gmatch("([^%s]+)") do ws[#ws + 1] = w end
-  return ws
-end
-
 --- Try hard to turn the arguments into an Attr object.
 local function ensureAttr(attr)
-  if type(attr) == 'table' then
-    if #attr > 0 then return M.Attr(table.unpack(attr)) end
-
-    -- assume HTML-like key-value pairs
-    local ident = attr.id or ''
-    local classes = words(attr.class or '')
-    local attributes = attr
-    attributes.id = nil
-    attributes.class = nil
-    return M.Attr(ident, classes, attributes)
-  elseif attr == nil then
-    return M.Attr()
-  elseif type(attr) == 'string' then
-    -- treat argument as ID
-    return M.Attr(attr)
+  if type(attr) == 'userdata' then
+    return attr
   end
-  -- print(arg, ...)
-  error('Could not convert to Attr')
+  return M.Attr(attr)
 end
 
 ------------------------------------------------------------------------
---- Pandoc Document
--- @section document
-
---- A complete pandoc document
--- @function Pandoc
--- @tparam      {Block,...} blocks      document content
--- @tparam[opt] Meta        meta        document meta data
-M.Pandoc = AstElement:make_subtype'Pandoc'
-M.Pandoc.behavior.clone = M.types.clone.Pandoc
-function M.Pandoc:new (blocks, meta)
-  return {
-    blocks = ensureList(blocks),
-    meta = meta or {},
-  }
-end
-
--- DEPRECATED synonym:
-M.Doc = M.Pandoc
-
-------------------------------------------------------------------------
 -- Meta
 -- @section Meta
 
@@ -581,404 +540,9 @@
 
 
 ------------------------------------------------------------------------
--- Inline
--- @section Inline
-
---- Inline element class
-M.Inline = AstElement:make_subtype'Inline'
-M.Inline.behavior.clone = M.types.clone.Inline
-
---- Creates a Cite inline element
--- @function Cite
--- @tparam {Inline,...}   content       List of inlines
--- @tparam {Citation,...} citations     List of citations
--- @treturn Inline citations element
-M.Cite = M.Inline:create_constructor(
-  "Cite",
-  function(content, citations)
-    return {c = {ensureList(citations), ensureInlineList(content)}}
-  end,
-  {"citations", "content"}
-)
-
---- Creates a Code inline element
--- @function Code
--- @tparam      string      text  code string
--- @tparam[opt] Attr        attr  additional attributes
--- @treturn Inline code element
-M.Code = M.Inline:create_constructor(
-  "Code",
-  function(text, attr) return {c = {ensureAttr(attr), text}} end,
-  {{attr = {"identifier", "classes", "attributes"}}, "text"}
-)
-
---- Creates an inline element representing emphasised text.
--- @function Emph
--- @tparam      {Inline,..} content     inline content
--- @treturn Inline emphasis element
-M.Emph = M.Inline:create_constructor(
-  "Emph",
-  function(content) return {c = ensureInlineList(content)} end,
-  "content"
-)
-
---- Creates a Image inline element
--- @function Image
--- @tparam      {Inline,..} caption     text used to describe the image
--- @tparam      string      src         path to the image file
--- @tparam[opt] string      title       brief image description
--- @tparam[opt] Attr        attr additional attributes
--- @treturn Inline image element
-M.Image = M.Inline:create_constructor(
-  "Image",
-  function(caption, src, title, attr)
-    title = title or ""
-    return {c = {ensureAttr(attr), ensureInlineList(caption), {src, title}}}
-  end,
-  {{attr = {"identifier", "classes", "attributes"}}, "caption", {"src", "title"}}
-)
-
---- Create a LineBreak inline element
--- @function LineBreak
--- @treturn Inline linebreak element
-M.LineBreak = M.Inline:create_constructor(
-  "LineBreak",
-  function() return {} end
-)
-
---- Creates a link inline element, usually a hyperlink.
--- @function Link
--- @tparam      {Inline,..} content     text for this link
--- @tparam      string      target      the link target
--- @tparam[opt] string      title       brief link description
--- @tparam[opt] Attr        attr additional attributes
--- @treturn Inline image element
-M.Link = M.Inline:create_constructor(
-  "Link",
-  function(content, target, title, attr)
-    title = title or ""
-    attr = ensureAttr(attr)
-    return {c = {attr, ensureInlineList(content), {target, title}}}
-  end,
-  {{attr = {"identifier", "classes", "attributes"}}, "content", {"target", "title"}}
-)
-
---- Creates a Math element, either inline or displayed.
--- @function Math
--- @tparam      "InlineMath"|"DisplayMath" mathtype rendering specifier
--- @tparam      string      text        Math content
--- @treturn     Inline                  Math element
-M.Math = M.Inline:create_constructor(
-  "Math",
-  function(mathtype, text)
-    return {c = {mathtype, text}}
-  end,
-  {"mathtype", "text"}
-)
---- Creates a DisplayMath element (DEPRECATED).
--- @function DisplayMath
--- @tparam      string      text        Math content
--- @treturn     Inline                  Math element
-M.DisplayMath = M.Inline:create_constructor(
-  "DisplayMath",
-  function(text) return M.Math("DisplayMath", text) end,
-  {"mathtype", "text"}
-)
---- Creates an InlineMath inline element (DEPRECATED).
--- @function InlineMath
--- @tparam      string      text        Math content
--- @treturn     Inline                  Math element
-M.InlineMath = M.Inline:create_constructor(
-  "InlineMath",
-  function(text) return M.Math("InlineMath", text) end,
-  {"mathtype", "text"}
-)
-
---- Creates a Note inline element
--- @function Note
--- @tparam      {Block,...} content     footnote block content
-M.Note = M.Inline:create_constructor(
-  "Note",
-  function(content) return {c = ensureList(content)} end,
-  "content"
-)
-
---- Creates a Quoted inline element given the quote type and quoted content.
--- @function Quoted
--- @tparam      "DoubleQuote"|"SingleQuote" quotetype type of quotes to be used
--- @tparam      {Inline,..} content     inline content
--- @treturn     Inline                  quoted element
-M.Quoted = M.Inline:create_constructor(
-  "Quoted",
-  function(quotetype, content)
-    return {c = {quotetype, ensureInlineList(content)}}
-  end,
-  {"quotetype", "content"}
-)
---- Creates a single-quoted inline element (DEPRECATED).
--- @function SingleQuoted
--- @tparam      {Inline,..} content     inline content
--- @treturn     Inline                  quoted element
--- @see Quoted
-M.SingleQuoted = M.Inline:create_constructor(
-  "SingleQuoted",
-  function(content) return M.Quoted(M.SingleQuote, content) end,
-  {"quotetype", "content"}
-)
---- Creates a single-quoted inline element (DEPRECATED).
--- @function DoubleQuoted
--- @tparam      {Inline,..} content     inline content
--- @treturn     Inline                  quoted element
--- @see Quoted
-M.DoubleQuoted = M.Inline:create_constructor(
-  "DoubleQuoted",
-  function(content) return M.Quoted("DoubleQuote", content) end,
-  {"quotetype", "content"}
-)
-
---- Creates a RawInline inline element
--- @function RawInline
--- @tparam      string      format      format of the contents
--- @tparam      string      text        string content
--- @treturn     Inline                  raw inline element
-M.RawInline = M.Inline:create_constructor(
-  "RawInline",
-  function(format, text) return {c = {format, text}} end,
-  {"format", "text"}
-)
-
---- Creates text rendered in small caps
--- @function SmallCaps
--- @tparam      {Inline,..} content     inline content
--- @treturn     Inline                  smallcaps element
-M.SmallCaps = M.Inline:create_constructor(
-  "SmallCaps",
-  function(content) return {c = ensureInlineList(content)} end,
-  "content"
-)
-
---- Creates a SoftBreak inline element.
--- @function SoftBreak
--- @treturn     Inline                  softbreak element
-M.SoftBreak = M.Inline:create_constructor(
-  "SoftBreak",
-  function() return {} end
-)
-
---- Create a Space inline element
--- @function Space
--- @treturn Inline space element
-M.Space = M.Inline:create_constructor(
-  "Space",
-  function() return {} end
-)
-
---- Creates a Span inline element
--- @function Span
--- @tparam      {Inline,..} content     inline content
--- @tparam[opt] Attr        attr  additional attributes
--- @treturn Inline span element
-M.Span = M.Inline:create_constructor(
-  "Span",
-  function(content, attr)
-    return {c = {ensureAttr(attr), ensureInlineList(content)}}
-  end,
-  {{attr = {"identifier", "classes", "attributes"}}, "content"}
-)
-
---- Creates a Str inline element
--- @function Str
--- @tparam      string      text        content
--- @treturn     Inline                  string element
-M.Str = M.Inline:create_constructor(
-  "Str",
-  function(text) return {c = text} end,
-  "text"
-)
-
---- Creates text which is striked out.
--- @function Strikeout
--- @tparam      {Inline,..} content     inline content
--- @treturn     Inline                  strikeout element
-M.Strikeout = M.Inline:create_constructor(
-  "Strikeout",
-  function(content) return {c = ensureInlineList(content)} end,
-  "content"
-)
-
---- Creates a Strong element, whose text is usually displayed in a bold font.
--- @function Strong
--- @tparam      {Inline,..} content     inline content
--- @treturn     Inline                  strong element
-M.Strong = M.Inline:create_constructor(
-  "Strong",
-  function(content) return {c = ensureInlineList(content)} end,
-  "content"
-)
-
---- Creates a Subscript inline element
--- @function Subscript
--- @tparam      {Inline,..} content     inline content
--- @treturn     Inline                  subscript element
-M.Subscript = M.Inline:create_constructor(
-  "Subscript",
-  function(content) return {c = ensureInlineList(content)} end,
-  "content"
-)
-
---- Creates a Superscript inline element
--- @function Superscript
--- @tparam      {Inline,..} content     inline content
--- @treturn     Inline                  superscript element
-M.Superscript = M.Inline:create_constructor(
-  "Superscript",
-  function(content) return {c = ensureInlineList(content)} end,
-  "content"
-)
-
---- Creates an Underline inline element
--- @function Underline
--- @tparam      {Inline,..} content     inline content
--- @treturn     Inline                  underline element
-M.Underline = M.Inline:create_constructor(
-  "Underline",
-  function(content) return {c = ensureInlineList(content)} end,
-  "content"
-)
-
-
-------------------------------------------------------------------------
 -- Element components
 -- @section components
 
---- Check if the first element of a pair matches the given value.
--- @param x  key value to be checked
--- @return function returning true iff first element of its argument matches x
--- @local
-local function assoc_key_equals (x)
-  return function (y) return y[1] == x end
-end
-
---- Lookup a value in an associative list
--- @function lookup
--- @local
--- @tparam {{key, value},...} alist associative list
--- @param key key for which the associated value is to be looked up
-local function lookup(alist, key)
-  return (List.find_if(alist, assoc_key_equals(key)) or {})[2]
-end
-
---- Return an iterator which returns key-value pairs of an associative list.
--- @function apairs
--- @local
--- @tparam {{key, value},...} alist associative list
-local apairs = function (alist)
-  local i = 1
-  local cur
-  function nxt ()
-    cur = rawget(alist, i)
-    if cur then
-      i = i + 1
-      return cur[1], cur[2]
-    end
-    return nil
-  end
-  return nxt, nil, nil
-end
-
---- AttributeList, a metatable to allow table-like access to attribute lists
--- represented by associative lists.
--- @local
-local AttributeList = {
-  __index = function (t, k)
-    if type(k) == "number" then
-      return rawget(t, k)
-    else
-      return lookup(t, k)
-    end
-  end,
-
-  __newindex = function (t, k, v)
-    local cur, idx = List.find_if(t, assoc_key_equals(k))
-    if v == nil and not cur then
-      -- deleted key does not exists in list
-      return
-    elseif v == nil then
-      table.remove(t, idx)
-    elseif cur then
-      cur[2] = v
-    elseif type(k) == "number" then
-      rawset(t, k, v)
-    else
-      rawset(t, #t + 1, {k, v})
-    end
-  end,
-
-  __pairs = apairs
-}
-
---- Convert a table to an associative list. The order of key-value pairs in the
--- alist is undefined. The table should either contain no numeric keys or
--- already be an associative list.
--- @local
--- @tparam table tbl associative list or table without numeric keys.
--- @treturn table associative list
-local to_alist = function (tbl)
-  if #tbl ~= 0 or next(tbl) == nil then
-    -- probably already an alist
-    return tbl
-  end
-  local alist = {}
-  local i = 1
-  for k, v in pairs(tbl) do
-    alist[i] = {k, v}
-    i = i + 1
-  end
-  return alist
-end
-
--- Attr
-
---- Create a new set of attributes (Attr).
--- @function Attr
--- @tparam[opt] string       identifier element identifier
--- @tparam[opt] {string,...} classes    element classes
--- @tparam[opt] table        attributes table containing string keys and values
--- @return element attributes
-M.Attr = AstElement:make_subtype'Attr'
-function M.Attr:new (identifier, classes, attributes)
-  identifier = identifier or ''
-  classes = ensureList(classes or {})
-  attributes = setmetatable(to_alist(attributes or {}), AttributeList)
-  return setmetatable({identifier, classes, attributes}, self.behavior)
-end
-M.Attr.behavior.clone = M.types.clone.Attr
-M.Attr.behavior.tag = 'Attr'
-M.Attr.behavior._field_names = {identifier = 1, classes = 2, attributes = 3}
-M.Attr.behavior.__eq = utils.equals
-M.Attr.behavior.__index = function(t, k)
-  return (k == 't' and t.tag) or
-    rawget(t, getmetatable(t)._field_names[k]) or
-    getmetatable(t)[k]
-end
-M.Attr.behavior.__newindex = function(t, k, v)
-  if k == 'attributes' then
-    rawset(t, 3, setmetatable(to_alist(v or {}), AttributeList))
-  elseif getmetatable(t)._field_names[k] then
-    rawset(t, getmetatable(t)._field_names[k], v)
-  else
-    rawset(t, k, v)
-  end
-end
-M.Attr.behavior.__pairs = function(t)
-  local field_names = M.Attr.behavior._field_names
-  local fields = {}
-  for name, i in pairs(field_names) do
-    fields[i] = name
-  end
-  return make_next_function(fields), t, nil
-end
-
 -- Monkey-patch setters for `attr` fields to be more forgiving in the input that
 -- results in a valid Attr value.
 function augment_attr_setter (setters)
@@ -992,10 +556,6 @@
 for _, blk in pairs(M.Block.constructor) do
   augment_attr_setter(blk.behavior.setters)
 end
-for _, inln in pairs(M.Inline.constructor) do
-  augment_attr_setter(inln.behavior.setters)
-end
-
 
 -- Citation
 M.Citation = AstElement:make_subtype'Citation'
diff --git a/data/pptx/ppt/slideMasters/slideMaster1.xml b/data/pptx/ppt/slideMasters/slideMaster1.xml
--- a/data/pptx/ppt/slideMasters/slideMaster1.xml
+++ b/data/pptx/ppt/slideMasters/slideMaster1.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<p:sldMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:cSld><p:bg><p:bgRef idx="1001"><a:schemeClr val="bg1"/></p:bgRef></p:bg><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Title Placeholder 1"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="title"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="274638"/><a:ext cx="8229600" cy="1143000"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"><a:normAutofit/></a:bodyPr><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master title style</a:t></a:r><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Text Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="1600200"/><a:ext cx="8229600" cy="4525963"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0"><a:normAutofit/></a:bodyPr><a:lstStyle/><a:p><a:pPr lvl="0"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master text styles</a:t></a:r></a:p><a:p><a:pPr lvl="1"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Second level</a:t></a:r></a:p><a:p><a:pPr lvl="2"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Third level</a:t></a:r></a:p><a:p><a:pPr lvl="3"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Fourth level</a:t></a:r></a:p><a:p><a:pPr lvl="4"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Fifth level</a:t></a:r><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="4" name="Date Placeholder 3"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="dt" sz="half" idx="2"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="6356350"/><a:ext cx="2133600" cy="365125"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/><a:lstStyle><a:lvl1pPr algn="l"><a:defRPr sz="1200"><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl1pPr></a:lstStyle><a:p><a:fld id="{241EB5C9-1307-BA42-ABA2-0BC069CD8E7F}" type="datetimeFigureOut"><a:rPr lang="en-US" smtClean="0"/><a:t>4/5/2019</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="5" name="Footer Placeholder 4"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="ftr" sz="quarter" idx="3"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="3124200" y="6356350"/><a:ext cx="2895600" cy="365125"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/><a:lstStyle><a:lvl1pPr algn="ctr"><a:defRPr sz="1200"><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl1pPr></a:lstStyle><a:p><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="6" name="Slide Number Placeholder 5"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldNum" sz="quarter" idx="4"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="6553200" y="6356350"/><a:ext cx="2133600" cy="365125"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/><a:lstStyle><a:lvl1pPr algn="r"><a:defRPr sz="1200"><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl1pPr></a:lstStyle><a:p><a:fld id="{C5EF2332-01BF-834F-8236-50238282D533}" type="slidenum"><a:rPr lang="en-US" smtClean="0"/><a:t>‹#›</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp></p:spTree><p:extLst><p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}"><p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="3676200875"/></p:ext></p:extLst></p:cSld><p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/><p:sldLayoutIdLst><p:sldLayoutId id="2147483649" r:id="rId1"/><p:sldLayoutId id="2147483650" r:id="rId2"/><p:sldLayoutId id="2147483651" r:id="rId3"/><p:sldLayoutId id="2147483652" r:id="rId4"/><p:sldLayoutId id="2147483653" r:id="rId5"/><p:sldLayoutId id="2147483654" r:id="rId6"/><p:sldLayoutId id="2147483655" r:id="rId7"/><p:sldLayoutId id="2147483656" r:id="rId8"/><p:sldLayoutId id="2147483657" r:id="rId9"/><p:sldLayoutId id="2147483658" r:id="rId10"/><p:sldLayoutId id="2147483659" r:id="rId11"/></p:sldLayoutIdLst><p:txStyles><p:titleStyle><a:lvl1pPr algn="ctr" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="0"/></a:spcBef><a:buNone/><a:defRPr sz="4400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mj-lt"/><a:ea typeface="+mj-ea"/><a:cs typeface="+mj-cs"/></a:defRPr></a:lvl1pPr></p:titleStyle><p:bodyStyle><a:lvl1pPr marL="342900" indent="-342900" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="3200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr><a:lvl2pPr marL="742950" indent="-285750" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="–"/><a:defRPr sz="2800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl2pPr><a:lvl3pPr marL="1143000" indent="-228600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="2400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl3pPr><a:lvl4pPr marL="1600200" indent="-228600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="–"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl4pPr><a:lvl5pPr marL="2057400" indent="-228600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="»"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl5pPr><a:lvl6pPr marL="2514600" indent="-228600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl6pPr><a:lvl7pPr marL="2971800" indent="-228600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl7pPr><a:lvl8pPr marL="3429000" indent="-228600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl8pPr><a:lvl9pPr marL="3886200" indent="-228600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl9pPr></p:bodyStyle><p:otherStyle><a:defPPr><a:defRPr lang="en-US"/></a:defPPr><a:lvl1pPr marL="0" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr><a:lvl2pPr marL="457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl2pPr><a:lvl3pPr marL="914400" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl3pPr><a:lvl4pPr marL="1371600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl4pPr><a:lvl5pPr marL="1828800" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl5pPr><a:lvl6pPr marL="2286000" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl6pPr><a:lvl7pPr marL="2743200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl7pPr><a:lvl8pPr marL="3200400" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl8pPr><a:lvl9pPr marL="3657600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl9pPr></p:otherStyle></p:txStyles></p:sldMaster>
+<p:sldMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:cSld><p:bg><p:bgRef idx="1001"><a:schemeClr val="bg1"/></p:bgRef></p:bg><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Title Placeholder 1"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="title"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="274638"/><a:ext cx="8229600" cy="1143000"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"><a:normAutofit/></a:bodyPr><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master title style</a:t></a:r><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Text Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="1600200"/><a:ext cx="8229600" cy="4525963"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0"><a:normAutofit/></a:bodyPr><a:lstStyle/><a:p><a:pPr lvl="0"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master text styles</a:t></a:r></a:p><a:p><a:pPr lvl="1"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Second level</a:t></a:r></a:p><a:p><a:pPr lvl="2"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Third level</a:t></a:r></a:p><a:p><a:pPr lvl="3"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Fourth level</a:t></a:r></a:p><a:p><a:pPr lvl="4"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Fifth level</a:t></a:r><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="4" name="Date Placeholder 3"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="dt" sz="half" idx="2"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="6356350"/><a:ext cx="2133600" cy="365125"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/><a:lstStyle><a:lvl1pPr algn="l"><a:defRPr sz="1200"><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl1pPr></a:lstStyle><a:p><a:fld id="{241EB5C9-1307-BA42-ABA2-0BC069CD8E7F}" type="datetimeFigureOut"><a:rPr lang="en-US" smtClean="0"/><a:t>4/5/2019</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="5" name="Footer Placeholder 4"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="ftr" sz="quarter" idx="3"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="3124200" y="6356350"/><a:ext cx="2895600" cy="365125"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/><a:lstStyle><a:lvl1pPr algn="ctr"><a:defRPr sz="1200"><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl1pPr></a:lstStyle><a:p><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="6" name="Slide Number Placeholder 5"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldNum" sz="quarter" idx="4"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="6553200" y="6356350"/><a:ext cx="2133600" cy="365125"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/><a:lstStyle><a:lvl1pPr algn="r"><a:defRPr sz="1200"><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl1pPr></a:lstStyle><a:p><a:fld id="{C5EF2332-01BF-834F-8236-50238282D533}" type="slidenum"><a:rPr lang="en-US" smtClean="0"/><a:t>‹#›</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp></p:spTree><p:extLst><p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}"><p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="3676200875"/></p:ext></p:extLst></p:cSld><p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/><p:sldLayoutIdLst><p:sldLayoutId id="2147483649" r:id="rId1"/><p:sldLayoutId id="2147483650" r:id="rId2"/><p:sldLayoutId id="2147483651" r:id="rId3"/><p:sldLayoutId id="2147483652" r:id="rId4"/><p:sldLayoutId id="2147483653" r:id="rId5"/><p:sldLayoutId id="2147483654" r:id="rId6"/><p:sldLayoutId id="2147483655" r:id="rId7"/><p:sldLayoutId id="2147483656" r:id="rId8"/><p:sldLayoutId id="2147483657" r:id="rId9"/><p:sldLayoutId id="2147483658" r:id="rId10"/><p:sldLayoutId id="2147483659" r:id="rId11"/></p:sldLayoutIdLst><p:txStyles><p:titleStyle><a:lvl1pPr algn="ctr" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="0"/></a:spcBef><a:buNone/><a:defRPr sz="4400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mj-lt"/><a:ea typeface="+mj-ea"/><a:cs typeface="+mj-cs"/></a:defRPr></a:lvl1pPr></p:titleStyle><p:bodyStyle><a:lvl1pPr marL="457200" indent="-457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="3200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr><a:lvl2pPr marL="914400" indent="-457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="–"/><a:defRPr sz="2800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl2pPr><a:lvl3pPr marL="1371600" indent="-457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="2400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl3pPr><a:lvl4pPr marL="1828800" indent="-457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="–"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl4pPr><a:lvl5pPr marL="2286000" indent="-457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="»"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl5pPr><a:lvl6pPr marL="2743200" indent="-457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl6pPr><a:lvl7pPr marL="3200400" indent="-457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl7pPr><a:lvl8pPr marL="3657600" indent="-457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl8pPr><a:lvl9pPr marL="4114800" indent="-457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial"/><a:buChar char="•"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl9pPr></p:bodyStyle><p:otherStyle><a:defPPr><a:defRPr lang="en-US"/></a:defPPr><a:lvl1pPr marL="0" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr><a:lvl2pPr marL="457200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl2pPr><a:lvl3pPr marL="914400" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl3pPr><a:lvl4pPr marL="1371600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl4pPr><a:lvl5pPr marL="1828800" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl5pPr><a:lvl6pPr marL="2286000" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl6pPr><a:lvl7pPr marL="2743200" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl7pPr><a:lvl8pPr marL="3200400" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl8pPr><a:lvl9pPr marL="3657600" algn="l" defTabSz="457200" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl9pPr></p:otherStyle></p:txStyles></p:sldMaster>
diff --git a/data/templates/default.latex b/data/templates/default.latex
--- a/data/templates/default.latex
+++ b/data/templates/default.latex
@@ -4,11 +4,6 @@
 $if(colorlinks)$
 \PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
 $endif$
-$if(dir)$
-$if(latex-dir-rtl)$
-\PassOptionsToPackage{RTLdocument}{bidi}
-$endif$
-$endif$
 $if(CJKmainfont)$
 \PassOptionsToPackage{space}{xeCJK}
 $endif$
@@ -17,9 +12,6 @@
 $if(fontsize)$
   $fontsize$,
 $endif$
-$if(lang)$
-  $babel-lang$,
-$endif$
 $if(papersize)$
   $papersize$paper,
 $endif$
@@ -370,35 +362,27 @@
 \newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
 \newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
 $endif$
-$for(header-includes)$
-$header-includes$
-$endfor$
 $if(lang)$
-\ifXeTeX
-  % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
-  \usepackage{polyglossia}
-  \setmainlanguage[$for(polyglossia-lang.options)$$polyglossia-lang.options$$sep$,$endfor$]{$polyglossia-lang.name$}
-$for(polyglossia-otherlangs)$
-  \setotherlanguage[$for(polyglossia-otherlangs.options)$$polyglossia-otherlangs.options$$sep$,$endfor$]{$polyglossia-otherlangs.name$}
-$endfor$
+\ifLuaTeX
+\usepackage[bidi=basic]{babel}
 \else
-  \usepackage[$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
+\usepackage[bidi=default]{babel}
+\fi
+\babelprovide[main,import]{$babel-lang$}
+$for(babel-otherlangs)$
+\babelprovide[import]{$babel-otherlangs$}
+$endfor$
 % get rid of language-specific shorthands (see #6817):
 \let\LanguageShortHands\languageshorthands
 \def\languageshorthands#1{}
-$if(babel-newcommands)$
-  $babel-newcommands$
 $endif$
-\fi
-$endif$
+$for(header-includes)$
+$header-includes$
+$endfor$
 \ifLuaTeX
   \usepackage{selnolig}  % disable illegal ligatures
 \fi
 $if(dir)$
-\ifXeTeX
-  % Load bidi as late as possible as it modifies e.g. graphicx
-  \usepackage{bidi}
-\fi
 \ifPDFTeX
   \TeXXeTstate=1
   \newcommand{\RL}[1]{\beginR #1\endR}
diff --git a/data/templates/default.revealjs b/data/templates/default.revealjs
--- a/data/templates/default.revealjs
+++ b/data/templates/default.revealjs
@@ -19,6 +19,9 @@
   <link rel="stylesheet" href="$revealjs-url$/dist/reset.css">
   <link rel="stylesheet" href="$revealjs-url$/dist/reveal.css">
   <style>
+    .reveal .sourceCode {  /* see #7635 */
+      overflow: visible;
+    }
     $styles.html()$
   </style>
 $if(theme)$
diff --git a/man/pandoc.1 b/man/pandoc.1
--- a/man/pandoc.1
+++ b/man/pandoc.1
@@ -1,7 +1,7 @@
 '\" t
-.\" Automatically generated by Pandoc 2.14.1
+.\" Automatically generated by Pandoc 2.14.2
 .\"
-.TH "Pandoc User\[cq]s Guide" "" "July 18, 2021" "pandoc 2.14.2" ""
+.TH "Pandoc User\[cq]s Guide" "" "October 22, 2021" "pandoc 2.15" ""
 .hy
 .SH NAME
 pandoc - general markup converter
@@ -178,11 +178,11 @@
 \f[C]hyperref\f[R], \f[C]xcolor\f[R], \f[C]ulem\f[R], \f[C]geometry\f[R]
 (with the \f[C]geometry\f[R] variable set), \f[C]setspace\f[R] (with
 \f[C]linestretch\f[R]), and \f[C]babel\f[R] (with \f[C]lang\f[R]).
+If \f[C]CJKmainfont\f[R] is set, \f[C]xeCJK\f[R] is needed.
 The use of \f[C]xelatex\f[R] or \f[C]lualatex\f[R] as the PDF engine
 requires \f[C]fontspec\f[R].
 \f[C]lualatex\f[R] uses \f[C]selnolig\f[R].
-\f[C]xelatex\f[R] uses \f[C]polyglossia\f[R] (with \f[C]lang\f[R]),
-\f[C]xecjk\f[R], and \f[C]bidi\f[R] (with the \f[C]dir\f[R] variable
+\f[C]xelatex\f[R] uses \f[C]bidi\f[R] (with the \f[C]dir\f[R] variable
 set).
 If the \f[C]mathspec\f[R] variable is set, \f[C]xelatex\f[R] will use
 \f[C]mathspec\f[R] instead of \f[C]unicode-math\f[R].
@@ -765,6 +765,15 @@
 If no \f[I]VAL\f[R] is specified, the key will be given the value
 \f[C]true\f[R].
 .TP
+\f[B]\f[CB]--sandbox\f[B]\f[R]
+Run pandoc in a sandbox, limiting IO operations in readers and writers
+to reading the files specified on the command line.
+Note that this option does not limit IO operations by filters or in the
+production of PDF documents.
+But it does offer security against, for example, disclosure of files
+through the use of \f[C]include\f[R] directives.
+Anyone using pandoc on untrusted user input should use this option.
+.TP
 \f[B]\f[CB]-D\f[B]\f[R] \f[I]FORMAT\f[R], \f[B]\f[CB]--print-default-template=\f[B]\f[R]\f[I]FORMAT\f[R]
 Print the system default template for an output \f[I]FORMAT\f[R].
 (See \f[C]-t\f[R] for a list of possible \f[I]FORMAT\f[R]s.) Templates
@@ -995,7 +1004,10 @@
 is set) are placed at the end of the current (top-level) block, the
 current section, or the document.
 The default is \f[C]document\f[R].
-Currently only affects the markdown writer.
+Currently this option only affects the \f[C]markdown\f[R],
+\f[C]muse\f[R], \f[C]html\f[R], \f[C]epub\f[R], \f[C]slidy\f[R],
+\f[C]s5\f[R], \f[C]slideous\f[R], \f[C]dzslides\f[R], and
+\f[C]revealjs\f[R] writers.
 .TP
 \f[B]\f[CB]--markdown-headings=setext\f[B]\f[R]|\f[B]\f[CB]atx\f[B]\f[R]
 Specify whether to use ATX-style (\f[C]#\f[R]-prefixed) or Setext-style
@@ -1249,11 +1261,18 @@
 Section Header
 .IP \[bu] 2
 Two Content
+.IP \[bu] 2
+Comparison
+.IP \[bu] 2
+Content with Caption
+.IP \[bu] 2
+Blank
 .PP
 For each name, the first layout found with that name will be used.
 If no layout is found with one of the names, pandoc will output a
 warning and use the layout with that name from the default reference doc
 instead.
+(How these layouts are used is described in PowerPoint layout choice.)
 .PP
 All templates included with a recent version of MS PowerPoint will fit
 these criteria.
@@ -1263,7 +1282,7 @@
 You can also modify the default \f[C]reference.pptx\f[R]: first run
 \f[C]pandoc -o custom-reference.pptx --print-default-data-file reference.pptx\f[R],
 and then modify \f[C]custom-reference.pptx\f[R] in MS PowerPoint (pandoc
-will use the first four layout slides, as mentioned above).
+will use the layouts with the names listed above).
 .RE
 .RE
 .TP
@@ -1617,6 +1636,11 @@
 PandocCiteprocError
 T}
 T{
+25
+T}@T{
+PandocBibliographyError
+T}
+T{
 31
 T}@T{
 PandocEpubSubdirectoryError
@@ -2444,7 +2468,7 @@
 AsciiDoc metadata; repeat as for \f[C]author\f[R], above
 .TP
 \f[B]\f[CB]subject\f[B]\f[R]
-document subject, included in ODT, PDF, docx and pptx metadata
+document subject, included in ODT, PDF, docx, EPUB, and pptx metadata
 .TP
 \f[B]\f[CB]description\f[B]\f[R]
 document description, included in ODT, docx and pptx metadata.
@@ -2621,7 +2645,7 @@
 .TP
 \f[B]\f[CB]title-slide-attributes\f[B]\f[R]
 additional attributes for the title slide of reveal.js slide shows.
-See background in reveal.js and beamer for an example.
+See [background in reveal.js and beamer] for an example.
 .PP
 All reveal.js configuration options are available as variables.
 To turn off boolean flags that default to true in reveal.js, use
@@ -3107,8 +3131,8 @@
 non-null value if \f[C]--toc/--table-of-contents\f[R] was specified
 .TP
 \f[B]\f[CB]toc-title\f[B]\f[R]
-title of table of contents (works only with EPUB, HTML, opendocument,
-odt, docx, pptx, beamer, LaTeX)
+title of table of contents (works only with EPUB, HTML, revealjs,
+opendocument, odt, docx, pptx, beamer, LaTeX)
 .SH EXTENSIONS
 .PP
 The behavior of some of the readers and writers can be adjusted by
@@ -4247,8 +4271,8 @@
 A term may have multiple definitions, and each definition may consist of
 one or more block elements (paragraph, code block, list, etc.), each
 indented four spaces or one tab stop.
-The body of the definition (including the first line, aside from the
-colon or tilde) should be indented four spaces.
+The body of the definition (not including the first line) should be
+indented four spaces.
 However, as with other Markdown lists, you can \[lq]lazily\[rq] omit
 indentation except at the beginning of a paragraph or other block
 element:
@@ -6001,7 +6025,8 @@
 file containing the reference link or image itself, if these differ.
 .SS Extension: \f[C]attributes\f[R]
 .PP
-Allows attributes to be attached to any inline or block-level element.
+Allows attributes to be attached to any inline or block-level element
+when parsing \f[C]commonmark\f[R].
 The syntax for the attributes is the same as that used in
 \f[C]header_attributes\f[R].
 .IP \[bu] 2
@@ -6819,15 +6844,58 @@
 .PP
 These rules are designed to support many different styles of slide show.
 If you don\[cq]t care about structuring your slides into sections and
-subsections, you can just use level-1 headings for all each slide.
-(In that case, level-1 will be the slide level.) But you can also
-structure the slide show into sections, as in the example above.
+subsections, you can either just use level-1 headings for all slides (in
+that case, level 1 will be the slide level) or you can set
+\f[C]--slide-level=0\f[R].
 .PP
 Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
 layout will be produced, with level-1 headings building horizontally and
 level-2 headings building vertically.
 It is not recommended that you use deeper nesting of section levels with
-reveal.js.
+reveal.js unless you set \f[C]--slide-level=0\f[R] (which lets reveal.js
+produce a one-dimensional layout and only interprets horizontal rules as
+slide boundaries).
+.SS PowerPoint layout choice
+.PP
+When creating slides, the pptx writer chooses from a number of
+pre-defined layouts, based on the content of the slide:
+.TP
+Title Slide
+This layout is used for the initial slide, which is generated and filled
+from the metadata fields \f[C]date\f[R], \f[C]author\f[R], and
+\f[C]title\f[R], if they are present.
+.TP
+Section Header
+This layout is used for what pandoc calls \[lq]title slides\[rq], i.e.
+slides which start with a header which is above the slide level in the
+hierarchy.
+.TP
+Two Content
+This layout is used for two-column slides, i.e.\ slides containing a div
+with class \f[C]columns\f[R] which contains at least two divs with class
+\f[C]column\f[R].
+.TP
+Comparison
+This layout is used instead of \[lq]Two Content\[rq] for any two-column
+slides in which at least one column contains text followed by non-text
+(e.g.\ an image or a table).
+.TP
+Content with Caption
+This layout is used for any non-two-column slides which contain text
+followed by non-text (e.g.\ an image or a table).
+.TP
+Blank
+This layout is used for any slides which only contain blank content,
+e.g.\ a slide containing only speaker notes, or a slide containing only
+a non-breaking space.
+.TP
+Title and Content
+This layout is used for all slides which do not match the criteria for
+another layout.
+.PP
+These layouts are chosen from the default pptx reference doc included
+with pandoc, unless an alternative reference doc is specified using
+\f[C]--reference-doc\f[R].
 .SS Incremental lists
 .PP
 By default, these writers produce lists that display \[lq]all at
@@ -6879,9 +6947,6 @@
 .PP
 Both methods allow incremental and nonincremental lists to be mixed in a
 single document.
-.PP
-Note: Neither the \f[C]-i/--incremental\f[R] option nor any of the
-methods described here currently works for PowerPoint output.
 .SS Inserting pauses
 .PP
 You can add \[lq]pauses\[rq] within a slide by including a paragraph
@@ -7057,48 +7122,65 @@
 \f[C]allowframebreaks\f[R], \f[C]b\f[R], \f[C]c\f[R], \f[C]t\f[R],
 \f[C]environment\f[R], \f[C]label\f[R], \f[C]plain\f[R],
 \f[C]shrink\f[R], \f[C]standout\f[R], \f[C]noframenumbering\f[R].
-.SS Background in reveal.js and beamer
+.SS Background in reveal.js, beamer, and pptx
 .PP
-Background images can be added to self-contained reveal.js slideshows
-and to beamer slideshows.
+Background images can be added to self-contained reveal.js slide shows,
+beamer slide shows, and pptx slide shows.
+.SS On all slides (beamer, reveal.js, pptx)
 .PP
-For the same image on every slide, use the configuration option
-\f[C]background-image\f[R] either in the YAML metadata block or as a
-command-line variable.
-(There are no other options in beamer and the rest of this section
-concerns reveal.js slideshows.)
+With beamer and reveal.js, the configuration option
+\f[C]background-image\f[R] can be used either in the YAML metadata block
+or as a command-line variable to get the same image on every slide.
 .PP
-For reveal.js, you can instead use the reveal.js-native option
-\f[C]parallaxBackgroundImage\f[R].
-You can also set \f[C]parallaxBackgroundHorizontal\f[R] and
-\f[C]parallaxBackgroundVertical\f[R] the same way and must also set
-\f[C]parallaxBackgroundSize\f[R] to have your values take effect.
+For pptx, you can use a reference doc in which background images have
+been set on the relevant layouts.
+.SS \f[C]parallaxBackgroundImage\f[R] (reveal.js)
 .PP
-To set an image for a particular reveal.js slide, add
-\f[C]{data-background-image=\[dq]/path/to/image\[dq]}\f[R] to the first
-slide-level heading on the slide (which may even be empty).
+For reveal.js, there is also the reveal.js-native option
+\f[C]parallaxBackgroundImage\f[R], which can be used instead of
+\f[C]background-image\f[R] to produce a parallax scrolling background.
+You must also set \f[C]parallaxBackgroundSize\f[R], and can optionally
+set \f[C]parallaxBackgroundHorizontal\f[R] and
+\f[C]parallaxBackgroundVertical\f[R] to configure the scrolling
+behaviour.
+See the reveal.js documentation for more details about the meaning of
+these options.
 .PP
 In reveal.js\[cq]s overview mode, the parallaxBackgroundImage will show
 up only on the first slide.
+.SS On individual slides (reveal.js, pptx)
 .PP
-Other reveal.js background settings also work on individual slides,
-including \f[C]data-background-size\f[R],
-\f[C]data-background-repeat\f[R], \f[C]data-background-color\f[R],
-\f[C]data-transition\f[R], and \f[C]data-transition-speed\f[R].
+To set an image for a particular reveal.js or pptx slide, add
+\f[C]{background-image=\[dq]/path/to/image\[dq]}\f[R] to the first
+slide-level heading on the slide (which may even be empty).
 .PP
-To add a background image to the automatically generated title slide,
-use the \f[C]title-slide-attributes\f[R] variable in the YAML metadata
-block.
-It must contain a map of attribute names and values.
+As the HTML writers pass unknown attributes through, other reveal.js
+background settings also work on individual slides, including
+\f[C]background-size\f[R], \f[C]background-repeat\f[R],
+\f[C]background-color\f[R], \f[C]transition\f[R], and
+\f[C]transition-speed\f[R].
+(The \f[C]data-\f[R] prefix will automatically be added.)
 .PP
-See the reveal.js documentation for more details.
+Note: \f[C]data-background-image\f[R] is also supported in pptx for
+consistency with reveal.js \[en] if \f[C]background-image\f[R] isn\[cq]t
+found, \f[C]data-background-image\f[R] will be checked.
+.SS On the title slide (reveal.js, pptx)
 .PP
-For example in reveal.js:
+To add a background image to the automatically generated title slide for
+reveal.js, use the \f[C]title-slide-attributes\f[R] variable in the YAML
+metadata block.
+It must contain a map of attribute names and values.
+(Note that the \f[C]data-\f[R] prefix is required here, as it isn\[cq]t
+added automatically.)
+.PP
+For pptx, pass a reference doc with the background image set on the
+\[lq]Title Slide\[rq] layout.
+.SS Example (reveal.js)
 .IP
 .nf
 \f[C]
 ---
-title: My Slideshow
+title: My Slide Show
 parallaxBackgroundImage: /path/to/my/background_image.png
 title-slide-attributes:
     data-background-image: /path/to/title_image.png
@@ -7109,7 +7191,7 @@
 
 Slide 1 has background_image.png as its background.
 
-## {data-background-image=\[dq]/path/to/special_image.jpg\[dq]}
+## {background-image=\[dq]/path/to/special_image.jpg\[dq]}
 
 Slide 2 has a special image for its background, even though the heading has no content.
 \f[R]
@@ -7184,7 +7266,15 @@
 Pandoc will default to the local language if nothing is specified.
 .TP
 \f[B]\f[CB]subject\f[B]\f[R]
-A string value or a list of such values.
+Either a string value, or an object with fields \f[C]text\f[R],
+\f[C]authority\f[R], and \f[C]term\f[R], or a list of such objects.
+Valid values for \f[C]authority\f[R] are either a reserved authority
+value (currently \f[C]AAT\f[R], \f[C]BIC\f[R], \f[C]BISAC\f[R],
+\f[C]CLC\f[R], \f[C]DDC\f[R], \f[C]CLIL\f[R], \f[C]EuroVoc\f[R],
+\f[C]MEDTOP\f[R], \f[C]LCSH\f[R], \f[C]NDC\f[R], \f[C]Thema\f[R],
+\f[C]UDC\f[R], and \f[C]WGS\f[R]) or an absolute IRI identifying a
+custom scheme.
+Valid values for \f[C]term\f[R] are defined by the scheme.
 .TP
 \f[B]\f[CB]description\f[B]\f[R]
 A string value.
@@ -7368,6 +7458,11 @@
 frontmatter
 T}
 T{
+frontispiece
+T}@T{
+frontmatter
+T}
+T{
 appendix
 T}@T{
 backmatter
@@ -7769,13 +7864,22 @@
 included in the output.
 An untrusted attacker could use these to view the contents of files on
 the file system.
+(Using the \f[C]--sandbox\f[R] option can protect against this threat.)
 .IP "3." 3
+Several output formats (including RTF, FB2, HTML with
+\f[C]--self-contained\f[R], EPUB, Docx, and ODT) will embed encoded or
+raw images into the output file.
+An untrusted attacker could exploit this to view the contents of
+non-image files on the file system.
+(Using the \f[C]--sandbox\f[R] option can protect against this threat,
+but will also prevent including images in these formats.)
+.IP "4." 3
 If your application uses pandoc as a Haskell library (rather than
 shelling out to the executable), it is possible to use it in a mode that
 fully isolates pandoc from your file system, by running the pandoc
 operations in the \f[C]PandocPure\f[R] monad.
 See the document Using the pandoc API for more details.
-.IP "4." 3
+.IP "5." 3
 Pandoc\[cq]s parsers can exhibit pathological performance on some corner
 cases.
 It is wise to put any pandoc operations under a timeout, to avoid DOS
@@ -7783,7 +7887,11 @@
 If you are using the pandoc executable, you can add the command line
 options \f[C]+RTS -M512M -RTS\f[R] (for example) to limit the heap size
 to 512MB.
-.IP "5." 3
+Note that the \f[C]commonmark\f[R] parser (including
+\f[C]commonmark_x\f[R] and \f[C]gfm\f[R]) is much less vulnerable to
+pathological performance than the \f[C]markdown\f[R] parser, so it is a
+better choice when processing untrusted input.
+.IP "6." 3
 The HTML generated by pandoc is not guaranteed to be safe.
 If \f[C]raw_html\f[R] is enabled for the Markdown input, users can
 inject arbitrary HTML.
diff --git a/pandoc.cabal b/pandoc.cabal
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,6 +1,6 @@
 cabal-version:   2.2
 name:            pandoc
-version:         2.14.2
+version:         2.15
 build-type:      Simple
 license:         GPL-2.0-or-later
 license-file:    COPYING.md
@@ -242,6 +242,7 @@
                  test/command/sub-file-chapter-1.tex
                  test/command/sub-file-chapter-2.tex
                  test/command/bar.tex
+                 test/command/bar-endinput.tex
                  test/command/yaml-metadata.yaml
                  test/command/3510-subdoc.org
                  test/command/3510-export.latex
@@ -379,7 +380,89 @@
                  test/rtf/*.native
                  test/rtf/*.rtf
                  test/pptx/*.pptx
-                 test/pptx/*.native
+                 test/pptx/background-image/input.native
+                 test/pptx/background-image/*.pptx
+                 test/pptx/blanks/just-speaker-notes/input.native
+                 test/pptx/blanks/just-speaker-notes/*.pptx
+                 test/pptx/blanks/nbsp-in-body/input.native
+                 test/pptx/blanks/nbsp-in-body/*.pptx
+                 test/pptx/blanks/nbsp-in-heading/input.native
+                 test/pptx/blanks/nbsp-in-heading/*.pptx
+                 test/pptx/code-custom/*.pptx
+                 test/pptx/code/input.native
+                 test/pptx/code/*.pptx
+                 test/pptx/content-with-caption/heading-text-image/input.native
+                 test/pptx/content-with-caption/heading-text-image/*.pptx
+                 test/pptx/content-with-caption/image-text/input.native
+                 test/pptx/content-with-caption/image-text/*.pptx
+                 test/pptx/content-with-caption/text-image/input.native
+                 test/pptx/content-with-caption/text-image/*.pptx
+                 test/pptx/comparison/both-columns/input.native
+                 test/pptx/comparison/both-columns/*.pptx
+                 test/pptx/comparison/extra-image/input.native
+                 test/pptx/comparison/extra-image/*.pptx
+                 test/pptx/comparison/extra-text/input.native
+                 test/pptx/comparison/extra-text/*.pptx
+                 test/pptx/comparison/non-text-first/input.native
+                 test/pptx/comparison/non-text-first/*.pptx
+                 test/pptx/comparison/one-column/input.native
+                 test/pptx/comparison/one-column/*.pptx
+                 test/pptx/document-properties-short-desc/input.native
+                 test/pptx/document-properties-short-desc/*.pptx
+                 test/pptx/document-properties/input.native
+                 test/pptx/document-properties/*.pptx
+                 test/pptx/endnotes-toc/*.pptx
+                 test/pptx/endnotes/input.native
+                 test/pptx/endnotes/*.pptx
+                 test/pptx/footer/input.native
+                 test/pptx/footer/basic/*.pptx
+                 test/pptx/footer/fixed-date/*.pptx
+                 test/pptx/footer/higher-slide-number/*.pptx
+                 test/pptx/footer/no-title-slide/*.pptx
+                 test/pptx/images/input.native
+                 test/pptx/images/*.pptx
+                 test/pptx/incremental-lists/with-flag/input.native
+                 test/pptx/incremental-lists/with-flag/*.pptx
+                 test/pptx/incremental-lists/without-flag/input.native
+                 test/pptx/incremental-lists/without-flag/*.pptx
+                 test/pptx/inline-formatting/input.native
+                 test/pptx/inline-formatting/*.pptx
+                 test/pptx/lists/input.native
+                 test/pptx/lists/*.pptx
+                 test/pptx/list-level/input.native
+                 test/pptx/list-level/*.pptx
+                 test/pptx/raw-ooxml/input.native
+                 test/pptx/raw-ooxml/*.pptx
+                 test/pptx/remove-empty-slides/input.native
+                 test/pptx/remove-empty-slides/*.pptx
+                 test/pptx/slide-breaks-slide-level-1/*.pptx
+                 test/pptx/slide-breaks-toc/*.pptx
+                 test/pptx/slide-breaks/input.native
+                 test/pptx/slide-breaks/*.pptx
+                 test/pptx/slide-level-0/h1-h2-with-table/input.native
+                 test/pptx/slide-level-0/h1-h2-with-table/*.pptx
+                 test/pptx/slide-level-0/h1-with-image/input.native
+                 test/pptx/slide-level-0/h1-with-image/*.pptx
+                 test/pptx/slide-level-0/h1-with-table/input.native
+                 test/pptx/slide-level-0/h1-with-table/*.pptx
+                 test/pptx/slide-level-0/h2-with-image/input.native
+                 test/pptx/slide-level-0/h2-with-image/*.pptx
+                 test/pptx/speaker-notes-after-metadata/input.native
+                 test/pptx/speaker-notes-after-metadata/*.pptx
+                 test/pptx/speaker-notes-afterheader/input.native
+                 test/pptx/speaker-notes-afterheader/*.pptx
+                 test/pptx/speaker-notes-afterseps/input.native
+                 test/pptx/speaker-notes-afterseps/*.pptx
+                 test/pptx/speaker-notes/input.native
+                 test/pptx/speaker-notes/*.pptx
+                 test/pptx/start-numbering-at/input.native
+                 test/pptx/start-numbering-at/*.pptx
+                 test/pptx/tables/input.native
+                 test/pptx/tables/*.pptx
+                 test/pptx/two-column/all-text/input.native
+                 test/pptx/two-column/all-text/*.pptx
+                 test/pptx/two-column/text-and-image/input.native
+                 test/pptx/two-column/text-and-image/*.pptx
                  test/ipynb/*.in.native
                  test/ipynb/*.out.native
                  test/ipynb/*.ipynb
@@ -442,8 +525,8 @@
                  HsYAML                >= 0.2      && < 0.3,
                  JuicyPixels           >= 3.1.6.1  && < 3.4,
                  SHA                   >= 1.6      && < 1.7,
-                 aeson                 >= 0.7      && < 1.6,
-                 aeson-pretty          >= 0.8.5    && < 0.9,
+                 aeson                 >= 0.7      && < 2.1,
+                 aeson-pretty          >= 0.8.9    && < 0.9,
                  array                 >= 0.5      && < 0.6,
                  attoparsec            >= 0.12     && < 0.15,
                  base64-bytestring     >= 0.1      && < 1.3,
@@ -452,57 +535,60 @@
                  blaze-markup          >= 0.8      && < 0.9,
                  bytestring            >= 0.9      && < 0.12,
                  case-insensitive      >= 1.2      && < 1.3,
-                 citeproc              >= 0.5      && < 0.6,
-                 commonmark            >= 0.2.1    && < 0.3,
-                 commonmark-extensions >= 0.2.1.2  && < 0.3,
+                 citeproc              >= 0.6      && < 0.7,
+                 commonmark            >= 0.2.1.1  && < 0.3,
+                 commonmark-extensions >= 0.2.2    && < 0.3,
                  commonmark-pandoc     >= 0.2.1.1  && < 0.3,
                  connection            >= 0.3.1,
                  containers            >= 0.4.2.1  && < 0.7,
                  data-default          >= 0.4      && < 0.8,
                  deepseq               >= 1.3      && < 1.5,
                  directory             >= 1.2.3    && < 1.4,
-                 doclayout             >= 0.3.0.1  && < 0.4,
+                 doclayout             >= 0.3.1.1  && < 0.4,
                  doctemplates          >= 0.10     && < 0.11,
                  emojis                >= 0.1      && < 0.2,
                  exceptions            >= 0.8      && < 0.11,
                  file-embed            >= 0.0      && < 0.1,
                  filepath              >= 1.1      && < 1.5,
                  haddock-library       >= 1.10     && < 1.11,
-                 hslua                 >= 1.1      && < 1.4,
-                 hslua-module-path     >= 0.1.0    && < 0.2.0,
-                 hslua-module-system   >= 0.2      && < 0.3,
-                 hslua-module-text     >= 0.2.1    && < 0.4,
+                 hslua                 >= 2.0      && < 2.1,
+                 hslua-marshalling     >= 2.0      && < 2.1,
+                 hslua-module-path     >= 1.0      && < 1.1,
+                 hslua-module-system   >= 1.0      && < 1.1,
+                 hslua-module-text     >= 1.0      && < 1.1,
+                 hslua-module-version  >= 1.0      && < 1.1,
                  http-client           >= 0.4.30   && < 0.8,
                  http-client-tls       >= 0.2.4    && < 0.4,
                  http-types            >= 0.8      && < 0.13,
-                 ipynb                 >= 0.1      && < 0.2,
+                 ipynb                 >= 0.1.0.2  && < 0.2,
                  jira-wiki-markup      >= 1.4      && < 1.5,
                  mtl                   >= 2.2      && < 2.3,
                  network               >= 2.6,
                  network-uri           >= 2.6      && < 2.8,
-                 pandoc-types          >= 1.22     && < 1.23,
+                 pandoc-types          >= 1.22.1   && < 1.23,
                  parsec                >= 3.1      && < 3.2,
                  process               >= 1.2.3    && < 1.7,
                  random                >= 1        && < 1.3,
                  safe                  >= 0.3.18   && < 0.4,
                  scientific            >= 0.3      && < 0.4,
-                 skylighting           >= 0.11     && < 0.12,
-                 skylighting-core      >= 0.11     && < 0.12,
+                 skylighting           >= 0.12     && < 0.13,
+                 skylighting-core      >= 0.12     && < 0.13,
                  split                 >= 0.2      && < 0.3,
                  syb                   >= 0.1      && < 0.8,
                  tagsoup               >= 0.14.6   && < 0.15,
                  temporary             >= 1.1      && < 1.4,
-                 texmath               >= 0.12.3.1 && < 0.12.4,
+                 texmath               >= 0.12.3.2 && < 0.12.4,
                  text                  >= 1.1.1.0  && < 1.3,
                  text-conversions      >= 0.3      && < 0.4,
-                 time                  >= 1.5      && < 1.12,
+                 time                  >= 1.5      && < 1.13,
                  unicode-transforms    >= 0.3      && < 0.4,
-                 unordered-containers  >= 0.2      && < 0.3,
                  xml                   >= 1.3.12   && < 1.4,
                  xml-conduit           >= 1.9.1.1  && < 1.10,
                  unicode-collation     >= 0.1.1    && < 0.2,
                  zip-archive           >= 0.2.3.4  && < 0.5,
-                 zlib                  >= 0.5      && < 0.7
+                 zlib                  >= 0.5      && < 0.7,
+                 pretty-show           >= 1.10     && < 1.11,
+                 pretty                >= 1.1      && < 1.2
   if os(windows) && arch(i386)
      build-depends: basement >= 0.0.10,
                     foundation >= 0.0.23
@@ -621,6 +707,7 @@
                    Text.Pandoc.Class.PandocMonad,
                    Text.Pandoc.Class.PandocIO,
                    Text.Pandoc.Class.PandocPure,
+                   Text.Pandoc.Class.Sandbox,
                    Text.Pandoc.Filter.JSON,
                    Text.Pandoc.Filter.Lua,
                    Text.Pandoc.Filter.Path,
@@ -690,15 +777,13 @@
                    Text.Pandoc.Lua.Init,
                    Text.Pandoc.Lua.Marshaling,
                    Text.Pandoc.Lua.Marshaling.AST,
-                   Text.Pandoc.Lua.Marshaling.AnyValue,
+                   Text.Pandoc.Lua.Marshaling.Attr,
                    Text.Pandoc.Lua.Marshaling.CommonState,
                    Text.Pandoc.Lua.Marshaling.Context,
                    Text.Pandoc.Lua.Marshaling.List,
-                   Text.Pandoc.Lua.Marshaling.MediaBag,
                    Text.Pandoc.Lua.Marshaling.PandocError,
                    Text.Pandoc.Lua.Marshaling.ReaderOptions,
                    Text.Pandoc.Lua.Marshaling.SimpleTable,
-                   Text.Pandoc.Lua.Marshaling.Version,
                    Text.Pandoc.Lua.Module.MediaBag,
                    Text.Pandoc.Lua.Module.Pandoc,
                    Text.Pandoc.Lua.Module.System,
@@ -762,17 +847,17 @@
                   doctemplates      >= 0.10    && < 0.11,
                   exceptions        >= 0.8     && < 0.11,
                   filepath          >= 1.1     && < 1.5,
-                  hslua             >= 1.1     && < 1.4,
+                  hslua             >= 2.0     && < 2.1,
                   mtl               >= 2.2     && < 2.3,
-                  pandoc-types      >= 1.22    && < 1.23,
+                  pandoc-types      >= 1.22.1  && < 1.23,
                   process           >= 1.2.3   && < 1.7,
                   tasty             >= 0.11    && < 1.5,
                   tasty-golden      >= 2.3     && < 2.4,
                   tasty-hunit       >= 0.9     && < 0.11,
-                  tasty-lua         >= 0.2     && < 0.3,
+                  tasty-lua         >= 1.0     && < 1.1,
                   tasty-quickcheck  >= 0.8     && < 0.11,
                   text              >= 1.1.1.0  && < 1.3,
-                  time              >= 1.5     && < 1.12,
+                  time              >= 1.5     && < 1.13,
                   xml               >= 1.3.12  && < 1.4,
                   zip-archive       >= 0.2.3.4 && < 0.5
   other-modules:  Tests.Old
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE TupleSections       #-}
 {-# LANGUAGE LambdaCase          #-}
 {-# LANGUAGE OverloadedStrings   #-}
 {-# LANGUAGE CPP                 #-}
@@ -25,9 +26,9 @@
           , applyFilters
           ) where
 import qualified Control.Exception as E
-import Control.Monad ( (>=>), when )
+import Control.Monad ( (>=>), when, forM_ )
 import Control.Monad.Trans ( MonadIO(..) )
-import Control.Monad.Except (throwError)
+import Control.Monad.Except (throwError, catchError)
 import qualified Data.ByteString as BS
 import qualified Data.ByteString.Char8 as B8
 import qualified Data.ByteString.Lazy as BL
@@ -38,17 +39,20 @@
 import qualified Data.Text as T
 import qualified Data.Text.Lazy as TL
 import qualified Data.Text.Lazy.Encoding as TE
+import qualified Data.Text.Encoding as TSE
 import qualified Data.Text.Encoding.Error as TE
 import qualified Data.Text.Encoding.Error as TSE
 import Network.URI (URI (..), parseURI)
 import System.Directory (doesDirectoryExist)
 import System.Exit (exitSuccess)
-import System.FilePath ( takeBaseName, takeExtension )
+import System.FilePath ( takeBaseName, takeExtension)
 import System.IO (nativeNewline, stdout)
 import qualified System.IO as IO (Newline (..))
 import Text.Pandoc
 import Text.Pandoc.Builder (setMeta)
-import Text.Pandoc.MIME (getCharset)
+import Text.Pandoc.MediaBag (mediaItems)
+import Text.Pandoc.MIME (getCharset, MimeType)
+import Text.Pandoc.Image (svgToPng)
 import Text.Pandoc.App.FormatHeuristics (formatFromFilePaths)
 import Text.Pandoc.App.Opt (Opt (..), LineEnding (..), defaultOpts,
                             IpynbOutput (..))
@@ -94,40 +98,24 @@
   let sources = case optInputFiles opts of
                      Just xs | not (optIgnoreArgs opts) -> xs
                      _ -> ["-"]
-
-  let runIO' :: PandocIO a -> IO a
-      runIO' f = do
-        (res, reports) <- runIOorExplode $ do
-                             setTrace (optTrace opts)
-                             setVerbosity verbosity
-                             x <- f
-                             rs <- getLog
-                             return (x, rs)
-        case optLogFile opts of
-             Nothing      -> return ()
-             Just logfile -> BL.writeFile logfile (encodeLogMessages reports)
-        let isWarning msg = messageVerbosity msg == WARNING
-        when (optFailIfWarnings opts && any isWarning reports) $
-            E.throwIO PandocFailOnWarningError
-        return res
-
-  let eol = case optEol opts of
-                 CRLF   -> IO.CRLF
-                 LF     -> IO.LF
-                 Native -> nativeNewline
 #ifdef _WINDOWS
   let istty = True
 #else
   istty <- liftIO $ queryTerminal stdOutput
 #endif
 
-  runIO' $ do
+  res <- runIO $ do
+
+    setTrace (optTrace opts)
+    setVerbosity verbosity
     setUserDataDir datadir
     setResourcePath (optResourcePath opts)
 
     setInputFiles (fromMaybe ["-"] (optInputFiles opts))
     setOutputFile (optOutputFile opts)
 
+    inputs <- readSources sources
+
     -- assign reader and writer based on options and filenames
     readerName <- case optFrom opts of
                        Just f  -> return f
@@ -151,21 +139,26 @@
             <> "` instead of `pandoc " <> inputFile <> " -o " <> outputFile <> "`."
         _ -> return ()
 
-    (reader :: Reader PandocIO, readerExts) <- getReader readerName
 
-    let convertTabs = tabFilter (if optPreserveTabs opts ||
-                                      readerNameBase == "t2t" ||
-                                      readerNameBase == "man"
-                                    then 0
-                                    else optTabStop opts)
-
-
-    let readSources :: [FilePath] -> PandocIO [(FilePath, Text)]
-        readSources srcs =
-          mapM (\fp -> do
-                   t <- readSource fp
-                   return (if fp == "-" then "" else fp, convertTabs t)) srcs
+    let makeSandboxed pureReader =
+          let files = maybe id (:) (optReferenceDoc opts) .
+                      maybe id (:) (optEpubMetadata opts) .
+                      maybe id (:) (optEpubCoverImage opts) .
+                      maybe id (:) (optCSL opts) .
+                      maybe id (:) (optCitationAbbreviations opts) $
+                      optEpubFonts opts ++
+                      optBibliography opts
+           in  case pureReader of
+                 TextReader r -> TextReader $ \o t -> sandbox files (r o t)
+                 ByteStringReader r
+                            -> ByteStringReader $ \o t -> sandbox files (r o t)
 
+    (reader, readerExts) <-
+      if optSandbox opts
+         then case runPure (getReader readerName) of
+                Left e -> throwError e
+                Right (r, rexts) -> return (makeSandboxed r, rexts)
+         else getReader readerName
 
     outputSettings <- optToOutputSettings opts
     let format = outputFormat outputSettings
@@ -254,20 +247,11 @@
                                             _        -> Format format) :))
                      $ []
 
-    let sourceToDoc :: [FilePath] -> PandocIO Pandoc
-        sourceToDoc sources' =
-           case reader of
-             TextReader r
-               | readerNameBase == "json" ->
-                   mconcat <$> mapM (readSource >=> r readerOpts) sources'
-               | optFileScope opts  ->
-                   -- Read source and convert tabs (see #6709)
-                   let readSource' = fmap convertTabs . readSource
-                   in mconcat <$> mapM (readSource' >=> r readerOpts) sources'
-               | otherwise ->
-                   readSources sources' >>= r readerOpts
-             ByteStringReader r ->
-               mconcat <$> mapM (readFile' >=> r readerOpts) sources'
+    let convertTabs = tabFilter (if optPreserveTabs opts ||
+                                      readerNameBase == "t2t" ||
+                                      readerNameBase == "man"
+                                    then 0
+                                    else optTabStop opts)
 
 
     when (readerNameBase == "markdown_github" ||
@@ -293,8 +277,25 @@
           maybe id (setMeta "citation-abbreviations")
                          (optCitationAbbreviations opts) $ mempty
 
-    doc <- sourceToDoc sources >>=
-              (   (if isJust (optExtractMedia opts)
+    doc <- (case reader of
+             TextReader r
+               | readerNameBase == "json" ->
+                   mconcat <$>
+                      mapM (inputToText convertTabs
+                             >=> r readerOpts . (:[])) inputs
+               | optFileScope opts  ->
+                   mconcat <$> mapM
+                      (inputToText convertTabs
+                             >=> r readerOpts . (:[]))
+                      inputs
+               | otherwise -> mapM (inputToText convertTabs) inputs
+                                >>= r readerOpts
+             ByteStringReader r ->
+               mconcat <$> mapM (r readerOpts . inputToLazyByteString) inputs)
+            >>=
+              (   (if not (optSandbox opts) &&
+                      (isJust (optExtractMedia opts)
+                       || writerNameBase == "docx") -- for fallback pngs
                       then fillMediaBag
                       else return)
               >=> return . adjustMetadata (metadataFromFile <>)
@@ -305,14 +306,28 @@
               >=> maybe return extractMedia (optExtractMedia opts)
               )
 
-    case writer of
-      ByteStringWriter f -> f writerOptions doc >>= writeFnBinary outputFile
+    when (writerNameBase == "docx" && not (optSandbox opts)) $ do
+      -- create fallback pngs for svgs
+      items <- mediaItems <$> getMediaBag
+      forM_ items $ \(fp, mt, bs) ->
+        case T.takeWhile (/=';') mt of
+          "image/svg+xml" -> do
+            res <- svgToPng (writerDpi writerOptions) bs
+            case res of
+              Right bs' -> do
+                let fp' = fp <> ".png"
+                insertMedia fp' (Just "image/png") bs'
+              Left e -> report $ CouldNotConvertImage (T.pack fp) (tshow e)
+          _ -> return ()
+
+    output <- case writer of
+      ByteStringWriter f -> BinaryOutput <$> f writerOptions doc
       TextWriter f -> case outputPdfProgram outputSettings of
         Just pdfProg -> do
                 res <- makePDF pdfProg (optPdfEngineOpts opts) f
                         writerOptions doc
                 case res of
-                     Right pdf -> writeFnBinary outputFile pdf
+                     Right pdf -> return $ BinaryOutput pdf
                      Left err' -> throwError $ PandocPDFError $
                                      TL.toStrict (TE.decodeUtf8With TE.lenientDecode err')
 
@@ -321,12 +336,33 @@
                       | standalone = t
                       | T.null t || T.last t /= '\n' = t <> T.singleton '\n'
                       | otherwise = t
-                output <- ensureNl <$> f writerOptions doc
-                writerFn eol outputFile =<<
-                  if optSelfContained opts && htmlFormat format
-                     then makeSelfContained output
-                     else return output
+                textOutput <- ensureNl <$> f writerOptions doc
+                if optSelfContained opts && htmlFormat format
+                   then TextOutput <$> makeSelfContained textOutput
+                   else return $ TextOutput textOutput
+    reports <- getLog
+    return (output, reports)
 
+  case res of
+    Left e -> E.throwIO e
+    Right (output, reports) -> do
+      case optLogFile opts of
+           Nothing      -> return ()
+           Just logfile -> BL.writeFile logfile (encodeLogMessages reports)
+      let isWarning msg = messageVerbosity msg == WARNING
+      when (optFailIfWarnings opts && any isWarning reports) $
+          E.throwIO PandocFailOnWarningError
+      let eol = case optEol opts of
+                     CRLF   -> IO.CRLF
+                     LF     -> IO.LF
+                     Native -> nativeNewline
+      case output of
+        TextOutput t    -> writerFn eol outputFile t
+        BinaryOutput bs -> writeFnBinary outputFile bs
+
+data PandocOutput = TextOutput Text | BinaryOutput BL.ByteString
+  deriving (Show)
+
 type Transform = Pandoc -> Pandoc
 
 htmlFormat :: Text -> Bool
@@ -344,49 +380,68 @@
 applyTransforms :: Monad m => [Transform] -> Pandoc -> m Pandoc
 applyTransforms transforms d = return $ foldr ($) d transforms
 
-readSource :: FilePath -> PandocIO Text
-readSource src = case parseURI src of
-                      Just u | uriScheme u `elem` ["http:","https:"] ->
-                                 readURI src
-                             | uriScheme u == "file:" -> liftIO $
-                                 readTextFile (uriPathToPath $ T.pack $ uriPath u)
-                      _       -> liftIO $ readTextFile src
-  where readTextFile :: FilePath -> IO Text
-        readTextFile fp = do
-          bs <- if src == "-"
-                   then BS.getContents
-                   else BS.readFile fp
-          E.catch (return $! UTF8.toText bs)
-             (\e -> E.throwIO $ case e of
-                         TSE.DecodeError _ (Just w) ->
-                           case BS.elemIndex w bs of
-                             Just offset ->
-                                  PandocUTF8DecodingError (T.pack fp) offset w
-                             _ -> PandocUTF8DecodingError (T.pack fp) 0 w
-                         _ -> PandocAppError (tshow e))
+readSources :: (PandocMonad m, MonadIO m)
+            => [FilePath] -> m [(FilePath, (BS.ByteString, Maybe MimeType))]
+readSources srcs =
+  mapM (\fp -> do t <- readSource fp
+                  return (if fp == "-" then "" else fp, t)) srcs
 
-readURI :: FilePath -> PandocIO Text
-readURI src = do
-  (bs, mt) <- openURL (T.pack src)
+readSource :: (PandocMonad m, MonadIO m)
+           => FilePath -> m (BS.ByteString, Maybe MimeType)
+readSource "-" = (,Nothing) <$> readStdinStrict
+readSource src =
+  case parseURI src of
+    Just u | uriScheme u `elem` ["http:","https:"] -> openURL (T.pack src)
+           | uriScheme u == "file:" ->
+               (,Nothing) <$>
+                 readFileStrict (uriPathToPath $ T.pack $ uriPath u)
+    _       -> (,Nothing) <$> readFileStrict src
+
+utf8ToText :: PandocMonad m => FilePath -> BS.ByteString -> m Text
+utf8ToText fp bs =
+  case TSE.decodeUtf8' . dropBOM $ bs of
+    Left (TSE.DecodeError _ (Just w)) ->
+      case BS.elemIndex w bs of
+        Just offset -> throwError $ PandocUTF8DecodingError (T.pack fp) offset w
+        Nothing -> throwError $ PandocUTF8DecodingError (T.pack fp) 0 w
+    Left e -> throwError $ PandocAppError (tshow e)
+    Right t -> return t
+ where
+   dropBOM bs' =
+     if "\xEF\xBB\xBF" `BS.isPrefixOf` bs'
+        then BS.drop 3 bs'
+        else bs'
+
+
+inputToText :: PandocMonad m
+            => (Text -> Text)
+            -> (FilePath, (BS.ByteString, Maybe MimeType))
+            -> m (FilePath, Text)
+inputToText convTabs (fp, (bs,mt)) =
+  (fp,) . convTabs . T.filter (/='\r') <$>
   case mt >>= getCharset of
-    Just "UTF-8"      -> return $ UTF8.toText bs
+    Just "UTF-8"      -> utf8ToText fp bs
     Just "ISO-8859-1" -> return $ T.pack $ B8.unpack bs
     Just charset      -> throwError $ PandocUnsupportedCharsetError charset
-    Nothing           -> liftIO $ -- try first as UTF-8, then as latin1
-                          E.catch (return $! UTF8.toText bs)
-                                  (\case
-                                      TSE.DecodeError{} ->
-                                        return $ T.pack $ B8.unpack bs
-                                      e -> E.throwIO e)
+    Nothing           -> catchError
+                           (utf8ToText fp bs)
+                           (\case
+                              PandocUTF8DecodingError{} -> do
+                                report $ NotUTF8Encoded
+                                  (if null fp
+                                      then "input"
+                                      else fp)
+                                return $ T.pack $ B8.unpack bs
+                              e -> throwError e)
 
-readFile' :: MonadIO m => FilePath -> m BL.ByteString
-readFile' "-" = liftIO BL.getContents
-readFile' f   = liftIO $ BL.readFile f
+inputToLazyByteString :: (FilePath, (BS.ByteString, Maybe MimeType))
+                      -> BL.ByteString
+inputToLazyByteString (_, (bs,_)) = BL.fromStrict bs
 
-writeFnBinary :: MonadIO m => FilePath -> BL.ByteString -> m ()
-writeFnBinary "-" = liftIO . BL.putStr
-writeFnBinary f   = liftIO . BL.writeFile (UTF8.encodePath f)
+writeFnBinary :: FilePath -> BL.ByteString -> IO ()
+writeFnBinary "-" = BL.putStr
+writeFnBinary f   = BL.writeFile (UTF8.encodePath f)
 
-writerFn :: MonadIO m => IO.Newline -> FilePath -> Text -> m ()
-writerFn eol "-" = liftIO . UTF8.putStrWith eol
-writerFn eol f   = liftIO . UTF8.writeFileWith eol f
+writerFn :: IO.Newline -> FilePath -> Text -> IO ()
+writerFn eol "-" = UTF8.putStrWith eol
+writerFn eol f   = UTF8.writeFileWith eol f
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -188,6 +188,11 @@
                   (\opt -> return opt { optFileScope = True }))
                  "" -- "Parse input files before combining"
 
+    , Option "" ["sandbox"]
+                 (NoArg
+                  (\opt -> return opt { optSandbox = True }))
+                 ""
+
     , Option "s" ["standalone"]
                  (NoArg
                   (\opt -> return opt { optStandalone = True }))
@@ -332,14 +337,8 @@
 
     , Option "" ["syntax-definition"]
                 (ReqArg
-                 (\arg opt -> do
-                   let tr c d = map (\x -> if x == c then d else x)
-                   let arg' = case arg of -- see #4836
-                                   -- HXT confuses Windows path with URI
-                                   _:':':'\\':_ ->
-                                       "file:///" ++ tr '\\' '/' arg
-                                   _ -> normalizePath arg
-                   return opt{ optSyntaxDefinitions = arg' :
+                 (\arg opt ->
+                   return opt{ optSyntaxDefinitions = normalizePath arg :
                                 optSyntaxDefinitions opt })
                  "FILE")
                 "" -- "Syntax definition (xml) file"
diff --git a/src/Text/Pandoc/App/FormatHeuristics.hs b/src/Text/Pandoc/App/FormatHeuristics.hs
--- a/src/Text/Pandoc/App/FormatHeuristics.hs
+++ b/src/Text/Pandoc/App/FormatHeuristics.hs
@@ -74,7 +74,6 @@
     ".s5"       -> Just "s5"
     ".t2t"      -> Just "t2t"
     ".tei"      -> Just "tei"
-    ".tei.xml"  -> Just "tei"
     ".tex"      -> Just "latex"
     ".texi"     -> Just "texinfo"
     ".texinfo"  -> Just "texinfo"
diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs
--- a/src/Text/Pandoc/App/Opt.hs
+++ b/src/Text/Pandoc/App/Opt.hs
@@ -160,6 +160,7 @@
     , optCSL                   :: Maybe FilePath -- ^ CSL stylesheet
     , optBibliography          :: [FilePath]  -- ^ Bibliography files
     , optCitationAbbreviations :: Maybe FilePath -- ^ Citation abbreviations
+    , optSandbox               :: Bool
     } deriving (Generic, Show)
 
 instance FromYAML (Opt -> Opt) where
@@ -595,6 +596,8 @@
       parseYAML v >>= \x -> return (\o -> o{ optEol = x })
     "strip-comments" ->
       parseYAML v >>= \x -> return (\o -> o  { optStripComments = x })
+    "sandbox" ->
+      parseYAML v >>= \x -> return (\o -> o  { optSandbox = x })
     _ -> failAtNode k' $ "Unknown option " ++ show k
 
 -- | Defaults for command-line options.
@@ -673,6 +676,7 @@
     , optCSL                   = Nothing
     , optBibliography          = []
     , optCitationAbbreviations = Nothing
+    , optSandbox               = False
     }
 
 parseStringKey ::  Node Pos -> Parser Text
diff --git a/src/Text/Pandoc/App/OutputSettings.hs b/src/Text/Pandoc/App/OutputSettings.hs
--- a/src/Text/Pandoc/App/OutputSettings.hs
+++ b/src/Text/Pandoc/App/OutputSettings.hs
@@ -45,16 +45,16 @@
 readUtf8File = fmap UTF8.toText . readFileStrict
 
 -- | Settings specifying how document output should be produced.
-data OutputSettings = OutputSettings
+data OutputSettings m = OutputSettings
   { outputFormat :: T.Text
-  , outputWriter :: Writer PandocIO
+  , outputWriter :: Writer m
   , outputWriterName :: T.Text
   , outputWriterOptions :: WriterOptions
   , outputPdfProgram :: Maybe String
   }
 
 -- | Get output settings from command line options.
-optToOutputSettings :: Opt -> PandocIO OutputSettings
+optToOutputSettings :: (PandocMonad m, MonadIO m) => Opt -> m (OutputSettings m)
 optToOutputSettings opts = do
   let outputFile = fromMaybe "-" (optOutputFile opts)
 
@@ -90,12 +90,31 @@
                   then writerName
                   else T.toLower $ baseWriterName writerName
 
-  (writer :: Writer PandocIO, writerExts) <-
+  let makeSandboxed pureWriter =
+          let files = maybe id (:) (optReferenceDoc opts) .
+                      maybe id (:) (optEpubMetadata opts) .
+                      maybe id (:) (optEpubCoverImage opts) .
+                      maybe id (:) (optCSL opts) .
+                      maybe id (:) (optCitationAbbreviations opts) $
+                      optEpubFonts opts ++
+                      optBibliography opts
+           in  case pureWriter of
+                 TextWriter w -> TextWriter $ \o d -> sandbox files (w o d)
+                 ByteStringWriter w
+                            -> ByteStringWriter $ \o d -> sandbox files (w o d)
+
+
+  (writer, writerExts) <-
             if ".lua" `T.isSuffixOf` format
                then return (TextWriter
-                       (\o d -> writeCustom (T.unpack writerName) o d)
-                               :: Writer PandocIO, mempty)
-               else getWriter (T.toLower writerName)
+                       (\o d -> writeCustom (T.unpack writerName) o d), mempty)
+               else if optSandbox opts
+                       then
+                         case runPure (getWriter writerName) of
+                           Left e -> throwError e
+                           Right (w, wexts) ->
+                                  return (makeSandboxed w, wexts)
+                       else getWriter (T.toLower writerName)
 
   let standalone = optStandalone opts || not (isTextFormat format) || pdfOutput
 
diff --git a/src/Text/Pandoc/Citeproc/BibTeX.hs b/src/Text/Pandoc/Citeproc/BibTeX.hs
--- a/src/Text/Pandoc/Citeproc/BibTeX.hs
+++ b/src/Text/Pandoc/Citeproc/BibTeX.hs
@@ -34,7 +34,7 @@
 import qualified Text.Pandoc.Walk       as Walk
 import Citeproc.Types
 import Citeproc.Pandoc ()
-import Text.Pandoc.Citeproc.Util (toIETF)
+import Text.Pandoc.Citeproc.Util (toIETF, splitStrWhen)
 import Text.Pandoc.Citeproc.Data (biblatexStringMap)
 import Data.Default
 import           Data.Text              (Text)
@@ -54,7 +54,6 @@
 import           Text.Printf            (printf)
 import           Text.DocLayout         (literal, hsep, nest, hang, Doc(..),
                                          braces, ($$), cr)
-
 data Variant = Bibtex | Biblatex
   deriving (Show, Eq, Ord)
 
@@ -527,9 +526,9 @@
     let fixSeriesTitle [Str xs] | isNumber xs =
           [Str (ordinalize locale xs), Space, Str (resolveKey' lang "jourser")]
         fixSeriesTitle xs = xs
-    seriesTitle' <- (Just . B.fromList . fixSeriesTitle .
-                     B.toList . resolveKey lang <$>
-                        getTitle "series") <|>
+
+    seriesTitle' <- (Just . B.fromList . fixSeriesTitle . B.toList
+                       <$> getTitle "series") <|>
                     return Nothing
     shortTitle' <- (Just <$> (guard (not hasMaintitle || isChapterlike) >>
                               getTitle "shorttitle"))
@@ -984,8 +983,12 @@
   ils <- getField f
   utc <- gets untitlecase
   lang <- gets localeLang
+  let ils' =
+        if f == "series"
+           then resolveKey lang ils
+           else ils
   let processTitle = if utc then unTitlecase (Just lang) else id
-  return $ processTitle ils
+  return $ processTitle ils'
 
 getShortTitle :: Bool -> Text -> Bib (Maybe Inlines)
 getShortTitle requireColon f = do
@@ -1253,20 +1256,6 @@
           , nameStaticOrdering      = False
           }
 
-splitStrWhen :: (Char -> Bool) -> [Inline] -> [Inline]
-splitStrWhen _ [] = []
-splitStrWhen p (Str xs : ys) = map Str (go xs) ++ splitStrWhen p ys
-  where go s =
-          let (w,z) = T.break p s
-           in if T.null z
-                 then if T.null w
-                         then []
-                         else [w]
-                 else if T.null w
-                         then (T.take 1 z : go (T.drop 1 z))
-                         else (w : T.take 1 z : go (T.drop 1 z))
-splitStrWhen p (x : ys) = x : splitStrWhen p ys
-
 ordinalize :: Locale -> Text -> Text
 ordinalize locale n =
   let terms = localeTerms locale
@@ -1460,14 +1449,14 @@
        _                -> [z]
 
 resolveKey :: Lang -> Inlines -> Inlines
-resolveKey lang ils = Walk.walk go ils
+resolveKey lang (Many ils) = Many $ fmap go ils
   where go (Str s) = Str $ resolveKey' lang s
         go x       = x
 
 resolveKey' :: Lang -> Text -> Text
 resolveKey' lang k =
   case Map.lookup (langLanguage lang) biblatexStringMap >>=
-        Map.lookup (T.toLower k) of
+        Map.lookup k of
     Nothing     -> k
     Just (x, _) -> either (const k) stringify $ parseLaTeX lang x
 
diff --git a/src/Text/Pandoc/Citeproc/Locator.hs b/src/Text/Pandoc/Citeproc/Locator.hs
--- a/src/Text/Pandoc/Citeproc/Locator.hs
+++ b/src/Text/Pandoc/Citeproc/Locator.hs
@@ -5,6 +5,7 @@
   ( parseLocator )
 where
 import Citeproc.Types
+import Text.Pandoc.Citeproc.Util (splitStrWhen)
 import Data.Text (Text)
 import qualified Data.Text as T
 import Data.List (foldl')
@@ -246,18 +247,6 @@
 isLocatorSep ',' = True
 isLocatorSep ';' = True
 isLocatorSep _   = False
-
-splitStrWhen :: (Char -> Bool) -> [Inline] -> [Inline]
-splitStrWhen _ [] = []
-splitStrWhen p (Str xs : ys) = go (T.unpack xs) ++ splitStrWhen p ys
-  where
-   go [] = []
-   go s = case break p s of
-             ([],[])     -> []
-             (zs,[])     -> [Str $ T.pack zs]
-             ([],w:ws) -> Str (T.singleton w) : go ws
-             (zs,w:ws) -> Str (T.pack zs) : Str (T.singleton w) : go ws
-splitStrWhen p (x : ys) = x : splitStrWhen p ys
 
 --
 -- Locator Map
diff --git a/src/Text/Pandoc/Citeproc/Util.hs b/src/Text/Pandoc/Citeproc/Util.hs
--- a/src/Text/Pandoc/Citeproc/Util.hs
+++ b/src/Text/Pandoc/Citeproc/Util.hs
@@ -1,9 +1,21 @@
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE OverloadedStrings #-}
 module Text.Pandoc.Citeproc.Util
- ( toIETF )
+ ( splitStrWhen
+ , toIETF )
 where
+import qualified Data.Text as T
 import Data.Text (Text)
+import Text.Pandoc.Definition
+
+-- Split Str elements so that characters satisfying the
+-- predicate each have their own Str.
+splitStrWhen :: (Char -> Bool) -> [Inline] -> [Inline]
+splitStrWhen p = foldr go []
+ where
+  go (Str t) = (map Str (T.groupBy goesTogether t) ++)
+  go x = (x :)
+  goesTogether c d   = not (p c || p d)
 
 toIETF :: Text -> Text
 toIETF "english"         = "en-US" -- "en-EN" unavailable in CSL
diff --git a/src/Text/Pandoc/Class.hs b/src/Text/Pandoc/Class.hs
--- a/src/Text/Pandoc/Class.hs
+++ b/src/Text/Pandoc/Class.hs
@@ -19,6 +19,7 @@
   , module Text.Pandoc.Class.PandocIO
   , module Text.Pandoc.Class.PandocMonad
   , module Text.Pandoc.Class.PandocPure
+  , module Text.Pandoc.Class.Sandbox
   , Translations
   ) where
 
@@ -27,3 +28,4 @@
 import Text.Pandoc.Class.PandocIO
 import Text.Pandoc.Class.PandocPure
 import Text.Pandoc.Translations (Translations)
+import Text.Pandoc.Class.Sandbox
diff --git a/src/Text/Pandoc/Class/IO.hs b/src/Text/Pandoc/Class/IO.hs
--- a/src/Text/Pandoc/Class/IO.hs
+++ b/src/Text/Pandoc/Class/IO.hs
@@ -30,6 +30,7 @@
   , openURL
   , readFileLazy
   , readFileStrict
+  , readStdinStrict
   , extractMedia
  ) where
 
@@ -157,6 +158,11 @@
 -- raising an error on failure.
 readFileStrict :: (PandocMonad m, MonadIO m) => FilePath -> m B.ByteString
 readFileStrict s = liftIOError B.readFile s
+
+-- | Read the strict ByteString contents from stdin, raising
+-- an error on failure.
+readStdinStrict :: (PandocMonad m, MonadIO m) => m B.ByteString
+readStdinStrict = liftIOError (const B.getContents) "stdin"
 
 -- | Return a list of paths that match a glob, relative to the working
 -- directory. See 'System.FilePath.Glob' for the glob syntax.
diff --git a/src/Text/Pandoc/Class/PandocIO.hs b/src/Text/Pandoc/Class/PandocIO.hs
--- a/src/Text/Pandoc/Class/PandocIO.hs
+++ b/src/Text/Pandoc/Class/PandocIO.hs
@@ -29,6 +29,7 @@
 import Text.Pandoc.Definition
 import Text.Pandoc.Error
 import qualified Text.Pandoc.Class.IO as IO
+import Control.Monad.Catch (MonadCatch, MonadMask, MonadThrow)
 
 -- | Evaluate a 'PandocIO' operation.
 runIO :: PandocIO a -> IO (Either PandocError a)
@@ -45,6 +46,9 @@
              , Functor
              , Applicative
              , Monad
+             , MonadCatch
+             , MonadMask
+             , MonadThrow
              , MonadError PandocError
              )
 
@@ -58,6 +62,7 @@
   openURL = IO.openURL
   readFileLazy = IO.readFileLazy
   readFileStrict = IO.readFileStrict
+  readStdinStrict = IO.readStdinStrict
 
   glob = IO.glob
   fileExists = IO.fileExists
@@ -70,5 +75,5 @@
   logOutput = IO.logOutput
 
 -- | Extract media from the mediabag into a directory.
-extractMedia :: FilePath -> Pandoc -> PandocIO Pandoc
+extractMedia :: (PandocMonad m, MonadIO m) => FilePath -> Pandoc -> m Pandoc
 extractMedia = IO.extractMedia
diff --git a/src/Text/Pandoc/Class/PandocMonad.hs b/src/Text/Pandoc/Class/PandocMonad.hs
--- a/src/Text/Pandoc/Class/PandocMonad.hs
+++ b/src/Text/Pandoc/Class/PandocMonad.hs
@@ -117,6 +117,9 @@
   -- | Read the strict ByteString contents from a file path,
   -- raising an error on failure.
   readFileStrict :: FilePath -> m B.ByteString
+  -- | Read the contents of stdin as a strict ByteString, raising
+  -- an error on failure.
+  readStdinStrict :: m B.ByteString
   -- | Return a list of paths that match a glob, relative to
   -- the working directory.  See 'System.FilePath.Glob' for
   -- the glob syntax.
@@ -674,6 +677,7 @@
   openURL = lift . openURL
   readFileLazy = lift . readFileLazy
   readFileStrict = lift . readFileStrict
+  readStdinStrict = lift readStdinStrict
   glob = lift . glob
   fileExists = lift . fileExists
   getDataFileName = lift . getDataFileName
@@ -691,6 +695,7 @@
   openURL = lift . openURL
   readFileLazy = lift . readFileLazy
   readFileStrict = lift . readFileStrict
+  readStdinStrict = lift readStdinStrict
   glob = lift . glob
   fileExists = lift . fileExists
   getDataFileName = lift . getDataFileName
diff --git a/src/Text/Pandoc/Class/PandocPure.hs b/src/Text/Pandoc/Class/PandocPure.hs
--- a/src/Text/Pandoc/Class/PandocPure.hs
+++ b/src/Text/Pandoc/Class/PandocPure.hs
@@ -64,6 +64,7 @@
   , stReferencePptx :: Archive
   , stReferenceODT :: Archive
   , stFiles :: FileTree
+  , stStdin :: B.ByteString
   , stUserDataFiles :: FileTree
   , stCabalDataFiles :: FileTree
   }
@@ -80,6 +81,7 @@
         , stReferencePptx = emptyArchive
         , stReferenceODT = emptyArchive
         , stFiles = mempty
+        , stStdin = mempty
         , stUserDataFiles = mempty
         , stCabalDataFiles = mempty
         }
@@ -192,6 +194,8 @@
     case infoFileContents <$> getFileInfo fp fps of
       Just bs -> return bs
       Nothing -> throwError $ PandocResourceNotFound $ T.pack fp
+
+  readStdinStrict = getsPureState stStdin
 
   glob s = do
     FileTree ftmap <- getsPureState stFiles
diff --git a/src/Text/Pandoc/Class/Sandbox.hs b/src/Text/Pandoc/Class/Sandbox.hs
new file mode 100644
--- /dev/null
+++ b/src/Text/Pandoc/Class/Sandbox.hs
@@ -0,0 +1,50 @@
+{- |
+Module      : Text.Pandoc.Class.Sandbox
+Copyright   : Copyright (C) 2021 John MacFarlane
+License     : GNU GPL, version 2 or above
+
+Maintainer  : John MacFarlane (<jgm@berkeley.edu>)
+Stability   : alpha
+Portability : portable
+
+This module provides a way to run PandocMonad actions in a sandbox
+(pure context, with no IO allowed and access only to designated files).
+-}
+
+module Text.Pandoc.Class.Sandbox
+  ( sandbox )
+where
+
+import Control.Monad (foldM)
+import Control.Monad.Except (throwError)
+import Control.Monad.IO.Class (MonadIO (liftIO))
+import Text.Pandoc.Class.PandocMonad
+import Text.Pandoc.Class.PandocPure
+import Text.Pandoc.Class.CommonState (CommonState(..))
+import Text.Pandoc.Logging (messageVerbosity)
+
+-- | Lift a PandocPure action into any instance of PandocMonad.
+-- The main computation is done purely, but CommonState is preserved
+-- continuously, and warnings are emitted after the action completes.
+-- The parameter is a list of FilePaths which will be added to the
+-- ersatz file system and be available for reading.
+sandbox :: (PandocMonad m, MonadIO m) => [FilePath] -> PandocPure a -> m a
+sandbox files action = do
+  oldState <- getCommonState
+  tree <- liftIO $ foldM addToFileTree mempty files
+  case runPure (do putCommonState oldState
+                   modifyPureState $ \ps -> ps{ stFiles = tree }
+                   result <- action
+                   st <- getCommonState
+                   return (st, result)) of
+          Left e -> throwError e
+          Right (st, result) -> do
+            putCommonState st
+            let verbosity = stVerbosity st
+            -- emit warnings, since these are not printed in runPure
+            let newMessages = reverse $ take
+                  (length (stLog st) - length (stLog oldState)) (stLog st)
+            mapM_ logOutput
+              (filter ((<= verbosity) . messageVerbosity) newMessages)
+            return result
+
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs
--- a/src/Text/Pandoc/Extensions.hs
+++ b/src/Text/Pandoc/Extensions.hs
@@ -74,6 +74,7 @@
     | Ext_angle_brackets_escapable  -- ^ Make < and > escapable
     | Ext_ascii_identifiers   -- ^ ascii-only identifiers for headers;
                               -- presupposes Ext_auto_identifiers
+    | Ext_attributes          -- ^ Generic attribute syntax
     | Ext_auto_identifiers    -- ^ Automatic identifiers for headers
     | Ext_autolink_bare_uris  -- ^ Make all absolute URIs into links
     | Ext_backtick_code_blocks    -- ^ GitHub style ``` code blocks
@@ -105,6 +106,7 @@
                               -- header identifiers; presupposes
                               -- Ext_auto_identifiers
     | Ext_grid_tables         -- ^ Grid tables (pandoc, reST)
+    | Ext_gutenberg           -- ^ Use Project Gutenberg conventions for plain
     | Ext_hard_line_breaks    -- ^ All newlines become hard line breaks
     | Ext_header_attributes   -- ^ Explicit header attributes {#id .class k=v}
     | Ext_ignore_line_breaks  -- ^ Newlines in paragraphs are ignored
@@ -124,7 +126,6 @@
     | Ext_mmd_header_identifiers -- ^ Multimarkdown style header identifiers [myid]
     | Ext_mmd_link_attributes     -- ^ MMD style reference link attributes
     | Ext_mmd_title_block     -- ^ Multimarkdown metadata block
-    | Ext_short_subsuperscripts -- ^ sub-&superscripts w/o closing char (v~i)
     | Ext_multiline_tables    -- ^ Pandoc-style multiline tables
     | Ext_native_divs             -- ^ Use Div blocks for contents of <div> tags
     | Ext_native_spans            -- ^ Use Span inlines for contents of <span>
@@ -139,9 +140,11 @@
     | Ext_raw_markdown        -- ^ Parse markdown in ipynb as raw markdown
     | Ext_rebase_relative_paths -- ^ Rebase relative image and link paths,
                                 -- relative to directory of containing file
+    | Ext_short_subsuperscripts -- ^ sub-&superscripts w/o closing char (v~i)
     | Ext_shortcut_reference_links -- ^ Shortcut reference links
     | Ext_simple_tables       -- ^ Pandoc-style simple tables
     | Ext_smart               -- ^ "Smart" quotes, apostrophes, ellipses, dashes
+    | Ext_sourcepos           -- ^ Include source position attributes
     | Ext_space_in_atx_header -- ^ Require space between # and header text
     | Ext_spaced_reference_links -- ^ Allow space between two parts of ref link
     | Ext_startnum            -- ^ Make start number of ordered list significant
@@ -157,9 +160,6 @@
     | Ext_xrefs_name          -- ^ Use xrefs with names
     | Ext_xrefs_number        -- ^ Use xrefs with numbers
     | Ext_yaml_metadata_block -- ^ YAML metadata block
-    | Ext_gutenberg           -- ^ Use Project Gutenberg conventions for plain
-    | Ext_attributes          -- ^ Generic attribute syntax
-    | Ext_sourcepos           -- ^ Include source position attributes
     deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable, Generic)
 
 -- | Extensions to be used with pandoc-flavored markdown.
@@ -353,6 +353,7 @@
   , Ext_task_lists
   , Ext_emoji
   , Ext_yaml_metadata_block
+  , Ext_footnotes
   ]
 getDefaultExtensions "commonmark"      = extensionsFromList
                                           [Ext_raw_html]
diff --git a/src/Text/Pandoc/Filter.hs b/src/Text/Pandoc/Filter.hs
--- a/src/Text/Pandoc/Filter.hs
+++ b/src/Text/Pandoc/Filter.hs
@@ -21,8 +21,7 @@
 import System.CPUTime (getCPUTime)
 import Data.Aeson.TH (deriveJSON, defaultOptions)
 import GHC.Generics (Generic)
-import Text.Pandoc.Class.PandocIO (PandocIO)
-import Text.Pandoc.Class.PandocMonad (report, getVerbosity)
+import Text.Pandoc.Class (report, getVerbosity, PandocMonad)
 import Text.Pandoc.Definition (Pandoc)
 import Text.Pandoc.Options (ReaderOptions)
 import Text.Pandoc.Logging
@@ -66,11 +65,12 @@
            _       -> JSONFilter fp) node
 
 -- | Modify the given document using a filter.
-applyFilters :: ReaderOptions
+applyFilters :: (PandocMonad m, MonadIO m)
+             => ReaderOptions
              -> [Filter]
              -> [String]
              -> Pandoc
-             -> PandocIO Pandoc
+             -> m Pandoc
 applyFilters ropts filters args d = do
   expandedFilters <- mapM expandFilterPath filters
   foldM applyFilter d expandedFilters
@@ -92,7 +92,7 @@
   toMilliseconds picoseconds = picoseconds `div` 1000000000
 
 -- | Expand paths of filters, searching the data directory.
-expandFilterPath :: Filter -> PandocIO Filter
+expandFilterPath :: (PandocMonad m, MonadIO m) => Filter -> m Filter
 expandFilterPath (LuaFilter fp) = LuaFilter <$> Path.expandFilterPath fp
 expandFilterPath (JSONFilter fp) = JSONFilter <$> Path.expandFilterPath fp
 expandFilterPath CiteprocFilter = return CiteprocFilter
diff --git a/src/Text/Pandoc/Filter/Lua.hs b/src/Text/Pandoc/Filter/Lua.hs
--- a/src/Text/Pandoc/Filter/Lua.hs
+++ b/src/Text/Pandoc/Filter/Lua.hs
@@ -14,7 +14,8 @@
 import Control.Exception (throw)
 import Control.Monad ((>=>))
 import qualified Data.Text as T
-import Text.Pandoc.Class.PandocIO (PandocIO)
+import Text.Pandoc.Class (PandocMonad)
+import Control.Monad.Trans (MonadIO)
 import Text.Pandoc.Definition (Pandoc)
 import Text.Pandoc.Error (PandocError (PandocFilterError, PandocLuaError))
 import Text.Pandoc.Lua (Global (..), runLua, runFilterFile, setGlobals)
@@ -23,11 +24,12 @@
 -- | Run the Lua filter in @filterPath@ for a transformation to the
 -- target format (first element in args). Pandoc uses Lua init files to
 -- setup the Lua interpreter.
-apply :: ReaderOptions
+apply :: (PandocMonad m, MonadIO m)
+      => ReaderOptions
       -> [String]
       -> FilePath
       -> Pandoc
-      -> PandocIO Pandoc
+      -> m Pandoc
 apply ropts args fp doc = do
   let format = case args of
                  (x:_) -> x
@@ -39,7 +41,8 @@
                ]
     runFilterFile fp doc
 
-forceResult :: FilePath -> Either PandocError Pandoc -> PandocIO Pandoc
+forceResult :: (PandocMonad m, MonadIO m)
+            => FilePath -> Either PandocError Pandoc -> m Pandoc
 forceResult fp eitherResult = case eitherResult of
   Right x  -> return x
   Left err -> throw . PandocFilterError (T.pack fp) $ case err of
diff --git a/src/Text/Pandoc/Image.hs b/src/Text/Pandoc/Image.hs
--- a/src/Text/Pandoc/Image.hs
+++ b/src/Text/Pandoc/Image.hs
@@ -11,24 +11,25 @@
 Functions for converting images.
 -}
 module Text.Pandoc.Image ( svgToPng ) where
-import Text.Pandoc.Options (WriterOptions(..))
 import Text.Pandoc.Process (pipeProcess)
 import qualified Data.ByteString.Lazy as L
 import System.Exit
 import Data.Text (Text)
 import Text.Pandoc.Shared (tshow)
 import qualified Control.Exception as E
+import Control.Monad.IO.Class (MonadIO(liftIO))
 
 -- | Convert svg image to png. rsvg-convert
 -- is used and must be available on the path.
-svgToPng :: WriterOptions
+svgToPng :: MonadIO m
+         => Int           -- ^ DPI
          -> L.ByteString  -- ^ Input image as bytestring
-         -> IO (Either Text L.ByteString)
-svgToPng opts bs = do
-  let dpi = show $ writerDpi opts
-  E.catch
+         -> m (Either Text L.ByteString)
+svgToPng dpi bs = do
+  let dpi' = show dpi
+  liftIO $ E.catch
        (do (exit, out) <- pipeProcess Nothing "rsvg-convert"
-                          ["-f","png","-a","--dpi-x",dpi,"--dpi-y",dpi]
+                          ["-f","png","-a","--dpi-x",dpi',"--dpi-y",dpi']
                           bs
            return $ if exit == ExitSuccess
               then Right out
diff --git a/src/Text/Pandoc/Logging.hs b/src/Text/Pandoc/Logging.hs
--- a/src/Text/Pandoc/Logging.hs
+++ b/src/Text/Pandoc/Logging.hs
@@ -105,6 +105,7 @@
   | ATXHeadingInLHS Int Text
   | EnvironmentVariableUndefined Text
   | DuplicateAttribute Text Text
+  | NotUTF8Encoded FilePath
   deriving (Show, Eq, Data, Ord, Typeable, Generic)
 
 instance ToJSON LogMessage where
@@ -244,6 +245,8 @@
       DuplicateAttribute attr val ->
            ["attribute" .= attr
            ,"value" .= val]
+      NotUTF8Encoded src ->
+           ["source" .= src]
 
 showPos :: SourcePos -> Text
 showPos pos = Text.pack $ sn ++ "line " ++
@@ -370,6 +373,9 @@
          "Undefined environment variable " <> var <> " in defaults file."
        DuplicateAttribute attr val ->
          "Ignoring duplicate attribute " <> attr <> "=" <> tshow val <> "."
+       NotUTF8Encoded src ->
+         Text.pack src <>
+           " is not UTF-8 encoded: falling back to latin1."
 
 messageVerbosity :: LogMessage -> Verbosity
 messageVerbosity msg =
@@ -420,3 +426,4 @@
        ATXHeadingInLHS{}             -> WARNING
        EnvironmentVariableUndefined{}-> WARNING
        DuplicateAttribute{}          -> WARNING
+       NotUTF8Encoded{}              -> WARNING
diff --git a/src/Text/Pandoc/Lua/ErrorConversion.hs b/src/Text/Pandoc/Lua/ErrorConversion.hs
--- a/src/Text/Pandoc/Lua/ErrorConversion.hs
+++ b/src/Text/Pandoc/Lua/ErrorConversion.hs
@@ -1,6 +1,5 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
 {-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE RankNTypes #-}
-{-# LANGUAGE ScopedTypeVariables #-}
 {- |
    Module      : Text.Pandoc.Lua.ErrorConversion
    Copyright   : © 2020-2021 Albert Krewinkel
@@ -13,49 +12,37 @@
 exceptions, and /vice versa/.
 -}
 module Text.Pandoc.Lua.ErrorConversion
-  ( errorConversion
+  ( addContextToException
   ) where
 
-import Foreign.Lua (Lua (..), NumResults)
+import HsLua (LuaError, LuaE, top)
+import HsLua.Marshalling (resultToEither, runPeek)
+import HsLua.Class.Peekable (PeekError (..))
 import Text.Pandoc.Error (PandocError (PandocLuaError))
 import Text.Pandoc.Lua.Marshaling.PandocError (pushPandocError, peekPandocError)
 
-import qualified Control.Monad.Catch as Catch
 import qualified Data.Text as T
-import qualified Foreign.Lua as Lua
-
--- | Conversions between Lua errors and Haskell exceptions, assuming
--- that all exceptions are of type @'PandocError'@.
-errorConversion :: Lua.ErrorConversion
-errorConversion = Lua.ErrorConversion
-  { Lua.addContextToException = addContextToException
-  , Lua.alternative           = alternative
-  , Lua.errorToException      = errorToException
-  , Lua.exceptionToError      = exceptionToError
-  }
+import qualified HsLua as Lua
 
--- | Convert a Lua error, which must be at the top of the stack, into a
--- @'PandocError'@, popping the value from the stack.
-errorToException :: forall a . Lua.State -> IO a
-errorToException l = Lua.unsafeRunWith l $ do
-  err <- peekPandocError Lua.stackTop
-  Lua.pop 1
-  Catch.throwM err
+addContextToException :: ()
+addContextToException = undefined
 
--- | Try the first op -- if it doesn't succeed, run the second.
-alternative :: forall a . Lua a -> Lua a -> Lua a
-alternative x y = Catch.try x >>= \case
-  Left (_ :: PandocError) -> y
-  Right x' -> return x'
+-- | Retrieve a @'PandocError'@ from the Lua stack.
+popPandocError :: LuaE PandocError PandocError
+popPandocError = do
+  errResult <- runPeek $ peekPandocError top
+  case resultToEither errResult of
+    Right x -> return x
+    Left err -> return $ PandocLuaError (T.pack err)
 
--- | Add more context to an error
-addContextToException :: forall a . String -> Lua a -> Lua a
-addContextToException ctx op = op `Catch.catch` \case
-  PandocLuaError msg -> Catch.throwM $ PandocLuaError (T.pack ctx <> msg)
-  e -> Catch.throwM e
+-- Ensure conversions between Lua errors and 'PandocError' exceptions
+-- are possible.
+instance LuaError PandocError where
+  popException = popPandocError
+  pushException = pushPandocError
+  luaException = PandocLuaError . T.pack
 
--- | Catch a @'PandocError'@ exception and raise it as a Lua error.
-exceptionToError :: Lua NumResults -> Lua NumResults
-exceptionToError op = op `Catch.catch` \e -> do
-  pushPandocError e
-  Lua.error
+instance PeekError PandocError where
+  messageFromException = \case
+    PandocLuaError m -> T.unpack m
+    err -> show err
diff --git a/src/Text/Pandoc/Lua/Filter.hs b/src/Text/Pandoc/Lua/Filter.hs
--- a/src/Text/Pandoc/Lua/Filter.hs
+++ b/src/Text/Pandoc/Lua/Filter.hs
@@ -1,4 +1,7 @@
-{-# LANGUAGE FlexibleContexts  #-}
+{-# LANGUAGE FlexibleContexts     #-}
+{-# LANGUAGE IncoherentInstances  #-}
+{-# LANGUAGE OverloadedStrings    #-}
+{-# LANGUAGE ScopedTypeVariables  #-}
 {- |
 Module      : Text.Pandoc.Lua.Filter
 Copyright   : © 2012-2021 John MacFarlane,
@@ -19,43 +22,42 @@
                               , module Text.Pandoc.Lua.Walk
                               ) where
 import Control.Applicative ((<|>))
-import Control.Monad (mplus, (>=>))
-import Control.Monad.Catch (finally, try)
+import Control.Monad (mplus, (>=>), (<$!>))
 import Data.Data (Data, DataType, dataTypeConstrs, dataTypeName, dataTypeOf,
                   showConstr, toConstr, tyconUQname)
 import Data.Foldable (foldrM)
 import Data.List (foldl')
 import Data.Map (Map)
-import Data.Maybe (fromMaybe)
-import Foreign.Lua (Lua, Peekable, Pushable, StackIndex)
+import Data.String (IsString (fromString))
+import HsLua as Lua
 import Text.Pandoc.Definition
 import Text.Pandoc.Error (PandocError)
 import Text.Pandoc.Lua.Marshaling ()
-import Text.Pandoc.Lua.Marshaling.List (List (..))
+import Text.Pandoc.Lua.Marshaling.AST
+import Text.Pandoc.Lua.Marshaling.List (List (..), peekList')
 import Text.Pandoc.Lua.Walk (SingletonsList (..))
 import Text.Pandoc.Walk (Walkable (walkM))
 
 import qualified Data.Map.Strict as Map
-import qualified Foreign.Lua as Lua
 import qualified Text.Pandoc.Lua.Util as LuaUtil
 
 -- | Transform document using the filter defined in the given file.
-runFilterFile :: FilePath -> Pandoc -> Lua Pandoc
+runFilterFile :: FilePath -> Pandoc -> LuaE PandocError Pandoc
 runFilterFile filterPath doc = do
-  top <- Lua.gettop
+  oldtop <- Lua.gettop
   stat <- LuaUtil.dofileWithTraceback filterPath
   if stat /= Lua.OK
-    then Lua.throwTopMessage
+    then Lua.throwErrorAsException
     else do
       newtop <- Lua.gettop
       -- Use the returned filters, or the implicitly defined global
       -- filter if nothing was returned.
-      luaFilters <- if newtop - top >= 1
-                    then Lua.peek Lua.stackTop
+      luaFilters <- if newtop - oldtop >= 1
+                    then Lua.peek Lua.top
                     else Lua.pushglobaltable *> fmap (:[]) Lua.popValue
       runAll luaFilters doc
 
-runAll :: [LuaFilter] -> Pandoc -> Lua Pandoc
+runAll :: [LuaFilter] -> Pandoc -> LuaE PandocError Pandoc
 runAll = foldr ((>=>) . walkMWithLuaFilter) return
 
 -- | Filter function stored in the registry
@@ -63,7 +65,7 @@
 
 -- | Collection of filter functions (at most one function per element
 -- constructor)
-newtype LuaFilter = LuaFilter (Map String LuaFilterFunction)
+newtype LuaFilter = LuaFilter (Map Name LuaFilterFunction)
 
 instance Peekable LuaFilter where
   peek idx = do
@@ -79,19 +81,19 @@
           return $ case filterFn of
             Nothing -> acc
             Just fn -> Map.insert constr fn acc
-    LuaFilter <$> foldrM go Map.empty constrs
+    LuaFilter <$!> foldrM go Map.empty constrs
 
 -- | Register the function at the top of the stack as a filter function in the
 -- registry.
-registerFilterFunction :: Lua (Maybe LuaFilterFunction)
+registerFilterFunction :: LuaError e => LuaE e (Maybe LuaFilterFunction)
 registerFilterFunction = do
-  isFn <- Lua.isfunction Lua.stackTop
+  isFn <- Lua.isfunction Lua.top
   if isFn
     then Just . LuaFilterFunction <$> Lua.ref Lua.registryindex
     else Nothing <$ Lua.pop 1
 
 -- | Retrieve filter function from registry and push it to the top of the stack.
-pushFilterFunction :: LuaFilterFunction -> Lua ()
+pushFilterFunction :: LuaFilterFunction -> LuaE PandocError ()
 pushFilterFunction (LuaFilterFunction fnRef) =
   Lua.getref Lua.registryindex fnRef
 
@@ -99,58 +101,66 @@
 -- element instead of a list, fetch that element as a singleton list. If the top
 -- of the stack is nil, return the default element that was passed to this
 -- function. If none of these apply, raise an error.
-elementOrList :: Peekable a => a -> Lua [a]
-elementOrList x = do
-  let topOfStack = Lua.stackTop
-  elementUnchanged <- Lua.isnil topOfStack
+elementOrList :: Peeker PandocError a -> a -> LuaE PandocError [a]
+elementOrList p x = do
+  elementUnchanged <- Lua.isnil top
   if elementUnchanged
-    then [x] <$ Lua.pop 1
-    else do
-       mbres <- peekEither topOfStack
-       case mbres of
-         Right res -> [res] <$ Lua.pop 1
-         Left _    -> Lua.peekList topOfStack `finally` Lua.pop 1
+    then [x] <$ pop 1
+    else forcePeek . (`lastly` pop 1) $ (((:[]) <$!> p top) <|> peekList p top)
 
+-- | Fetches a single element; returns the fallback if the value is @nil@.
+singleElement :: forall a e. (LuaError e) => Peeker e a -> a -> LuaE e a
+singleElement p x = do
+  elementUnchanged <- Lua.isnil top
+  if elementUnchanged
+    then x <$ Lua.pop 1
+    else forcePeek $ p top `lastly` pop 1
+
 -- | Pop and return a value from the stack; if the value at the top of
 -- the stack is @nil@, return the fallback element.
-popOption :: Peekable a => a -> Lua a
-popOption fallback = fromMaybe fallback . Lua.fromOptional <$> Lua.popValue
+popOption :: Peeker PandocError a -> a -> LuaE PandocError a
+popOption peeker fallback = forcePeek . (`lastly` pop 1) $
+  (fallback <$ peekNil top) <|> peeker top
 
 -- | Apply filter on a sequence of AST elements. Both lists and single
 -- value are accepted as filter function return values.
-runOnSequence :: (Data a, Peekable a, Pushable a)
-              => LuaFilter -> SingletonsList a -> Lua (SingletonsList a)
-runOnSequence (LuaFilter fnMap) (SingletonsList xs) =
+runOnSequence :: forall a. (Data a, Pushable a)
+              => Peeker PandocError a -> LuaFilter -> SingletonsList a
+              -> LuaE PandocError (SingletonsList a)
+runOnSequence peeker (LuaFilter fnMap) (SingletonsList xs) =
   SingletonsList <$> mconcatMapM tryFilter xs
  where
-  tryFilter :: (Data a, Peekable a, Pushable a) => a -> Lua [a]
+  tryFilter :: a -> LuaE PandocError [a]
   tryFilter x =
-    let filterFnName = showConstr (toConstr x)
-        catchAllName = tyconUQname $ dataTypeName (dataTypeOf x)
+    let filterFnName = fromString $ showConstr (toConstr x)
+        catchAllName = fromString . tyconUQname $ dataTypeName (dataTypeOf x)
     in case Map.lookup filterFnName fnMap <|> Map.lookup catchAllName fnMap of
-         Just fn -> runFilterFunction fn x *> elementOrList x
+         Just fn -> runFilterFunction fn x *> elementOrList peeker x
          Nothing -> return [x]
 
 -- | Try filtering the given value without type error corrections on
 -- the return value.
-runOnValue :: (Data a, Peekable a, Pushable a)
-           => String -> LuaFilter -> a -> Lua a
-runOnValue filterFnName (LuaFilter fnMap) x =
+runOnValue :: (Data a, Pushable a)
+           => Name -> Peeker PandocError a
+           -> LuaFilter -> a
+           -> LuaE PandocError a
+runOnValue filterFnName peeker (LuaFilter fnMap) x =
   case Map.lookup filterFnName fnMap of
-    Just fn -> runFilterFunction fn x *> popOption x
+    Just fn -> runFilterFunction fn x *> popOption peeker x
     Nothing -> return x
 
--- | Push a value to the stack via a lua filter function. The filter function is
--- called with given element as argument and is expected to return an element.
--- Alternatively, the function can return nothing or nil, in which case the
--- element is left unchanged.
-runFilterFunction :: Pushable a => LuaFilterFunction -> a -> Lua ()
+-- | Push a value to the stack via a Lua filter function. The filter
+-- function is called with the given element as argument and is expected
+-- to return an element. Alternatively, the function can return nothing
+-- or nil, in which case the element is left unchanged.
+runFilterFunction :: Pushable a
+                  => LuaFilterFunction -> a -> LuaE PandocError ()
 runFilterFunction lf x = do
   pushFilterFunction lf
   Lua.push x
   LuaUtil.callWithTraceback 1 1
 
-walkMWithLuaFilter :: LuaFilter -> Pandoc -> Lua Pandoc
+walkMWithLuaFilter :: LuaFilter -> Pandoc -> LuaE PandocError Pandoc
 walkMWithLuaFilter f =
       walkInlines f
   >=> walkInlineLists f
@@ -162,92 +172,76 @@
 mconcatMapM :: (Monad m) => (a -> m [a]) -> [a] -> m [a]
 mconcatMapM f = fmap mconcat . mapM f
 
-hasOneOf :: LuaFilter -> [String] -> Bool
+hasOneOf :: LuaFilter -> [Name] -> Bool
 hasOneOf (LuaFilter fnMap) = any (`Map.member` fnMap)
 
-contains :: LuaFilter -> String -> Bool
+contains :: LuaFilter -> Name -> Bool
 contains (LuaFilter fnMap) = (`Map.member` fnMap)
 
-walkInlines :: Walkable (SingletonsList Inline) a => LuaFilter -> a -> Lua a
+walkInlines :: Walkable (SingletonsList Inline) a
+            => LuaFilter -> a -> LuaE PandocError a
 walkInlines lf =
-  let f :: SingletonsList Inline -> Lua (SingletonsList Inline)
-      f = runOnSequence lf
+  let f :: SingletonsList Inline -> LuaE PandocError (SingletonsList Inline)
+      f = runOnSequence peekInline lf
   in if lf `hasOneOf` inlineElementNames
      then walkM f
      else return
 
-walkInlineLists :: Walkable (List Inline) a => LuaFilter -> a -> Lua a
+walkInlineLists :: Walkable (List Inline) a
+                => LuaFilter -> a -> LuaE PandocError a
 walkInlineLists lf =
-  let f :: List Inline -> Lua (List Inline)
-      f = runOnValue listOfInlinesFilterName lf
+  let f :: List Inline -> LuaE PandocError (List Inline)
+      f = runOnValue listOfInlinesFilterName (peekList' peekInline) lf
   in if lf `contains` listOfInlinesFilterName
      then walkM f
      else return
 
-walkBlocks :: Walkable (SingletonsList Block) a => LuaFilter -> a -> Lua a
+walkBlocks :: Walkable (SingletonsList Block) a
+           => LuaFilter -> a -> LuaE PandocError a
 walkBlocks lf =
-  let f :: SingletonsList Block -> Lua (SingletonsList Block)
-      f = runOnSequence lf
+  let f :: SingletonsList Block -> LuaE PandocError (SingletonsList Block)
+      f = runOnSequence peekBlock lf
   in if lf `hasOneOf` blockElementNames
      then walkM f
      else return
 
-walkBlockLists :: Walkable (List Block) a => LuaFilter -> a -> Lua a
+walkBlockLists :: Walkable (List Block) a
+               => LuaFilter -> a -> LuaE PandocError a
 walkBlockLists lf =
-  let f :: List Block -> Lua (List Block)
-      f = runOnValue listOfBlocksFilterName lf
+  let f :: List Block -> LuaE PandocError (List Block)
+      f = runOnValue listOfBlocksFilterName (peekList' peekBlock) lf
   in if lf `contains` listOfBlocksFilterName
      then walkM f
      else return
 
-walkMeta :: LuaFilter -> Pandoc -> Lua Pandoc
+walkMeta :: LuaFilter -> Pandoc -> LuaE PandocError Pandoc
 walkMeta lf (Pandoc m bs) = do
-  m' <- runOnValue "Meta" lf m
+  m' <- runOnValue "Meta" peekMeta lf m
   return $ Pandoc m' bs
 
-walkPandoc :: LuaFilter -> Pandoc -> Lua Pandoc
+walkPandoc :: LuaFilter -> Pandoc -> LuaE PandocError Pandoc
 walkPandoc (LuaFilter fnMap) =
   case foldl' mplus Nothing (map (`Map.lookup` fnMap) pandocFilterNames) of
-    Just fn -> \x -> runFilterFunction fn x *> singleElement x
+    Just fn -> \x -> runFilterFunction fn x *> singleElement peekPandoc x
     Nothing -> return
 
-constructorsFor :: DataType -> [String]
-constructorsFor x = map show (dataTypeConstrs x)
+constructorsFor :: DataType -> [Name]
+constructorsFor x = map (fromString . show) (dataTypeConstrs x)
 
-inlineElementNames :: [String]
+inlineElementNames :: [Name]
 inlineElementNames = "Inline" : constructorsFor (dataTypeOf (Str mempty))
 
-blockElementNames :: [String]
+blockElementNames :: [Name]
 blockElementNames = "Block" : constructorsFor (dataTypeOf (Para []))
 
-listOfInlinesFilterName :: String
+listOfInlinesFilterName :: Name
 listOfInlinesFilterName = "Inlines"
 
-listOfBlocksFilterName :: String
+listOfBlocksFilterName :: Name
 listOfBlocksFilterName = "Blocks"
 
-metaFilterName :: String
+metaFilterName :: Name
 metaFilterName = "Meta"
 
-pandocFilterNames :: [String]
+pandocFilterNames :: [Name]
 pandocFilterNames = ["Pandoc", "Doc"]
-
-singleElement :: Peekable a => a -> Lua a
-singleElement x = do
-  elementUnchanged <- Lua.isnil (-1)
-  if elementUnchanged
-    then x <$ Lua.pop 1
-    else do
-    mbres <- peekEither (-1)
-    case mbres of
-      Right res -> res <$ Lua.pop 1
-      Left err  -> do
-        Lua.pop 1
-        Lua.throwMessage
-          ("Error while trying to get a filter's return " <>
-           "value from Lua stack.\n" <> show err)
-
--- | Try to convert the value at the given stack index to a Haskell value.
--- Returns @Left@ with an error message on failure.
-peekEither :: Peekable a => StackIndex -> Lua (Either PandocError a)
-peekEither = try . Lua.peek
diff --git a/src/Text/Pandoc/Lua/Global.hs b/src/Text/Pandoc/Lua/Global.hs
--- a/src/Text/Pandoc/Lua/Global.hs
+++ b/src/Text/Pandoc/Lua/Global.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE OverloadedStrings  #-}
 {- |
    Module      : Text.Pandoc.Lua
    Copyright   : Copyright © 2017-2021 Albert Krewinkel
@@ -14,19 +14,18 @@
   , setGlobals
   ) where
 
-import Data.Data (Data)
-import Foreign.Lua (Lua, Peekable, Pushable)
-import Foreign.Lua.Userdata ( ensureUserdataMetatable, pushAnyWithMetatable
-                            , metatableName)
+import HsLua as Lua
+import HsLua.Module.Version (pushVersion)
 import Paths_pandoc (version)
 import Text.Pandoc.Class.CommonState (CommonState)
 import Text.Pandoc.Definition (Pandoc (Pandoc), pandocTypesVersion)
+import Text.Pandoc.Error (PandocError)
 import Text.Pandoc.Lua.Marshaling ()
-import Text.Pandoc.Lua.Util (addFunction)
+import Text.Pandoc.Lua.Marshaling.CommonState (pushCommonState)
+import Text.Pandoc.Lua.Marshaling.ReaderOptions (pushReaderOptions)
 import Text.Pandoc.Options (ReaderOptions)
 
 import qualified Data.Text as Text
-import qualified Foreign.Lua as Lua
 
 -- | Permissible global Lua variables.
 data Global =
@@ -40,50 +39,37 @@
   -- Cannot derive instance of Data because of CommonState
 
 -- | Set all given globals.
-setGlobals :: [Global] -> Lua ()
+setGlobals :: [Global] -> LuaE PandocError ()
 setGlobals = mapM_ setGlobal
 
-setGlobal :: Global -> Lua ()
+setGlobal :: Global -> LuaE PandocError ()
 setGlobal global = case global of
   -- This could be simplified if Global was an instance of Data.
   FORMAT format -> do
     Lua.push format
     Lua.setglobal "FORMAT"
   PANDOC_API_VERSION -> do
-    Lua.push pandocTypesVersion
+    pushVersion pandocTypesVersion
     Lua.setglobal "PANDOC_API_VERSION"
   PANDOC_DOCUMENT doc -> do
-    Lua.push (LazyPandoc doc)
+    pushUD typePandocLazy  doc
     Lua.setglobal "PANDOC_DOCUMENT"
   PANDOC_READER_OPTIONS ropts -> do
-    Lua.push ropts
+    pushReaderOptions ropts
     Lua.setglobal "PANDOC_READER_OPTIONS"
   PANDOC_SCRIPT_FILE filePath -> do
     Lua.push filePath
     Lua.setglobal "PANDOC_SCRIPT_FILE"
   PANDOC_STATE commonState -> do
-    Lua.push commonState
+    pushCommonState commonState
     Lua.setglobal "PANDOC_STATE"
   PANDOC_VERSION              -> do
-    Lua.push version
+    pushVersion version
     Lua.setglobal "PANDOC_VERSION"
 
 -- | Readonly and lazy pandoc objects.
-newtype LazyPandoc = LazyPandoc Pandoc
-  deriving (Data)
-
-instance Pushable LazyPandoc where
-  push lazyDoc = pushAnyWithMetatable pushPandocMetatable lazyDoc
-   where
-    pushPandocMetatable = ensureUserdataMetatable (metatableName lazyDoc) $
-                          addFunction "__index" indexLazyPandoc
-
-instance Peekable LazyPandoc where
-  peek = Lua.peekAny
-
-indexLazyPandoc :: LazyPandoc -> String -> Lua Lua.NumResults
-indexLazyPandoc (LazyPandoc (Pandoc meta blks)) field = 1 <$
-  case field of
-    "blocks" -> Lua.push blks
-    "meta"   -> Lua.push meta
-    _        -> Lua.pushnil
+typePandocLazy :: LuaError e => DocumentedType e Pandoc
+typePandocLazy = deftype "Pandoc (lazy)" []
+  [ readonly "meta" "document metadata" (push, \(Pandoc meta _) -> meta)
+  , readonly "blocks" "content blocks" (push, \(Pandoc _ blocks) -> blocks)
+  ]
diff --git a/src/Text/Pandoc/Lua/Init.hs b/src/Text/Pandoc/Lua/Init.hs
--- a/src/Text/Pandoc/Lua/Init.hs
+++ b/src/Text/Pandoc/Lua/Init.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE OverloadedStrings #-}
 {- |
    Module      : Text.Pandoc.Lua
    Copyright   : Copyright © 2017-2021 Albert Krewinkel
@@ -13,24 +14,23 @@
   ) where
 
 import Control.Monad (when)
-import Control.Monad.Catch (try)
+import Control.Monad.Catch (throwM, try)
 import Control.Monad.Trans (MonadIO (..))
 import Data.Data (Data, dataTypeConstrs, dataTypeOf, showConstr)
-import Foreign.Lua (Lua)
+import HsLua as Lua hiding (status, try)
 import GHC.IO.Encoding (getForeignEncoding, setForeignEncoding, utf8)
-import Text.Pandoc.Class.PandocMonad (readDataFile)
-import Text.Pandoc.Class.PandocIO (PandocIO)
-import Text.Pandoc.Error (PandocError)
+import Text.Pandoc.Class.PandocMonad (PandocMonad, readDataFile)
+import Text.Pandoc.Error (PandocError (PandocLuaError))
 import Text.Pandoc.Lua.Packages (installPandocPackageSearcher)
 import Text.Pandoc.Lua.PandocLua (PandocLua, liftPandocLua, runPandocLua)
-import Text.Pandoc.Lua.Util (throwTopMessageAsError')
-import qualified Foreign.Lua as Lua
+import qualified Data.Text as T
 import qualified Text.Pandoc.Definition as Pandoc
 import qualified Text.Pandoc.Lua.Module.Pandoc as ModulePandoc
 
 -- | Run the lua interpreter, using pandoc's default way of environment
 -- initialization.
-runLua :: Lua a -> PandocIO (Either PandocError a)
+runLua :: (PandocMonad m, MonadIO m)
+       => LuaE PandocError a -> m (Either PandocError a)
 runLua luaOp = do
   enc <- liftIO $ getForeignEncoding <* setForeignEncoding utf8
   res <- runPandocLua . try $ do
@@ -53,9 +53,9 @@
     ModulePandoc.pushModule
     -- register as loaded module
     liftPandocLua $ do
-      Lua.pushvalue Lua.stackTop
-      Lua.getfield Lua.registryindex Lua.loadedTableRegistryField
-      Lua.setfield (Lua.nthFromTop 2) "pandoc"
+      Lua.pushvalue Lua.top
+      Lua.getfield Lua.registryindex Lua.loaded
+      Lua.setfield (Lua.nth 2) "pandoc"
       Lua.pop 1
     -- copy constructors into registry
     putConstructorsInRegistry
@@ -66,10 +66,12 @@
   loadInitScript scriptFile = do
     script <- readDataFile scriptFile
     status <- liftPandocLua $ Lua.dostring script
-    when (status /= Lua.OK) . liftPandocLua $
-      throwTopMessageAsError'
-      (("Couldn't load '" ++ scriptFile ++ "'.\n") ++)
-
+    when (status /= Lua.OK) . liftPandocLua $ do
+      err <- popException
+      let prefix = "Couldn't load '" <> T.pack scriptFile <> "':\n"
+      throwM . PandocLuaError . (prefix <>) $ case err of
+        PandocLuaError msg -> msg
+        _                  -> T.pack $ show err
 
 -- | AST elements are marshaled via normal constructor functions in the
 -- @pandoc@ module. However, accessing Lua globals from Haskell is
@@ -87,17 +89,16 @@
   constrsToReg $ Pandoc.Meta mempty
   constrsToReg $ Pandoc.MetaList mempty
   constrsToReg $ Pandoc.Citation mempty mempty mempty Pandoc.AuthorInText 0 0
-  putInReg "Attr"  -- used for Attr type alias
   putInReg "ListAttributes"  -- used for ListAttributes type alias
   putInReg "List"  -- pandoc.List
   putInReg "SimpleTable"  -- helper for backward-compatible table handling
  where
-  constrsToReg :: Data a => a -> Lua ()
+  constrsToReg :: Data a => a -> LuaE PandocError ()
   constrsToReg = mapM_ (putInReg . showConstr) . dataTypeConstrs . dataTypeOf
 
-  putInReg :: String -> Lua ()
+  putInReg :: String -> LuaE PandocError ()
   putInReg name = do
     Lua.push ("pandoc." ++ name) -- name in registry
     Lua.push name -- in pandoc module
-    Lua.rawget (Lua.nthFromTop 3)
+    Lua.rawget (Lua.nth 3)
     Lua.rawset Lua.registryindex
diff --git a/src/Text/Pandoc/Lua/Marshaling.hs b/src/Text/Pandoc/Lua/Marshaling.hs
--- a/src/Text/Pandoc/Lua/Marshaling.hs
+++ b/src/Text/Pandoc/Lua/Marshaling.hs
@@ -16,4 +16,4 @@
 import Text.Pandoc.Lua.Marshaling.Context ()
 import Text.Pandoc.Lua.Marshaling.PandocError()
 import Text.Pandoc.Lua.Marshaling.ReaderOptions ()
-import Text.Pandoc.Lua.Marshaling.Version ()
+import Text.Pandoc.Lua.ErrorConversion ()
diff --git a/src/Text/Pandoc/Lua/Marshaling/AST.hs b/src/Text/Pandoc/Lua/Marshaling/AST.hs
--- a/src/Text/Pandoc/Lua/Marshaling/AST.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/AST.hs
@@ -1,6 +1,10 @@
 {-# OPTIONS_GHC -fno-warn-orphans #-}
-{-# LANGUAGE BangPatterns         #-}
+{-# LANGUAGE FlexibleInstances    #-}
 {-# LANGUAGE LambdaCase           #-}
+{-# LANGUAGE OverloadedStrings    #-}
+{-# LANGUAGE ScopedTypeVariables  #-}
+{-# LANGUAGE TupleSections        #-}
+{-# LANGUAGE TypeApplications     #-}
 {- |
    Module      : Text.Pandoc.Lua.Marshaling.AST
    Copyright   : © 2012-2021 John MacFarlane
@@ -13,224 +17,299 @@
 Marshaling/unmarshaling instances for document AST elements.
 -}
 module Text.Pandoc.Lua.Marshaling.AST
-  ( LuaAttr (..)
-  , LuaListAttributes (..)
+  ( peekAttr
+  , peekBlock
+  , peekBlocks
+  , peekCaption
+  , peekCitation
+  , peekFormat
+  , peekInline
+  , peekInlines
+  , peekListAttributes
+  , peekMeta
+  , peekMetaValue
+  , peekPandoc
+  , peekMathType
+  , peekQuoteType
+
+  , peekFuzzyInlines
+  , peekFuzzyBlocks
+
+  , pushAttr
+  , pushBlock
+  , pushInline
+  , pushListAttributes
+  , pushMetaValue
+  , pushPandoc
   ) where
 
-import Control.Applicative ((<|>))
-import Control.Monad ((<$!>))
-import Foreign.Lua (Lua, Peekable, Pushable, StackIndex)
+import Control.Applicative ((<|>), optional)
+import Control.Monad.Catch (throwM)
+import Control.Monad ((<$!>), (>=>))
+import Data.Data (showConstr, toConstr)
+import Data.Text (Text)
+import Data.Version (Version)
+import HsLua hiding (Operation (Div))
+import HsLua.Module.Version (peekVersionFuzzy)
 import Text.Pandoc.Definition
-import Text.Pandoc.Error (PandocError)
-import Text.Pandoc.Lua.Util (defineHowTo, pushViaConstructor)
-import Text.Pandoc.Lua.Marshaling.CommonState ()
+import Text.Pandoc.Error (PandocError (PandocLuaError))
+import Text.Pandoc.Lua.Util (pushViaConstr', pushViaConstructor)
+import Text.Pandoc.Lua.Marshaling.Attr (peekAttr, pushAttr)
+import Text.Pandoc.Lua.Marshaling.List (pushPandocList)
 
-import qualified Control.Monad.Catch as Catch
-import qualified Foreign.Lua as Lua
+import qualified HsLua as Lua
 import qualified Text.Pandoc.Lua.Util as LuaUtil
 
 instance Pushable Pandoc where
-  push (Pandoc meta blocks) =
-    pushViaConstructor "Pandoc" blocks meta
+  push = pushPandoc
 
-instance Peekable Pandoc where
-  peek idx = defineHowTo "get Pandoc value" $! Pandoc
-    <$!> LuaUtil.rawField idx "meta"
-    <*>  LuaUtil.rawField idx "blocks"
+pushPandoc :: LuaError e => Pusher e Pandoc
+pushPandoc = pushUD typePandoc
 
+peekPandoc :: LuaError e => Peeker e Pandoc
+peekPandoc = retrieving "Pandoc value" . peekUD typePandoc
+
+typePandoc :: LuaError e => DocumentedType e Pandoc
+typePandoc = deftype "Pandoc"
+  [ operation Eq $ defun "__eq"
+     ### liftPure2 (==)
+     <#> parameter (optional . peekPandoc) "doc1" "pandoc" ""
+     <#> parameter (optional . peekPandoc) "doc2" "pandoc" ""
+     =#> functionResult pushBool "boolean" "true iff the two values are equal"
+  ]
+  [ property "blocks" "list of blocks"
+      (pushPandocList pushBlock, \(Pandoc _ blks) -> blks)
+      (peekList peekBlock, \(Pandoc m _) blks -> Pandoc m blks)
+  , property "meta" "document metadata"
+      (pushMeta, \(Pandoc meta _) -> meta)
+      (peekMeta, \(Pandoc _ blks) meta -> Pandoc meta blks)
+  ]
+
 instance Pushable Meta where
-  push (Meta mmap) =
-    pushViaConstructor "Meta" mmap
-instance Peekable Meta where
-  peek idx = defineHowTo "get Meta value" $!
-    Meta <$!> Lua.peek idx
+  push = pushMeta
 
+pushMeta :: LuaError e => Pusher e Meta
+pushMeta (Meta mmap) = pushViaConstr' "Meta" [push mmap]
+
+peekMeta :: LuaError e => Peeker e Meta
+peekMeta idx = retrieving "Meta" $
+  Meta <$!> peekMap peekText peekMetaValue idx
+
 instance Pushable MetaValue where
   push = pushMetaValue
-instance Peekable MetaValue where
-  peek = peekMetaValue
 
 instance Pushable Block where
   push = pushBlock
 
-instance Peekable Block where
-  peek = peekBlock
-
 -- Inline
 instance Pushable Inline where
   push = pushInline
 
-instance Peekable Inline where
-  peek = peekInline
-
 -- Citation
 instance Pushable Citation where
-  push (Citation cid prefix suffix mode noteNum hash) =
-    pushViaConstructor "Citation" cid mode prefix suffix noteNum hash
+  push = pushCitation
 
-instance Peekable Citation where
-  peek idx = Citation
-    <$!> LuaUtil.rawField idx "id"
-    <*> LuaUtil.rawField idx "prefix"
-    <*> LuaUtil.rawField idx "suffix"
-    <*> LuaUtil.rawField idx "mode"
-    <*> LuaUtil.rawField idx "note_num"
-    <*> LuaUtil.rawField idx "hash"
+pushCitation :: LuaError e => Pusher e Citation
+pushCitation (Citation cid prefix suffix mode noteNum hash) =
+  pushViaConstr' "Citation"
+  [ push cid, push mode, push prefix, push suffix, push noteNum, push hash
+  ]
 
+peekCitation :: LuaError e => Peeker e Citation
+peekCitation = fmap (retrieving "Citation")
+  . typeChecked "table" Lua.istable $ \idx -> do
+      idx' <- liftLua $ absindex idx
+      Citation
+        <$!> peekFieldRaw peekText "id" idx'
+        <*>  peekFieldRaw (peekList peekInline) "prefix" idx'
+        <*>  peekFieldRaw (peekList peekInline) "suffix" idx'
+        <*>  peekFieldRaw peekRead "mode" idx'
+        <*>  peekFieldRaw peekIntegral "note_num" idx'
+        <*>  peekFieldRaw peekIntegral "hash" idx'
+
+
 instance Pushable Alignment where
-  push = Lua.push . show
-instance Peekable Alignment where
-  peek = Lua.peekRead
+  push = Lua.pushString . show
 
 instance Pushable CitationMode where
   push = Lua.push . show
-instance Peekable CitationMode where
-  peek = Lua.peekRead
 
 instance Pushable Format where
-  push (Format f) = Lua.push f
-instance Peekable Format where
-  peek idx = Format <$!> Lua.peek idx
+  push = pushFormat
 
+pushFormat :: LuaError e => Pusher e Format
+pushFormat (Format f) = pushText f
+
+peekFormat :: LuaError e => Peeker e Format
+peekFormat idx = Format <$!> peekText idx
+
 instance Pushable ListNumberDelim where
   push = Lua.push . show
-instance Peekable ListNumberDelim where
-  peek = Lua.peekRead
 
 instance Pushable ListNumberStyle where
   push = Lua.push . show
-instance Peekable ListNumberStyle where
-  peek = Lua.peekRead
 
 instance Pushable MathType where
   push = Lua.push . show
-instance Peekable MathType where
-  peek = Lua.peekRead
 
 instance Pushable QuoteType where
-  push = Lua.push . show
-instance Peekable QuoteType where
-  peek = Lua.peekRead
+  push = pushQuoteType
 
+pushMathType :: LuaError e => Pusher e MathType
+pushMathType = pushString . show
+
+peekMathType :: LuaError e => Peeker e MathType
+peekMathType = peekRead
+
+pushQuoteType :: LuaError e => Pusher e QuoteType
+pushQuoteType = pushString . show
+
+peekQuoteType :: LuaError e => Peeker e QuoteType
+peekQuoteType = peekRead
+
 -- | Push an meta value element to the top of the lua stack.
-pushMetaValue :: MetaValue -> Lua ()
+pushMetaValue :: LuaError e => MetaValue -> LuaE e ()
 pushMetaValue = \case
-  MetaBlocks blcks  -> pushViaConstructor "MetaBlocks" blcks
+  MetaBlocks blcks  -> pushViaConstr' "MetaBlocks" [pushList pushBlock blcks]
   MetaBool bool     -> Lua.push bool
-  MetaInlines inlns -> pushViaConstructor "MetaInlines" inlns
-  MetaList metalist -> pushViaConstructor "MetaList" metalist
-  MetaMap metamap   -> pushViaConstructor "MetaMap" metamap
+  MetaInlines inlns -> pushViaConstr' "MetaInlines"
+                       [pushList pushInline inlns]
+  MetaList metalist -> pushViaConstr' "MetaList"
+                       [pushList pushMetaValue metalist]
+  MetaMap metamap   -> pushViaConstr' "MetaMap"
+                       [pushMap pushText pushMetaValue metamap]
   MetaString str    -> Lua.push str
 
 -- | Interpret the value at the given stack index as meta value.
-peekMetaValue :: StackIndex -> Lua MetaValue
-peekMetaValue idx = defineHowTo "get MetaValue" $ do
+peekMetaValue :: forall e. LuaError e => Peeker e MetaValue
+peekMetaValue = retrieving "MetaValue $ " . \idx -> do
   -- Get the contents of an AST element.
-  let elementContent :: Peekable a => Lua a
-      elementContent = Lua.peek idx
-  luatype <- Lua.ltype idx
+  let mkMV :: (a -> MetaValue) -> Peeker e a -> Peek e MetaValue
+      mkMV f p = f <$!> p idx
+
+      peekTagged = \case
+        "MetaBlocks"  -> mkMV MetaBlocks $
+          retrieving "MetaBlocks" . peekBlocks
+        "MetaBool"    -> mkMV MetaBool $
+          retrieving "MetaBool" . peekBool
+        "MetaMap"     -> mkMV MetaMap $
+          retrieving "MetaMap" . peekMap peekText peekMetaValue
+        "MetaInlines" -> mkMV MetaInlines $
+          retrieving "MetaInlines" . peekInlines
+        "MetaList"    -> mkMV MetaList $
+          retrieving "MetaList" . peekList peekMetaValue
+        "MetaString"  -> mkMV MetaString $
+          retrieving "MetaString" . peekText
+        (Name t)      -> failPeek ("Unknown meta tag: " <> t)
+
+      peekUntagged = do
+        -- no meta value tag given, try to guess.
+        len <- liftLua $ Lua.rawlen idx
+        if len <= 0
+          then MetaMap <$!> peekMap peekText peekMetaValue idx
+          else  (MetaInlines <$!> peekInlines idx)
+            <|> (MetaBlocks <$!> peekBlocks idx)
+            <|> (MetaList <$!> peekList peekMetaValue idx)
+  luatype <- liftLua $ Lua.ltype idx
   case luatype of
-    Lua.TypeBoolean -> MetaBool <$!> Lua.peek idx
-    Lua.TypeString  -> MetaString <$!> Lua.peek idx
+    Lua.TypeBoolean -> MetaBool <$!> peekBool idx
+    Lua.TypeString  -> MetaString <$!> peekText idx
     Lua.TypeTable   -> do
-      tag <- try $ LuaUtil.getTag idx
-      case tag of
-        Right "MetaBlocks"  -> MetaBlocks  <$!> elementContent
-        Right "MetaBool"    -> MetaBool    <$!> elementContent
-        Right "MetaMap"     -> MetaMap     <$!> elementContent
-        Right "MetaInlines" -> MetaInlines <$!> elementContent
-        Right "MetaList"    -> MetaList    <$!> elementContent
-        Right "MetaString"  -> MetaString  <$!> elementContent
-        Right t             -> Lua.throwMessage ("Unknown meta tag: " <> t)
-        Left _ -> do
-          -- no meta value tag given, try to guess.
-          len <- Lua.rawlen idx
-          if len <= 0
-            then MetaMap <$!> Lua.peek idx
-            else  (MetaInlines <$!> Lua.peek idx)
-                  <|> (MetaBlocks <$!> Lua.peek idx)
-                  <|> (MetaList <$!> Lua.peek idx)
-    _        -> Lua.throwMessage "could not get meta value"
+      optional (LuaUtil.getTag idx) >>= \case
+        Just tag -> peekTagged tag
+        Nothing  -> peekUntagged
+    _        -> failPeek "could not get meta value"
 
 -- | Push a block element to the top of the Lua stack.
-pushBlock :: Block -> Lua ()
+pushBlock :: forall e. LuaError e => Block -> LuaE e ()
 pushBlock = \case
-  BlockQuote blcks         -> pushViaConstructor "BlockQuote" blcks
-  BulletList items         -> pushViaConstructor "BulletList" items
-  CodeBlock attr code      -> pushViaConstructor "CodeBlock" code (LuaAttr attr)
-  DefinitionList items     -> pushViaConstructor "DefinitionList" items
-  Div attr blcks           -> pushViaConstructor "Div" blcks (LuaAttr attr)
-  Header lvl attr inlns    -> pushViaConstructor "Header" lvl inlns (LuaAttr attr)
-  HorizontalRule           -> pushViaConstructor "HorizontalRule"
-  LineBlock blcks          -> pushViaConstructor "LineBlock" blcks
-  OrderedList lstAttr list -> pushViaConstructor "OrderedList" list
-                                                 (LuaListAttributes lstAttr)
-  Null                     -> pushViaConstructor "Null"
-  Para blcks               -> pushViaConstructor "Para" blcks
-  Plain blcks              -> pushViaConstructor "Plain" blcks
-  RawBlock f cs            -> pushViaConstructor "RawBlock" f cs
+  BlockQuote blcks         -> pushViaConstructor @e "BlockQuote" blcks
+  BulletList items         -> pushViaConstructor @e "BulletList" items
+  CodeBlock attr code      -> pushViaConstr' @e "CodeBlock"
+                              [ push code, pushAttr attr ]
+  DefinitionList items     -> pushViaConstructor @e "DefinitionList" items
+  Div attr blcks           -> pushViaConstr' @e "Div"
+                              [push blcks, pushAttr attr]
+  Header lvl attr inlns    -> pushViaConstr' @e "Header"
+                              [push lvl, push inlns, pushAttr attr]
+  HorizontalRule           -> pushViaConstructor @e "HorizontalRule"
+  LineBlock blcks          -> pushViaConstructor @e "LineBlock" blcks
+  OrderedList lstAttr list -> pushViaConstr' @e "OrderedList"
+                              [ push list, pushListAttributes @e lstAttr ]
+  Null                     -> pushViaConstructor @e "Null"
+  Para blcks               -> pushViaConstructor @e "Para" blcks
+  Plain blcks              -> pushViaConstructor @e "Plain" blcks
+  RawBlock f cs            -> pushViaConstructor @e "RawBlock" f cs
   Table attr blkCapt specs thead tbody tfoot ->
-    pushViaConstructor "Table" blkCapt specs thead tbody tfoot attr
+    pushViaConstr' @e "Table"
+    [ pushCaption blkCapt, push specs, push thead, push tbody
+    , push tfoot, pushAttr attr]
 
 -- | Return the value at the given index as block if possible.
-peekBlock :: StackIndex -> Lua Block
-peekBlock idx = defineHowTo "get Block value" $! do
-  tag <- LuaUtil.getTag idx
-  case tag of
-      "BlockQuote"     -> BlockQuote <$!> elementContent
-      "BulletList"     -> BulletList <$!> elementContent
-      "CodeBlock"      -> withAttr CodeBlock <$!> elementContent
-      "DefinitionList" -> DefinitionList <$!> elementContent
-      "Div"            -> withAttr Div <$!> elementContent
-      "Header"         -> (\(lvl, LuaAttr attr, lst) -> Header lvl attr lst)
-                          <$!> elementContent
+peekBlock :: forall e. LuaError e => Peeker e Block
+peekBlock = fmap (retrieving "Block")
+  . typeChecked "table" Lua.istable
+  $ \idx -> do
+  -- Get the contents of an AST element.
+  let mkBlock :: (a -> Block) -> Peeker e a -> Peek e Block
+      mkBlock f p = f <$!> peekFieldRaw p "c" idx
+  LuaUtil.getTag idx >>= \case
+      "BlockQuote"     -> mkBlock BlockQuote peekBlocks
+      "BulletList"     -> mkBlock BulletList (peekList peekBlocks)
+      "CodeBlock"      -> mkBlock (uncurry CodeBlock)
+                                  (peekPair peekAttr peekText)
+      "DefinitionList" -> mkBlock DefinitionList
+                          (peekList (peekPair peekInlines (peekList peekBlocks)))
+      "Div"            -> mkBlock (uncurry Div) (peekPair peekAttr peekBlocks)
+      "Header"         -> mkBlock (\(lvl, attr, lst) -> Header lvl attr lst)
+                          (peekTriple peekIntegral peekAttr peekInlines)
       "HorizontalRule" -> return HorizontalRule
-      "LineBlock"      -> LineBlock <$!> elementContent
-      "OrderedList"    -> (\(LuaListAttributes lstAttr, lst) ->
-                             OrderedList lstAttr lst)
-                          <$!> elementContent
+      "LineBlock"      -> mkBlock LineBlock (peekList peekInlines)
+      "OrderedList"    -> mkBlock (uncurry OrderedList)
+                          (peekPair peekListAttributes (peekList peekBlocks))
       "Null"           -> return Null
-      "Para"           -> Para <$!> elementContent
-      "Plain"          -> Plain <$!> elementContent
-      "RawBlock"       -> uncurry RawBlock <$!> elementContent
-      "Table"          -> (\(attr, capt, colSpecs, thead, tbodies, tfoot) ->
-                              Table (fromLuaAttr attr)
-                                    capt
-                                    colSpecs
-                                    thead
-                                    tbodies
-                                    tfoot)
-                          <$!> elementContent
-      _ -> Lua.throwMessage ("Unknown block type: " <> tag)
- where
-   -- Get the contents of an AST element.
-   elementContent :: Peekable a => Lua a
-   elementContent = LuaUtil.rawField idx "c"
+      "Para"           -> mkBlock Para peekInlines
+      "Plain"          -> mkBlock Plain peekInlines
+      "RawBlock"       -> mkBlock (uncurry RawBlock)
+                                  (peekPair peekFormat peekText)
+      "Table"          -> mkBlock id
+        (retrieving "Table" . (liftLua . absindex >=> (\idx' -> cleanup $ do
+          attr  <- liftLua (rawgeti idx' 1) *> peekAttr top
+          capt  <- liftLua (rawgeti idx' 2) *> peekCaption top
+          cs    <- liftLua (rawgeti idx' 3) *> peekList peekColSpec top
+          thead <- liftLua (rawgeti idx' 4) *> peekTableHead top
+          tbods <- liftLua (rawgeti idx' 5) *> peekList peekTableBody top
+          tfoot <- liftLua (rawgeti idx' 6) *> peekTableFoot top
+          return $! Table attr capt cs thead tbods tfoot)))
+      Name tag -> failPeek ("Unknown block type: " <> tag)
 
-instance Pushable Caption where
-  push = pushCaption
+peekBlocks :: LuaError e => Peeker e [Block]
+peekBlocks = peekList peekBlock
 
-instance Peekable Caption where
-  peek = peekCaption
+peekInlines :: LuaError e => Peeker e [Inline]
+peekInlines = peekList peekInline
 
 -- | Push Caption element
-pushCaption :: Caption -> Lua ()
+pushCaption :: LuaError e => Caption -> LuaE e ()
 pushCaption (Caption shortCaption longCaption) = do
   Lua.newtable
   LuaUtil.addField "short" (Lua.Optional shortCaption)
   LuaUtil.addField "long" longCaption
 
 -- | Peek Caption element
-peekCaption :: StackIndex -> Lua Caption
-peekCaption idx = Caption
-  <$!> (Lua.fromOptional <$!> LuaUtil.rawField idx "short")
-  <*>  LuaUtil.rawField idx "long"
+peekCaption :: LuaError e => Peeker e Caption
+peekCaption = retrieving "Caption" . \idx -> do
+  short <- optional $ peekFieldRaw peekInlines "short" idx
+  long <- peekFieldRaw peekBlocks "long" idx
+  return $! Caption short long
 
-instance Peekable ColWidth where
-  peek idx = do
-    width <- Lua.fromOptional <$!> Lua.peek idx
-    return $! maybe ColWidthDefault ColWidth width
+peekColWidth :: LuaError e => Peeker e ColWidth
+peekColWidth = retrieving "ColWidth" . \idx -> do
+  maybe ColWidthDefault ColWidth <$!> optional (peekRealFloat idx)
 
+peekColSpec :: LuaError e => Peeker e ColSpec
+peekColSpec = peekPair peekRead peekColWidth
+
 instance Pushable ColWidth where
   push = \case
     (ColWidth w)    -> Lua.push w
@@ -240,8 +319,13 @@
   push (Row attr cells) = Lua.push (attr, cells)
 
 instance Peekable Row where
-  peek = fmap (uncurry Row) . Lua.peek
+  peek = forcePeek . peekRow
 
+peekRow :: LuaError e => Peeker e Row
+peekRow = ((uncurry Row) <$!>)
+  . retrieving "Row"
+  . peekPair peekAttr (peekList peekCell)
+
 instance Pushable TableBody where
   push (TableBody attr (RowHeadColumns rowHeadColumns) head' body) = do
     Lua.newtable
@@ -250,32 +334,38 @@
     LuaUtil.addField "head" head'
     LuaUtil.addField "body" body
 
-instance Peekable TableBody where
-  peek idx = TableBody
-    <$!> LuaUtil.rawField idx "attr"
-    <*>  (RowHeadColumns <$!> LuaUtil.rawField idx "row_head_columns")
-    <*>  LuaUtil.rawField idx "head"
-    <*>  LuaUtil.rawField idx "body"
+peekTableBody :: LuaError e => Peeker e TableBody
+peekTableBody = fmap (retrieving "TableBody")
+  . typeChecked "table" Lua.istable
+  $ \idx -> TableBody
+  <$!> peekFieldRaw peekAttr "attr" idx
+  <*>  peekFieldRaw ((fmap RowHeadColumns) . peekIntegral) "row_head_columns" idx
+  <*>  peekFieldRaw (peekList peekRow) "head" idx
+  <*>  peekFieldRaw (peekList peekRow) "body" idx
 
 instance Pushable TableHead where
   push (TableHead attr rows) = Lua.push (attr, rows)
 
-instance Peekable TableHead where
-  peek = fmap (uncurry TableHead) . Lua.peek
+peekTableHead :: LuaError e => Peeker e TableHead
+peekTableHead = ((uncurry TableHead) <$!>)
+  . retrieving "TableHead"
+  . peekPair peekAttr (peekList peekRow)
 
 instance Pushable TableFoot where
   push (TableFoot attr cells) = Lua.push (attr, cells)
 
-instance Peekable TableFoot where
-  peek = fmap (uncurry TableFoot) . Lua.peek
+peekTableFoot :: LuaError e => Peeker e TableFoot
+peekTableFoot = ((uncurry TableFoot) <$!>)
+  . retrieving "TableFoot"
+  . peekPair peekAttr (peekList peekRow)
 
 instance Pushable Cell where
   push = pushCell
 
 instance Peekable Cell where
-  peek = peekCell
+  peek = forcePeek . peekCell
 
-pushCell :: Cell -> Lua ()
+pushCell :: LuaError e => Cell -> LuaE e ()
 pushCell (Cell attr align (RowSpan rowSpan) (ColSpan colSpan) contents) = do
   Lua.newtable
   LuaUtil.addField "attr" attr
@@ -284,95 +374,252 @@
   LuaUtil.addField "col_span" colSpan
   LuaUtil.addField "contents" contents
 
-peekCell :: StackIndex -> Lua Cell
-peekCell idx = Cell
-  <$!> (fromLuaAttr <$!> LuaUtil.rawField idx "attr")
-  <*>  LuaUtil.rawField idx "alignment"
-  <*>  (RowSpan <$!> LuaUtil.rawField idx "row_span")
-  <*>  (ColSpan <$!> LuaUtil.rawField idx "col_span")
-  <*>  LuaUtil.rawField idx "contents"
+peekCell :: LuaError e => Peeker e Cell
+peekCell = fmap (retrieving "Cell")
+  . typeChecked "table" Lua.istable
+  $ \idx -> do
+  attr <- peekFieldRaw peekAttr "attr" idx
+  algn <- peekFieldRaw peekRead "alignment" idx
+  rs   <- RowSpan <$!> peekFieldRaw peekIntegral "row_span" idx
+  cs   <- ColSpan <$!> peekFieldRaw peekIntegral "col_span" idx
+  blks <- peekFieldRaw peekBlocks "contents" idx
+  return $! Cell attr algn rs cs blks
 
+getInlineText :: Inline -> Possible Text
+getInlineText = \case
+  Code _ lst      -> Actual lst
+  Math _ str      -> Actual str
+  RawInline _ raw -> Actual raw
+  Str s           -> Actual s
+  _               -> Absent
+
+setInlineText :: Inline -> Text -> Possible Inline
+setInlineText = \case
+  Code attr _     -> Actual . Code attr
+  Math mt _       -> Actual . Math mt
+  RawInline f _   -> Actual . RawInline f
+  Str _           -> Actual . Str
+  _               -> const Absent
+
+data Content
+  = ContentBlocks [Block]
+  | ContentInlines [Inline]
+
+setInlineContent :: Inline -> Content -> Possible Inline
+setInlineContent = \case
+  -- inline content
+  Cite cs _     -> Actual . Cite cs . inlineContent
+  Emph _        -> Actual . Emph . inlineContent
+  Quoted qt _   -> Actual . Quoted qt . inlineContent
+  SmallCaps _   -> Actual . SmallCaps . inlineContent
+  Span attr _   -> Actual . Span attr . inlineContent
+  Strong _      -> Actual . Strong . inlineContent
+  Subscript _   -> Actual . Subscript . inlineContent
+  Superscript _ -> Actual . Superscript . inlineContent
+  Underline _   -> Actual . Underline . inlineContent
+  -- block content
+  Note _        -> Actual . Note . blockContent
+  _             -> const Absent
+  where
+    inlineContent = \case
+      ContentInlines inlns -> inlns
+      ContentBlocks _      -> throwM $
+                              PandocLuaError "expected Inlines, got Blocks"
+    blockContent = \case
+      ContentBlocks blks -> blks
+      ContentInlines []  -> []
+      ContentInlines _   -> throwM $
+                            PandocLuaError "expected Blocks, got Inlines"
+
+getInlineContent :: Inline -> Possible Content
+getInlineContent = \case
+  Cite _ inlns      -> Actual $ ContentInlines inlns
+  Emph inlns        -> Actual $ ContentInlines inlns
+  Quoted _ inlns    -> Actual $ ContentInlines inlns
+  SmallCaps inlns   -> Actual $ ContentInlines inlns
+  Span _ inlns      -> Actual $ ContentInlines inlns
+  Strong inlns      -> Actual $ ContentInlines inlns
+  Subscript inlns   -> Actual $ ContentInlines inlns
+  Superscript inlns -> Actual $ ContentInlines inlns
+  Underline inlns   -> Actual $ ContentInlines inlns
+  Note blks         -> Actual $ ContentBlocks blks
+  _                 -> Absent
+
+-- title
+getInlineTitle :: Inline -> Possible Text
+getInlineTitle = \case
+  Image _ _ (_, tit) -> Actual tit
+  Link _ _ (_, tit)  -> Actual tit
+  _                  -> Absent
+
+setInlineTitle :: Inline -> Text -> Possible Inline
+setInlineTitle = \case
+  Image attr capt (src, _) -> Actual . Image attr capt . (src,)
+  Link attr capt (src, _)  -> Actual . Link attr capt . (src,)
+  _                        -> const Absent
+
+-- attr
+getInlineAttr :: Inline -> Possible Attr
+getInlineAttr = \case
+  Code attr _    -> Actual attr
+  Image attr _ _ -> Actual attr
+  Link attr _ _  -> Actual attr
+  Span attr _    -> Actual attr
+  _              -> Absent
+
+setInlineAttr :: Inline -> Attr -> Possible Inline
+setInlineAttr = \case
+  Code _ cs       -> Actual . (`Code` cs)
+  Image _ cpt tgt -> Actual . \attr -> Image attr cpt tgt
+  Link _ cpt tgt  -> Actual . \attr -> Link attr cpt tgt
+  Span _ inlns    -> Actual . (`Span` inlns)
+  _               -> const Absent
+
+showInline :: LuaError e => DocumentedFunction e
+showInline = defun "show"
+  ### liftPure (show @Inline)
+  <#> parameter peekInline "inline" "Inline" "Object"
+  =#> functionResult pushString "string" "stringified Inline"
+
+pushContent :: LuaError e => Pusher e Content
+pushContent = \case
+  ContentBlocks blks -> pushPandocList pushBlock blks
+  ContentInlines inlns -> pushPandocList pushInline inlns
+
+peekContent :: LuaError e => Peeker e Content
+peekContent idx =
+  (ContentInlines <$!> peekList peekInline idx) <|>
+  (ContentBlocks  <$!> peekList peekBlock idx)
+
+typeInline :: LuaError e => DocumentedType e Inline
+typeInline = deftype "Inline"
+  [ operation Tostring showInline
+  , operation Eq $ defun "__eq"
+      ### liftPure2 (==)
+      <#> parameter peekInline "a" "Inline" ""
+      <#> parameter peekInline "b" "Inline" ""
+      =#> functionResult pushBool "boolean" "whether the two are equal"
+  ]
+  [ possibleProperty "attr" "element attributes"
+      (pushAttr, getInlineAttr)
+      (peekAttr, setInlineAttr)
+  , possibleProperty "caption" "image caption"
+      (pushPandocList pushInline, \case
+          Image _ capt _ -> Actual capt
+          _              -> Absent)
+      (peekInlines, \case
+          Image attr _ target -> Actual . (\capt -> Image attr capt target)
+          _                   -> const Absent)
+  , possibleProperty "citations" "list of citations"
+      (pushPandocList pushCitation, \case {Cite cs _ -> Actual cs; _ -> Absent})
+      (peekList peekCitation, \case
+          Cite _ inlns -> Actual . (`Cite` inlns)
+          _            -> const Absent)
+  , possibleProperty "content" "element contents"
+      (pushContent, getInlineContent)
+      (peekContent, setInlineContent)
+  , possibleProperty "format" "format of raw text"
+      (pushFormat, \case {RawInline fmt _ -> Actual fmt; _ -> Absent})
+      (peekFormat, \case
+          RawInline _ txt -> Actual . (`RawInline` txt)
+          _ -> const Absent)
+  , possibleProperty "mathtype" "math rendering method"
+      (pushMathType, \case {Math mt _ -> Actual mt; _ -> Absent})
+      (peekMathType, \case
+          Math _ txt -> Actual . (`Math` txt)
+          _          -> const Absent)
+  , possibleProperty "quotetype" "type of quotes (single or double)"
+      (pushQuoteType, \case {Quoted qt _ -> Actual qt; _ -> Absent})
+      (peekQuoteType, \case
+          Quoted _ inlns  -> Actual . (`Quoted` inlns)
+          _               -> const Absent)
+  , possibleProperty "src" "image source"
+      (pushText, \case
+          Image _ _ (src, _) -> Actual src
+          _                  -> Absent)
+      (peekText, \case
+          Image attr capt (_, title) -> Actual . Image attr capt . (,title)
+          _                          -> const Absent)
+  , possibleProperty "target" "link target URL"
+      (pushText, \case
+          Link _ _ (tgt, _) -> Actual tgt
+          _                 -> Absent)
+      (peekText, \case
+          Link attr capt (_, title) -> Actual . Image attr capt . (,title)
+          _                         -> const Absent)
+  , possibleProperty "title" "title text"
+      (pushText, getInlineTitle)
+      (peekText, setInlineTitle)
+  , possibleProperty "text" "text contents"
+      (pushText, getInlineText)
+      (peekText, setInlineText)
+  , readonly "tag" "type of Inline"
+      (pushString, showConstr . toConstr )
+
+  , alias "t" "tag" ["tag"]
+  , alias "c" "content" ["content"]
+  , alias "identifier" "element identifier"       ["attr", "identifier"]
+  , alias "classes"    "element classes"          ["attr", "classes"]
+  , alias "attributes" "other element attributes" ["attr", "attributes"]
+
+  , method $ defun "clone"
+      ### return
+      <#> parameter peekInline "inline" "Inline" "self"
+      =#> functionResult pushInline "Inline" "cloned Inline"
+  ]
+
 -- | Push an inline element to the top of the lua stack.
-pushInline :: Inline -> Lua ()
-pushInline = \case
-  Cite citations lst       -> pushViaConstructor "Cite" lst citations
-  Code attr lst            -> pushViaConstructor "Code" lst (LuaAttr attr)
-  Emph inlns               -> pushViaConstructor "Emph" inlns
-  Underline inlns          -> pushViaConstructor "Underline" inlns
-  Image attr alt (src,tit) -> pushViaConstructor "Image" alt src tit (LuaAttr attr)
-  LineBreak                -> pushViaConstructor "LineBreak"
-  Link attr lst (src,tit)  -> pushViaConstructor "Link" lst src tit (LuaAttr attr)
-  Note blcks               -> pushViaConstructor "Note" blcks
-  Math mty str             -> pushViaConstructor "Math" mty str
-  Quoted qt inlns          -> pushViaConstructor "Quoted" qt inlns
-  RawInline f cs           -> pushViaConstructor "RawInline" f cs
-  SmallCaps inlns          -> pushViaConstructor "SmallCaps" inlns
-  SoftBreak                -> pushViaConstructor "SoftBreak"
-  Space                    -> pushViaConstructor "Space"
-  Span attr inlns          -> pushViaConstructor "Span" inlns (LuaAttr attr)
-  Str str                  -> pushViaConstructor "Str" str
-  Strikeout inlns          -> pushViaConstructor "Strikeout" inlns
-  Strong inlns             -> pushViaConstructor "Strong" inlns
-  Subscript inlns          -> pushViaConstructor "Subscript" inlns
-  Superscript inlns        -> pushViaConstructor "Superscript" inlns
+pushInline :: forall e. LuaError e => Inline -> LuaE e ()
+pushInline = pushUD typeInline
 
 -- | Return the value at the given index as inline if possible.
-peekInline :: StackIndex -> Lua Inline
-peekInline idx = defineHowTo "get Inline value" $ do
-  tag <- LuaUtil.getTag idx
-  case tag of
-    "Cite"       -> uncurry Cite <$!> elementContent
-    "Code"       -> withAttr Code <$!> elementContent
-    "Emph"       -> Emph <$!> elementContent
-    "Underline"  -> Underline <$!> elementContent
-    "Image"      -> (\(LuaAttr !attr, !lst, !tgt) -> Image attr lst tgt)
-                    <$!> elementContent
-    "Link"       -> (\(LuaAttr !attr, !lst, !tgt) -> Link attr lst tgt)
-                    <$!> elementContent
-    "LineBreak"  -> return LineBreak
-    "Note"       -> Note <$!> elementContent
-    "Math"       -> uncurry Math <$!> elementContent
-    "Quoted"     -> uncurry Quoted <$!> elementContent
-    "RawInline"  -> uncurry RawInline <$!> elementContent
-    "SmallCaps"  -> SmallCaps <$!> elementContent
-    "SoftBreak"  -> return SoftBreak
-    "Space"      -> return Space
-    "Span"       -> withAttr Span <$!> elementContent
-    -- strict to Lua string is copied before gc
-    "Str"        -> Str <$!> elementContent
-    "Strikeout"  -> Strikeout <$!> elementContent
-    "Strong"     -> Strong <$!> elementContent
-    "Subscript"  -> Subscript <$!> elementContent
-    "Superscript"-> Superscript <$!> elementContent
-    _ -> Lua.throwMessage ("Unknown inline type: " <> tag)
- where
-   -- Get the contents of an AST element.
-   elementContent :: Peekable a => Lua a
-   elementContent = LuaUtil.rawField idx "c"
+peekInline :: forall e. LuaError e => Peeker e Inline
+peekInline = retrieving "Inline" . \idx -> peekUD typeInline idx
 
-try :: Lua a -> Lua (Either PandocError a)
-try = Catch.try
+-- | Try extra-hard to return the value at the given index as a list of
+-- inlines.
+peekFuzzyInlines :: LuaError e => Peeker e [Inline]
+peekFuzzyInlines = choice
+  [ peekList peekInline
+  , fmap pure . peekInline
+  , \idx -> pure . Str <$!> peekText idx
+  ]
 
-withAttr :: (Attr -> a -> b) -> (LuaAttr, a) -> b
-withAttr f (attributes, x) = f (fromLuaAttr attributes) x
+peekFuzzyBlocks :: LuaError e => Peeker e [Block]
+peekFuzzyBlocks = choice
+  [ peekList peekBlock
+  , fmap pure . peekBlock
+  , \idx -> pure . Plain . pure . Str <$!> peekText idx
+  ]
 
--- | Wrapper for Attr
-newtype LuaAttr = LuaAttr { fromLuaAttr :: Attr }
 
-instance Pushable LuaAttr where
-  push (LuaAttr (id', classes, kv)) =
-    pushViaConstructor "Attr" id' classes kv
+pushListAttributes :: forall e. LuaError e => ListAttributes -> LuaE e ()
+pushListAttributes (start, style, delimiter) =
+    pushViaConstr' "ListAttributes"
+    [ push start, push style, push delimiter ]
 
-instance Peekable LuaAttr where
-  peek idx = defineHowTo "get Attr value" $! (LuaAttr <$!> Lua.peek idx)
+peekListAttributes :: LuaError e => Peeker e ListAttributes
+peekListAttributes = retrieving "ListAttributes" . peekTriple
+  peekIntegral
+  peekRead
+  peekRead
 
--- | Wrapper for ListAttributes
-newtype LuaListAttributes = LuaListAttributes  ListAttributes
+-- These instances exist only for testing. It's a hack to avoid making
+-- the marshalling modules public.
+instance Peekable Inline where
+  peek = forcePeek . peekInline
 
-instance Pushable LuaListAttributes where
-  push (LuaListAttributes (start, style, delimiter)) =
-    pushViaConstructor "ListAttributes" start style delimiter
+instance Peekable Block where
+  peek = forcePeek . peekBlock
 
-instance Peekable LuaListAttributes where
-  peek = defineHowTo "get ListAttributes value" .
-         fmap LuaListAttributes . Lua.peek
+instance Peekable Meta where
+  peek = forcePeek . peekMeta
+
+instance Peekable Pandoc where
+  peek = forcePeek . peekPandoc
+
+instance Peekable Version where
+  peek = forcePeek . peekVersionFuzzy
+
+instance {-# OVERLAPPING #-} Peekable Attr where
+  peek = forcePeek . peekAttr
diff --git a/src/Text/Pandoc/Lua/Marshaling/AnyValue.hs b/src/Text/Pandoc/Lua/Marshaling/AnyValue.hs
deleted file mode 100644
--- a/src/Text/Pandoc/Lua/Marshaling/AnyValue.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-{- |
-   Module      : Text.Pandoc.Lua.Marshaling.AnyValue
-   Copyright   : © 2017-2021 Albert Krewinkel
-   License     : GNU GPL, version 2 or above
-
-   Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
-   Stability   : alpha
-
-Helper type to work with raw Lua stack indices instead of unmarshaled
-values.
-
-TODO: Most of this module should be abstracted, factored out, and go
-into HsLua.
--}
-module Text.Pandoc.Lua.Marshaling.AnyValue (AnyValue (..)) where
-
-import Foreign.Lua (Peekable (peek), StackIndex)
-
--- | Dummy type to allow values of arbitrary Lua type. This just wraps
--- stack indices, using it requires extra care.
-newtype AnyValue = AnyValue StackIndex
-
-instance Peekable AnyValue where
-  peek = return . AnyValue
diff --git a/src/Text/Pandoc/Lua/Marshaling/Attr.hs b/src/Text/Pandoc/Lua/Marshaling/Attr.hs
new file mode 100644
--- /dev/null
+++ b/src/Text/Pandoc/Lua/Marshaling/Attr.hs
@@ -0,0 +1,225 @@
+{-# LANGUAGE BangPatterns         #-}
+{-# LANGUAGE LambdaCase           #-}
+{-# LANGUAGE OverloadedStrings    #-}
+{-# LANGUAGE ScopedTypeVariables  #-}
+{-# LANGUAGE TupleSections        #-}
+{-# LANGUAGE TypeApplications     #-}
+{- |
+Module      : Text.Pandoc.Lua.Marshaling.Attr
+Copyright   : © 2012-2021 John MacFarlane
+              © 2017-2021 Albert Krewinkel
+License     : GNU GPL, version 2 or above
+
+Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
+Stability   : alpha
+
+Marshaling/unmarshaling instances for document AST elements.
+-}
+module Text.Pandoc.Lua.Marshaling.Attr
+  ( typeAttr
+  , peekAttr
+  , pushAttr
+  , mkAttr
+  , mkAttributeList
+  ) where
+
+import Control.Applicative ((<|>), optional)
+import Control.Monad ((<$!>))
+import Data.Maybe (fromMaybe)
+import Data.Text (Text)
+import HsLua
+import HsLua.Marshalling.Peekers (peekIndexRaw)
+import Safe (atMay)
+import Text.Pandoc.Definition (Attr, nullAttr)
+import Text.Pandoc.Lua.Marshaling.List (pushPandocList)
+
+import qualified Data.Text as T
+
+typeAttr :: LuaError e => DocumentedType e Attr
+typeAttr = deftype "Attr"
+  [ operation Eq $ lambda
+    ### liftPure2 (==)
+    <#> parameter peekAttr "a1" "Attr" ""
+    <#> parameter peekAttr "a2" "Attr" ""
+    =#> functionResult pushBool "boolean" "whether the two are equal"
+  ]
+  [ property "identifier" "element identifier"
+      (pushText, \(ident,_,_) -> ident)
+      (peekText, \(_,cls,kv) -> (,cls,kv))
+  , property "classes" "element classes"
+      (pushPandocList pushText, \(_,classes,_) -> classes)
+      (peekList peekText, \(ident,_,kv) -> (ident,,kv))
+  , property "attributes" "various element attributes"
+      (pushAttribs, \(_,_,attribs) -> attribs)
+      (peekAttribs, \(ident,cls,_) -> (ident,cls,))
+  , method $ defun "clone"
+    ### return
+    <#> parameter peekAttr "attr" "Attr" ""
+    =#> functionResult pushAttr "Attr" "new Attr element"
+  ]
+
+pushAttr :: LuaError e => Pusher e Attr
+pushAttr = pushUD typeAttr
+
+peekAttribs :: LuaError e => Peeker e [(Text,Text)]
+peekAttribs idx = liftLua (ltype idx) >>= \case
+  TypeUserdata -> peekUD typeAttributeList idx
+  TypeTable    -> liftLua (rawlen idx) >>= \case
+    0 -> peekKeyValuePairs peekText peekText idx
+    _ -> peekList (peekPair peekText peekText) idx
+  _            -> fail "unsupported type"
+
+pushAttribs :: LuaError e => Pusher e [(Text, Text)]
+pushAttribs = pushUD typeAttributeList
+
+typeAttributeList :: LuaError e => DocumentedType e [(Text, Text)]
+typeAttributeList = deftype "AttributeList"
+  [ operation Eq $ lambda
+    ### liftPure2 (==)
+    <#> parameter peekAttribs "a1" "AttributeList" ""
+    <#> parameter peekAttribs "a2" "AttributeList" ""
+    =#> functionResult pushBool "boolean" "whether the two are equal"
+
+  , operation Index $ lambda
+    ### liftPure2 lookupKey
+    <#> udparam typeAttributeList "t" "attributes list"
+    <#> parameter peekKey "string|integer" "key" "lookup key"
+    =#> functionResult (maybe pushnil pushAttribute) "string|table"
+          "attribute value"
+
+  , operation Newindex $ lambda
+    ### setKey
+    <#> udparam typeAttributeList "t" "attributes list"
+    <#> parameter peekKey "string|integer" "key" "lookup key"
+    <#> optionalParameter peekAttribute "string|nil" "value" "new value"
+    =#> []
+
+  , operation Len $ lambda
+    ### liftPure length
+    <#> udparam typeAttributeList "t" "attributes list"
+    =#> functionResult pushIntegral "integer" "number of attributes in list"
+
+  , operation Pairs $ lambda
+    ### pushIterator (\(k, v) -> 2 <$ pushText k <* pushText v)
+    <#> udparam typeAttributeList "t" "attributes list"
+    =?> "iterator triple"
+
+  , operation Tostring $ lambda
+    ### liftPure show
+    <#> udparam typeAttributeList "t" "attributes list"
+    =#> functionResult pushString "string" ""
+  ]
+  []
+
+data Key = StringKey Text | IntKey Int
+
+peekKey :: LuaError e => Peeker e (Maybe Key)
+peekKey idx = liftLua (ltype idx) >>= \case
+  TypeNumber -> Just . IntKey <$!> peekIntegral idx
+  TypeString -> Just . StringKey <$!> peekText idx
+  _          -> return Nothing
+
+data Attribute
+  = AttributePair (Text, Text)
+  | AttributeValue Text
+
+pushAttribute :: LuaError e => Pusher e Attribute
+pushAttribute = \case
+  (AttributePair kv) -> pushPair pushText pushText kv
+  (AttributeValue v) -> pushText v
+
+-- | Retrieve an 'Attribute'.
+peekAttribute :: LuaError e => Peeker e Attribute
+peekAttribute idx = (AttributeValue <$!> peekText idx)
+  <|> (AttributePair <$!> peekPair peekText peekText idx)
+
+lookupKey :: [(Text,Text)] -> Maybe Key -> Maybe Attribute
+lookupKey !kvs = \case
+  Just (StringKey str) -> AttributeValue <$> lookup str kvs
+  Just (IntKey n)      -> AttributePair <$!> atMay kvs (n - 1)
+  Nothing              -> Nothing
+
+setKey :: forall e. LuaError e
+       => [(Text, Text)] -> Maybe Key -> Maybe Attribute
+       -> LuaE e ()
+setKey kvs mbKey mbValue = case mbKey of
+  Just (StringKey str) ->
+    case break ((== str) . fst) kvs of
+      (prefix, _:suffix) -> case mbValue of
+        Nothing -> setNew $ prefix ++ suffix
+        Just (AttributeValue value) -> setNew $ prefix ++ (str, value):suffix
+        _ -> failLua "invalid attribute value"
+      _  -> case mbValue of
+        Nothing -> return ()
+        Just (AttributeValue value) -> setNew (kvs ++ [(str, value)])
+        _ -> failLua "invalid attribute value"
+  Just (IntKey idx) ->
+    case splitAt (idx - 1) kvs of
+      (prefix, (k,_):suffix) -> setNew $ case mbValue of
+        Nothing -> prefix ++ suffix
+        Just (AttributePair kv) -> prefix ++ kv : suffix
+        Just (AttributeValue v) -> prefix ++ (k, v) : suffix
+      (prefix, []) -> case mbValue of
+        Nothing -> setNew prefix
+        Just (AttributePair kv) -> setNew $ prefix ++ [kv]
+        _ -> failLua $ "trying to set an attribute key-value pair, "
+             ++ "but got a single string instead."
+
+  _  -> failLua "invalid attribute key"
+  where
+    setNew :: [(Text, Text)] -> LuaE e ()
+    setNew new =
+      putuserdata (nthBottom 1) (udName @e typeAttributeList) new >>= \case
+        True -> return ()
+        False -> failLua "failed to modify attributes list"
+
+peekAttr :: LuaError e => Peeker e Attr
+peekAttr idx = retrieving "Attr" $ liftLua (ltype idx) >>= \case
+  TypeString -> (,[],[]) <$!> peekText idx -- treat string as ID
+  TypeUserdata -> peekUD typeAttr idx
+  TypeTable -> peekAttrTable idx
+  x -> liftLua . failLua $ "Cannot get Attr from " ++ show x
+
+-- | Helper function which gets an Attr from a Lua table.
+peekAttrTable :: LuaError e => Peeker e Attr
+peekAttrTable idx = do
+  len' <- liftLua $ rawlen idx
+  let peekClasses = peekList peekText
+  if len' > 0
+    then do
+      ident <- peekIndexRaw 1 peekText idx
+      classes <- fromMaybe [] <$!> optional (peekIndexRaw 2 peekClasses idx)
+      attribs <- fromMaybe [] <$!> optional (peekIndexRaw 3 peekAttribs idx)
+      return $ ident `seq` classes `seq` attribs `seq`
+        (ident, classes, attribs)
+    else retrieving "HTML-like attributes" $ do
+      kvs <- peekKeyValuePairs peekText peekText idx
+      let ident = fromMaybe "" $ lookup "id" kvs
+      let classes = maybe [] T.words $ lookup "class" kvs
+      let attribs = filter ((`notElem` ["id", "class"]) . fst) kvs
+      return $ ident `seq` classes `seq` attribs `seq`
+        (ident, classes, attribs)
+
+mkAttr :: LuaError e => LuaE e NumResults
+mkAttr = do
+  attr <- ltype (nthBottom 1) >>= \case
+    TypeString -> forcePeek $ do
+      mident <- optional (peekText (nthBottom 1))
+      mclass <- optional (peekList peekText (nthBottom 2))
+      mattribs <- optional (peekAttribs (nthBottom 3))
+      return (fromMaybe "" mident, fromMaybe [] mclass, fromMaybe [] mattribs)
+    TypeTable  -> forcePeek $ peekAttrTable (nthBottom 1)
+    TypeUserdata -> forcePeek $ peekUD typeAttr (nthBottom 1) <|> do
+      attrList <- peekUD typeAttributeList (nthBottom 1)
+      return ("", [], attrList)
+    TypeNil    -> pure nullAttr
+    TypeNone   -> pure nullAttr
+    x          -> failLua $ "Cannot create Attr from " ++ show x
+  pushAttr attr
+  return 1
+
+mkAttributeList :: LuaError e => LuaE e NumResults
+mkAttributeList = do
+  attribs <- forcePeek $ peekAttribs (nthBottom 1)
+  pushUD typeAttributeList attribs
+  return 1
diff --git a/src/Text/Pandoc/Lua/Marshaling/CommonState.hs b/src/Text/Pandoc/Lua/Marshaling/CommonState.hs
--- a/src/Text/Pandoc/Lua/Marshaling/CommonState.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/CommonState.hs
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-orphans #-}
-{-# LANGUAGE LambdaCase           #-}
 {-# LANGUAGE OverloadedStrings    #-}
 {- |
    Module      : Text.Pandoc.Lua.Marshaling.CommonState
@@ -11,92 +9,62 @@
 
 Instances to marshal (push) and unmarshal (peek) the common state.
 -}
-module Text.Pandoc.Lua.Marshaling.CommonState () where
+module Text.Pandoc.Lua.Marshaling.CommonState
+  ( typeCommonState
+  , peekCommonState
+  , pushCommonState
+  ) where
 
-import Foreign.Lua (Lua, Peekable, Pushable)
-import Foreign.Lua.Types.Peekable (reportValueOnFailure)
-import Foreign.Lua.Userdata (ensureUserdataMetatable, pushAnyWithMetatable,
-                             toAnyWithName)
+import HsLua.Core
+import HsLua.Marshalling
+import HsLua.Packaging
 import Text.Pandoc.Class (CommonState (..))
 import Text.Pandoc.Logging (LogMessage, showLogMessage)
-import Text.Pandoc.Lua.Marshaling.AnyValue (AnyValue (..))
+import Text.Pandoc.Lua.Marshaling.List (pushPandocList)
 
-import qualified Data.Map as Map
-import qualified Data.Text as Text
-import qualified Foreign.Lua as Lua
-import qualified Text.Pandoc.Lua.Util as LuaUtil
+-- | Lua type used for the @CommonState@ object.
+typeCommonState :: LuaError e => DocumentedType e CommonState
+typeCommonState = deftype "pandoc CommonState" []
+  [ readonly "input_files" "input files passed to pandoc"
+      (pushPandocList pushString, stInputFiles)
 
--- | Name used by Lua for the @CommonState@ type.
-commonStateTypeName :: String
-commonStateTypeName = "Pandoc CommonState"
+  , readonly "output_file" "the file to which pandoc will write"
+      (maybe pushnil pushString, stOutputFile)
 
-instance Peekable CommonState where
-  peek idx = reportValueOnFailure commonStateTypeName
-             (`toAnyWithName` commonStateTypeName) idx
+  , readonly "log" "list of log messages"
+      (pushPandocList (pushUD typeLogMessage), stLog)
 
-instance Pushable CommonState where
-  push st = pushAnyWithMetatable pushCommonStateMetatable st
-   where
-    pushCommonStateMetatable = ensureUserdataMetatable commonStateTypeName $ do
-      LuaUtil.addFunction "__index" indexCommonState
-      LuaUtil.addFunction "__pairs" pairsCommonState
+  , readonly "request_headers" "headers to add for HTTP requests"
+      (pushPandocList (pushPair pushText pushText), stRequestHeaders)
 
-indexCommonState :: CommonState -> AnyValue -> Lua Lua.NumResults
-indexCommonState st (AnyValue idx) = Lua.ltype idx >>= \case
-  Lua.TypeString -> 1 <$ (Lua.peek idx >>= pushField)
-  _ -> 1 <$ Lua.pushnil
- where
-  pushField :: Text.Text -> Lua ()
-  pushField name = case lookup name commonStateFields of
-    Just pushValue -> pushValue st
-    Nothing -> Lua.pushnil
+  , readonly "resource_path"
+      "path to search for resources like included images"
+      (pushPandocList pushString, stResourcePath)
 
-pairsCommonState :: CommonState -> Lua Lua.NumResults
-pairsCommonState st = do
-  Lua.pushHaskellFunction nextFn
-  Lua.pushnil
-  Lua.pushnil
-  return 3
- where
-  nextFn :: AnyValue -> AnyValue -> Lua Lua.NumResults
-  nextFn _ (AnyValue idx) =
-    Lua.ltype idx >>= \case
-      Lua.TypeNil -> case commonStateFields of
-        []  -> 2 <$ (Lua.pushnil *> Lua.pushnil)
-        (key, pushValue):_ -> 2 <$ (Lua.push key *> pushValue st)
-      Lua.TypeString -> do
-        key <- Lua.peek idx
-        case tail $ dropWhile ((/= key) . fst) commonStateFields of
-          []                     -> 2 <$ (Lua.pushnil *> Lua.pushnil)
-          (nextKey, pushValue):_ -> 2 <$ (Lua.push nextKey *> pushValue st)
-      _ -> 2 <$ (Lua.pushnil *> Lua.pushnil)
+  , readonly "source_url" "absolute URL + dir of 1st source file"
+      (maybe pushnil pushText, stSourceURL)
 
-commonStateFields :: [(Text.Text, CommonState -> Lua ())]
-commonStateFields =
-  [ ("input_files", Lua.push . stInputFiles)
-  , ("output_file", Lua.push . Lua.Optional . stOutputFile)
-  , ("log", Lua.push . stLog)
-  , ("request_headers", Lua.push . Map.fromList . stRequestHeaders)
-  , ("resource_path", Lua.push . stResourcePath)
-  , ("source_url", Lua.push . Lua.Optional . stSourceURL)
-  , ("user_data_dir", Lua.push . Lua.Optional . stUserDataDir)
-  , ("trace", Lua.push . stTrace)
-  , ("verbosity", Lua.push . show . stVerbosity)
-  ]
+  , readonly "user_data_dir" "directory to search for data files"
+      (maybe pushnil pushString, stUserDataDir)
 
--- | Name used by Lua for the @CommonState@ type.
-logMessageTypeName :: String
-logMessageTypeName = "Pandoc LogMessage"
+  , readonly "trace" "controls whether tracing messages are issued"
+      (pushBool, stTrace)
 
-instance Peekable LogMessage where
-  peek idx = reportValueOnFailure logMessageTypeName
-             (`toAnyWithName` logMessageTypeName) idx
+  , readonly "verbosity" "verbosity level"
+      (pushString . show, stVerbosity)
+  ]
 
-instance Pushable LogMessage where
-  push msg = pushAnyWithMetatable pushLogMessageMetatable msg
-   where
-    pushLogMessageMetatable = ensureUserdataMetatable logMessageTypeName $
-      LuaUtil.addFunction "__tostring" tostringLogMessage
+peekCommonState :: LuaError e => Peeker e CommonState
+peekCommonState = peekUD typeCommonState
 
-tostringLogMessage :: LogMessage -> Lua Text.Text
-tostringLogMessage = return . showLogMessage
+pushCommonState :: LuaError e => Pusher e CommonState
+pushCommonState = pushUD typeCommonState
+
+typeLogMessage :: LuaError e => DocumentedType e LogMessage
+typeLogMessage = deftype "pandoc LogMessage"
+  [ operation Index $ defun "__tostring"
+      ### liftPure showLogMessage
+      <#> udparam typeLogMessage "msg" "object"
+      =#> functionResult pushText "string" "stringified log message"
+  ]
+  mempty -- no members
diff --git a/src/Text/Pandoc/Lua/Marshaling/Context.hs b/src/Text/Pandoc/Lua/Marshaling/Context.hs
--- a/src/Text/Pandoc/Lua/Marshaling/Context.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/Context.hs
@@ -12,8 +12,8 @@
 -}
 module Text.Pandoc.Lua.Marshaling.Context () where
 
-import qualified Foreign.Lua as Lua
-import Foreign.Lua (Pushable)
+import qualified HsLua as Lua
+import HsLua (Pushable)
 import Text.DocTemplates (Context(..), Val(..), TemplateTarget)
 import Text.DocLayout (render)
 
diff --git a/src/Text/Pandoc/Lua/Marshaling/List.hs b/src/Text/Pandoc/Lua/Marshaling/List.hs
--- a/src/Text/Pandoc/Lua/Marshaling/List.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/List.hs
@@ -1,7 +1,8 @@
-{-# LANGUAGE DeriveDataTypeable   #-}
-{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE DeriveDataTypeable    #-}
+{-# LANGUAGE FlexibleInstances     #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE UndecidableInstances #-}
+{-# LANGUAGE OverloadedStrings     #-}
+{-# LANGUAGE UndecidableInstances  #-}
 {- |
 Module      : Text.Pandoc.Lua.Marshaling.List
 Copyright   : © 2012-2021 John MacFarlane
@@ -14,27 +15,30 @@
 -}
 module Text.Pandoc.Lua.Marshaling.List
   ( List (..)
+  , peekList'
+  , pushPandocList
   ) where
 
+import Control.Monad ((<$!>))
 import Data.Data (Data)
-import Foreign.Lua (Peekable, Pushable)
+import HsLua (LuaError, Peeker, Pusher, Pushable (push), peekList, pushList)
 import Text.Pandoc.Walk (Walkable (..))
-import Text.Pandoc.Lua.Util (defineHowTo, pushViaConstructor)
-
-import qualified Foreign.Lua as Lua
+import Text.Pandoc.Lua.Util (pushViaConstr')
 
 -- | List wrapper which is marshalled as @pandoc.List@.
 newtype List a = List { fromList :: [a] }
   deriving (Data, Eq, Show)
 
 instance Pushable a => Pushable (List a) where
-  push (List xs) =
-    pushViaConstructor "List" xs
+  push (List xs) = pushPandocList push xs
 
-instance Peekable a => Peekable (List a) where
-  peek idx = defineHowTo "get List" $ do
-    xs <- Lua.peek idx
-    return $ List xs
+-- | Pushes a list as a numerical Lua table, setting a metatable that offers a
+-- number of convenience functions.
+pushPandocList :: LuaError e => Pusher e a -> Pusher e [a]
+pushPandocList pushItem xs = pushViaConstr' "List" [pushList pushItem xs]
+
+peekList' :: LuaError e => Peeker e a -> Peeker e (List a)
+peekList' p = (List <$!>) . peekList p
 
 -- List is just a wrapper, so we can reuse the walk instance for
 -- unwrapped Hasekll lists.
diff --git a/src/Text/Pandoc/Lua/Marshaling/MediaBag.hs b/src/Text/Pandoc/Lua/Marshaling/MediaBag.hs
deleted file mode 100644
--- a/src/Text/Pandoc/Lua/Marshaling/MediaBag.hs
+++ /dev/null
@@ -1,73 +0,0 @@
-{- |
-   Module      : Text.Pandoc.Lua.Marshaling.MediaBag
-   Copyright   : © 2012-2021 John MacFarlane
-                 © 2017-2021 Albert Krewinkel
-   License     : GNU GPL, version 2 or above
-   Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
-   Stability   : alpha
-
-Instances to marshal (push) and unmarshal (peek) media data.
--}
-module Text.Pandoc.Lua.Marshaling.MediaBag (pushIterator) where
-
-import Foreign.Ptr (Ptr)
-import Foreign.StablePtr (StablePtr, deRefStablePtr, newStablePtr)
-import Foreign.Lua (Lua, NumResults, Peekable, Pushable, StackIndex)
-import Foreign.Lua.Types.Peekable (reportValueOnFailure)
-import Foreign.Lua.Userdata (ensureUserdataMetatable, pushAnyWithMetatable,
-                             toAnyWithName)
-import Text.Pandoc.MediaBag (MediaBag, mediaItems)
-import Text.Pandoc.MIME (MimeType)
-import Text.Pandoc.Lua.Marshaling.AnyValue (AnyValue (..))
-
-import qualified Data.ByteString.Lazy as BL
-import qualified Foreign.Lua as Lua
-import qualified Foreign.Storable as Storable
-
--- | A list of 'MediaBag' items.
-newtype MediaItems = MediaItems [(String, MimeType, BL.ByteString)]
-
-instance Pushable MediaItems where
-  push = pushMediaItems
-
-instance Peekable MediaItems where
-  peek = peekMediaItems
-
--- | Push an iterator triple to be used with Lua's @for@ loop construct.
--- Each iterator invocation returns a triple containing the item's
--- filename, MIME type, and content.
-pushIterator :: MediaBag -> Lua NumResults
-pushIterator mb = do
-  Lua.pushHaskellFunction nextItem
-  Lua.push (MediaItems $ mediaItems mb)
-  Lua.pushnil
-  return 3
-
--- | Lua type name for @'MediaItems'@.
-mediaItemsTypeName :: String
-mediaItemsTypeName = "pandoc MediaItems"
-
--- | Push a @MediaItems@ element to the stack.
-pushMediaItems :: MediaItems -> Lua ()
-pushMediaItems xs = pushAnyWithMetatable pushMT xs
- where
-  pushMT = ensureUserdataMetatable mediaItemsTypeName (return ())
-
--- | Retrieve a @MediaItems@ element from the stack.
-peekMediaItems :: StackIndex -> Lua MediaItems
-peekMediaItems = reportValueOnFailure mediaItemsTypeName
-                 (`toAnyWithName` mediaItemsTypeName)
-
--- | Retrieve a list of items from an iterator state, return the first
--- item (if present), and advance the state.
-nextItem :: Ptr (StablePtr MediaItems) -> AnyValue -> Lua NumResults
-nextItem ptr _ = do
-  (MediaItems items) <- Lua.liftIO $ deRefStablePtr =<< Storable.peek ptr
-  case items of
-    [] -> 2 <$ (Lua.pushnil *> Lua.pushnil)
-    (key, mt, content):xs -> do
-      Lua.liftIO $ Storable.poke ptr =<< newStablePtr (MediaItems xs)
-      Lua.push key
-      Lua.push mt
-      Lua.push content
-      return 3
diff --git a/src/Text/Pandoc/Lua/Marshaling/PandocError.hs b/src/Text/Pandoc/Lua/Marshaling/PandocError.hs
--- a/src/Text/Pandoc/Lua/Marshaling/PandocError.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/PandocError.hs
@@ -1,7 +1,7 @@
-{-# OPTIONS_GHC -fno-warn-orphans #-}
 {-# LANGUAGE LambdaCase           #-}
 {-# LANGUAGE OverloadedStrings    #-}
 {-# LANGUAGE ScopedTypeVariables  #-}
+{-# LANGUAGE TypeApplications     #-}
 {- |
    Module      : Text.Pandoc.Lua.Marshaling.PandocError
    Copyright   : © 2020-2021 Albert Krewinkel
@@ -15,51 +15,37 @@
 module Text.Pandoc.Lua.Marshaling.PandocError
   ( peekPandocError
   , pushPandocError
+  , typePandocError
   )
   where
 
-import Foreign.Lua (Lua, Peekable, Pushable, StackIndex)
+import HsLua.Core (LuaError)
+import HsLua.Marshalling (Peeker, Pusher, pushString, liftLua)
+import HsLua.Packaging
 import Text.Pandoc.Error (PandocError (PandocLuaError))
 
-import qualified Foreign.Lua as Lua
-import qualified Foreign.Lua.Userdata as Lua
-import qualified Text.Pandoc.Lua.Util as LuaUtil
+import qualified HsLua as Lua
 import qualified Text.Pandoc.UTF8 as UTF8
 
--- | Userdata name used by Lua for the @PandocError@ type.
-pandocErrorName :: String
-pandocErrorName = "pandoc error"
+-- | Lua userdata type definition for PandocError.
+typePandocError :: LuaError e => DocumentedType e PandocError
+typePandocError = deftype "PandocError"
+  [ operation Tostring $ defun "__tostring"
+    ### liftPure (show @PandocError)
+    <#> udparam typePandocError "obj" "PandocError object"
+    =#> functionResult pushString "string" "string representation of error."
+  ]
+  mempty -- no members
 
 -- | Peek a @'PandocError'@ element to the Lua stack.
-pushPandocError :: PandocError -> Lua ()
-pushPandocError = Lua.pushAnyWithMetatable pushPandocErrorMT
-  where
-    pushPandocErrorMT = Lua.ensureUserdataMetatable pandocErrorName $
-      LuaUtil.addFunction "__tostring" __tostring
+pushPandocError :: LuaError e => Pusher e PandocError
+pushPandocError = pushUD typePandocError
 
 -- | Retrieve a @'PandocError'@ from the Lua stack.
-peekPandocError :: StackIndex -> Lua PandocError
-peekPandocError idx = Lua.ltype idx >>= \case
-  Lua.TypeUserdata -> do
-    errMb <- Lua.toAnyWithName idx pandocErrorName
-    return $ case errMb of
-      Just err -> err
-      Nothing  -> PandocLuaError "could not retrieve original error"
-  _ -> do
-    Lua.pushvalue idx
-    msg <- Lua.state >>= \l -> Lua.liftIO (Lua.errorMessage l)
-    return $ PandocLuaError (UTF8.toText msg)
-
--- | Convert to string.
-__tostring :: PandocError -> Lua String
-__tostring = return . show
-
---
--- Instances
---
-
-instance Pushable PandocError where
-  push = pushPandocError
-
-instance Peekable PandocError where
-  peek = peekPandocError
+peekPandocError :: LuaError e => Peeker e PandocError
+peekPandocError idx = Lua.retrieving "PandocError" $
+  liftLua (Lua.ltype idx) >>= \case
+    Lua.TypeUserdata -> peekUD typePandocError idx
+    _ -> do
+      msg <- liftLua $ Lua.state >>= \l -> Lua.liftIO (Lua.popErrorMessage l)
+      return $ PandocLuaError (UTF8.toText msg)
diff --git a/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs b/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs
--- a/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE LambdaCase           #-}
 {-# LANGUAGE OverloadedStrings    #-}
 {-# LANGUAGE ScopedTypeVariables  #-}
 {-# OPTIONS_GHC -fno-warn-orphans #-}
@@ -13,67 +12,60 @@
 
 Marshaling instance for ReaderOptions and its components.
 -}
-module Text.Pandoc.Lua.Marshaling.ReaderOptions () where
-
-import Data.Data (showConstr, toConstr)
-import Foreign.Lua (Lua, Pushable)
-import Text.Pandoc.Extensions (Extensions)
-import Text.Pandoc.Lua.Marshaling.AnyValue (AnyValue (..))
-import Text.Pandoc.Lua.Marshaling.CommonState ()
-import Text.Pandoc.Options (ReaderOptions (..), TrackChanges)
+module Text.Pandoc.Lua.Marshaling.ReaderOptions
+  ( peekReaderOptions
+  , pushReaderOptions
+  ) where
 
-import qualified Data.Set as Set
-import qualified Data.Text as Text
-import qualified Foreign.Lua as Lua
-import qualified Text.Pandoc.Lua.Util as LuaUtil
+import HsLua as Lua
+import Text.Pandoc.Lua.Marshaling.List (pushPandocList)
+import Text.Pandoc.Options (ReaderOptions (..))
 
 --
 -- Reader Options
 --
-instance Pushable Extensions where
-  push exts = Lua.push (show exts)
 
-instance Pushable TrackChanges where
-  push = Lua.push . showConstr . toConstr
+peekReaderOptions :: LuaError e => Peeker e ReaderOptions
+peekReaderOptions = peekUD typeReaderOptions
 
-instance Pushable ReaderOptions where
-  push ro = do
-    let ReaderOptions
-          (extensions            :: Extensions)
-          (standalone            :: Bool)
-          (columns               :: Int)
-          (tabStop               :: Int)
-          (indentedCodeClasses   :: [Text.Text])
-          (abbreviations         :: Set.Set Text.Text)
-          (defaultImageExtension :: Text.Text)
-          (trackChanges          :: TrackChanges)
-          (stripComments         :: Bool)
-          = ro
-    Lua.newtable
-    LuaUtil.addField "extensions" extensions
-    LuaUtil.addField "standalone" standalone
-    LuaUtil.addField "columns" columns
-    LuaUtil.addField "tab_stop" tabStop
-    LuaUtil.addField "indented_code_classes" indentedCodeClasses
-    LuaUtil.addField "abbreviations" abbreviations
-    LuaUtil.addField "default_image_extension" defaultImageExtension
-    LuaUtil.addField "track_changes" trackChanges
-    LuaUtil.addField "strip_comments" stripComments
+pushReaderOptions :: LuaError e => Pusher e ReaderOptions
+pushReaderOptions = pushUD typeReaderOptions
 
-    -- add metatable
-    let indexReaderOptions :: AnyValue -> AnyValue -> Lua Lua.NumResults
-        indexReaderOptions _tbl (AnyValue key) = do
-          Lua.ltype key >>= \case
-            Lua.TypeString -> Lua.peek key >>= \case
-              ("defaultImageExtension" :: Text.Text)
-                                    -> Lua.push defaultImageExtension
-              "indentedCodeClasses" -> Lua.push indentedCodeClasses
-              "stripComments" -> Lua.push stripComments
-              "tabStop" -> Lua.push tabStop
-              "trackChanges" -> Lua.push trackChanges
-              _ -> Lua.pushnil
-            _ -> Lua.pushnil
-          return 1
-    Lua.newtable
-    LuaUtil.addFunction "__index" indexReaderOptions
-    Lua.setmetatable (Lua.nthFromTop 2)
+typeReaderOptions :: LuaError e => DocumentedType e ReaderOptions
+typeReaderOptions = deftype "pandoc ReaderOptions"
+  [ operation Tostring luaShow
+  ]
+  [ readonly "extensions" ""
+      ( pushString . show
+      , readerExtensions)
+  , readonly "standalone" ""
+      ( pushBool
+      , readerStandalone)
+  , readonly "columns" ""
+      ( pushIntegral
+      , readerColumns)
+  , readonly "tab_stop" ""
+      ( pushIntegral
+      , readerTabStop)
+  , readonly "indented_code_classes" ""
+      ( pushPandocList pushText
+      , readerIndentedCodeClasses)
+  , readonly "abbreviations" ""
+      ( pushSet pushText
+      , readerAbbreviations)
+  , readonly "track_changes" ""
+      ( pushString . show
+      , readerTrackChanges)
+  , readonly "strip_comments" ""
+      ( pushBool
+      , readerStripComments)
+  , readonly "default_image_extension" ""
+      ( pushText
+      , readerDefaultImageExtension)
+  ]
+
+luaShow :: LuaError e => DocumentedFunction e
+luaShow = defun "__tostring"
+  ### liftPure show
+  <#> udparam typeReaderOptions "state" "object to print in native format"
+  =#> functionResult pushString "string" "Haskell representation"
diff --git a/src/Text/Pandoc/Lua/Marshaling/SimpleTable.hs b/src/Text/Pandoc/Lua/Marshaling/SimpleTable.hs
--- a/src/Text/Pandoc/Lua/Marshaling/SimpleTable.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/SimpleTable.hs
@@ -1,3 +1,6 @@
+{-# LANGUAGE OverloadedStrings    #-}
+{-# LANGUAGE ScopedTypeVariables  #-}
+{-# LANGUAGE TypeApplications     #-}
 {- |
    Module      : Text.Pandoc.Lua.Marshaling.SimpleTable
    Copyright   : © 2020-2021 Albert Krewinkel
@@ -16,12 +19,11 @@
   )
   where
 
-import Foreign.Lua (Lua, Peekable, Pushable, StackIndex)
+import Control.Monad ((<$!>))
+import HsLua as Lua
 import Text.Pandoc.Definition
-import Text.Pandoc.Lua.Util (defineHowTo, pushViaConstructor, rawField)
-import Text.Pandoc.Lua.Marshaling.AST ()
-
-import qualified Foreign.Lua as Lua
+import Text.Pandoc.Lua.Util (pushViaConstructor)
+import Text.Pandoc.Lua.Marshaling.AST
 
 -- | A simple (legacy-style) table.
 data SimpleTable = SimpleTable
@@ -32,16 +34,10 @@
   , simpleTableBody :: [[[Block]]]
   }
 
-instance Pushable SimpleTable where
-  push = pushSimpleTable
-
-instance Peekable SimpleTable where
-  peek = peekSimpleTable
-
 -- | Push a simple table to the stack by calling the
 -- @pandoc.SimpleTable@ constructor.
-pushSimpleTable :: SimpleTable -> Lua ()
-pushSimpleTable tbl = pushViaConstructor "SimpleTable"
+pushSimpleTable :: forall e. LuaError e => SimpleTable -> LuaE e ()
+pushSimpleTable tbl = pushViaConstructor @e "SimpleTable"
   (simpleTableCaption tbl)
   (simpleTableAlignments tbl)
   (simpleTableColumnWidths tbl)
@@ -49,11 +45,10 @@
   (simpleTableBody tbl)
 
 -- | Retrieve a simple table from the stack.
-peekSimpleTable :: StackIndex -> Lua SimpleTable
-peekSimpleTable idx = defineHowTo "get SimpleTable" $
-  SimpleTable
-    <$> rawField idx "caption"
-    <*> rawField idx "aligns"
-    <*> rawField idx "widths"
-    <*> rawField idx "headers"
-    <*> rawField idx "rows"
+peekSimpleTable :: forall e. LuaError e => Peeker e SimpleTable
+peekSimpleTable idx = retrieving "SimpleTable" $ SimpleTable
+  <$!> peekFieldRaw peekInlines "caption" idx
+  <*>  peekFieldRaw (peekList peekRead) "aligns" idx
+  <*>  peekFieldRaw (peekList peekRealFloat) "widths" idx
+  <*>  peekFieldRaw (peekList peekBlocks) "headers" idx
+  <*>  peekFieldRaw (peekList (peekList peekBlocks)) "rows" idx
diff --git a/src/Text/Pandoc/Lua/Marshaling/Version.hs b/src/Text/Pandoc/Lua/Marshaling/Version.hs
deleted file mode 100644
--- a/src/Text/Pandoc/Lua/Marshaling/Version.hs
+++ /dev/null
@@ -1,154 +0,0 @@
-{-# OPTIONS_GHC -fno-warn-orphans #-}
-{-# LANGUAGE LambdaCase           #-}
-{-# LANGUAGE OverloadedStrings    #-}
-{-# LANGUAGE ScopedTypeVariables  #-}
-{- |
-   Module      : Text.Pandoc.Lua.Marshaling.Version
-   Copyright   : © 2019-2021 Albert Krewinkel
-   License     : GNU GPL, version 2 or above
-
-   Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
-   Stability   : alpha
-
-Marshaling of @'Version'@s. The marshaled elements can be compared using
-default comparison operators (like @>@ and @<=@).
--}
-module Text.Pandoc.Lua.Marshaling.Version
-  ( peekVersion
-  , pushVersion
-  )
-  where
-
-import Data.Text (Text)
-import Data.Maybe (fromMaybe)
-import Data.Version (Version (..), makeVersion, parseVersion, showVersion)
-import Foreign.Lua (Lua, Optional (..), NumResults,
-                    Peekable, Pushable, StackIndex)
-import Foreign.Lua.Types.Peekable (reportValueOnFailure)
-import Foreign.Lua.Userdata (ensureUserdataMetatable, pushAnyWithMetatable,
-                             toAnyWithName)
-import Safe (atMay, lastMay)
-import Text.Pandoc.Lua.Marshaling.AnyValue (AnyValue (..))
-import Text.ParserCombinators.ReadP (readP_to_S)
-
-import qualified Foreign.Lua as Lua
-import qualified Text.Pandoc.Lua.Util as LuaUtil
-
--- | Push a @'Version'@ element to the Lua stack.
-pushVersion :: Version -> Lua ()
-pushVersion version = pushAnyWithMetatable pushVersionMT version
- where
-  pushVersionMT = ensureUserdataMetatable versionTypeName $ do
-    LuaUtil.addFunction "__eq" __eq
-    LuaUtil.addFunction "__le" __le
-    LuaUtil.addFunction "__lt" __lt
-    LuaUtil.addFunction "__len" __len
-    LuaUtil.addFunction "__index" __index
-    LuaUtil.addFunction "__pairs" __pairs
-    LuaUtil.addFunction "__tostring" __tostring
-
-instance Pushable Version where
-  push = pushVersion
-
-peekVersion :: StackIndex -> Lua Version
-peekVersion idx = Lua.ltype idx >>= \case
-  Lua.TypeString -> do
-    versionStr <- Lua.peek idx
-    let parses = readP_to_S parseVersion versionStr
-    case lastMay parses of
-      Just (v, "") -> return v
-      _  -> Lua.throwMessage $ "could not parse as Version: " ++ versionStr
-
-  Lua.TypeUserdata ->
-    reportValueOnFailure versionTypeName
-                         (`toAnyWithName` versionTypeName)
-                         idx
-  Lua.TypeNumber -> do
-    n <- Lua.peek idx
-    return (makeVersion [n])
-
-  Lua.TypeTable ->
-    makeVersion <$> Lua.peek idx
-
-  _ ->
-    Lua.throwMessage "could not peek Version"
-
-instance Peekable Version where
-  peek = peekVersion
-
--- | Name used by Lua for the @CommonState@ type.
-versionTypeName :: String
-versionTypeName = "HsLua Version"
-
-__eq :: Version -> Version -> Lua Bool
-__eq v1 v2 = return (v1 == v2)
-
-__le :: Version -> Version -> Lua Bool
-__le v1 v2 = return (v1 <= v2)
-
-__lt :: Version -> Version -> Lua Bool
-__lt v1 v2 = return (v1 < v2)
-
--- | Get number of version components.
-__len :: Version -> Lua Int
-__len = return . length . versionBranch
-
--- | Access fields.
-__index :: Version -> AnyValue -> Lua NumResults
-__index v (AnyValue k) = do
-  ty <- Lua.ltype k
-  case ty of
-    Lua.TypeNumber -> do
-      n <- Lua.peek k
-      let versionPart = atMay (versionBranch v) (n - 1)
-      Lua.push (Lua.Optional versionPart)
-      return 1
-    Lua.TypeString -> do
-      (str :: Text) <- Lua.peek k
-      if str == "must_be_at_least"
-        then 1 <$ Lua.pushHaskellFunction must_be_at_least
-        else 1 <$ Lua.pushnil
-    _ -> 1 <$ Lua.pushnil
-
--- | Create iterator.
-__pairs :: Version -> Lua NumResults
-__pairs v = do
-  Lua.pushHaskellFunction nextFn
-  Lua.pushnil
-  Lua.pushnil
-  return 3
- where
-  nextFn :: AnyValue -> Optional Int -> Lua Lua.NumResults
-  nextFn _ (Optional key) =
-    case key of
-      Nothing -> case versionBranch v of
-                   []  -> 2 <$ (Lua.pushnil *> Lua.pushnil)
-                   n:_ -> 2 <$ (Lua.push (1 :: Int) *> Lua.push n)
-      Just n  -> case atMay (versionBranch v) n of
-                   Nothing -> 2 <$ (Lua.pushnil *> Lua.pushnil)
-                   Just b  -> 2 <$ (Lua.push (n + 1) *> Lua.push b)
-
--- | Convert to string.
-__tostring :: Version -> Lua String
-__tostring v = return (showVersion v)
-
--- | Default error message when a version is too old. This message is
--- formatted in Lua with the expected and actual versions as arguments.
-versionTooOldMessage :: String
-versionTooOldMessage = "expected version %s or newer, got %s"
-
--- | Throw an error if this version is older than the given version.
--- FIXME: This function currently requires the string library to be
--- loaded.
-must_be_at_least :: Version -> Version -> Optional String -> Lua NumResults
-must_be_at_least actual expected optMsg = do
-  let msg = fromMaybe versionTooOldMessage (fromOptional optMsg)
-  if expected <= actual
-    then return 0
-    else do
-      Lua.getglobal' "string.format"
-      Lua.push msg
-      Lua.push (showVersion expected)
-      Lua.push (showVersion actual)
-      Lua.call 3 1
-      Lua.error
diff --git a/src/Text/Pandoc/Lua/Module/MediaBag.hs b/src/Text/Pandoc/Lua/Module/MediaBag.hs
--- a/src/Text/Pandoc/Lua/Module/MediaBag.hs
+++ b/src/Text/Pandoc/Lua/Module/MediaBag.hs
@@ -15,18 +15,19 @@
 
 import Prelude hiding (lookup)
 import Control.Monad (zipWithM_)
-import Foreign.Lua (Lua, NumResults, Optional)
+import HsLua (LuaE, NumResults, Optional)
+import HsLua.Marshalling (pushIterator)
 import Text.Pandoc.Class.CommonState (CommonState (..))
 import Text.Pandoc.Class.PandocMonad (fetchItem, getMediaBag, modifyCommonState,
                                       setMediaBag)
+import Text.Pandoc.Error (PandocError)
 import Text.Pandoc.Lua.Marshaling ()
-import Text.Pandoc.Lua.Marshaling.MediaBag (pushIterator)
 import Text.Pandoc.Lua.PandocLua (PandocLua (..), liftPandocLua, addFunction)
 import Text.Pandoc.MIME (MimeType)
 
 import qualified Data.ByteString.Lazy as BL
 import qualified Data.Text as T
-import qualified Foreign.Lua as Lua
+import qualified HsLua as Lua
 import qualified Text.Pandoc.MediaBag as MB
 
 --
@@ -65,7 +66,15 @@
 
 -- | Returns iterator values to be used with a Lua @for@ loop.
 items :: PandocLua NumResults
-items = getMediaBag >>= liftPandocLua . pushIterator
+items = do
+  mb <- getMediaBag
+  liftPandocLua $ do
+    let pushItem (fp, mimetype, contents) = do
+          Lua.pushString fp
+          Lua.pushText mimetype
+          Lua.pushByteString $ BL.toStrict contents
+          return (Lua.NumResults 3)
+    pushIterator pushItem (MB.mediaItems mb)
 
 lookup :: FilePath
        -> PandocLua NumResults
@@ -86,7 +95,7 @@
     zipWithM_ addEntry [1..] dirContents
   return 1
  where
-  addEntry :: Lua.Integer -> (FilePath, MimeType, Int) -> Lua ()
+  addEntry :: Lua.Integer -> (FilePath, MimeType, Int) -> LuaE PandocError ()
   addEntry idx (fp, mimeType, contentLength) = do
     Lua.newtable
     Lua.push ("path" :: T.Text) *> Lua.push fp *> Lua.rawset (-3)
diff --git a/src/Text/Pandoc/Lua/Module/Pandoc.hs b/src/Text/Pandoc/Lua/Module/Pandoc.hs
--- a/src/Text/Pandoc/Lua/Module/Pandoc.hs
+++ b/src/Text/Pandoc/Lua/Module/Pandoc.hs
@@ -1,5 +1,6 @@
 {-# LANGUAGE FlexibleContexts  #-}
 {-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TypeApplications  #-}
 {- |
    Module      : Text.Pandoc.Lua.Module.Pandoc
    Copyright   : Copyright © 2017-2021 Albert Krewinkel
@@ -15,29 +16,33 @@
   ) where
 
 import Prelude hiding (read)
-import Control.Monad (when)
+import Control.Applicative (optional)
+import Control.Monad ((>=>), forM_, when)
+import Control.Monad.Catch (catch, throwM)
 import Control.Monad.Except (throwError)
 import Data.Default (Default (..))
 import Data.Maybe (fromMaybe)
-import Foreign.Lua (Lua, NumResults, Optional, Peekable, Pushable)
+import HsLua as Lua hiding (pushModule)
+import HsLua.Class.Peekable (PeekError)
 import System.Exit (ExitCode (..))
 import Text.Pandoc.Class.PandocIO (runIO)
-import Text.Pandoc.Definition (Block, Inline)
-import Text.Pandoc.Lua.Filter (LuaFilter, SingletonsList (..), walkInlines,
+import Text.Pandoc.Definition
+import Text.Pandoc.Lua.Filter (SingletonsList (..), walkInlines,
                                walkInlineLists, walkBlocks, walkBlockLists)
 import Text.Pandoc.Lua.Marshaling ()
+import Text.Pandoc.Lua.Marshaling.AST
+import Text.Pandoc.Lua.Marshaling.Attr (mkAttr, mkAttributeList)
 import Text.Pandoc.Lua.Marshaling.List (List (..))
 import Text.Pandoc.Lua.PandocLua (PandocLua, addFunction, liftPandocLua,
                                   loadDefaultModule)
-import Text.Pandoc.Walk (Walkable)
 import Text.Pandoc.Options (ReaderOptions (readerExtensions))
 import Text.Pandoc.Process (pipeProcess)
 import Text.Pandoc.Readers (Reader (..), getReader)
+import Text.Pandoc.Walk (Walkable)
 
 import qualified Data.ByteString.Lazy as BL
 import qualified Data.ByteString.Lazy.Char8 as BSL
 import qualified Data.Text as T
-import qualified Foreign.Lua as Lua
 import qualified Text.Pandoc.Lua.Util as LuaUtil
 import Text.Pandoc.Error
 
@@ -48,23 +53,134 @@
   loadDefaultModule "pandoc"
   addFunction "read" read
   addFunction "pipe" pipe
-  addFunction "walk_block" walk_block
-  addFunction "walk_inline" walk_inline
+  addFunction "walk_block" (walkElement peekBlock pushBlock)
+  addFunction "walk_inline" (walkElement peekInline pushInline)
+  -- Constructors
+  addFunction "Attr" (liftPandocLua mkAttr)
+  addFunction "AttributeList" (liftPandocLua mkAttributeList)
+  addFunction "Pandoc" mkPandoc
+  liftPandocLua $ do
+    let addConstr fn = do
+          pushName (functionName fn)
+          pushDocumentedFunction fn
+          rawset (nth 3)
+    forM_ inlineConstructors addConstr
+    -- add constructors to Inlines.constructor
+    newtable  -- constructor
+    forM_ (inlineConstructors @PandocError) $ \fn -> do
+      let name = functionName fn
+      pushName name
+      pushName name
+      rawget (nth 4)
+      rawset (nth 3)
+    -- set as pandoc.Inline.constructor
+    pushName "Inline"
+    newtable *> pushName "constructor" *> pushvalue (nth 4) *> rawset (nth 3)
+    rawset (nth 4)
+    pop 1 -- remaining constructor table
   return 1
 
+inlineConstructors :: LuaError e =>  [DocumentedFunction e]
+inlineConstructors =
+  [ defun "Cite"
+    ### liftPure2 Cite
+    <#> parameter (peekList peekCitation) "citations" "list of Citations" ""
+    <#> parameter peekFuzzyInlines "content" "Inline" "placeholder content"
+    =#> functionResult pushInline "Inline" "cite element"
+  , defun "Code"
+    ### liftPure2 (flip Code)
+    <#> parameter peekText "code" "string" "code string"
+    <#> parameter peekAttr "attr" "Attr" "additional attributes"
+    =#> functionResult pushInline "Inline" "code element"
+  , mkInlinesConstr "Emph" Emph
+  , defun "Image"
+    ### liftPure4 (\caption src mtitle mattr ->
+                     let attr = fromMaybe nullAttr mattr
+                         title = fromMaybe mempty mtitle
+                     in Image attr caption (src, title))
+    <#> parameter peekFuzzyInlines "Inlines" "caption" "image caption / alt"
+    <#> parameter peekText "string" "src" "path/URL of the image file"
+    <#> optionalParameter peekText "string" "title" "brief image description"
+    <#> optionalParameter peekAttr "Attr" "attr" "image attributes"
+    =#> functionResult pushInline "Inline" "image element"
+  , defun "LineBreak"
+    ### return LineBreak
+    =#> functionResult pushInline "Inline" "line break"
+  , defun "Link"
+    ### liftPure4 (\content target mtitle mattr ->
+                     let attr = fromMaybe nullAttr mattr
+                         title = fromMaybe mempty mtitle
+                     in Link attr content (target, title))
+    <#> parameter peekFuzzyInlines "Inlines" "content" "text for this link"
+    <#> parameter peekText "string" "target" "the link target"
+    <#> optionalParameter peekText "string" "title" "brief link description"
+    <#> optionalParameter peekAttr "Attr" "attr" "link attributes"
+    =#> functionResult pushInline "Inline" "link element"
+  , defun "Math"
+    ### liftPure2 Math
+    <#> parameter peekMathType "quotetype" "Math" "rendering method"
+    <#> parameter peekText "text" "string" "math content"
+    =#> functionResult pushInline "Inline" "math element"
+  , defun "Note"
+    ### liftPure Note
+    <#> parameter peekFuzzyBlocks "content" "Blocks" "note content"
+    =#> functionResult pushInline "Inline" "note"
+  , defun "Quoted"
+    ### liftPure2 Quoted
+    <#> parameter peekQuoteType "quotetype" "QuoteType" "type of quotes"
+    <#> parameter peekFuzzyInlines "content" "Inlines" "inlines in quotes"
+    =#> functionResult pushInline "Inline" "quoted element"
+  , defun "RawInline"
+    ### liftPure2 RawInline
+    <#> parameter peekFormat "format" "Format" "format of content"
+    <#> parameter peekText "text" "string" "string content"
+    =#> functionResult pushInline "Inline" "raw inline element"
+  , mkInlinesConstr "SmallCaps" SmallCaps
+  , defun "SoftSpace"
+    ### return SoftBreak
+    =#> functionResult pushInline "Inline" "soft break"
+  , defun "Space"
+    ### return Space
+    =#> functionResult pushInline "Inline" "new space"
+  , defun "Span"
+    ### liftPure2 (\inlns mattr -> Span (fromMaybe nullAttr mattr) inlns)
+    <#> parameter peekFuzzyInlines "content" "Inlines" "inline content"
+    <#> optionalParameter peekAttr "attr" "Attr" "additional attributes"
+    =#> functionResult pushInline "Inline" "span element"
+  , defun "Str"
+    ### liftPure (\s -> s `seq` Str s)
+    <#> parameter peekText "text" "string" ""
+    =#> functionResult pushInline "Inline" "new Str object"
+  , mkInlinesConstr "Strong" Strong
+  , mkInlinesConstr "Strikeout" Strikeout
+  , mkInlinesConstr "Subscript" Subscript
+  , mkInlinesConstr "Superscript" Superscript
+  , mkInlinesConstr "Underline" Underline
+  ]
+
+mkInlinesConstr :: LuaError e
+                => Name -> ([Inline] -> Inline) -> DocumentedFunction e
+mkInlinesConstr name constr = defun name
+  ### liftPure (\x -> x `seq` constr x)
+  <#> parameter peekFuzzyInlines "content" "Inlines" ""
+  =#> functionResult pushInline "Inline" "new object"
+
+
 walkElement :: (Walkable (SingletonsList Inline) a,
                 Walkable (SingletonsList Block) a,
                 Walkable (List Inline) a,
                 Walkable (List Block) a)
-            => a -> LuaFilter -> PandocLua a
-walkElement x f = liftPandocLua $
-  walkInlines f x >>= walkInlineLists f >>= walkBlocks f >>= walkBlockLists f
-
-walk_inline :: Inline -> LuaFilter -> PandocLua Inline
-walk_inline = walkElement
-
-walk_block :: Block -> LuaFilter -> PandocLua Block
-walk_block = walkElement
+            => Peeker PandocError a -> Pusher PandocError a
+            -> LuaE PandocError NumResults
+walkElement peek' push' = do
+  x <- forcePeek $ peek' (nthBottom 1)
+  f <- peek (nthBottom 2)
+  let walk' =  walkInlines f
+           >=> walkInlineLists f
+           >=> walkBlocks f
+           >=> walkBlockLists f
+  walk' x >>= push'
+  return (NumResults 1)
 
 read :: T.Text -> Optional T.Text -> PandocLua NumResults
 read content formatSpecOrNil = liftPandocLua $ do
@@ -91,9 +207,12 @@
      -> PandocLua NumResults
 pipe command args input = liftPandocLua $ do
   (ec, output) <- Lua.liftIO $ pipeProcess Nothing command args input
+    `catch` (throwM . PandocIOError "pipe")
   case ec of
     ExitSuccess -> 1 <$ Lua.push output
-    ExitFailure n -> Lua.raiseError (PipeError (T.pack command) n output)
+    ExitFailure n -> do
+      pushPipeError (PipeError (T.pack command) n output)
+      Lua.error
 
 data PipeError = PipeError
   { pipeErrorCommand :: T.Text
@@ -101,29 +220,34 @@
   , pipeErrorOutput :: BL.ByteString
   }
 
-instance Peekable PipeError where
-  peek idx =
-    PipeError
-    <$> (Lua.getfield idx "command"    *> Lua.peek (-1) <* Lua.pop 1)
-    <*> (Lua.getfield idx "error_code" *> Lua.peek (-1) <* Lua.pop 1)
-    <*> (Lua.getfield idx "output"     *> Lua.peek (-1) <* Lua.pop 1)
+peekPipeError :: PeekError e => StackIndex -> LuaE e PipeError
+peekPipeError idx =
+  PipeError
+  <$> (Lua.getfield idx "command"    *> Lua.peek (-1) <* Lua.pop 1)
+  <*> (Lua.getfield idx "error_code" *> Lua.peek (-1) <* Lua.pop 1)
+  <*> (Lua.getfield idx "output"     *> Lua.peek (-1) <* Lua.pop 1)
 
-instance Pushable PipeError where
-  push pipeErr = do
-    Lua.newtable
-    LuaUtil.addField "command" (pipeErrorCommand pipeErr)
-    LuaUtil.addField "error_code" (pipeErrorCode pipeErr)
-    LuaUtil.addField "output" (pipeErrorOutput pipeErr)
-    pushPipeErrorMetaTable
-    Lua.setmetatable (-2)
-      where
-        pushPipeErrorMetaTable :: Lua ()
-        pushPipeErrorMetaTable = do
-          v <- Lua.newmetatable "pandoc pipe error"
-          when v $ LuaUtil.addFunction "__tostring" pipeErrorMessage
+pushPipeError :: PeekError e => Pusher e PipeError
+pushPipeError pipeErr = do
+  Lua.newtable
+  LuaUtil.addField "command" (pipeErrorCommand pipeErr)
+  LuaUtil.addField "error_code" (pipeErrorCode pipeErr)
+  LuaUtil.addField "output" (pipeErrorOutput pipeErr)
+  pushPipeErrorMetaTable
+  Lua.setmetatable (-2)
+    where
+      pushPipeErrorMetaTable :: PeekError e => LuaE e ()
+      pushPipeErrorMetaTable = do
+        v <- Lua.newmetatable "pandoc pipe error"
+        when v $ do
+          pushName "__tostring"
+          pushHaskellFunction pipeErrorMessage
+          rawset (nth 3)
 
-        pipeErrorMessage :: PipeError -> Lua BL.ByteString
-        pipeErrorMessage (PipeError cmd errorCode output) = return $ mconcat
+      pipeErrorMessage :: PeekError e => LuaE e NumResults
+      pipeErrorMessage = do
+        (PipeError cmd errorCode output) <- peekPipeError (nthBottom 1)
+        pushByteString . BSL.toStrict . BSL.concat $
           [ BSL.pack "Error running "
           , BSL.pack $ T.unpack cmd
           , BSL.pack " (error code "
@@ -131,3 +255,13 @@
           , BSL.pack "): "
           , if output == mempty then BSL.pack "<no output>" else output
           ]
+        return (NumResults 1)
+
+mkPandoc :: PandocLua NumResults
+mkPandoc = liftPandocLua $ do
+  doc <- forcePeek $ do
+    blks <- peekBlocks (nthBottom 1)
+    mMeta <- optional $ peekMeta (nthBottom 2)
+    pure $ Pandoc (fromMaybe nullMeta mMeta) blks
+  pushPandoc doc
+  return 1
diff --git a/src/Text/Pandoc/Lua/Module/System.hs b/src/Text/Pandoc/Lua/Module/System.hs
--- a/src/Text/Pandoc/Lua/Module/System.hs
+++ b/src/Text/Pandoc/Lua/Module/System.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE ScopedTypeVariables #-}
 {- |
    Module      : Text.Pandoc.Lua.Module.System
    Copyright   : © 2019-2021 Albert Krewinkel
@@ -12,22 +14,31 @@
   ( pushModule
   ) where
 
-import Foreign.Lua (Lua, NumResults)
-import Foreign.Lua.Module.System (arch, env, getwd, os,
-                                  with_env, with_tmpdir, with_wd)
-import Text.Pandoc.Lua.Util (addFunction, addField)
+import HsLua hiding (pushModule)
+import HsLua.Module.System
+  (arch, env, getwd, os, with_env, with_tmpdir, with_wd)
+import Text.Pandoc.Error (PandocError)
+import Text.Pandoc.Lua.ErrorConversion ()
 
-import qualified Foreign.Lua as Lua
+import qualified HsLua as Lua
 
 -- | Push the pandoc.system module on the Lua stack.
-pushModule :: Lua NumResults
+pushModule :: LuaE PandocError NumResults
 pushModule = do
-  Lua.newtable
-  addField "arch" arch
-  addField "os" os
-  addFunction "environment" env
-  addFunction "get_working_directory" getwd
-  addFunction "with_environment" with_env
-  addFunction "with_temporary_directory" with_tmpdir
-  addFunction "with_working_directory" with_wd
+  Lua.pushModule $ Module
+    { moduleName = "system"
+    , moduleDescription = "system functions"
+    , moduleFields =
+        [ arch
+        , os
+        ]
+    , moduleFunctions =
+        [ setName "environment" env
+        , setName "get_working_directory" getwd
+        , setName "with_environment" with_env
+        , setName "with_temporary_directory" with_tmpdir
+        , setName "with_working_directory" with_wd
+        ]
+    , moduleOperations = []
+    }
   return 1
diff --git a/src/Text/Pandoc/Lua/Module/Types.hs b/src/Text/Pandoc/Lua/Module/Types.hs
--- a/src/Text/Pandoc/Lua/Module/Types.hs
+++ b/src/Text/Pandoc/Lua/Module/Types.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE OverloadedStrings #-}
 {- |
    Module      : Text.Pandoc.Lua.Module.Types
    Copyright   : © 2019-2021 Albert Krewinkel
@@ -12,57 +13,42 @@
   ( pushModule
   ) where
 
-import Data.Version (Version)
-import Foreign.Lua (Lua, NumResults)
-import Text.Pandoc.Definition
-import Text.Pandoc.Lua.Marshaling.AST (LuaAttr, LuaListAttributes)
-import Text.Pandoc.Lua.Marshaling.Version ()
+import HsLua (LuaE, NumResults, Peeker, Pusher)
+import Text.Pandoc.Error (PandocError)
+import Text.Pandoc.Lua.ErrorConversion ()
+import Text.Pandoc.Lua.Marshaling.AST
 import Text.Pandoc.Lua.Util (addFunction)
 
-import qualified Foreign.Lua as Lua
+import qualified HsLua as Lua
+import qualified HsLua.Module.Version as Version
 
--- | Push the pandoc.system module on the Lua stack.
-pushModule :: Lua NumResults
+-- | Push the pandoc.types module on the Lua stack.
+pushModule :: LuaE PandocError NumResults
 pushModule = do
   Lua.newtable
-  addFunction "Version" (return :: Version -> Lua Version)
+  Lua.pushName "Version" *> Lua.pushModule Version.documentedModule
+    *> Lua.rawset (Lua.nth 3)
   pushCloneTable
-  Lua.setfield (Lua.nthFromTop 2) "clone"
+  Lua.setfield (Lua.nth 2) "clone"
   return 1
 
-pushCloneTable :: Lua NumResults
+pushCloneTable :: LuaE PandocError NumResults
 pushCloneTable = do
   Lua.newtable
-  addFunction "Attr" cloneAttr
-  addFunction "Block" cloneBlock
-  addFunction "Citation" cloneCitation
-  addFunction "Inline" cloneInline
-  addFunction "Meta" cloneMeta
-  addFunction "MetaValue" cloneMetaValue
-  addFunction "ListAttributes" cloneListAttributes
-  addFunction "Pandoc" clonePandoc
+  addFunction "Attr"      $ cloneWith peekAttr pushAttr
+  addFunction "Block"     $ cloneWith peekBlock pushBlock
+  addFunction "Citation"  $ cloneWith peekCitation Lua.push
+  addFunction "Inline"    $ cloneWith peekInline pushInline
+  addFunction "Meta"      $ cloneWith peekMeta Lua.push
+  addFunction "MetaValue" $ cloneWith peekMetaValue pushMetaValue
+  addFunction "ListAttributes" $ cloneWith peekListAttributes pushListAttributes
+  addFunction "Pandoc"    $ cloneWith peekPandoc pushPandoc
   return 1
 
-cloneAttr :: LuaAttr -> Lua LuaAttr
-cloneAttr = return
-
-cloneBlock :: Block -> Lua Block
-cloneBlock = return
-
-cloneCitation :: Citation -> Lua Citation
-cloneCitation = return
-
-cloneInline :: Inline -> Lua Inline
-cloneInline = return
-
-cloneListAttributes :: LuaListAttributes -> Lua LuaListAttributes
-cloneListAttributes = return
-
-cloneMeta :: Meta -> Lua Meta
-cloneMeta = return
-
-cloneMetaValue :: MetaValue -> Lua MetaValue
-cloneMetaValue = return
-
-clonePandoc :: Pandoc -> Lua Pandoc
-clonePandoc = return
+cloneWith :: Peeker PandocError a
+          -> Pusher PandocError a
+          -> LuaE PandocError NumResults
+cloneWith peeker pusher = do
+  x <- Lua.forcePeek $ peeker (Lua.nthBottom 1)
+  pusher x
+  return (Lua.NumResults 1)
diff --git a/src/Text/Pandoc/Lua/Module/Utils.hs b/src/Text/Pandoc/Lua/Module/Utils.hs
--- a/src/Text/Pandoc/Lua/Module/Utils.hs
+++ b/src/Text/Pandoc/Lua/Module/Utils.hs
@@ -1,5 +1,7 @@
-{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE LambdaCase          #-}
+{-# LANGUAGE OverloadedStrings   #-}
 {-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeApplications    #-}
 {- |
    Module      : Text.Pandoc.Lua.Module.Utils
    Copyright   : Copyright © 2017-2021 Albert Krewinkel
@@ -15,83 +17,138 @@
   ) where
 
 import Control.Applicative ((<|>))
-import Control.Monad.Catch (try)
+import Control.Monad ((<$!>))
 import Data.Data (showConstr, toConstr)
 import Data.Default (def)
 import Data.Version (Version)
-import Foreign.Lua (Peekable, Lua, NumResults (..))
+import HsLua as Lua hiding (pushModule)
+import HsLua.Class.Peekable (PeekError)
+import HsLua.Module.Version (peekVersionFuzzy, pushVersion)
 import Text.Pandoc.Definition
 import Text.Pandoc.Error (PandocError)
 import Text.Pandoc.Lua.Marshaling ()
+import Text.Pandoc.Lua.Marshaling.AST
+  ( peekBlock, peekInline, peekPandoc, pushBlock, pushInline, pushPandoc
+  , peekAttr, peekListAttributes, peekMeta, peekMetaValue)
+import Text.Pandoc.Lua.Marshaling.List (pushPandocList)
 import Text.Pandoc.Lua.Marshaling.SimpleTable
-  ( SimpleTable (..)
-  , pushSimpleTable
-  )
-import Text.Pandoc.Lua.PandocLua (PandocLua, addFunction, liftPandocLua)
+  ( SimpleTable (..), peekSimpleTable, pushSimpleTable )
+import Text.Pandoc.Lua.PandocLua (PandocLua (unPandocLua))
 
 import qualified Data.Digest.Pure.SHA as SHA
 import qualified Data.ByteString.Lazy as BSL
 import qualified Data.Text as T
-import qualified Foreign.Lua as Lua
+import qualified HsLua.Packaging as Lua
 import qualified Text.Pandoc.Builder as B
 import qualified Text.Pandoc.Filter.JSON as JSONFilter
 import qualified Text.Pandoc.Shared as Shared
+import qualified Text.Pandoc.UTF8 as UTF8
 import qualified Text.Pandoc.Writers.Shared as Shared
 
 -- | Push the "pandoc.utils" module to the Lua stack.
-pushModule :: PandocLua NumResults
-pushModule = do
-  liftPandocLua Lua.newtable
-  addFunction "blocks_to_inlines" blocksToInlines
-  addFunction "equals" equals
-  addFunction "from_simple_table" from_simple_table
-  addFunction "make_sections" makeSections
-  addFunction "normalize_date" normalizeDate
-  addFunction "run_json_filter" runJSONFilter
-  addFunction "sha1" sha1
-  addFunction "stringify" stringify
-  addFunction "to_roman_numeral" toRomanNumeral
-  addFunction "to_simple_table" to_simple_table
-  addFunction "Version" (return :: Version -> Lua Version)
-  return 1
+pandocUtilsModule :: Module PandocError
+pandocUtilsModule = Module
+  { moduleName = "pandoc.utils"
+  , moduleDescription = "pandoc utility functions"
+  , moduleFields = []
+  , moduleOperations = []
+  , moduleFunctions =
+    [ defun "blocks_to_inlines"
+      ### (\blks mSep -> do
+              let sep = maybe Shared.defaultBlocksSeparator B.fromList mSep
+              return $ B.toList (Shared.blocksToInlinesWithSep sep blks))
+      <#> parameter (peekList peekBlock) "list of blocks"
+            "blocks" ""
+      <#> optionalParameter (peekList peekInline) "list of inlines"
+            "inline" ""
+      =#> functionResult (pushPandocList pushInline) "list of inlines" ""
 
--- | Squashes a list of blocks into inlines.
-blocksToInlines :: [Block] -> Lua.Optional [Inline] -> PandocLua [Inline]
-blocksToInlines blks optSep = liftPandocLua $ do
-  let sep = maybe Shared.defaultBlocksSeparator B.fromList
-            $ Lua.fromOptional optSep
-  return $ B.toList (Shared.blocksToInlinesWithSep sep blks)
+    , defun "equals"
+      ### liftPure2 (==)
+      <#> parameter peekAstElement "AST element" "elem1" ""
+      <#> parameter peekAstElement "AST element" "elem2" ""
+      =#> functionResult pushBool "boolean" "true iff elem1 == elem2"
 
--- | Convert list of Pandoc blocks into sections using Divs.
-makeSections :: Bool -> Lua.Optional Int -> [Block] -> Lua [Block]
-makeSections number baselevel =
-  return . Shared.makeSections number (Lua.fromOptional baselevel)
+    , defun "make_sections"
+      ### liftPure3 Shared.makeSections
+      <#> parameter peekBool "boolean" "numbering" "add header numbers"
+      <#> parameter (\i -> (Nothing <$ peekNil i) <|> (Just <$!> peekIntegral i))
+                    "integer or nil" "baselevel" ""
+      <#> parameter (peekList peekBlock) "list of blocks"
+            "blocks" "document blocks to process"
+      =#> functionResult (pushPandocList pushBlock) "list of Blocks"
+            "processes blocks"
 
--- | Parse a date and convert (if possible) to "YYYY-MM-DD" format. We
--- limit years to the range 1601-9999 (ISO 8601 accepts greater than
--- or equal to 1583, but MS Word only accepts dates starting 1601).
--- Returns nil instead of a string if the conversion failed.
-normalizeDate :: T.Text -> Lua (Lua.Optional T.Text)
-normalizeDate = return . Lua.Optional . Shared.normalizeDate
+    , defun "normalize_date"
+      ### liftPure Shared.normalizeDate
+      <#> parameter peekText "string" "date" "the date string"
+      =#> functionResult (maybe pushnil pushText) "string or nil"
+            "normalized date, or nil if normalization failed."
+      #? T.unwords
+      [ "Parse a date and convert (if possible) to \"YYYY-MM-DD\" format. We"
+      , "limit years to the range 1601-9999 (ISO 8601 accepts greater than"
+      , "or equal to 1583, but MS Word only accepts dates starting 1601)."
+      , "Returns nil instead of a string if the conversion failed."
+      ]
 
--- | Run a JSON filter on the given document.
-runJSONFilter :: Pandoc
-              -> FilePath
-              -> Lua.Optional [String]
-              -> PandocLua Pandoc
-runJSONFilter doc filterFile optArgs = do
-  args <- case Lua.fromOptional optArgs of
-            Just x -> return x
-            Nothing -> liftPandocLua $ do
-              Lua.getglobal "FORMAT"
-              (:[]) <$> Lua.popValue
-  JSONFilter.apply def args filterFile doc
+    , defun "sha1"
+      ### liftPure (SHA.showDigest . SHA.sha1)
+      <#> parameter (fmap BSL.fromStrict . peekByteString) "string"
+            "input" ""
+      =#> functionResult pushString "string" "hexadecimal hash value"
+      #? "Compute the hash of the given string value."
 
--- | Calculate the hash of the given contents.
-sha1 :: BSL.ByteString
-     -> Lua T.Text
-sha1 = return . T.pack . SHA.showDigest . SHA.sha1
+    , defun "Version"
+      ### liftPure (id @Version)
+      <#> parameter peekVersionFuzzy
+            "version string, list of integers, or integer"
+            "v" "version description"
+      =#> functionResult pushVersion "Version" "new Version object"
+      #? "Creates a Version object."
 
+    , defun "run_json_filter"
+      ### (\doc filterPath margs -> do
+              args <- case margs of
+                        Just xs -> return xs
+                        Nothing -> do
+                          Lua.getglobal "FORMAT"
+                          (forcePeek ((:[]) <$!> peekString top) <* pop 1)
+              JSONFilter.apply def args filterPath doc
+          )
+      <#> parameter peekPandoc "Pandoc" "doc" "input document"
+      <#> parameter peekString "filepath" "filter_path" "path to filter"
+      <#> optionalParameter (peekList peekString) "list of strings"
+            "args" "arguments to pass to the filter"
+      =#> functionResult pushPandoc "Pandoc" "filtered document"
+
+    , defun "stringify"
+      ### unPandocLua . stringify
+      <#> parameter peekAstElement "AST element" "elem" "some pandoc AST element"
+      =#> functionResult pushText "string" "stringified element"
+
+    , defun "from_simple_table"
+      ### from_simple_table
+      <#> parameter peekSimpleTable "SimpleTable" "simple_tbl" ""
+      =?> "Simple table"
+
+    , defun "to_roman_numeral"
+      ### liftPure Shared.toRomanNumeral
+      <#> parameter (peekIntegral @Int) "integer" "n" "number smaller than 4000"
+      =#> functionResult pushText "string" "roman numeral"
+      #? "Converts a number < 4000 to uppercase roman numeral."
+
+    , defun "to_simple_table"
+      ### to_simple_table
+      <#> parameter peekTable "Block" "tbl" "a table"
+      =#> functionResult pushSimpleTable "SimpleTable" "SimpleTable object"
+      #? "Converts a table into an old/simple table."
+    ]
+  }
+
+pushModule :: LuaE PandocError NumResults
+pushModule = 1 <$ Lua.pushModule pandocUtilsModule
+
+
 -- | Convert pandoc structure to a string with formatting removed.
 -- Footnotes are skipped (since we don't want their contents in link
 -- labels).
@@ -111,9 +168,6 @@
   MetaString s -> s
   _            -> Shared.stringify mv
 
-equals :: AstElement -> AstElement -> PandocLua Bool
-equals e1 e2 = return (e1 == e2)
-
 data AstElement
   = PandocElement Pandoc
   | MetaElement Meta
@@ -125,22 +179,19 @@
   | CitationElement Citation
   deriving (Eq, Show)
 
-instance Peekable AstElement where
-  peek idx  = do
-    res <- try $  (PandocElement <$> Lua.peek idx)
-              <|> (InlineElement <$> Lua.peek idx)
-              <|> (BlockElement <$> Lua.peek idx)
-              <|> (AttrElement <$> Lua.peek idx)
-              <|> (ListAttributesElement <$> Lua.peek idx)
-              <|> (MetaElement <$> Lua.peek idx)
-              <|> (MetaValueElement <$> Lua.peek idx)
-    case res of
-      Right x -> return x
-      Left (_ :: PandocError) -> Lua.throwMessage
-        "Expected an AST element, but could not parse value as such."
+peekAstElement :: PeekError e => Peeker e AstElement
+peekAstElement = retrieving "pandoc AST element" . choice
+  [ (fmap PandocElement . peekPandoc)
+  , (fmap InlineElement . peekInline)
+  , (fmap BlockElement . peekBlock)
+  , (fmap AttrElement . peekAttr)
+  , (fmap ListAttributesElement . peekListAttributes)
+  , (fmap MetaElement . peekMeta)
+  , (fmap MetaValueElement . peekMetaValue)
+  ]
 
 -- | Converts an old/simple table into a normal table block element.
-from_simple_table :: SimpleTable -> Lua NumResults
+from_simple_table :: SimpleTable -> LuaE PandocError NumResults
 from_simple_table (SimpleTable capt aligns widths head' body) = do
   Lua.push $ Table
     nullAttr
@@ -159,17 +210,19 @@
     toColWidth w = ColWidth w
 
 -- | Converts a table into an old/simple table.
-to_simple_table :: Block -> Lua NumResults
+to_simple_table :: Block -> LuaE PandocError SimpleTable
 to_simple_table = \case
   Table _attr caption specs thead tbodies tfoot -> do
     let (capt, aligns, widths, headers, rows) =
           Shared.toLegacyTable caption specs thead tbodies tfoot
-    pushSimpleTable $ SimpleTable capt aligns widths headers rows
-    return (NumResults 1)
-  blk ->
-    Lua.throwMessage $
-      "Expected Table, got " <> showConstr (toConstr blk) <> "."
+    return $ SimpleTable capt aligns widths headers rows
+  blk -> Lua.failLua $ mconcat
+         [ "Expected Table, got ", showConstr (toConstr blk), "." ]
 
--- | Convert a number < 4000 to uppercase roman numeral.
-toRomanNumeral :: Lua.Integer -> PandocLua T.Text
-toRomanNumeral = return . Shared.toRomanNumeral . fromIntegral
+peekTable :: LuaError e => Peeker e Block
+peekTable idx = peekBlock idx >>= \case
+  t@(Table {}) -> return t
+  b -> Lua.failPeek $ mconcat
+       [ "Expected Table, got "
+       , UTF8.fromString $ showConstr (toConstr b)
+       , "." ]
diff --git a/src/Text/Pandoc/Lua/Packages.hs b/src/Text/Pandoc/Lua/Packages.hs
--- a/src/Text/Pandoc/Lua/Packages.hs
+++ b/src/Text/Pandoc/Lua/Packages.hs
@@ -1,3 +1,6 @@
+{-# LANGUAGE FlexibleContexts  #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TypeApplications  #-}
 {- |
    Module      : Text.Pandoc.Lua.Packages
    Copyright   : Copyright © 2017-2021 Albert Krewinkel
@@ -13,12 +16,13 @@
   ) where
 
 import Control.Monad (forM_)
-import Foreign.Lua (NumResults)
+import HsLua (NumResults)
+import Text.Pandoc.Error (PandocError)
 import Text.Pandoc.Lua.PandocLua (PandocLua, liftPandocLua, loadDefaultModule)
 
-import qualified Foreign.Lua as Lua
-import qualified Foreign.Lua.Module.Path as Path
-import qualified Foreign.Lua.Module.Text as Text
+import qualified HsLua as Lua
+import qualified HsLua.Module.Path as Path
+import qualified HsLua.Module.Text as Text
 import qualified Text.Pandoc.Lua.Module.Pandoc as Pandoc
 import qualified Text.Pandoc.Lua.Module.MediaBag as MediaBag
 import qualified Text.Pandoc.Lua.Module.System as System
@@ -30,8 +34,8 @@
 installPandocPackageSearcher = liftPandocLua $ do
   Lua.getglobal' "package.searchers"
   shiftArray
-  Lua.pushHaskellFunction pandocPackageSearcher
-  Lua.rawseti (Lua.nthFromTop 2) 1
+  Lua.pushHaskellFunction $ Lua.toHaskellFunction pandocPackageSearcher
+  Lua.rawseti (Lua.nth 2) 1
   Lua.pop 1           -- remove 'package.searchers' from stack
  where
   shiftArray = forM_ [4, 3, 2, 1] $ \i -> do
@@ -42,14 +46,16 @@
 pandocPackageSearcher :: String -> PandocLua NumResults
 pandocPackageSearcher pkgName =
   case pkgName of
-    "pandoc"          -> pushWrappedHsFun Pandoc.pushModule
-    "pandoc.mediabag" -> pushWrappedHsFun MediaBag.pushModule
-    "pandoc.path"     -> pushWrappedHsFun Path.pushModule
-    "pandoc.system"   -> pushWrappedHsFun System.pushModule
-    "pandoc.types"    -> pushWrappedHsFun Types.pushModule
-    "pandoc.utils"    -> pushWrappedHsFun Utils.pushModule
-    "text"            -> pushWrappedHsFun Text.pushModule
-    "pandoc.List"     -> pushWrappedHsFun (loadDefaultModule pkgName)
+    "pandoc"          -> pushWrappedHsFun $ Lua.toHaskellFunction @PandocError Pandoc.pushModule
+    "pandoc.mediabag" -> pushWrappedHsFun $ Lua.toHaskellFunction @PandocError MediaBag.pushModule
+    "pandoc.path"     -> pushWrappedHsFun
+      (Lua.NumResults 1 <$ Lua.pushModule @PandocError Path.documentedModule)
+    "pandoc.system"   -> pushWrappedHsFun $ Lua.toHaskellFunction System.pushModule
+    "pandoc.types"    -> pushWrappedHsFun $ Lua.toHaskellFunction @PandocError Types.pushModule
+    "pandoc.utils"    -> pushWrappedHsFun $ Lua.toHaskellFunction @PandocError Utils.pushModule
+    "text"            -> pushWrappedHsFun
+      (Lua.NumResults 1 <$ Lua.pushModule @PandocError Text.documentedModule)
+    "pandoc.List"     -> pushWrappedHsFun $ Lua.toHaskellFunction @PandocError (loadDefaultModule pkgName)
     _                 -> reportPandocSearcherFailure
  where
   pushWrappedHsFun f = liftPandocLua $ do
diff --git a/src/Text/Pandoc/Lua/PandocLua.hs b/src/Text/Pandoc/Lua/PandocLua.hs
--- a/src/Text/Pandoc/Lua/PandocLua.hs
+++ b/src/Text/Pandoc/Lua/PandocLua.hs
@@ -28,21 +28,19 @@
 
 import Control.Monad.Catch (MonadCatch, MonadMask, MonadThrow)
 import Control.Monad.Except (MonadError (catchError, throwError))
-import Control.Monad.IO.Class (MonadIO (liftIO))
-import Foreign.Lua (Lua (..), NumResults, Pushable, ToHaskellFunction)
-import Text.Pandoc.Class.PandocIO (PandocIO)
+import Control.Monad.IO.Class (MonadIO)
+import HsLua as Lua
 import Text.Pandoc.Class.PandocMonad (PandocMonad (..), readDefaultDataFile)
 import Text.Pandoc.Error (PandocError (PandocLuaError))
 import Text.Pandoc.Lua.Global (Global (..), setGlobals)
-import Text.Pandoc.Lua.ErrorConversion (errorConversion)
+import Text.Pandoc.Lua.Marshaling.CommonState (peekCommonState)
 
 import qualified Control.Monad.Catch as Catch
 import qualified Data.Text as T
-import qualified Foreign.Lua as Lua
 import qualified Text.Pandoc.Class.IO as IO
 
 -- | Type providing access to both, pandoc and Lua operations.
-newtype PandocLua a = PandocLua { unPandocLua :: Lua a }
+newtype PandocLua a = PandocLua { unPandocLua :: LuaE PandocError a }
   deriving
     ( Applicative
     , Functor
@@ -54,16 +52,16 @@
     )
 
 -- | Lift a @'Lua'@ operation into the @'PandocLua'@ type.
-liftPandocLua :: Lua a -> PandocLua a
+liftPandocLua :: LuaE PandocError a -> PandocLua a
 liftPandocLua = PandocLua
 
 -- | Evaluate a @'PandocLua'@ computation, running all contained Lua
 -- operations..
-runPandocLua :: PandocLua a -> PandocIO a
+runPandocLua :: (PandocMonad m, MonadIO m) => PandocLua a -> m a
 runPandocLua pLua = do
   origState <- getCommonState
   globals <- defaultGlobals
-  (result, newState) <- liftIO . Lua.run' errorConversion . unPandocLua $ do
+  (result, newState) <- liftIO . Lua.run . unPandocLua $ do
     putCommonState origState
     liftPandocLua $ setGlobals globals
     r <- pLua
@@ -72,17 +70,17 @@
   putCommonState newState
   return result
 
-instance {-# OVERLAPPING #-} ToHaskellFunction (PandocLua NumResults) where
-  toHsFun _narg = unPandocLua
+instance {-# OVERLAPPING #-} Exposable PandocError (PandocLua NumResults) where
+  partialApply _narg = unPandocLua
 
-instance Pushable a => ToHaskellFunction (PandocLua a) where
-  toHsFun _narg x = 1 <$ (unPandocLua x >>= Lua.push)
+instance Pushable a => Exposable PandocError (PandocLua a) where
+  partialApply _narg x = 1 <$ (unPandocLua x >>= Lua.push)
 
 -- | Add a function to the table at the top of the stack, using the given name.
-addFunction :: ToHaskellFunction a => String -> a -> PandocLua ()
+addFunction :: Exposable PandocError a => Name -> a -> PandocLua ()
 addFunction name fn = liftPandocLua $ do
-  Lua.push name
-  Lua.pushHaskellFunction fn
+  Lua.pushName name
+  Lua.pushHaskellFunction $ toHaskellFunction fn
   Lua.rawset (-3)
 
 -- | Load a pure Lua module included with pandoc. Leaves the result on
@@ -94,8 +92,8 @@
 loadDefaultModule :: String -> PandocLua NumResults
 loadDefaultModule name = do
   script <- readDefaultDataFile (name <> ".lua")
-  status <- liftPandocLua $ Lua.dostring script
-  if status == Lua.OK
+  result <- liftPandocLua $ Lua.dostring script
+  if result == Lua.OK
     then return (1 :: NumResults)
     else do
       msg <- liftPandocLua Lua.popValue
@@ -103,7 +101,7 @@
       throwError $ PandocLuaError (T.pack err)
 
 -- | Global variables which should always be set.
-defaultGlobals :: PandocIO [Global]
+defaultGlobals :: PandocMonad m => m [Global]
 defaultGlobals = do
   commonState <- getCommonState
   return
@@ -127,6 +125,7 @@
 
   readFileLazy = IO.readFileLazy
   readFileStrict = IO.readFileStrict
+  readStdinStrict = IO.readStdinStrict
 
   glob = IO.glob
   fileExists = IO.fileExists
@@ -135,7 +134,7 @@
 
   getCommonState = PandocLua $ do
     Lua.getglobal "PANDOC_STATE"
-    Lua.peek Lua.stackTop
+    forcePeek $ peekCommonState Lua.top
   putCommonState = PandocLua . setGlobals . (:[]) . PANDOC_STATE
 
   logOutput = IO.logOutput
diff --git a/src/Text/Pandoc/Lua/Util.hs b/src/Text/Pandoc/Lua/Util.hs
--- a/src/Text/Pandoc/Lua/Util.hs
+++ b/src/Text/Pandoc/Lua/Util.hs
@@ -1,6 +1,9 @@
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE AllowAmbiguousTypes   #-}
+{-# LANGUAGE FlexibleInstances     #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE OverloadedStrings     #-}
+{-# LANGUAGE ScopedTypeVariables   #-}
+{-# LANGUAGE TypeApplications      #-}
 {- |
    Module      : Text.Pandoc.Lua.Util
    Copyright   : © 2012-2021 John MacFarlane,
@@ -14,114 +17,91 @@
 -}
 module Text.Pandoc.Lua.Util
   ( getTag
-  , rawField
   , addField
   , addFunction
-  , addValue
   , pushViaConstructor
-  , defineHowTo
-  , throwTopMessageAsError'
   , callWithTraceback
   , dofileWithTraceback
+  , pushViaConstr'
   ) where
 
 import Control.Monad (unless, when)
-import Data.Text (Text)
-import Foreign.Lua ( Lua, NumArgs, NumResults, Peekable, Pushable, StackIndex
-                   , Status, ToHaskellFunction )
-import qualified Foreign.Lua as Lua
-import qualified Text.Pandoc.UTF8 as UTF8
-
--- | Get value behind key from table at given index.
-rawField :: Peekable a => StackIndex -> String -> Lua a
-rawField idx key = do
-  absidx <- Lua.absindex idx
-  Lua.push key
-  Lua.rawget absidx
-  Lua.popValue
+import HsLua
+import qualified HsLua as Lua
 
 -- | Add a value to the table at the top of the stack at a string-index.
-addField :: Pushable a => String -> a -> Lua ()
-addField = addValue
-
--- | Add a key-value pair to the table at the top of the stack.
-addValue :: (Pushable a, Pushable b) => a -> b -> Lua ()
-addValue key value = do
+addField :: (LuaError e, Pushable a) => String -> a -> LuaE e ()
+addField key value = do
   Lua.push key
   Lua.push value
-  Lua.rawset (Lua.nthFromTop 3)
+  Lua.rawset (Lua.nth 3)
 
--- | Add a function to the table at the top of the stack, using the given name.
-addFunction :: ToHaskellFunction a => String -> a -> Lua ()
+-- | Add a function to the table at the top of the stack, using the
+-- given name.
+addFunction :: Exposable e a => String -> a -> LuaE e ()
 addFunction name fn = do
   Lua.push name
-  Lua.pushHaskellFunction fn
+  Lua.pushHaskellFunction $ toHaskellFunction fn
   Lua.rawset (-3)
 
--- | Helper class for pushing a single value to the stack via a lua function.
--- See @pushViaCall@.
-class PushViaCall a where
-  pushViaCall' :: String -> Lua () -> NumArgs -> a
+-- | Helper class for pushing a single value to the stack via a lua
+-- function. See @pushViaCall@.
+class LuaError e => PushViaCall e a where
+  pushViaCall' :: LuaError e => Name -> LuaE e () -> NumArgs -> a
 
-instance PushViaCall (Lua ()) where
+instance LuaError e => PushViaCall e (LuaE e ()) where
   pushViaCall' fn pushArgs num = do
-    Lua.push fn
+    Lua.pushName @e fn
     Lua.rawget Lua.registryindex
     pushArgs
     Lua.call num 1
 
-instance (Pushable a, PushViaCall b) => PushViaCall (a -> b) where
+instance (LuaError e, Pushable a, PushViaCall e b) =>
+         PushViaCall e (a -> b) where
   pushViaCall' fn pushArgs num x =
-    pushViaCall' fn (pushArgs *> Lua.push x) (num + 1)
+    pushViaCall' @e fn (pushArgs *> Lua.push x) (num + 1)
 
 -- | Push an value to the stack via a lua function. The lua function is called
 -- with all arguments that are passed to this function and is expected to return
 -- a single value.
-pushViaCall :: PushViaCall a => String -> a
-pushViaCall fn = pushViaCall' fn (return ()) 0
+pushViaCall :: forall e a. LuaError e => PushViaCall e a => Name -> a
+pushViaCall fn = pushViaCall' @e fn (return ()) 0
 
 -- | Call a pandoc element constructor within Lua, passing all given arguments.
-pushViaConstructor :: PushViaCall a => String -> a
-pushViaConstructor pandocFn = pushViaCall ("pandoc." ++ pandocFn)
+pushViaConstructor :: forall e a. LuaError e => PushViaCall e a => Name -> a
+pushViaConstructor pandocFn = pushViaCall @e ("pandoc." <> pandocFn)
 
 -- | Get the tag of a value. This is an optimized and specialized version of
 -- @Lua.getfield idx "tag"@. It only checks for the field on the table at index
 -- @idx@ and on its metatable, also ignoring any @__index@ value on the
 -- metatable.
-getTag :: StackIndex -> Lua String
+getTag :: LuaError e => Peeker e Name
 getTag idx = do
   -- push metatable or just the table
-  Lua.getmetatable idx >>= \hasMT -> unless hasMT (Lua.pushvalue idx)
-  Lua.push ("tag" :: Text)
-  Lua.rawget (Lua.nthFromTop 2)
-  Lua.tostring Lua.stackTop <* Lua.pop 2 >>= \case
-    Nothing -> Lua.throwMessage "untagged value"
-    Just x -> return (UTF8.toString x)
-
--- | Modify the message at the top of the stack before throwing it as an
--- Exception.
-throwTopMessageAsError' :: (String -> String) -> Lua a
-throwTopMessageAsError' modifier = do
-  msg <- Lua.tostring' Lua.stackTop
-  Lua.pop 2 -- remove error and error string pushed by tostring'
-  Lua.throwMessage (modifier (UTF8.toString msg))
+  liftLua $ do
+    Lua.getmetatable idx >>= \hasMT -> unless hasMT (Lua.pushvalue idx)
+    Lua.pushName "tag"
+    Lua.rawget (Lua.nth 2)
+  Lua.peekName Lua.top `lastly` Lua.pop 2  -- table/metatable and `tag` field
 
--- | Mark the context of a Lua computation for better error reporting.
-defineHowTo :: String -> Lua a -> Lua a
-defineHowTo ctx op = Lua.errorConversion >>= \ec ->
-  Lua.addContextToException ec ("Could not " <> ctx <> ": ") op
+pushViaConstr' :: forall e. LuaError e => Name -> [LuaE e ()] -> LuaE e ()
+pushViaConstr' fnname pushArgs = do
+  pushName @e ("pandoc." <> fnname)
+  rawget @e registryindex
+  sequence_ pushArgs
+  call @e (fromIntegral (length pushArgs)) 1
 
 -- | Like @'Lua.pcall'@, but uses a predefined error handler which adds a
 -- traceback on error.
-pcallWithTraceback :: NumArgs -> NumResults -> Lua Status
+pcallWithTraceback :: LuaError e => NumArgs -> NumResults -> LuaE e Status
 pcallWithTraceback nargs nresults = do
-  let traceback' :: Lua NumResults
+  let traceback' :: LuaError e => LuaE e NumResults
       traceback' = do
         l <- Lua.state
-        msg <- Lua.tostring' (Lua.nthFromBottom 1)
-        Lua.traceback l (Just (UTF8.toString msg)) 2
+        msg <- Lua.tostring' (Lua.nthBottom 1)
+        Lua.traceback l (Just msg) 2
         return 1
-  tracebackIdx <- Lua.absindex (Lua.nthFromTop (Lua.fromNumArgs nargs + 1))
+  tracebackIdx <- Lua.absindex (Lua.nth (Lua.fromNumArgs nargs + 1))
   Lua.pushHaskellFunction traceback'
   Lua.insert tracebackIdx
   result <- Lua.pcall nargs nresults (Just tracebackIdx)
@@ -129,15 +109,15 @@
   return result
 
 -- | Like @'Lua.call'@, but adds a traceback to the error message (if any).
-callWithTraceback :: NumArgs -> NumResults -> Lua ()
+callWithTraceback :: LuaError e => NumArgs -> NumResults -> LuaE e ()
 callWithTraceback nargs nresults = do
   result <- pcallWithTraceback nargs nresults
   when (result /= Lua.OK)
-    Lua.throwTopMessage
+    Lua.throwErrorAsException
 
 -- | Run the given string as a Lua program, while also adding a traceback to the
 -- error message if an error occurs.
-dofileWithTraceback :: FilePath -> Lua Status
+dofileWithTraceback :: LuaError e => FilePath -> LuaE e Status
 dofileWithTraceback fp = do
   loadRes <- Lua.loadfile fp
   case loadRes of
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -2,6 +2,7 @@
 {-# LANGUAGE LambdaCase          #-}
 {-# LANGUAGE OverloadedStrings   #-}
 {-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE FlexibleContexts    #-}
 {- |
    Module      : Text.Pandoc.PDF
    Copyright   : Copyright (C) 2012-2021 John MacFarlane
@@ -50,13 +51,13 @@
 import qualified Text.Pandoc.UTF8 as UTF8
 import Text.Pandoc.Walk (walkM)
 import Text.Pandoc.Writers.Shared (getField, metaToContext)
+import Control.Monad.Catch (MonadMask)
 #ifdef _WINDOWS
 import Data.List (intercalate)
 #endif
 import Data.List (isPrefixOf, find)
-import Text.Pandoc.Class.PandocIO (PandocIO, extractMedia, runIOorExplode)
-import Text.Pandoc.Class.PandocMonad (fillMediaBag, getCommonState, getVerbosity,
-                                      putCommonState, report, setVerbosity)
+import Text.Pandoc.Class (fillMediaBag, getVerbosity,
+                          report, extractMedia, PandocMonad)
 import Text.Pandoc.Logging
 
 #ifdef _WINDOWS
@@ -67,14 +68,15 @@
   intercalate "/" . map (filter (/='\\')) . splitDirectories
 #endif
 
-makePDF :: String              -- ^ pdf creator (pdflatex, lualatex, xelatex,
+makePDF :: (PandocMonad m, MonadIO m, MonadMask m)
+        => String              -- ^ pdf creator (pdflatex, lualatex, xelatex,
                                -- wkhtmltopdf, weasyprint, prince, context, pdfroff,
                                -- or path to executable)
         -> [String]            -- ^ arguments to pass to pdf creator
-        -> (WriterOptions -> Pandoc -> PandocIO Text)  -- ^ writer
+        -> (WriterOptions -> Pandoc -> m Text)  -- ^ writer
         -> WriterOptions       -- ^ options
         -> Pandoc              -- ^ document
-        -> PandocIO (Either ByteString ByteString)
+        -> m (Either ByteString ByteString)
 makePDF program pdfargs writer opts doc =
   case takeBaseName program of
     "wkhtmltopdf" -> makeWithWkhtmltopdf program pdfargs writer opts doc
@@ -86,57 +88,52 @@
       source <- writer opts doc
       let args   = ["-ms", "-mpdfmark", "-mspdf",
                     "-e", "-t", "-k", "-KUTF-8", "-i"] ++ pdfargs
-      verbosity <- getVerbosity
-      liftIO $ generic2pdf verbosity program args source
+      generic2pdf program args source
     baseProg -> do
-      commonState <- getCommonState
-      verbosity <- getVerbosity
-      -- latex has trouble with tildes in paths, which
-      -- you find in Windows temp dir paths with longer
-      -- user names (see #777)
-      let withTempDir templ action = do
-            tmp <- getTemporaryDirectory
-            uname <- E.catch
-              (do (ec, sout, _) <- readProcessWithExitCode "uname" ["-o"] ""
-                  if ec == ExitSuccess
-                     then return $ Just $ filter (not . isSpace) sout
-                     else return Nothing)
-              (\(_ :: E.SomeException) -> return Nothing)
-            if '~' `elem` tmp || uname == Just "Cygwin" -- see #5451
-                   then withTempDirectory "." templ action
-                   else withSystemTempDirectory templ action
-      (newCommonState, res) <- liftIO $ withTempDir "tex2pdf." $ \tmpdir' -> do
+      withTempDir "tex2pdf." $ \tmpdir' -> do
 #ifdef _WINDOWS
         -- note:  we want / even on Windows, for TexLive
         let tmpdir = changePathSeparators tmpdir'
 #else
         let tmpdir = tmpdir'
 #endif
-        runIOorExplode $ do
-          putCommonState commonState
-          doc' <- handleImages opts tmpdir doc
-          source <- writer opts{ writerExtensions = -- disable use of quote
-                                    -- ligatures to avoid bad ligatures like ?`
-                                    disableExtension Ext_smart
-                                     (writerExtensions opts) } doc'
-          res <- case baseProg of
-            "context" -> context2pdf verbosity program pdfargs tmpdir source
-            "tectonic" -> tectonic2pdf verbosity program pdfargs tmpdir source
-            prog | prog `elem` ["pdflatex", "lualatex", "xelatex", "latexmk"]
-                -> tex2pdf verbosity program pdfargs tmpdir source
-            _ -> return $ Left $ UTF8.fromStringLazy
-                               $ "Unknown program " ++ program
-          cs <- getCommonState
-          return (cs, res)
-      putCommonState newCommonState
-      return res
+        doc' <- handleImages opts tmpdir doc
+        source <- writer opts{ writerExtensions = -- disable use of quote
+                                  -- ligatures to avoid bad ligatures like ?`
+                                  disableExtension Ext_smart
+                                   (writerExtensions opts) } doc'
+        case baseProg of
+          "context" -> context2pdf program pdfargs tmpdir source
+          "tectonic" -> tectonic2pdf program pdfargs tmpdir source
+          prog | prog `elem` ["pdflatex", "lualatex", "xelatex", "latexmk"]
+              -> tex2pdf program pdfargs tmpdir source
+          _ -> return $ Left $ UTF8.fromStringLazy
+                             $ "Unknown program " ++ program
 
-makeWithWkhtmltopdf :: String              -- ^ wkhtmltopdf or path
+-- latex has trouble with tildes in paths, which
+-- you find in Windows temp dir paths with longer
+-- user names (see #777)
+withTempDir :: (PandocMonad m, MonadMask m, MonadIO m)
+            => FilePath -> (FilePath -> m a) -> m a
+withTempDir templ action = do
+  tmp <- liftIO getTemporaryDirectory
+  uname <- liftIO $ E.catch
+    (do (ec, sout, _) <- readProcessWithExitCode "uname" ["-o"] ""
+        if ec == ExitSuccess
+           then return $ Just $ filter (not . isSpace) sout
+           else return Nothing)
+    (\(_  :: E.SomeException) -> return Nothing)
+  if '~' `elem` tmp || uname == Just "Cygwin" -- see #5451
+         then withTempDirectory "." templ action
+         else withSystemTempDirectory templ action
+
+makeWithWkhtmltopdf :: (PandocMonad m, MonadIO m)
+                    => String              -- ^ wkhtmltopdf or path
                     -> [String]            -- ^ arguments
-                    -> (WriterOptions -> Pandoc -> PandocIO Text)  -- ^ writer
+                    -> (WriterOptions -> Pandoc -> m Text)  -- ^ writer
                     -> WriterOptions       -- ^ options
                     -> Pandoc              -- ^ document
-                    -> PandocIO (Either ByteString ByteString)
+                    -> m (Either ByteString ByteString)
 makeWithWkhtmltopdf program pdfargs writer opts doc@(Pandoc meta _) = do
   let mathArgs = case writerHTMLMathMethod opts of
                  -- with MathJax, wait til all math is rendered:
@@ -167,16 +164,18 @@
   verbosity <- getVerbosity
   liftIO $ html2pdf verbosity program args source
 
-handleImages :: WriterOptions
+handleImages :: (PandocMonad m, MonadIO m)
+             => WriterOptions
              -> FilePath      -- ^ temp dir to store images
              -> Pandoc        -- ^ document
-             -> PandocIO Pandoc
+             -> m Pandoc
 handleImages opts tmpdir doc =
   fillMediaBag doc >>=
     extractMedia tmpdir >>=
     walkM (convertImages opts tmpdir)
 
-convertImages :: WriterOptions -> FilePath -> Inline -> PandocIO Inline
+convertImages :: (PandocMonad m, MonadIO m)
+              => WriterOptions -> FilePath -> Inline -> m Inline
 convertImages opts tmpdir (Image attr ils (src, tit)) = do
   img <- liftIO $ convertImage opts tmpdir $ T.unpack src
   newPath <-
@@ -221,33 +220,32 @@
     mime = getMimeType fname
     doNothing = return (Right fname)
 
-tectonic2pdf :: Verbosity                       -- ^ Verbosity level
-             -> String                          -- ^ tex program
+tectonic2pdf :: (PandocMonad m, MonadIO m)
+             => String                          -- ^ tex program
              -> [String]                        -- ^ Arguments to the latex-engine
              -> FilePath                        -- ^ temp directory for output
              -> Text                            -- ^ tex source
-             -> PandocIO (Either ByteString ByteString)
-tectonic2pdf verbosity program args tmpDir source = do
-  (exit, log', mbPdf) <- runTectonic verbosity program args tmpDir source
+             -> m (Either ByteString ByteString)
+tectonic2pdf program args tmpDir source = do
+  (exit, log', mbPdf) <- runTectonic program args tmpDir source
   case (exit, mbPdf) of
        (ExitFailure _, _)      -> return $ Left $ extractMsg log'
        (ExitSuccess, Nothing)  -> return $ Left ""
        (ExitSuccess, Just pdf) -> do
-          missingCharacterWarnings verbosity log'
+          missingCharacterWarnings log'
           return $ Right pdf
 
-tex2pdf :: Verbosity                       -- ^ Verbosity level
-        -> String                          -- ^ tex program
+tex2pdf :: (PandocMonad m, MonadIO m)
+        => String                          -- ^ tex program
         -> [String]                        -- ^ Arguments to the latex-engine
         -> FilePath                        -- ^ temp directory for output
         -> Text                            -- ^ tex source
-        -> PandocIO (Either ByteString ByteString)
-tex2pdf verbosity program args tmpDir source = do
+        -> m (Either ByteString ByteString)
+tex2pdf program args tmpDir source = do
   let numruns | takeBaseName program == "latexmk"        = 1
               | "\\tableofcontents" `T.isInfixOf` source = 3  -- to get page numbers
               | otherwise                                = 2  -- 1 run won't give you PDF bookmarks
-  (exit, log', mbPdf) <- runTeXProgram verbosity program args numruns
-                          tmpDir source
+  (exit, log', mbPdf) <- runTeXProgram program args numruns tmpDir source
   case (exit, mbPdf) of
        (ExitFailure _, _)      -> do
           let logmsg = extractMsg log'
@@ -260,11 +258,11 @@
           return $ Left $ logmsg <> extramsg
        (ExitSuccess, Nothing)  -> return $ Left ""
        (ExitSuccess, Just pdf) -> do
-          missingCharacterWarnings verbosity log'
+          missingCharacterWarnings log'
           return $ Right pdf
 
-missingCharacterWarnings :: Verbosity -> ByteString -> PandocIO ()
-missingCharacterWarnings verbosity log' = do
+missingCharacterWarnings :: PandocMonad m => ByteString -> m ()
+missingCharacterWarnings log' = do
   let ls = BC.lines log'
   let isMissingCharacterWarning = BC.isPrefixOf "Missing character: "
   let toCodePoint c
@@ -275,7 +273,6 @@
                  | l <- ls
                  , isMissingCharacterWarning l
                  ]
-  setVerbosity verbosity
   mapM_ (report . MissingCharacter) warnings
 
 -- parsing output
@@ -299,9 +296,10 @@
 
 -- running tex programs
 
-runTectonic :: Verbosity -> String -> [String] -> FilePath
-              -> Text -> PandocIO (ExitCode, ByteString, Maybe ByteString)
-runTectonic verbosity program args' tmpDir' source = do
+runTectonic :: (PandocMonad m, MonadIO m)
+            => String -> [String] -> FilePath
+              -> Text -> m (ExitCode, ByteString, Maybe ByteString)
+runTectonic program args' tmpDir' source = do
     let getOutDir acc (a:b:xs) = if a `elem` ["-o", "--outdir"]
                                     then (reverse acc ++ xs, Just b)
                                     else getOutDir (b:a:acc) xs
@@ -313,6 +311,7 @@
     let sourceBL = BL.fromStrict $ UTF8.fromText source
     let programArgs = ["--outdir", tmpDir] ++ args ++ ["-"]
     env <- liftIO getEnvironment
+    verbosity <- getVerbosity
     when (verbosity >= INFO) $ liftIO $
       showVerboseInfo (Just tmpDir) program programArgs env
          (utf8ToText sourceBL)
@@ -329,7 +328,9 @@
 
 -- read a pdf that has been written to a temporary directory, and optionally read
 -- logs
-getResultingPDF :: Maybe String -> String -> PandocIO (Maybe ByteString, Maybe ByteString)
+getResultingPDF :: (PandocMonad m, MonadIO m)
+                => Maybe String -> String
+                -> m (Maybe ByteString, Maybe ByteString)
 getResultingPDF logFile pdfFile = do
     pdfExists <- liftIO $ doesFileExist pdfFile
     pdf <- if pdfExists
@@ -353,9 +354,10 @@
 -- Run a TeX program on an input bytestring and return (exit code,
 -- contents of stdout, contents of produced PDF if any).  Rerun
 -- a fixed number of times to resolve references.
-runTeXProgram :: Verbosity -> String -> [String] -> Int -> FilePath
-              -> Text -> PandocIO (ExitCode, ByteString, Maybe ByteString)
-runTeXProgram verbosity program args numRuns tmpDir' source = do
+runTeXProgram :: (PandocMonad m, MonadIO m)
+              => String -> [String] -> Int -> FilePath
+              -> Text -> m (ExitCode, ByteString, Maybe ByteString)
+runTeXProgram program args numRuns tmpDir' source = do
     let isOutdirArg x = "-outdir=" `isPrefixOf` x ||
                         "-output-directory=" `isPrefixOf` x
     let tmpDir =
@@ -378,6 +380,7 @@
                 ("TEXMFOUTPUT", tmpDir) :
                   [(k,v) | (k,v) <- env'
                          , k /= "TEXINPUTS" && k /= "TEXMFOUTPUT"]
+    verbosity <- getVerbosity
     when (verbosity >= INFO) $ liftIO $
         UTF8.readFile file >>=
          showVerboseInfo (Just tmpDir) program programArgs env''
@@ -398,16 +401,17 @@
                return (exit, fromMaybe out log', pdf)
     runTeX 1
 
-generic2pdf :: Verbosity
-            -> String
+generic2pdf :: (PandocMonad m, MonadIO m)
+            => String
             -> [String]
             -> Text
-            -> IO (Either ByteString ByteString)
-generic2pdf verbosity program args source = do
-  env' <- getEnvironment
+            -> m (Either ByteString ByteString)
+generic2pdf program args source = do
+  env' <- liftIO getEnvironment
+  verbosity <- getVerbosity
   when (verbosity >= INFO) $
-    showVerboseInfo Nothing program args env' source
-  (exit, out) <- E.catch
+    liftIO $ showVerboseInfo Nothing program args env' source
+  (exit, out) <- liftIO $ E.catch
     (pipeProcess (Just env') program args
                      (BL.fromStrict $ UTF8.fromText source))
     (handlePDFProgramNotFound program)
@@ -454,19 +458,20 @@
                  (ExitSuccess, Nothing)  -> Left ""
                  (ExitSuccess, Just pdf) -> Right pdf
 
-context2pdf :: Verbosity    -- ^ Verbosity level
-            -> String       -- ^ "context" or path to it
+context2pdf :: (PandocMonad m, MonadIO m)
+            => String       -- ^ "context" or path to it
             -> [String]     -- ^ extra arguments
             -> FilePath     -- ^ temp directory for output
             -> Text         -- ^ ConTeXt source
-            -> PandocIO (Either ByteString ByteString)
-context2pdf verbosity program pdfargs tmpDir source =
+            -> m (Either ByteString ByteString)
+context2pdf program pdfargs tmpDir source = do
+  verbosity <- getVerbosity
   liftIO $ inDirectory tmpDir $ do
     let file = "input.tex"
     BS.writeFile file $ UTF8.fromText source
     let programArgs = "--batchmode" : pdfargs ++ [file]
     env' <- getEnvironment
-    when (verbosity >= INFO) $
+    when (verbosity >= INFO) $ liftIO $
       UTF8.readFile file >>=
         showVerboseInfo (Just tmpDir) program programArgs env'
     (exit, out) <- E.catch
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -907,6 +907,7 @@
            let classes' = case attrValue "language" e of
                                 "" -> []
                                 x  -> [x]
+                ++ ["numberLines" | attrValue "linenumbering" e == "numbered"]
            return $ codeBlockWith (attrValue "id" e, classes', [])
                   $ trimNl $ strContentRecursive e
          parseBlockquote = do
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs
--- a/src/Text/Pandoc/Readers/Docx.hs
+++ b/src/Text/Pandoc/Readers/Docx.hs
@@ -246,8 +246,8 @@
 
 parPartToText :: ParPart -> T.Text
 parPartToText (PlainRun run)             = runToText run
-parPartToText (InternalHyperLink _ runs) = T.concat $ map runToText runs
-parPartToText (ExternalHyperLink _ runs) = T.concat $ map runToText runs
+parPartToText (InternalHyperLink _ children) = T.concat $ map parPartToText children
+parPartToText (ExternalHyperLink _ children) = T.concat $ map parPartToText children
 parPartToText _                          = ""
 
 blacklistedCharStyles :: [CharStyleName]
@@ -322,6 +322,7 @@
   (lift . lift) $ P.insertMedia fp Nothing bs
   return $ imageWith (extentToAttr ext) (T.pack fp) title $ text alt
 runToInlines InlineChart = return $ spanWith ("", ["chart"], []) $ text "[CHART]"
+runToInlines InlineDiagram = return $ spanWith ("", ["diagram"], []) $ text "[DIAGRAM]"
 
 extentToAttr :: Extent -> Attr
 extentToAttr (Just (w, h)) =
@@ -434,18 +435,21 @@
   return $ imageWith (extentToAttr ext) (T.pack fp) title $ text alt
 parPartToInlines' Chart =
   return $ spanWith ("", ["chart"], []) $ text "[CHART]"
-parPartToInlines' (InternalHyperLink anchor runs) = do
-  ils <- smushInlines <$> mapM runToInlines runs
+parPartToInlines' Diagram =
+  return $ spanWith ("", ["diagram"], []) $ text "[DIAGRAM]"
+parPartToInlines' (InternalHyperLink anchor children) = do
+  ils <- smushInlines <$> mapM parPartToInlines' children
   return $ link ("#" <> anchor) "" ils
-parPartToInlines' (ExternalHyperLink target runs) = do
-  ils <- smushInlines <$> mapM runToInlines runs
+parPartToInlines' (ExternalHyperLink target children) = do
+  ils <- smushInlines <$> mapM parPartToInlines' children
   return $ link target "" ils
 parPartToInlines' (PlainOMath exps) =
   return $ math $ writeTeX exps
-parPartToInlines' (Field info runs) =
+parPartToInlines' (Field info children) =
   case info of
-    HyperlinkField url -> parPartToInlines' $ ExternalHyperLink url runs
-    UnknownField -> smushInlines <$> mapM runToInlines runs
+    HyperlinkField url -> parPartToInlines' $ ExternalHyperLink url children
+    PagerefField fieldAnchor True -> parPartToInlines' $ InternalHyperLink fieldAnchor children
+    _ -> smushInlines <$> mapM parPartToInlines' children
 parPartToInlines' NullParPart = return mempty
 
 isAnchorSpan :: Inline -> Bool
@@ -532,35 +536,37 @@
 extraAttr :: (Eq (StyleName a), HasStyleName a) => a -> Attr
 extraAttr s = ("", [], [("custom-style", fromStyleName $ getStyleName s)])
 
-parStyleToTransform :: PandocMonad m => ParagraphStyle -> DocxContext m (Blocks -> Blocks)
-parStyleToTransform pPr = case pStyle pPr of
-  c@(getStyleName -> styleName):cs
-    | styleName `elem` divsToKeep -> do
-        let pPr' = pPr { pStyle = cs }
-        transform <- parStyleToTransform pPr'
-        return $ divWith ("", [normalizeToClassName styleName], []) . transform
-    | styleName `elem` listParagraphStyles -> do
-        let pPr' = pPr { pStyle = cs, indentation = Nothing}
-        transform <- parStyleToTransform pPr'
-        return $ divWith ("", [normalizeToClassName styleName], []) . transform
-    | otherwise -> do
-        let pPr' = pPr { pStyle = cs }
-        transform <- parStyleToTransform pPr'
-        styles <- asks (isEnabled Ext_styles . docxOptions)
-        return $
-          (if styles then divWith (extraAttr c) else id)
-          . (if isBlockQuote c then blockQuote else id)
-          . transform
-  []
-    | Just left <- indentation pPr >>= leftParIndent -> do
-        let pPr' = pPr { indentation = Nothing }
-            hang = fromMaybe 0 $ indentation pPr >>= hangingParIndent
-        transform <- parStyleToTransform pPr'
-        return $ if (left - hang) > 0
-                 then blockQuote . transform
-                 else transform
-    | otherwise -> return id
+paragraphStyleToTransform :: PandocMonad m => ParagraphStyle -> DocxContext m (Blocks -> Blocks)
+paragraphStyleToTransform pPr =
+  let stylenames = map getStyleName (pStyle pPr)
+      transform = if (`elem` listParagraphStyles) `any` stylenames || relativeIndent pPr <= 0
+                  then id
+                  else blockQuote
+  in do
+    extStylesEnabled <- asks (isEnabled Ext_styles . docxOptions)
+    return $ foldr (\parStyle transform' ->
+        (parStyleToTransform extStylesEnabled parStyle) . transform'
+      ) transform (pStyle pPr)
 
+parStyleToTransform :: Bool -> ParStyle -> Blocks -> Blocks
+parStyleToTransform extStylesEnabled parStyle@(getStyleName -> styleName)
+  | (styleName `elem` divsToKeep) || (styleName `elem` listParagraphStyles) =
+      divWith ("", [normalizeToClassName styleName], [])
+  | otherwise =
+      (if extStylesEnabled then divWith (extraAttr parStyle) else id)
+      . (if isBlockQuote parStyle then blockQuote else id)
+
+-- The relative indent is the indentation minus the indentation of the parent style.
+-- This tells us whether this paragraph in particular was indented more and thus
+-- should be considered a block quote.
+relativeIndent :: ParagraphStyle -> Integer
+relativeIndent pPr =
+  let pStyleLeft = fromMaybe 0 $ pStyleIndentation pPr >>= leftParIndent
+      pStyleHang = fromMaybe 0 $ pStyleIndentation pPr >>= hangingParIndent
+      left = fromMaybe pStyleLeft $ indentation pPr >>= leftParIndent
+      hang = fromMaybe pStyleHang $ indentation pPr >>= hangingParIndent
+  in (left - hang) - (pStyleLeft - pStyleHang)
+
 normalizeToClassName :: (FromStyleName a) => a -> T.Text
 normalizeToClassName = T.map go . fromStyleName
   where go c | isSpace c = '-'
@@ -578,7 +584,7 @@
       local (\s -> s{ docxInBidi = True })
         (bodyPartToBlocks (Paragraph pPr' parparts))
   | isCodeDiv pPr = do
-      transform <- parStyleToTransform pPr
+      transform <- paragraphStyleToTransform pPr
       return $
         transform $
         codeBlock $
@@ -605,7 +611,7 @@
                           else prevParaIls <> space) <> ils'
                   handleInsertion = do
                     modify $ \s -> s {docxPrevPara = mempty}
-                    transform <- parStyleToTransform pPr'
+                    transform <- paragraphStyleToTransform pPr'
                     return $ transform $ paraOrPlain ils''
               opts <- asks docxOptions
               case (pChange pPr', readerTrackChanges opts) of
@@ -620,7 +626,7 @@
                    , AllChanges) -> do
                       let attr = ("", ["paragraph-insertion"], addAuthorAndDate cAuthor cDate)
                           insertMark = spanWith attr mempty
-                      transform <- parStyleToTransform pPr'
+                      transform <- paragraphStyleToTransform pPr'
                       return $ transform $
                         paraOrPlain $ ils'' <> insertMark
                   (Just (TrackedChange Deletion _), AcceptChanges) -> do
@@ -632,7 +638,7 @@
                    , AllChanges) -> do
                       let attr = ("", ["paragraph-deletion"], addAuthorAndDate cAuthor cDate)
                           insertMark = spanWith attr mempty
-                      transform <- parStyleToTransform pPr'
+                      transform <- paragraphStyleToTransform pPr'
                       return $ transform $
                         paraOrPlain $ ils'' <> insertMark
                   _ -> handleInsertion
diff --git a/src/Text/Pandoc/Readers/Docx/Fields.hs b/src/Text/Pandoc/Readers/Docx/Fields.hs
--- a/src/Text/Pandoc/Readers/Docx/Fields.hs
+++ b/src/Text/Pandoc/Readers/Docx/Fields.hs
@@ -21,8 +21,11 @@
 import Text.Parsec.Text (Parser)
 
 type URL = T.Text
+type Anchor = T.Text
 
 data FieldInfo = HyperlinkField URL
+                -- The boolean indicates whether the field is a hyperlink.
+               | PagerefField Anchor Bool
                | UnknownField
                deriving (Show)
 
@@ -33,6 +36,8 @@
 fieldInfo =
   try (HyperlinkField <$> hyperlink)
   <|>
+  try ((uncurry PagerefField) <$> pageref) 
+  <|>
   return UnknownField
 
 escapedQuote :: Parser T.Text
@@ -72,3 +77,23 @@
               ("\\l", s) : _ -> farg <> "#" <> s
               _              -> farg
   return url
+
+-- See §17.16.5.45
+pagerefSwitch :: Parser (T.Text, T.Text)
+pagerefSwitch = do
+  sw <- string "\\h"
+  spaces
+  farg <- fieldArgument
+  return (T.pack sw, farg)
+
+pageref :: Parser (Anchor, Bool)
+pageref = do
+  many space
+  string "PAGEREF"
+  spaces
+  farg <- fieldArgument
+  switches <- spaces *> many pagerefSwitch
+  let isLink = case switches of
+              ("\\h", _) : _ -> True 
+              _              -> False
+  return (farg, isLink)
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -50,6 +50,7 @@
                                       , archiveToDocxWithWarnings
                                       , getStyleNames
                                       , pHeading
+                                      , pStyleIndentation
                                       , constructBogusParStyleData
                                       , leftBiasedMergeRunStyle
                                       , rowsToRowspans
@@ -92,14 +93,13 @@
                deriving Show
 
 data ReaderState = ReaderState { stateWarnings :: [T.Text]
-                               , stateFldCharState :: FldCharState
+                               , stateFldCharState :: [FldCharState]
                                }
                  deriving Show
 
 data FldCharState = FldCharOpen
                   | FldCharFieldInfo FieldInfo
-                  | FldCharContent FieldInfo [Run]
-                  | FldCharClosed
+                  | FldCharContent FieldInfo [ParPart]
                   deriving (Show)
 
 data DocxError = DocxError
@@ -194,11 +194,6 @@
 data Comments = Comments NameSpaces (M.Map T.Text Element)
               deriving Show
 
-data ParIndentation = ParIndentation { leftParIndent    :: Maybe Integer
-                                     , rightParIndent   :: Maybe Integer
-                                     , hangingParIndent :: Maybe Integer}
-                      deriving Show
-
 data ChangeType = Insertion | Deletion
                 deriving Show
 
@@ -318,12 +313,13 @@
              | CommentStart CommentId Author (Maybe CommentDate) [BodyPart]
              | CommentEnd CommentId
              | BookMark BookMarkId Anchor
-             | InternalHyperLink Anchor [Run]
-             | ExternalHyperLink URL [Run]
+             | InternalHyperLink Anchor [ParPart]
+             | ExternalHyperLink URL [ParPart]
              | Drawing FilePath T.Text T.Text B.ByteString Extent -- title, alt
              | Chart                                              -- placeholder for now
+             | Diagram                                            -- placeholder for now
              | PlainOMath [Exp]
-             | Field FieldInfo [Run]
+             | Field FieldInfo [ParPart]
              | NullParPart      -- when we need to return nothing, but
                                 -- not because of an error.
              deriving Show
@@ -333,6 +329,7 @@
          | Endnote [BodyPart]
          | InlineDrawing FilePath T.Text T.Text B.ByteString Extent -- title, alt
          | InlineChart          -- placeholder
+         | InlineDiagram        -- placeholder
            deriving Show
 
 data RunElem = TextRun T.Text | LnBrk | Tab | SoftHyphen | NoBreakHyphen
@@ -375,7 +372,7 @@
                        , envDocXmlPath = docXmlPath
                        }
       rState = ReaderState { stateWarnings = []
-                           , stateFldCharState = FldCharClosed
+                           , stateFldCharState = []
                            }
       (eitherDoc, st) = runD (archiveToDocument archive) rEnv rState
   case eitherDoc of
@@ -437,6 +434,7 @@
 constructBogusParStyleData :: ParaStyleName -> ParStyle
 constructBogusParStyleData stName = ParStyle
   { headingLev = Nothing
+  , indent = Nothing
   , numInfo = Nothing
   , psParentStyle = Nothing
   , pStyleName = stName
@@ -671,20 +669,6 @@
     return $ Cell (fromMaybe 1 gridSpan) vMerge cellContents
 elemToCell _ _ = throwError WrongElem
 
-elemToParIndentation :: NameSpaces -> Element -> Maybe ParIndentation
-elemToParIndentation ns element | isElem ns "w" "ind" element =
- Just ParIndentation {
-    leftParIndent =
-       findAttrByName ns "w" "left" element >>=
-       stringToInteger
-    , rightParIndent =
-      findAttrByName ns "w" "right" element >>=
-      stringToInteger
-    , hangingParIndent =
-      findAttrByName ns "w" "hanging" element >>=
-      stringToInteger }
-elemToParIndentation _ _ = Nothing
-
 testBitMask :: Text -> Int -> Bool
 testBitMask bitMaskS n =
   case (reads ("0x" ++ T.unpack bitMaskS) :: [(Int, String)]) of
@@ -697,6 +681,9 @@
 pNumInfo :: ParagraphStyle -> Maybe (T.Text, T.Text)
 pNumInfo = getParStyleField numInfo . pStyle
 
+pStyleIndentation :: ParagraphStyle -> Maybe ParIndentation
+pStyleIndentation style = (getParStyleField indent . pStyle) style
+
 elemToBodyPart :: NameSpaces -> Element -> D BodyPart
 elemToBodyPart ns element
   | isElem ns "w" "p" element
@@ -713,28 +700,31 @@
 elemToBodyPart ns element
   | isElem ns "w" "p" element = do
       parstyle <- elemToParagraphStyle ns element <$> asks envParStyles
-      parparts <- mapD (elemToParPart ns) (elChildren element)
+      parparts' <- mapD (elemToParPart ns) (elChildren element)
+      fldCharState <- gets stateFldCharState
+      modify $ \st -> st {stateFldCharState = emptyFldCharContents fldCharState}
       -- Word uses list enumeration for numbered headings, so we only
       -- want to infer a list from the styles if it is NOT a heading.
-      case pHeading parstyle of
-        Nothing | Just (numId, lvl) <- pNumInfo parstyle -> do
-                    levelInfo <- lookupLevel numId lvl <$> asks envNumbering
-                    return $ ListItem parstyle numId lvl levelInfo parparts
-        _ -> let
-          hasCaptionStyle = elem "Caption" (pStyleId <$> pStyle parstyle)
+      let parparts = parparts' ++ (openFldCharsToParParts fldCharState) in
+        case pHeading parstyle of
+          Nothing | Just (numId, lvl) <- pNumInfo parstyle -> do
+                      levelInfo <- lookupLevel numId lvl <$> asks envNumbering
+                      return $ ListItem parstyle numId lvl levelInfo parparts
+          _ -> let
+            hasCaptionStyle = elem "Caption" (pStyleId <$> pStyle parstyle)
 
-          hasSimpleTableField = fromMaybe False $ do
-            fldSimple <- findChildByName ns "w" "fldSimple" element
-            instr <- findAttrByName ns "w" "instr" fldSimple
-            pure ("Table" `elem` T.words instr)
+            hasSimpleTableField = fromMaybe False $ do
+              fldSimple <- findChildByName ns "w" "fldSimple" element
+              instr <- findAttrByName ns "w" "instr" fldSimple
+              pure ("Table" `elem` T.words instr)
 
-          hasComplexTableField = fromMaybe False $ do
-            instrText <- findElementByName ns "w" "instrText" element
-            pure ("Table" `elem` T.words (strContent instrText))
+            hasComplexTableField = fromMaybe False $ do
+              instrText <- findElementByName ns "w" "instrText" element
+              pure ("Table" `elem` T.words (strContent instrText))
 
-          in if hasCaptionStyle && (hasSimpleTableField || hasComplexTableField)
-             then return $ TblCaption parstyle parparts
-             else return $ Paragraph parstyle parparts
+            in if hasCaptionStyle && (hasSimpleTableField || hasComplexTableField)
+              then return $ TblCaption parstyle parparts
+              else return $ Paragraph parstyle parparts
 
 elemToBodyPart ns element
   | isElem ns "w" "tbl" element = do
@@ -766,6 +756,19 @@
   where
     pairs = map (\(Relationship loc relid' target) -> ((loc, relid'), target)) rels
 
+openFldCharsToParParts :: [FldCharState] -> [ParPart]
+openFldCharsToParParts [] = []
+openFldCharsToParParts (FldCharContent info children : ancestors) = case openFldCharsToParParts ancestors of
+  Field parentInfo siblings : _ -> [Field parentInfo $ siblings ++ [Field info $ reverse children]]
+  _ -> [Field info $ reverse children]
+openFldCharsToParParts (_ : ancestors) = openFldCharsToParParts ancestors
+
+emptyFldCharContents :: [FldCharState] -> [FldCharState]
+emptyFldCharContents = map
+  (\x -> case x of
+    FldCharContent info _ -> FldCharContent info []
+    _ -> x)
+
 expandDrawingId :: T.Text -> D (FilePath, B.ByteString)
 expandDrawingId s = do
   location <- asks envLocation
@@ -790,44 +793,6 @@
   in (title, alt)
 
 elemToParPart :: NameSpaces -> Element -> D ParPart
-elemToParPart ns element
-  | isElem ns "w" "r" element
-  , Just drawingElem <- findChildByName ns "w" "drawing" element
-  , pic_ns <- "http://schemas.openxmlformats.org/drawingml/2006/picture"
-  , Just picElem <- findElement (QName "pic" (Just pic_ns) (Just "pic")) drawingElem
-  = let (title, alt) = getTitleAndAlt ns drawingElem
-        a_ns = "http://schemas.openxmlformats.org/drawingml/2006/main"
-        drawing = findElement (QName "blip" (Just a_ns) (Just "a")) picElem
-                  >>= findAttrByName ns "r" "embed"
-    in
-     case drawing of
-       Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp title alt bs $ elemToExtent drawingElem)
-       Nothing -> throwError WrongElem
--- The two cases below are an attempt to deal with images in deprecated vml format.
--- Todo: check out title and attr for deprecated format.
-elemToParPart ns element
-  | isElem ns "w" "r" element
-  , Just _ <- findChildByName ns "w" "pict" element =
-    let drawing = findElement (elemName ns "v" "imagedata") element
-                  >>= findAttrByName ns "r" "id"
-    in
-     case drawing of
-       Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp "" "" bs Nothing)
-       Nothing -> throwError WrongElem
-elemToParPart ns element
-  | isElem ns "w" "r" element
-  , Just objectElem <- findChildByName ns "w" "object" element
-  , Just shapeElem <- findChildByName ns "v" "shape" objectElem
-  , Just imagedataElem <- findChildByName ns "v" "imagedata" shapeElem
-  , Just drawingId <- findAttrByName ns "r" "id" imagedataElem
-  = expandDrawingId drawingId >>= (\(fp, bs) -> return $ Drawing fp "" "" bs Nothing)
--- Chart
-elemToParPart ns element
-  | isElem ns "w" "r" element
-  , Just drawingElem <- findChildByName ns "w" "drawing" element
-  , c_ns <- "http://schemas.openxmlformats.org/drawingml/2006/chart"
-  , Just _ <- findElement (QName "chart" (Just c_ns) (Just "c")) drawingElem
-  = return Chart
 {-
 The next one is a bit complicated. fldChar fields work by first
 having a <w:fldChar fldCharType="begin"> in a run, then a run with
@@ -859,8 +824,13 @@
 So we do this in a number of steps. If we encounter the fldchar begin
 tag, we start open a fldchar state variable (see state above). We add
 the instrtext to it as FieldInfo. Then we close that and start adding
-the runs when we get to separate. Then when we get to end, we produce
-the Field type with appropriate FieldInfo and Runs.
+the children when we get to separate. Then when we get to end, we produce
+the Field type with appropriate FieldInfo and ParParts.
+
+Since there can be nested fields, the fldchar state needs to be a stack,
+so we can have multiple fldchars open at the same time. When a fldchar is
+closed, we either add the resulting field to its parent or we return it if
+there is no parent.
 -}
 elemToParPart ns element
   | isElem ns "w" "r" element
@@ -868,78 +838,142 @@
   , Just fldCharType <- findAttrByName ns "w" "fldCharType" fldChar = do
       fldCharState <- gets stateFldCharState
       case fldCharState of
-        FldCharClosed | fldCharType == "begin" -> do
-          modify $ \st -> st {stateFldCharState = FldCharOpen}
+        _ | fldCharType == "begin" -> do
+          modify $ \st -> st {stateFldCharState = FldCharOpen : fldCharState}
           return NullParPart
-        FldCharFieldInfo info | fldCharType == "separate" -> do
-          modify $ \st -> st {stateFldCharState = FldCharContent info []}
+        FldCharFieldInfo info : ancestors | fldCharType == "separate" -> do
+          modify $ \st -> st {stateFldCharState = FldCharContent info [] : ancestors}
           return NullParPart
-        FldCharContent info runs | fldCharType == "end" -> do
-          modify $ \st -> st {stateFldCharState = FldCharClosed}
-          return $ Field info $ reverse runs
+        -- Some fields have no content, since Pandoc doesn't understand any of those fields, we can just close it.
+        FldCharFieldInfo _ : ancestors | fldCharType == "end" -> do
+          modify $ \st -> st {stateFldCharState = ancestors}
+          return NullParPart
+        [FldCharContent info children] | fldCharType == "end" -> do
+          modify $ \st -> st {stateFldCharState = []}
+          return $ Field info $ reverse children
+        FldCharContent info children : FldCharContent parentInfo siblings : ancestors | fldCharType == "end" ->
+          let parent = FldCharContent parentInfo $ (Field info (reverse children)) : siblings in do
+            modify $ \st -> st {stateFldCharState = parent : ancestors}
+            return NullParPart
         _ -> throwError WrongElem
 elemToParPart ns element
   | isElem ns "w" "r" element
   , Just instrText <- findChildByName ns "w" "instrText" element = do
       fldCharState <- gets stateFldCharState
       case fldCharState of
-        FldCharOpen -> do
+        FldCharOpen : ancestors -> do
           info <- eitherToD $ parseFieldInfo $ strContent instrText
-          modify $ \st -> st{stateFldCharState = FldCharFieldInfo info}
+          modify $ \st -> st {stateFldCharState = FldCharFieldInfo info : ancestors}
           return NullParPart
         _ -> return NullParPart
-elemToParPart ns element
+{-
+There is an open fldchar, so we calculate the element and add it to the
+children. For this we need to first change the fldchar state to an empty
+stack to avoid descendants of children simply being added to the state instead
+of to their direct parent element. This would happen in the case of a
+w:hyperlink element for example.
+-}
+elemToParPart ns element = do
+  fldCharState <- gets stateFldCharState
+  case fldCharState of
+    FldCharContent info children : ancestors -> do
+      modify $ \st -> st {stateFldCharState = []}
+      parPart <- elemToParPart' ns element `catchError` \_ -> return NullParPart
+      modify $ \st -> st{stateFldCharState = FldCharContent info (parPart : children) : ancestors}
+      return NullParPart
+    _ -> elemToParPart' ns element
+
+elemToParPart' :: NameSpaces -> Element -> D ParPart
+elemToParPart' ns element
+  | isElem ns "w" "r" element
+  , Just drawingElem <- findChildByName ns "w" "drawing" element
+  , pic_ns <- "http://schemas.openxmlformats.org/drawingml/2006/picture"
+  , Just picElem <- findElement (QName "pic" (Just pic_ns) (Just "pic")) drawingElem
+  = let (title, alt) = getTitleAndAlt ns drawingElem
+        a_ns = "http://schemas.openxmlformats.org/drawingml/2006/main"
+        drawing = findElement (QName "blip" (Just a_ns) (Just "a")) picElem
+                  >>= findAttrByName ns "r" "embed"
+    in
+     case drawing of
+       Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp title alt bs $ elemToExtent drawingElem)
+       Nothing -> throwError WrongElem
+-- The two cases below are an attempt to deal with images in deprecated vml format.
+-- Todo: check out title and attr for deprecated format.
+elemToParPart' ns element
+  | isElem ns "w" "r" element
+  , Just _ <- findChildByName ns "w" "pict" element =
+    let drawing = findElement (elemName ns "v" "imagedata") element
+                  >>= findAttrByName ns "r" "id"
+    in
+     case drawing of
+       Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp "" "" bs Nothing)
+       Nothing -> throwError WrongElem
+elemToParPart' ns element
+  | isElem ns "w" "r" element
+  , Just objectElem <- findChildByName ns "w" "object" element
+  , Just shapeElem <- findChildByName ns "v" "shape" objectElem
+  , Just imagedataElem <- findChildByName ns "v" "imagedata" shapeElem
+  , Just drawingId <- findAttrByName ns "r" "id" imagedataElem
+  = expandDrawingId drawingId >>= (\(fp, bs) -> return $ Drawing fp "" "" bs Nothing)
+-- Diagram
+elemToParPart' ns element
+  | isElem ns "w" "r" element
+  , Just drawingElem <- findChildByName ns "w" "drawing" element
+  , d_ns <- "http://schemas.openxmlformats.org/drawingml/2006/diagram"
+  , Just _ <- findElement (QName "relIds" (Just d_ns) (Just "dgm")) drawingElem
+  = return Diagram
+-- Chart
+elemToParPart' ns element
+  | isElem ns "w" "r" element
+  , Just drawingElem <- findChildByName ns "w" "drawing" element
+  , c_ns <- "http://schemas.openxmlformats.org/drawingml/2006/chart"
+  , Just _ <- findElement (QName "chart" (Just c_ns) (Just "c")) drawingElem
+  = return Chart
+elemToParPart' ns element
   | isElem ns "w" "r" element = do
     run <- elemToRun ns element
-    -- we check to see if we have an open FldChar in state that we're
-    -- recording.
-    fldCharState <- gets stateFldCharState
-    case fldCharState of
-      FldCharContent info runs -> do
-        modify $ \st -> st{stateFldCharState = FldCharContent info (run : runs)}
-        return NullParPart
-      _ -> return $ PlainRun run
-elemToParPart ns element
+    return $ PlainRun run
+elemToParPart' ns element
   | Just change <- getTrackedChange ns element = do
       runs <- mapD (elemToRun ns) (elChildren element)
       return $ ChangedRuns change runs
-elemToParPart ns element
+elemToParPart' ns element
   | isElem ns "w" "bookmarkStart" element
   , Just bmId <- findAttrByName ns "w" "id" element
   , Just bmName <- findAttrByName ns "w" "name" element =
     return $ BookMark bmId bmName
-elemToParPart ns element
+elemToParPart' ns element
   | isElem ns "w" "hyperlink" element
   , Just relId <- findAttrByName ns "r" "id" element = do
     location <- asks envLocation
-    runs <- mapD (elemToRun ns) (elChildren element)
+    children <- mapD (elemToParPart ns) (elChildren element)
     rels <- asks envRelationships
     case lookupRelationship location relId rels of
       Just target ->
          case findAttrByName ns "w" "anchor" element of
-             Just anchor -> return $ ExternalHyperLink (target <> "#" <> anchor) runs
-             Nothing -> return $ ExternalHyperLink target runs
-      Nothing     -> return $ ExternalHyperLink "" runs
-elemToParPart ns element
+             Just anchor -> return $ ExternalHyperLink (target <> "#" <> anchor) children
+             Nothing -> return $ ExternalHyperLink target children
+      Nothing     -> return $ ExternalHyperLink "" children
+elemToParPart' ns element
   | isElem ns "w" "hyperlink" element
   , Just anchor <- findAttrByName ns "w" "anchor" element = do
-    runs <- mapD (elemToRun ns) (elChildren element)
-    return $ InternalHyperLink anchor runs
-elemToParPart ns element
+    children <- mapD (elemToParPart ns) (elChildren element)
+    return $ InternalHyperLink anchor children
+elemToParPart' ns element
   | isElem ns "w" "commentRangeStart" element
   , Just cmtId <- findAttrByName ns "w" "id" element = do
       (Comments _ commentMap) <- asks envComments
       case M.lookup cmtId commentMap of
         Just cmtElem -> elemToCommentStart ns cmtElem
         Nothing      -> throwError WrongElem
-elemToParPart ns element
+elemToParPart' ns element
   | isElem ns "w" "commentRangeEnd" element
   , Just cmtId <- findAttrByName ns "w" "id" element =
     return $ CommentEnd cmtId
-elemToParPart ns element
+elemToParPart' ns element
   | isElem ns "m" "oMath" element =
     fmap PlainOMath (eitherToD $ readOMML $ showElement element)
-elemToParPart _ _ = throwError WrongElem
+elemToParPart' _ _ = throwError WrongElem
 
 elemToCommentStart :: NameSpaces -> Element -> D ParPart
 elemToCommentStart ns element
@@ -988,6 +1022,11 @@
   , Just _ <- findElement (QName "chart" (Just c_ns) (Just "c")) element
   = return InlineChart
 childElemToRun ns element
+  | isElem ns "w" "drawing" element
+  , c_ns <- "http://schemas.openxmlformats.org/drawingml/2006/diagram"
+  , Just _ <- findElement (QName "relIds" (Just c_ns) (Just "dgm")) element
+  = return InlineDiagram
+childElemToRun ns element
   | isElem ns "w" "footnoteReference" element
   , Just fnId <- findAttrByName ns "w" "id" element = do
     notes <- asks envNotes
@@ -1072,8 +1111,7 @@
     in ParagraphStyle
       {pStyle = mapMaybe (`M.lookup` sty) style
       , indentation =
-          findChildByName ns "w" "ind" pPr >>=
-          elemToParIndentation ns
+          getIndentation ns element
       , dropCap =
           case
             findChildByName ns "w" "framePr" pPr >>=
diff --git a/src/Text/Pandoc/Readers/Docx/Parse/Styles.hs b/src/Text/Pandoc/Readers/Docx/Parse/Styles.hs
--- a/src/Text/Pandoc/Readers/Docx/Parse/Styles.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse/Styles.hs
@@ -21,6 +21,7 @@
   , CharStyle
   , ParaStyleId(..)
   , ParStyle(..)
+  , ParIndentation(..)
   , RunStyle(..)
   , HasStyleName
   , StyleName
@@ -37,6 +38,7 @@
   , fromStyleName
   , fromStyleId
   , stringToInteger
+  , getIndentation
   , getNumInfo
   , elemToRunStyle
   , defaultRunStyle
@@ -115,7 +117,13 @@
                          }
                 deriving Show
 
+data ParIndentation = ParIndentation { leftParIndent    :: Maybe Integer
+                                     , rightParIndent   :: Maybe Integer
+                                     , hangingParIndent :: Maybe Integer}
+                      deriving Show
+
 data ParStyle = ParStyle { headingLev    :: Maybe (ParaStyleName, Int)
+                         , indent        :: Maybe ParIndentation
                          , numInfo       :: Maybe (T.Text, T.Text)
                          , psParentStyle :: Maybe ParStyle
                          , pStyleName    :: ParaStyleName
@@ -290,6 +298,23 @@
   , n > 0 = Just (styleName, fromInteger n)
 getHeaderLevel _ _ = Nothing
 
+getIndentation :: NameSpaces -> Element -> Maybe ParIndentation
+getIndentation ns el = do
+  indElement <- findChildByName ns "w" "pPr" el >>=
+                findChildByName ns "w" "ind"
+  return $ ParIndentation
+    {
+      leftParIndent = findAttrByName ns "w" "left" indElement <|>
+                      findAttrByName ns "w" "start" indElement >>=
+                      stringToInteger
+    , rightParIndent = findAttrByName ns "w" "right" indElement <|>
+                       findAttrByName ns "w" "end" indElement >>=
+                       stringToInteger
+    , hangingParIndent = (findAttrByName ns "w" "hanging" indElement >>= stringToInteger) <|>
+                         fmap negate
+                           (findAttrByName ns "w" "firstLine" indElement >>= stringToInteger)
+    }
+
 getElementStyleName :: Coercible T.Text a => NameSpaces -> Element -> Maybe a
 getElementStyleName ns el = coerce <$>
   ((findChildByName ns "w" "name" el >>= findAttrByName ns "w" "val")
@@ -314,6 +339,7 @@
   = Just $ ParStyle
       {
         headingLev = getHeaderLevel ns element
+      , indent = getIndentation ns element
       , numInfo = getNumInfo ns element
       , psParentStyle = parentStyle
       , pStyleName = styleName
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -551,7 +551,7 @@
   let caption = fromMaybe mempty mbcap
   case B.toList <$> mbimg of
        Just [Image attr _ (url, tit)] ->
-         return $ B.para $ B.imageWith attr url ("fig:" <> tit) caption
+         return $ B.simpleFigureWith attr caption url tit
        _ -> mzero
 
 pCodeBlock :: PandocMonad m => TagParser m Blocks
diff --git a/src/Text/Pandoc/Readers/HTML/Table.hs b/src/Text/Pandoc/Readers/HTML/Table.hs
--- a/src/Text/Pandoc/Readers/HTML/Table.hs
+++ b/src/Text/Pandoc/Readers/HTML/Table.hs
@@ -16,7 +16,7 @@
 module Text.Pandoc.Readers.HTML.Table (pTable) where
 
 import Control.Applicative ((<|>))
-import Data.Maybe (fromMaybe)
+import Data.Maybe (fromMaybe, isJust)
 import Data.Either (lefts, rights)
 import Data.List.NonEmpty (nonEmpty)
 import Data.Text (Text)
@@ -27,12 +27,13 @@
 import Text.Pandoc.Class.PandocMonad (PandocMonad (..))
 import Text.Pandoc.Parsing
   ( eof, lookAhead, many, many1, manyTill, option, optional
-  , optionMaybe, skipMany, try)
+  , optionMaybe, skipMany, try )
 import Text.Pandoc.Readers.HTML.Parsing
 import Text.Pandoc.Readers.HTML.Types (TagParser)
 import Text.Pandoc.Shared (onlySimpleTableCells, safeRead)
 import qualified Data.Text as T
 import qualified Text.Pandoc.Builder as B
+import Control.Monad (guard)
 
 -- | Parses a @<col>@ element, returning the column's width.
 -- An Either value is used:  Left i means a "relative length" with
@@ -183,11 +184,13 @@
            -> TagParser m TableBody
 pTableBody block = try $ do
   skipMany pBlank
-  attribs <- option [] $ getAttribs <$> pSatisfy (matchTagOpen "tbody" [])
-             <* skipMany pBlank
+  mbattribs <- option Nothing $ Just . getAttribs <$>
+                 pSatisfy (matchTagOpen "tbody" []) <* skipMany pBlank
   bodyheads <- many (pHeaderRow block)
-  (rowheads, rows) <- unzip <$> many1 (pRow block <* skipMany pBlank)
+  (rowheads, rows) <- unzip <$> many (pRow block <* skipMany pBlank)
   optional $ pSatisfy (matchTagClose "tbody")
+  guard $ isJust mbattribs || not (null bodyheads && null rows)
+  let attribs = fromMaybe [] mbattribs
   return $ TableBody (toAttr attribs) (foldr max 0 rowheads) bodyheads rows
   where
     getAttribs (TagOpen _ attribs) = attribs
diff --git a/src/Text/Pandoc/Readers/Ipynb.hs b/src/Text/Pandoc/Readers/Ipynb.hs
--- a/src/Text/Pandoc/Readers/Ipynb.hs
+++ b/src/Text/Pandoc/Readers/Ipynb.hs
@@ -19,6 +19,7 @@
 import Data.Maybe (fromMaybe)
 import Data.Digest.Pure.SHA (sha1, showDigest)
 import Text.Pandoc.Options
+import Control.Applicative ((<|>))
 import qualified Data.Scientific as Scientific
 import qualified Text.Pandoc.Builder as B
 import Text.Pandoc.Logging
@@ -94,15 +95,19 @@
              $ B.fromList bs
     Ipynb.Raw -> do
       -- we use ipynb to indicate no format given (a wildcard in nbformat)
-      let format = fromMaybe "ipynb" $ lookup "format" kvs
+      let format = fromMaybe "ipynb" $ lookup "raw_mimetype" kvs <|> lookup "format" kvs
       let format' =
             case format of
-              "text/html"       -> "html"
-              "text/latex"      -> "latex"
-              "application/pdf" -> "latex"
-              "text/markdown"   -> "markdown"
-              "text/x-rsrt"     -> "rst"
-              _                 -> format
+              "text/html"             -> "html"
+              "slides"                -> "html"
+              "text/latex"            -> "latex"
+              "application/pdf"       -> "latex"
+              "pdf"                   -> "latex"
+              "text/markdown"         -> "markdown"
+              "text/x-rst"            -> "rst"
+              "text/restructuredtext" -> "rst"
+              "text/asciidoc"         -> "asciidoc"
+              _                       -> format
       return $ B.divWith ("",["cell","raw"],kvs) $ B.rawBlock format' source
     Ipynb.Code{ codeOutputs = outputs, codeExecutionCount = ec } -> do
       outputBlocks <- mconcat <$> mapM outputToBlock outputs
@@ -191,6 +196,9 @@
 
     dataBlock ("text/latex", TextualData t)
       = return $ B.rawBlock "latex" t
+
+    dataBlock ("text/markdown", TextualData t)
+      = return $ B.rawBlock "markdown" t
 
     dataBlock ("text/plain", TextualData t) =
       return $ B.codeBlock t
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -890,7 +890,7 @@
          addMeta "bibliography" . splitBibs . untokenize))
    , ("addbibresource", mempty <$ (skipopts *> braced >>=
          addMeta "bibliography" . splitBibs . untokenize))
-   , ("endinput", mempty <$ skipMany anyTok)
+   , ("endinput", mempty <$ skipSameFileToks)
    -- includes
    , ("lstinputlisting", inputListing)
    , ("inputminted", inputMinted)
@@ -921,6 +921,10 @@
    , ("epigraph", epigraph)
    ]
 
+skipSameFileToks :: PandocMonad m => LP m ()
+skipSameFileToks = do
+    pos <- getPosition
+    skipMany $ infile (sourceName pos)
 
 environments :: PandocMonad m => M.Map Text (LP m Blocks)
 environments = M.union (tableEnvironments blocks inline) $
@@ -963,6 +967,7 @@
    , ("toggletrue", braced >>= setToggle True)
    , ("togglefalse", braced >>= setToggle False)
    , ("iftoggle", try $ ifToggle >> block)
+   , ("CSLReferences", braced >> braced >> env "CSLReferences" blocks)
    ]
 
 filecontents :: PandocMonad m => LP m Blocks
@@ -1090,24 +1095,25 @@
 
 addImageCaption :: PandocMonad m => Blocks -> LP m Blocks
 addImageCaption = walkM go
-  where go (Image attr@(_, cls, kvs) alt (src,tit))
+  where go p@(Para [Image attr@(_, cls, kvs) _ (src, tit)])
             | not ("fig:" `T.isPrefixOf` tit) = do
           st <- getState
-          let (alt', tit') = case sCaption st of
-                               Just ils -> (toList ils, "fig:" <> tit)
-                               Nothing  -> (alt, tit)
-              attr' = case sLastLabel st of
-                        Just lab -> (lab, cls, kvs)
-                        Nothing  -> attr
-          case attr' of
-               ("", _, _)    -> return ()
-               (ident, _, _) -> do
-                  num <- getNextNumber sLastFigureNum
-                  setState
-                    st{ sLastFigureNum = num
-                      , sLabels = M.insert ident
-                                 [Str (renderDottedNum num)] (sLabels st) }
-          return $ Image attr' alt' (src, tit')
+          case sCaption st of
+            Nothing -> return p
+            Just figureCaption -> do
+              let attr' = case sLastLabel st of
+                            Just lab -> (lab, cls, kvs)
+                            Nothing  -> attr
+              case attr' of
+                   ("", _, _)    -> return ()
+                   (ident, _, _) -> do
+                      num <- getNextNumber sLastFigureNum
+                      setState
+                        st{ sLastFigureNum = num
+                          , sLabels = M.insert ident
+                                     [Str (renderDottedNum num)] (sLabels st) }
+
+              return $ SimpleFigure attr' (B.toList figureCaption) (src, tit)
         go x = return x
 
 coloredBlock :: PandocMonad m => Text -> LP m Blocks
diff --git a/src/Text/Pandoc/Readers/LaTeX/Inline.hs b/src/Text/Pandoc/Readers/LaTeX/Inline.hs
--- a/src/Text/Pandoc/Readers/LaTeX/Inline.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/Inline.hs
@@ -35,7 +35,7 @@
 import Text.Pandoc.Extensions (extensionEnabled, Extension(..))
 import Text.Pandoc.Parsing (getOption, updateState, getState, notFollowedBy,
                             manyTill, getInput, setInput, incSourceColumn,
-                            option, many1, try)
+                            option, many1)
 import Data.Char (isDigit)
 import Text.Pandoc.Highlighting (fromListingsLanguage,)
 import Data.Maybe (maybeToList, fromMaybe)
@@ -160,8 +160,8 @@
 
 accentWith :: PandocMonad m
            => LP m Inlines -> Char -> Maybe Char -> LP m Inlines
-accentWith tok combiningAccent fallBack = try $ do
-  ils <- tok
+accentWith tok combiningAccent fallBack = do
+  ils <- option mempty tok
   case toList ils of
        (Str (T.uncons -> Just (x, xs)) : ys) -> return $ fromList $
          -- try to normalize to the combined character:
diff --git a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
--- a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
@@ -45,6 +45,7 @@
   , isNewlineTok
   , isWordTok
   , isArgTok
+  , infile
   , spaces
   , spaces1
   , tokTypeIn
@@ -646,6 +647,9 @@
 isArgTok (Tok _ (Arg _) _) = True
 isArgTok _                 = False
 
+infile :: PandocMonad m => SourceName -> LP m Tok
+infile reference = satisfyTok (\(Tok source _ _) -> (sourceName source) == reference)
+
 spaces :: PandocMonad m => LP m ()
 spaces = skipMany (satisfyTok (tokTypeIn [Comment, Spaces, Newline]))
 
@@ -937,12 +941,19 @@
              void $ count 4 braced
            "def" ->
              void $ manyTill anyTok braced
+           "vadjust" ->
+             void (manyTill anyTok braced) <|>
+                void (satisfyTok isPreTok) -- see #7531
            _ | isFontSizeCommand name -> return ()
              | otherwise -> do
                skipopts
                option "" (try dimenarg)
                void $ many braced
   return $ txt <> untokenize rawargs
+
+isPreTok :: Tok -> Bool
+isPreTok (Tok _ Word "pre") = True
+isPreTok _ = False
 
 isDigitTok :: Tok -> Bool
 isDigitTok (Tok _ Word t) = T.all isDigit t
diff --git a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs
--- a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs
@@ -23,11 +23,15 @@
                  => LP m Inlines -> M.Map Text (LP m Inlines)
 siunitxCommands tok = M.fromList
   [ ("si", dosi tok)
+  , ("unit", dosi tok) -- v3 version of si
   , ("SI", doSI tok)
+  , ("qty", doSI tok) -- v3 version of SI
   , ("SIrange", doSIrange True tok)
+  , ("qtyrange", doSIrange True tok) -- v3 version of SIrange
+  , ("SIlist", doSIlist tok)
+  , ("qtylist", doSIlist tok) -- v3 version of SIlist
   , ("numrange", doSIrange False tok)
   , ("numlist", doSInumlist)
-  , ("SIlist", doSIlist tok)
   , ("num", doSInum)
   , ("ang", doSIang)
   ]
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -198,6 +198,7 @@
         go openBrackets =
           (() <$ (escapedChar <|>
                 code <|>
+                math <|>
                 rawHtmlInline <|>
                 rawLaTeXInline') >> go openBrackets)
           <|>
@@ -326,6 +327,7 @@
 referenceKey = try $ do
   pos <- getPosition
   skipNonindentSpaces
+  notFollowedBy (void cite)
   (_,raw) <- reference
   char ':'
   skipSpaces >> optional newline >> skipSpaces >> notFollowedBy (char '[')
@@ -829,7 +831,7 @@
 listLineCommon = T.concat <$> manyTill
               (  many1Char (satisfy $ \c -> c `notElem` ['\n', '<', '`'])
              <|> fmap snd (withRaw code)
-             <|> fmap snd (htmlTag isCommentTag)
+             <|> fmap (renderTags . (:[]) . fst) (htmlTag isCommentTag)
              <|> countChar 1 anyChar
               ) newline
 
@@ -1013,19 +1015,18 @@
 para :: PandocMonad m => MarkdownParser m (F Blocks)
 para = try $ do
   exts <- getOption readerExtensions
-  let implicitFigures x
-       | extensionEnabled Ext_implicit_figures exts = do
-         x' <- x
-         case B.toList x' of
-               [Image attr alt (src,tit)]
-                 | not (null alt) ->
-                    -- the fig: at beginning of title indicates a figure
-                    return $ B.singleton
-                           $ Image attr alt (src, "fig:" <> tit)
-               _ -> return x'
-       | otherwise = x
-  result <- implicitFigures . trimInlinesF <$> inlines1
-  option (B.plain <$> result)
+
+  result <- trimInlinesF <$> inlines1
+  let figureOr constr inlns =
+        case B.toList inlns of
+          [Image attr figCaption (src, tit)]
+            | extensionEnabled Ext_implicit_figures exts
+            , not (null figCaption) -> do
+                B.simpleFigureWith attr (B.fromList figCaption) src tit
+
+          _ -> constr inlns
+
+  option (figureOr B.plain <$> result)
     $ try $ do
             newline
             (mempty <$ blanklines)
@@ -1047,7 +1048,7 @@
                      if divLevel > 0
                         then lookAhead divFenceEnd
                         else mzero
-            return $ B.para <$> result
+            return $ figureOr B.para <$> result
 
 plain :: PandocMonad m => MarkdownParser m (F Blocks)
 plain = fmap B.plain . trimInlinesF <$> inlines1
@@ -1124,7 +1125,12 @@
   let selfClosing = "/>" `T.isSuffixOf` raw
   -- we don't want '<td>    text' to be a code block:
   skipMany spaceChar
-  indentlevel <- (blankline >> length <$> many (char ' ')) <|> return 0
+  tabStop <- getOption readerTabStop
+  indentlevel <- option 0 $
+                 do blankline
+                    sum <$> many ( (1 <$ char ' ')
+                                   <|>
+                                   (tabStop <$ char '\t') )
   -- try to find closing tag
   -- we set stateInHtmlBlock so that closing tags that can be either block or
   -- inline will not be parsed as inline tags
@@ -1775,8 +1781,8 @@
 -- a reference label for a link
 reference :: PandocMonad m => MarkdownParser m (F Inlines, Text)
 reference = do
-  guardDisabled Ext_footnotes <|> notFollowedBy' (string "[^")
-  guardDisabled Ext_citations <|> notFollowedBy' (string "[@")
+  -- guardDisabled Ext_footnotes <|> notFollowedBy' (string "[^")
+  -- guardDisabled Ext_citations <|> notFollowedBy' (string "[@")
   withRaw $ trimInlinesF <$> inlinesInBalancedBrackets
 
 parenthesizedChars :: PandocMonad m => MarkdownParser m Text
@@ -2195,6 +2201,7 @@
   citations <- citeList
   spnl
   char ']'
+  notFollowedBy (oneOf "{([")  -- not a link or a bracketed span
   return citations
 
 suffix :: PandocMonad m => MarkdownParser m (F Inlines)
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -201,7 +201,12 @@
   contents <- trimInlines . mconcat <$> many1 inline
   if F.all (==Space) contents
      then return mempty
-     else return $ B.para contents
+     else case B.toList contents of
+         -- For the MediaWiki format all images are considered figures
+         [Image attr figureCaption (src, title)] ->
+             return $ B.simpleFigureWith
+                 attr (B.fromList figureCaption) src title
+         _ -> return $ B.para contents
 
 table :: PandocMonad m => MWParser m Blocks
 table = do
@@ -631,7 +636,7 @@
   let attr = ("", [], kvs)
   caption <-   (B.str fname <$ sym "]]")
            <|> try (char '|' *> (mconcat <$> manyTill inline (sym "]]")))
-  return $ B.imageWith attr fname ("fig:" <> stringify caption) caption
+  return $ B.imageWith attr fname (stringify caption) caption
 
 imageOption :: PandocMonad m => MWParser m Text
 imageOption = try $ char '|' *> opt
diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs
--- a/src/Text/Pandoc/Readers/Org/Blocks.hs
+++ b/src/Text/Pandoc/Readers/Org/Blocks.hs
@@ -474,15 +474,16 @@
        figCaption = fromMaybe mempty $ blockAttrCaption figAttrs
        figKeyVals = blockAttrKeyValues figAttrs
        attr       = (figLabel, mempty, figKeyVals)
-       figTitle   = (if isFigure then withFigPrefix else id) figName
-     in
-       B.para . B.imageWith attr imgSrc figTitle <$> figCaption
-
-   withFigPrefix :: Text -> Text
-   withFigPrefix cs =
-     if "fig:" `T.isPrefixOf` cs
-     then cs
-     else "fig:" <> cs
+     in if isFigure
+           then (\c ->
+               B.simpleFigureWith
+                   attr c imgSrc (unstackFig figName)) <$> figCaption
+           else B.para . B.imageWith attr imgSrc figName <$> figCaption
+   unstackFig :: Text -> Text
+   unstackFig figName =
+       if "fig:" `T.isPrefixOf` figName
+           then T.drop 4 figName
+           else figName
 
 -- | Succeeds if looking at the end of the current paragraph
 endOfParagraph :: Monad m => OrgParser m ()
@@ -889,7 +890,10 @@
   firstLine <- anyLineNewline
   blank <- option "" ("\n" <$ blankline)
   rest <- T.concat <$> many (listContinuation markerLength)
-  contents <- parseFromString blocks $ firstLine <> blank <> rest
+  contents <- parseFromString (do initial <- paraOrPlain <|> pure mempty
+                                  subsequent <- blocks
+                                  return $ initial <> subsequent)
+                (firstLine <> blank <> rest)
   return (maybe id (prependInlines . checkboxToInlines) box <$> contents)
 
 -- | Prepend inlines to blocks, adding them to the first paragraph or
diff --git a/src/Text/Pandoc/Readers/Org/DocumentTree.hs b/src/Text/Pandoc/Readers/Org/DocumentTree.hs
--- a/src/Text/Pandoc/Readers/Org/DocumentTree.hs
+++ b/src/Text/Pandoc/Readers/Org/DocumentTree.hs
@@ -41,6 +41,7 @@
              -> OrgParser m (F Inlines)
              -> OrgParser m (F Headline)
 documentTree blocks inline = do
+  properties <- option mempty propertiesDrawer
   initialBlocks <- blocks
   headlines <- sequence <$> manyTill (headline blocks inline 1) eof
   title <- fmap docTitle . orgStateMeta <$> getState
@@ -54,7 +55,7 @@
       , headlineText = B.fromList title'
       , headlineTags = mempty
       , headlinePlanning = emptyPlanning
-      , headlineProperties = mempty
+      , headlineProperties = properties
       , headlineContents = initialBlocks'
       , headlineChildren = headlines'
       }
@@ -163,8 +164,15 @@
   in if not usingSelectedTags ||
         any (`Set.member` orgStateSelectTags st) (headlineTags rootNode')
         then do headlineBlocks <- headlineToBlocks rootNode'
+                -- add metadata from root node :PROPERTIES:
+                updateState $ \s ->
+                  s{ orgStateMeta = foldr
+                    (\(PropertyKey k, PropertyValue v) m ->
+                        B.setMeta k v <$> m)
+                    (orgStateMeta s)
+                    (headlineProperties rootNode') }
                 -- ignore first headline, it's the document's title
-                return . drop 1 . B.toList $ headlineBlocks
+                return $ drop 1 $ B.toList headlineBlocks
         else do headlineBlocks <- mconcat <$> mapM headlineToBlocks
                                                    (headlineChildren rootNode')
                 return . B.toList $ headlineBlocks
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -725,8 +725,8 @@
         "figure" -> do
            (caption, legend) <- parseFromString' extractCaption body'
            let src = escapeURI $ trim top
-           return $ B.para (B.imageWith (imgAttr "figclass") src "fig:"
-                       caption) <> legend
+           return $ B.simpleFigureWith
+               (imgAttr "figclass") caption src "" <> legend
         "image" -> do
            let src = escapeURI $ trim top
            let alt = B.str $ maybe "image" trim $ lookup "alt" fields
@@ -1155,10 +1155,11 @@
   let rn = try $ do
              string ".. _"
              ref <- quotedReferenceName
-                  <|> manyChar (  noneOf ":\n"
+                  <|> manyChar (  noneOf "\\:\n"
                               <|> try (char '\n' <*
                                        string "   " <*
                                        notFollowedBy blankline)
+                              <|> try (char '\\' *> char ':')
                               <|> try (char ':' <* lookAhead alphaNum)
                                )
              char ':'
diff --git a/src/Text/Pandoc/Readers/RTF.hs b/src/Text/Pandoc/Readers/RTF.hs
--- a/src/Text/Pandoc/Readers/RTF.hs
+++ b/src/Text/Pandoc/Readers/RTF.hs
@@ -31,7 +31,7 @@
 import Text.Pandoc.Options
 import Text.Pandoc.Parsing
 import Text.Pandoc.Shared (safeRead, tshow)
-import Data.Char (isAlphaNum, chr, digitToInt, isAscii, isLetter, isSpace)
+import Data.Char (isAlphaNum, chr, isAscii, isLetter, isSpace, ord)
 import qualified Data.ByteString.Lazy as BL
 import Data.Digest.Pure.SHA (sha1, showDigest)
 import Data.Maybe (mapMaybe, fromMaybe)
@@ -204,7 +204,13 @@
   skipMany nl
   toks <- many tok
   -- return $! traceShowId toks
-  bs <- (foldM processTok mempty toks >>= emitBlocks)
+  bs <- (case toks of
+          -- if we start with {\rtf1...}, parse that and ignore
+          -- what follows (which in certain cases can be non-RTF content)
+          rtftok@(Tok _ (Grouped (Tok _ (ControlWord "rtf" (Just 1)) : _))) : _
+            -> foldM processTok mempty [rtftok]
+          _ -> foldM processTok mempty toks)
+        >>= emitBlocks
   unclosed <- closeContainers
   let doc = B.doc $ bs <> unclosed
   kvs <- sMetadata <$> getState
@@ -217,6 +223,7 @@
     ControlWord Text (Maybe Int)
   | ControlSymbol Char
   | UnformattedText Text
+  | BinData BL.ByteString
   | HexVal Word8
   | Grouped [Tok]
   deriving (Show, Eq)
@@ -228,9 +235,22 @@
  where
   controlThing = do
     char '\\' *>
-      ( (ControlWord <$> letterSequence <*> (parameter <* optional delimChar))
+      ( binData
+     <|> (ControlWord <$> letterSequence <*> (parameter <* optional delimChar))
      <|> (HexVal <$> hexVal)
      <|> (ControlSymbol <$> anyChar) )
+  binData = try $ do
+    string "bin" <* notFollowedBy letter
+    n <- fromMaybe 0 <$> parameter
+    spaces
+    -- NOTE: We assume here that if the document contains binary
+    -- data, it will not be valid UTF-8 and hence it will have been
+    -- read as latin1, so we can recover the data in the following
+    -- way.  This is probably not completely reliable, but I don't
+    -- know if we can do better without making this reader take
+    -- a ByteString input.
+    dat <- BL.pack . map (fromIntegral . ord) <$> count n anyChar
+    return $ BinData dat
   parameter = do
     hyph <- string "-" <|> pure ""
     rest <- many digit
@@ -389,15 +409,15 @@
 processTok :: PandocMonad m => Blocks -> Tok -> RTFParser m Blocks
 processTok bs (Tok pos tok') = do
   setPosition pos
-  -- ignore \* at beginning of group:
-  let tok'' = case tok' of
-                Grouped (Tok _ (ControlSymbol '*') : toks) -> Grouped toks
-                _ -> tok'
-  case tok'' of
+  case tok' of
     HexVal{} -> return ()
     UnformattedText{} -> return ()
     _ -> updateState $ \s -> s{ sEatChars = 0 }
-  case tok'' of
+  case tok' of
+    Grouped (Tok _ (ControlSymbol '*') : toks) ->
+      bs <$ (do oldTextContent <- sTextContent <$> getState
+                processTok mempty (Tok pos (Grouped toks))
+                updateState $ \st -> st{ sTextContent = oldTextContent })
     Grouped (Tok _ (ControlWord "fonttbl" _) : toks) -> inGroup $ do
       updateState $ \s -> s{ sFontTable = processFontTable toks }
       pure bs
@@ -411,6 +431,7 @@
       -- eject any previous list items...sometimes TextEdit
       -- doesn't put in a \par
       emitBlocks bs
+    Grouped (Tok _ (ControlWord "pgdsc" _) : _) -> pure bs
     Grouped (Tok _ (ControlWord "colortbl" _) : _) -> pure bs
     Grouped (Tok _ (ControlWord "listtable" _) : toks) ->
       bs <$ inGroup (handleListTable toks)
@@ -433,10 +454,10 @@
       -- TODO ideally we'd put the span around bkmkstart/end, but this
       -- is good for now:
       modifyGroup (\g -> g{ gAnchor = Just $ T.strip t })
-      addText ""
+      pure bs
+    Grouped (Tok _ (ControlWord "bkmkend" _) : _) -> do
       modifyGroup (\g -> g{ gAnchor = Nothing })
       pure bs
-    Grouped (Tok _ (ControlWord "bkmkend" _) : _) -> pure bs -- TODO
     Grouped (Tok _ (ControlWord f _) : _) | isHeaderFooter f -> pure bs
     Grouped (Tok _ (ControlWord "footnote" _) : toks) -> do
       noteBs <- inGroup $ processDestinationToks toks
@@ -853,14 +874,10 @@
 handlePict toks = do
   let pict = foldl' getPictData def toks
   let altText = "image"
-  let binToWord = T.foldl' (\acc x -> acc * 2 + fromIntegral (digitToInt x)) 0
-  let isBinaryDigit '0' = True
-      isBinaryDigit '1' = True
-      isBinaryDigit _   = False
-  let bytes = BL.pack $
-              if picBinary pict && T.all isBinaryDigit (picData pict)
-                 then map binToWord $ T.chunksOf 8 $ picData pict
-                 else map hexToWord $ T.chunksOf 2 $ picData pict
+  let bytes =
+        if picBinary pict
+           then picBytes pict
+           else BL.pack $ map hexToWord $ T.chunksOf 2 $ picData pict
   let (mimetype, ext) =
         case picType pict of
           Just Emfblip -> (Just "image/x-emf", ".emf")
@@ -887,7 +904,8 @@
       ControlWord "pich" (Just h) -> pict{ picHeight = Just h }
       ControlWord "picwgoal" (Just w) -> pict{ picWidthGoal = Just w }
       ControlWord "pichgoal" (Just h) -> pict{ picHeightGoal = Just h }
-      ControlWord "bin" _ -> pict{ picBinary = True }
+      BinData d | not (BL.null d)
+                  -> pict{ picBinary = True, picBytes = picBytes pict <> d }
       UnformattedText t -> pict{ picData = t }
       _ -> pict
 
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -60,18 +60,6 @@
 convertTags [] = return []
 convertTags (t@TagOpen{}:ts)
   | fromAttrib "data-external" t == "1" = (t:) <$> convertTags ts
-convertTags (t@(TagOpen tagname as):ts)
-  | any (isSourceAttribute tagname) as
-     = do
-       as' <- mapM processAttribute as
-       rest <- convertTags ts
-       return $ TagOpen tagname as' : rest
-  where processAttribute (x,y) =
-           if isSourceAttribute tagname (x,y)
-              then do
-                enc <- getDataURI (fromAttrib "type" t) y
-                return (x, enc)
-              else return (x,y)
 convertTags (t@(TagOpen "script" as):TagClose "script":ts) =
   case fromAttrib "src" t of
        ""  -> (t:) <$> convertTags ts
@@ -125,6 +113,18 @@
                       return $ TagOpen "link"
                        (("href",makeDataURI (mime, bs)) :
                          [(x,y) | (x,y) <- as, x /= "href"]) : rest
+convertTags (t@(TagOpen tagname as):ts)
+  | any (isSourceAttribute tagname) as
+     = do
+       as' <- mapM processAttribute as
+       rest <- convertTags ts
+       return $ TagOpen tagname as' : rest
+  where processAttribute (x,y) =
+           if isSourceAttribute tagname (x,y)
+              then do
+                enc <- getDataURI (fromAttrib "type" t) y
+                return (x, enc)
+              else return (x,y)
 convertTags (t:ts) = (t:) <$> convertTags ts
 
 cssURLs :: PandocMonad m
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -68,7 +68,6 @@
                      makeMeta,
                      eastAsianLineBreakFilter,
                      htmlSpanLikeElements,
-                     splitSentences,
                      filterIpynbOutput,
                      -- * TagSoup HTML handling
                      renderTags',
@@ -708,33 +707,6 @@
 -- the element tag itself.
 htmlSpanLikeElements :: Set.Set T.Text
 htmlSpanLikeElements = Set.fromList ["kbd", "mark", "dfn"]
-
--- | Returns the first sentence in a list of inlines, and the rest.
-breakSentence :: [Inline] -> ([Inline], [Inline])
-breakSentence [] = ([],[])
-breakSentence xs =
-  let isSentenceEndInline (Str ys)
-        | Just (_, c) <- T.unsnoc ys = c == '.' || c == '?'
-      isSentenceEndInline LineBreak  = True
-      isSentenceEndInline _          = False
-      (as, bs) = break isSentenceEndInline xs
-  in  case bs of
-        []             -> (as, [])
-        [c]            -> (as ++ [c], [])
-        (c:Space:cs)   -> (as ++ [c], cs)
-        (c:SoftBreak:cs) -> (as ++ [c], cs)
-        (Str ".":Str s@(T.uncons -> Just (')',_)):cs)
-          -> (as ++ [Str ".", Str s], cs)
-        (x@(Str (T.stripPrefix ".)" -> Just _)):cs) -> (as ++ [x], cs)
-        (LineBreak:x@(Str (T.uncons -> Just ('.',_))):cs) -> (as ++[LineBreak], x:cs)
-        (c:cs)         -> (as ++ [c] ++ ds, es)
-          where (ds, es) = breakSentence cs
-
--- | Split a list of inlines into sentences.
-splitSentences :: [Inline] -> [[Inline]]
-splitSentences xs =
-  let (sent, rest) = breakSentence xs
-  in  if null rest then [sent] else sent : splitSentences rest
 
 -- | Process ipynb output cells.  If mode is Nothing,
 -- remove all output.  If mode is Just format, select
diff --git a/src/Text/Pandoc/Translations.hs b/src/Text/Pandoc/Translations.hs
--- a/src/Text/Pandoc/Translations.hs
+++ b/src/Text/Pandoc/Translations.hs
@@ -31,7 +31,6 @@
 where
 import Data.Aeson.Types (Value(..), FromJSON(..))
 import qualified Data.Aeson.Types as Aeson
-import qualified Data.HashMap.Strict as HM
 import qualified Data.Map as M
 import qualified Data.Text as T
 import qualified Data.YAML as YAML
@@ -83,8 +82,8 @@
   parseYAML invalid = YAML.typeMismatch "Term" invalid
 
 instance FromJSON Translations where
-  parseJSON (Object hm) = do
-    xs <- mapM addItem (HM.toList hm)
+  parseJSON o@(Object{}) = do
+    xs <- parseJSON o >>= mapM addItem . M.toList
     return $ Translations (M.fromList xs)
     where addItem (k,v) =
             case safeRead k of
diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs
--- a/src/Text/Pandoc/Writers/AsciiDoc.hs
+++ b/src/Text/Pandoc/Writers/AsciiDoc.hs
@@ -21,7 +21,7 @@
 module Text.Pandoc.Writers.AsciiDoc (writeAsciiDoc, writeAsciiDoctor) where
 import Control.Monad.State.Strict
 import Data.Char (isPunctuation, isSpace)
-import Data.List (intercalate, intersperse)
+import Data.List (delete, intercalate, intersperse)
 import Data.List.NonEmpty (NonEmpty(..))
 import Data.Maybe (fromMaybe, isJust)
 import qualified Data.Set as Set
@@ -149,9 +149,8 @@
 blockToAsciiDoc opts (Plain inlines) = do
   contents <- inlineListToAsciiDoc opts inlines
   return $ contents <> blankline
-blockToAsciiDoc opts (Para [Image attr alternate (src,tgt)])
+blockToAsciiDoc opts (SimpleFigure attr alternate (src, tit))
   -- image::images/logo.png[Company logo, title="blah"]
-  | Just tit <- T.stripPrefix "fig:" tgt
   = (\args -> "image::" <> args <> blankline) <$>
     imageArguments opts attr alternate src tit
 blockToAsciiDoc opts (Para inlines) = do
@@ -193,7 +192,10 @@
      then "...." $$ literal str $$ "...."
      else attrs $$ "----" $$ literal str $$ "----")
   <> blankline
-    where attrs = "[" <> literal (T.intercalate "," ("source" : classes)) <> "]"
+    where attrs = "[" <> literal (T.intercalate "," classes') <> "]"
+          classes' = if "numberLines" `elem` classes
+                        then "source%linesnum" : delete "numberLines" classes
+                        else "source" : classes
 blockToAsciiDoc opts (BlockQuote blocks) = do
   contents <- blockListToAsciiDoc opts blocks
   let isBlock (BlockQuote _) = True
@@ -546,6 +548,7 @@
 -- or my@email.com[email john]
   linktext <- inlineListToAsciiDoc opts txt
   let isRelative = T.all (/= ':') src
+  let needsPassthrough = "--" `T.isInfixOf` src
   let prefix = if isRelative
                   then text "link:"
                   else empty
@@ -553,9 +556,16 @@
   let useAuto = case txt of
                       [Str s] | escapeURI s == srcSuffix -> True
                       _       -> False
-  return $ if useAuto
-              then literal srcSuffix
-              else prefix <> literal src <> "[" <> linktext <> "]"
+  return $
+    if needsPassthrough
+       then
+         if useAuto
+            then "link:++" <> literal srcSuffix <> "++[]"
+            else "link:++" <> literal src <> "++[" <> linktext <> "]"
+       else
+         if useAuto
+            then literal srcSuffix
+            else prefix <> literal src <> "[" <> linktext <> "]"
 inlineToAsciiDoc opts (Image attr alternate (src, tit)) =
   ("image:" <>) <$> imageArguments opts attr alternate src tit
 inlineToAsciiDoc opts (Note [Para inlines]) =
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -162,10 +162,7 @@
   innerContents <- blockListToConTeXt xs
   return $ header' $$ innerContents $$ footer'
 blockToConTeXt (Plain lst) = inlineListToConTeXt lst
--- title beginning with fig: indicates that the image is a figure
-blockToConTeXt (Para [Image attr txt (src,tgt)])
-  | Just _ <- T.stripPrefix "fig:" tgt
-  = do
+blockToConTeXt (SimpleFigure attr txt (src, _)) = do
       capt <- inlineListToConTeXt txt
       img  <- inlineToConTeXt (Image attr txt (src, ""))
       let (ident, _, _) = attr
diff --git a/src/Text/Pandoc/Writers/Custom.hs b/src/Text/Pandoc/Writers/Custom.hs
--- a/src/Text/Pandoc/Writers/Custom.hs
+++ b/src/Text/Pandoc/Writers/Custom.hs
@@ -1,5 +1,8 @@
-{-# LANGUAGE FlexibleInstances  #-}
-{-# LANGUAGE OverloadedStrings  #-}
+{-# LANGUAGE FlexibleContexts    #-}
+{-# LANGUAGE FlexibleInstances   #-}
+{-# LANGUAGE OverloadedStrings   #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeApplications    #-}
 {- |
    Module      : Text.Pandoc.Writers.Custom
    Copyright   : Copyright (C) 2012-2021 John MacFarlane
@@ -10,7 +13,7 @@
    Portability : portable
 
 Conversion of 'Pandoc' documents to custom markup using
-a lua writer.
+a Lua writer.
 -}
 module Text.Pandoc.Writers.Custom ( writeCustom ) where
 import Control.Arrow ((***))
@@ -20,49 +23,51 @@
 import qualified Data.Map as M
 import qualified Data.Text as T
 import Data.Text (Text, pack)
-import Foreign.Lua (Lua, Pushable)
+import HsLua as Lua hiding (Operation (Div), render)
+import HsLua.Class.Peekable (PeekError)
 import Text.DocLayout (render, literal)
-import Text.Pandoc.Class.PandocIO (PandocIO)
+import Control.Monad.IO.Class (MonadIO)
 import Text.Pandoc.Definition
 import Text.Pandoc.Lua (Global (..), runLua, setGlobals)
 import Text.Pandoc.Lua.Util (addField, dofileWithTraceback)
 import Text.Pandoc.Options
+import Text.Pandoc.Class (PandocMonad)
 import Text.Pandoc.Templates (renderTemplate)
 import Text.Pandoc.Writers.Shared
 
-import qualified Foreign.Lua as Lua
-
 attrToMap :: Attr -> M.Map T.Text T.Text
 attrToMap (id',classes,keyvals) = M.fromList
     $ ("id", id')
     : ("class", T.unwords classes)
     : keyvals
 
-newtype Stringify a = Stringify a
+newtype Stringify e a = Stringify a
 
-instance Pushable (Stringify Format) where
+instance Pushable (Stringify e Format) where
   push (Stringify (Format f)) = Lua.push (T.toLower f)
 
-instance Pushable (Stringify [Inline]) where
-  push (Stringify ils) = Lua.push =<< inlineListToCustom ils
+instance PeekError e => Pushable (Stringify e [Inline]) where
+  push (Stringify ils) = Lua.push =<<
+    changeErrorType ((inlineListToCustom @e) ils)
 
-instance Pushable (Stringify [Block]) where
-  push (Stringify blks) = Lua.push =<< blockListToCustom blks
+instance PeekError e => Pushable (Stringify e [Block]) where
+  push (Stringify blks) = Lua.push =<<
+    changeErrorType ((blockListToCustom @e) blks)
 
-instance Pushable (Stringify MetaValue) where
-  push (Stringify (MetaMap m))       = Lua.push (fmap Stringify m)
-  push (Stringify (MetaList xs))     = Lua.push (map Stringify xs)
+instance PeekError e => Pushable (Stringify e MetaValue) where
+  push (Stringify (MetaMap m))       = Lua.push (fmap (Stringify @e) m)
+  push (Stringify (MetaList xs))     = Lua.push (map (Stringify @e) xs)
   push (Stringify (MetaBool x))      = Lua.push x
   push (Stringify (MetaString s))    = Lua.push s
-  push (Stringify (MetaInlines ils)) = Lua.push (Stringify ils)
-  push (Stringify (MetaBlocks bs))   = Lua.push (Stringify bs)
+  push (Stringify (MetaInlines ils)) = Lua.push (Stringify @e ils)
+  push (Stringify (MetaBlocks bs))   = Lua.push (Stringify @e bs)
 
-instance Pushable (Stringify Citation) where
+instance PeekError e => Pushable (Stringify e Citation) where
   push (Stringify cit) = do
     Lua.createtable 6 0
     addField "citationId" $ citationId cit
-    addField "citationPrefix" . Stringify $ citationPrefix cit
-    addField "citationSuffix" . Stringify $ citationSuffix cit
+    addField "citationPrefix" . Stringify @e $ citationPrefix cit
+    addField "citationSuffix" . Stringify @e $ citationSuffix cit
     addField "citationMode" $ show (citationMode cit)
     addField "citationNoteNum" $ citationNoteNum cit
     addField "citationHash" $ citationHash cit
@@ -76,10 +81,11 @@
     Lua.newtable
     Lua.push k
     Lua.push v
-    Lua.rawset (Lua.nthFromTop 3)
+    Lua.rawset (Lua.nth 3)
 
 -- | Convert Pandoc to custom markup.
-writeCustom :: FilePath -> WriterOptions -> Pandoc -> PandocIO Text
+writeCustom :: (PandocMonad m, MonadIO m)
+            => FilePath -> WriterOptions -> Pandoc -> m Text
 writeCustom luaFile opts doc@(Pandoc meta _) = do
   let globals = [ PANDOC_DOCUMENT doc
                 , PANDOC_SCRIPT_FILE luaFile
@@ -90,7 +96,7 @@
     -- check for error in lua script (later we'll change the return type
     -- to handle this more gracefully):
     when (stat /= Lua.OK)
-      Lua.throwTopMessage
+      Lua.throwErrorAsException
     rendered <- docToCustom opts doc
     context <- metaToContext opts
                (fmap (literal . pack) . blockListToCustom)
@@ -105,126 +111,132 @@
         Just tpl -> render Nothing $
                     renderTemplate tpl $ setField "body" body context
 
-docToCustom :: WriterOptions -> Pandoc -> Lua String
+docToCustom :: forall e. PeekError e
+            => WriterOptions -> Pandoc -> LuaE e String
 docToCustom opts (Pandoc (Meta metamap) blocks) = do
   body <- blockListToCustom blocks
-  Lua.callFunc "Doc" body (fmap Stringify metamap) (writerVariables opts)
+  invoke @e "Doc" body (fmap (Stringify @e) metamap) (writerVariables opts)
 
 -- | Convert Pandoc block element to Custom.
-blockToCustom :: Block         -- ^ Block element
-              -> Lua String
+blockToCustom :: forall e. PeekError e
+              => Block         -- ^ Block element
+              -> LuaE e String
 
 blockToCustom Null = return ""
 
-blockToCustom (Plain inlines) = Lua.callFunc "Plain" (Stringify inlines)
+blockToCustom (Plain inlines) = invoke @e "Plain" (Stringify @e inlines)
 
 blockToCustom (Para [Image attr txt (src,tit)]) =
-  Lua.callFunc "CaptionedImage" src tit (Stringify txt) (attrToMap attr)
+  invoke @e "CaptionedImage" src tit (Stringify @e txt) (attrToMap attr)
 
-blockToCustom (Para inlines) = Lua.callFunc "Para" (Stringify inlines)
+blockToCustom (Para inlines) = invoke @e "Para" (Stringify @e inlines)
 
 blockToCustom (LineBlock linesList) =
-  Lua.callFunc "LineBlock" (map Stringify linesList)
+  invoke @e "LineBlock" (map (Stringify @e) linesList)
 
 blockToCustom (RawBlock format str) =
-  Lua.callFunc "RawBlock" (Stringify format) str
+  invoke @e "RawBlock" (Stringify @e format) str
 
-blockToCustom HorizontalRule = Lua.callFunc "HorizontalRule"
+blockToCustom HorizontalRule = invoke @e "HorizontalRule"
 
 blockToCustom (Header level attr inlines) =
-  Lua.callFunc "Header" level (Stringify inlines) (attrToMap attr)
+  invoke @e "Header" level (Stringify @e inlines) (attrToMap attr)
 
 blockToCustom (CodeBlock attr str) =
-  Lua.callFunc "CodeBlock" str (attrToMap attr)
+  invoke @e "CodeBlock" str (attrToMap attr)
 
 blockToCustom (BlockQuote blocks) =
-  Lua.callFunc "BlockQuote" (Stringify blocks)
+  invoke @e "BlockQuote" (Stringify @e blocks)
 
 blockToCustom (Table _ blkCapt specs thead tbody tfoot) =
   let (capt, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot
       aligns' = map show aligns
-      capt' = Stringify capt
-      headers' = map Stringify headers
-      rows' = map (map Stringify) rows
-  in Lua.callFunc "Table" capt' aligns' widths headers' rows'
+      capt' = Stringify @e capt
+      headers' = map (Stringify @e) headers
+      rows' = map (map (Stringify @e)) rows
+  in invoke @e "Table" capt' aligns' widths headers' rows'
 
 blockToCustom (BulletList items) =
-  Lua.callFunc "BulletList" (map Stringify items)
+  invoke @e "BulletList" (map (Stringify @e) items)
 
 blockToCustom (OrderedList (num,sty,delim) items) =
-  Lua.callFunc "OrderedList" (map Stringify items) num (show sty) (show delim)
+  invoke @e "OrderedList" (map (Stringify @e) items) num (show sty) (show delim)
 
 blockToCustom (DefinitionList items) =
-  Lua.callFunc "DefinitionList"
-               (map (KeyValue . (Stringify *** map Stringify)) items)
+  invoke @e "DefinitionList"
+               (map (KeyValue . (Stringify @e *** map (Stringify @e))) items)
 
 blockToCustom (Div attr items) =
-  Lua.callFunc "Div" (Stringify items) (attrToMap attr)
+  invoke @e "Div" (Stringify @e items) (attrToMap attr)
 
 -- | Convert list of Pandoc block elements to Custom.
-blockListToCustom :: [Block]       -- ^ List of block elements
-                  -> Lua String
+blockListToCustom :: forall e. PeekError e
+                  => [Block]       -- ^ List of block elements
+                  -> LuaE e String
 blockListToCustom xs = do
-  blocksep <- Lua.callFunc "Blocksep"
+  blocksep <- invoke @e "Blocksep"
   bs <- mapM blockToCustom xs
   return $ mconcat $ intersperse blocksep bs
 
 -- | Convert list of Pandoc inline elements to Custom.
-inlineListToCustom :: [Inline] -> Lua String
+inlineListToCustom :: forall e. PeekError e => [Inline] -> LuaE e String
 inlineListToCustom lst = do
-  xs <- mapM inlineToCustom lst
+  xs <- mapM (inlineToCustom @e) lst
   return $ mconcat xs
 
 -- | Convert Pandoc inline element to Custom.
-inlineToCustom :: Inline -> Lua String
+inlineToCustom :: forall e. PeekError e => Inline -> LuaE e String
 
-inlineToCustom (Str str) = Lua.callFunc "Str" str
+inlineToCustom (Str str) = invoke @e "Str" str
 
-inlineToCustom Space = Lua.callFunc "Space"
+inlineToCustom Space = invoke @e "Space"
 
-inlineToCustom SoftBreak = Lua.callFunc "SoftBreak"
+inlineToCustom SoftBreak = invoke @e "SoftBreak"
 
-inlineToCustom (Emph lst) = Lua.callFunc "Emph" (Stringify lst)
+inlineToCustom (Emph lst) = invoke @e "Emph" (Stringify @e lst)
 
-inlineToCustom (Underline lst) = Lua.callFunc "Underline" (Stringify lst)
+inlineToCustom (Underline lst) = invoke @e "Underline" (Stringify @e lst)
 
-inlineToCustom (Strong lst) = Lua.callFunc "Strong" (Stringify lst)
+inlineToCustom (Strong lst) = invoke @e "Strong" (Stringify @e lst)
 
-inlineToCustom (Strikeout lst) = Lua.callFunc "Strikeout" (Stringify lst)
+inlineToCustom (Strikeout lst) = invoke @e "Strikeout" (Stringify @e lst)
 
-inlineToCustom (Superscript lst) = Lua.callFunc "Superscript" (Stringify lst)
+inlineToCustom (Superscript lst) = invoke @e "Superscript" (Stringify @e lst)
 
-inlineToCustom (Subscript lst) = Lua.callFunc "Subscript" (Stringify lst)
+inlineToCustom (Subscript lst) = invoke @e "Subscript" (Stringify @e lst)
 
-inlineToCustom (SmallCaps lst) = Lua.callFunc "SmallCaps" (Stringify lst)
+inlineToCustom (SmallCaps lst) = invoke @e "SmallCaps" (Stringify @e lst)
 
-inlineToCustom (Quoted SingleQuote lst) = Lua.callFunc "SingleQuoted" (Stringify lst)
+inlineToCustom (Quoted SingleQuote lst) =
+  invoke @e "SingleQuoted" (Stringify @e lst)
 
-inlineToCustom (Quoted DoubleQuote lst) = Lua.callFunc "DoubleQuoted" (Stringify lst)
+inlineToCustom (Quoted DoubleQuote lst) =
+  invoke @e "DoubleQuoted" (Stringify @e lst)
 
-inlineToCustom (Cite cs lst) = Lua.callFunc "Cite" (Stringify lst) (map Stringify cs)
+inlineToCustom (Cite cs lst) =
+  invoke @e "Cite" (Stringify @e lst) (map (Stringify @e) cs)
 
 inlineToCustom (Code attr str) =
-  Lua.callFunc "Code" str (attrToMap attr)
+  invoke @e "Code" str (attrToMap attr)
 
 inlineToCustom (Math DisplayMath str) =
-  Lua.callFunc "DisplayMath" str
+  invoke @e "DisplayMath" str
 
 inlineToCustom (Math InlineMath str) =
-  Lua.callFunc "InlineMath" str
+  invoke @e "InlineMath" str
 
 inlineToCustom (RawInline format str) =
-  Lua.callFunc "RawInline" (Stringify format) str
+  invoke @e "RawInline" (Stringify @e format) str
 
-inlineToCustom LineBreak = Lua.callFunc "LineBreak"
+inlineToCustom LineBreak = invoke @e "LineBreak"
 
 inlineToCustom (Link attr txt (src,tit)) =
-  Lua.callFunc "Link" (Stringify txt) src tit (attrToMap attr)
+  invoke @e "Link" (Stringify @e txt) src tit (attrToMap attr)
 
 inlineToCustom (Image attr alt (src,tit)) =
-  Lua.callFunc "Image" (Stringify alt) src tit (attrToMap attr)
+  invoke @e "Image" (Stringify @e alt) src tit (attrToMap attr)
 
-inlineToCustom (Note contents) = Lua.callFunc "Note" (Stringify contents)
+inlineToCustom (Note contents) = invoke @e "Note" (Stringify @e contents)
 
 inlineToCustom (Span attr items) =
-  Lua.callFunc "Span" (Stringify items) (attrToMap attr)
+  invoke @e "Span" (Stringify @e items) (attrToMap attr)
diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs
--- a/src/Text/Pandoc/Writers/Docbook.hs
+++ b/src/Text/Pandoc/Writers/Docbook.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE PatternGuards     #-}
-{-# LANGUAGE ViewPatterns      #-}
 {- |
    Module      : Text.Pandoc.Writers.Docbook
    Copyright   : Copyright (C) 2006-2021 John MacFarlane
@@ -188,7 +187,7 @@
       -- standalone documents will include them in the template.
                  then [("xmlns", "http://docbook.org/ns/docbook"),("xmlns:xlink", "http://www.w3.org/1999/xlink")]
                  else []
-      
+
       -- Populate miscAttr with Header.Attr.attributes, filtering out non-valid DocBook section attributes, id, and xml:id
       miscAttr = filter (isSectionAttr version) attrs
       attribs = nsAttr <> idAttr <> miscAttr
@@ -233,7 +232,7 @@
   return empty
 blockToDocbook opts (Plain lst) = inlinesToDocbook opts lst
 -- title beginning with fig: indicates that the image is a figure
-blockToDocbook opts (Para [Image attr txt (src,T.stripPrefix "fig:" -> Just _)]) = do
+blockToDocbook opts (SimpleFigure attr txt (src, _)) = do
   alt <- inlinesToDocbook opts txt
   let capt = if null txt
                 then empty
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -36,7 +36,9 @@
 import Data.Digest.Pure.SHA (sha1, showDigest)
 import Skylighting
 import Text.Collate.Lang (renderLang)
-import Text.Pandoc.Class.PandocMonad (PandocMonad, report, toLang, translateTerm)
+import Text.Pandoc.Class (PandocMonad, report, toLang, translateTerm,
+                           getMediaBag)
+import Text.Pandoc.MediaBag (lookupMedia, MediaItem(..))
 import qualified Text.Pandoc.Translations as Term
 import qualified Text.Pandoc.Class.PandocMonad as P
 import Data.Time
@@ -175,6 +177,7 @@
   let initialSt = defaultWriterState {
           stStyleMaps  = styleMaps
         , stTocTitle   = tocTitle
+        , stCurId      = 20
         }
 
   let isRTLmeta = case lookupMeta "dir" meta of
@@ -783,8 +786,6 @@
   return $ mknode "w:rStyle" [("w:val", fromStyleId sty')] ()
 
 getUniqueId :: (PandocMonad m) => WS m Text
--- the + 20 is to ensure that there are no clashes with the rIds
--- already in word/document.xml.rel
 getUniqueId = do
   n <- gets stCurId
   modify $ \st -> st{stCurId = n + 1}
@@ -853,11 +854,13 @@
      then withParaProp prop block
      else block
 -- title beginning with fig: indicates that the image is a figure
-blockToOpenXML' opts (Para [Image attr alt (src,T.stripPrefix "fig:" -> Just tit)]) = do
+blockToOpenXML' opts (SimpleFigure attr@(imgident, _, _) alt (src, tit)) = do
   setFirstPara
   fignum <- gets stNextFigureNum
   unless (null alt) $ modify $ \st -> st{ stNextFigureNum = fignum + 1 }
-  let figid = "fig" <> tshow fignum
+  let refid = if T.null imgident
+                     then "ref_fig" <> tshow fignum
+                     else "ref_" <> imgident
   figname <- translateTerm Term.Figure
   prop <- pStyleM $
         if null alt
@@ -871,7 +874,7 @@
                          $ blockToOpenXML opts
                          $ Para
                          $ if isEnabled Ext_native_numbering opts
-                              then Span (figid,[],[])
+                              then Span (refid,[],[])
                                           [Str (figname <> "\160"),
                                            RawInline (Format "openxml")
                                            ("<w:fldSimple w:instr=\"SEQ Figure"
@@ -1234,7 +1237,42 @@
   imgs <- gets stImages
   let
     stImage = M.lookup (T.unpack src) imgs
-    generateImgElt (ident, _, _, img) =
+    generateImgElt (ident, _fp, mt, img) = do
+      docprid <- getUniqueId
+      nvpicprid <- getUniqueId
+      (blipAttrs, blipContents) <-
+        case T.takeWhile (/=';') <$> mt of
+          Just "image/svg+xml" -> do
+            -- get fallback png
+            mediabag <- getMediaBag
+            mbFallback <-
+              case lookupMedia (T.unpack (src <> ".png")) mediabag of
+                Just item -> do
+                  id' <- T.unpack . ("rId" <>) <$> getUniqueId
+                  let fp' = "media/" <> id' <> ".png"
+                  let imgdata = (id',
+                                 fp',
+                                 Just (mediaMimeType item),
+                                 BL.toStrict $ mediaContents item)
+                  modify $ \st -> st { stImages =
+                            M.insert fp' imgdata $ stImages st }
+                  return $ Just id'
+                Nothing -> return Nothing
+            let extLst = mknode "a:extLst" []
+                            [ mknode "a:ext"
+                              [("uri","{28A0092B-C50C-407E-A947-70E740481C1C}")]
+                              [ mknode "a14:useLocalDpi"
+                                [("xmlns:a14","http://schemas.microsoft.com/office/drawing/2010/main"),
+                                 ("val","0")] () ]
+                            , mknode "a:ext"
+                              [("uri","{96DAC541-7B7A-43D3-8B79-37D633B846F1}")]
+                              [ mknode "asvg:svgBlip"
+                                [("xmlns:asvg", "http://schemas.microsoft.com/office/drawing/2016/SVG/main"),
+                                 ("r:embed",T.pack ident)] () ]
+                            ]
+            return (maybe [] (\id'' -> [("r:embed", T.pack id'')]) mbFallback,
+                    [extLst])
+          _ -> return ([("r:embed", T.pack ident)], [])
       let
         (xpt,ypt) = desiredSizeInPoints opts attr
                (either (const def) id (imageSize opts img))
@@ -1246,10 +1284,12 @@
                                              ,("noChangeAspect","1")] ()
         nvPicPr  = mknode "pic:nvPicPr" []
                         [ mknode "pic:cNvPr"
-                            [("descr",src),("id","0"),("name","Picture")] ()
+                            [("descr",src)
+                            ,("id", nvpicprid)
+                            ,("name","Picture")] ()
                         , cNvPicPr ]
         blipFill = mknode "pic:blipFill" []
-          [ mknode "a:blip" [("r:embed",T.pack ident)] ()
+          [ mknode "a:blip" blipAttrs blipContents
           , mknode "a:stretch" [] $
               mknode "a:fillRect" [] ()
           ]
@@ -1283,16 +1323,15 @@
               , mknode "wp:docPr"
                 [ ("descr", stringify alt)
                 , ("title", title)
-                , ("id","1")
+                , ("id", docprid)
                 , ("name","Picture")
                 ] ()
               , graphic
               ]
-      in
-        imgElt
+      return [Elem imgElt]
 
   wrapBookmark imgident =<< case stImage of
-    Just imgData -> return [Elem $ generateImgElt imgData]
+    Just imgData -> generateImgElt imgData
     Nothing -> ( do --try
       (img, mt) <- P.fetchItem src
       ident <- ("rId" <>) <$> getUniqueId
@@ -1321,7 +1360,7 @@
          else do
            -- insert mime type to use in constructing [Content_Types].xml
            modify $ \st -> st { stImages = M.insert (T.unpack src) imgData $ stImages st }
-           return [Elem $ generateImgElt imgData]
+           generateImgElt imgData
       )
       `catchError` ( \e -> do
         report $ CouldNotFetchResource src $ T.pack (show e)
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs
--- a/src/Text/Pandoc/Writers/DokuWiki.hs
+++ b/src/Text/Pandoc/Writers/DokuWiki.hs
@@ -109,9 +109,7 @@
 
 -- title beginning with fig: indicates that the image is a figure
 -- dokuwiki doesn't support captions - so combine together alt and caption into alt
-blockToDokuWiki opts (Para [Image attr txt (src,tgt)])
-  | Just tit <- T.stripPrefix "fig:" tgt
-  = do
+blockToDokuWiki opts (SimpleFigure attr txt (src, tit)) = do
       capt <- if null txt
               then return ""
               else (" " <>) `fmap` inlineListToDokuWiki opts txt
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -79,7 +79,7 @@
   , epubLanguage            :: Text
   , epubCreator             :: [Creator]
   , epubContributor         :: [Creator]
-  , epubSubject             :: [Text]
+  , epubSubject             :: [Subject]
   , epubDescription         :: Maybe Text
   , epubType                :: Maybe Text
   , epubFormat              :: Maybe Text
@@ -121,6 +121,12 @@
 
 data ProgressionDirection = LTR | RTL deriving Show
 
+data Subject = Subject{
+    subjectText      :: Text
+  , subjectAuthority :: Maybe Text
+  , subjectTerm      :: Maybe Text
+  } deriving Show
+
 dcName :: Text -> QName
 dcName n = QName n Nothing (Just "dc")
 
@@ -232,7 +238,11 @@
                        , creatorRole = getAttr "role"
                        , creatorFileAs = getAttr "file-as"
                        } : epubContributor md }
-  | name == "subject" = md{ epubSubject = strContent e : epubSubject md }
+  | name == "subject" = md{ epubSubject =
+              Subject  { subjectText = strContent e
+                       , subjectAuthority = getAttr "authority"
+                       , subjectTerm = getAttr "term"
+                       } : epubSubject md }
   | name == "description" = md { epubDescription = Just $ strContent e }
   | name == "type" = md { epubType = Just $ strContent e }
   | name == "format" = md { epubFormat = Just $ strContent e }
@@ -313,12 +323,13 @@
         handleMetaValue mv = Date { dateText = fromMaybe "" $ normalizeDate' $ metaValueToString mv
                                   , dateEvent = Nothing }
 
-simpleList :: T.Text -> Meta -> [Text]
-simpleList s meta =
-  case lookupMeta s meta of
-       Just (MetaList xs) -> map metaValueToString xs
-       Just x             -> [metaValueToString x]
-       Nothing            -> []
+getSubject :: T.Text -> Meta -> [Subject]
+getSubject s meta = getList s meta handleMetaValue
+  where handleMetaValue (MetaMap m) =
+           Subject{ subjectText = maybe "" metaValueToString $ M.lookup "text" m
+                  , subjectAuthority = metaValueToString <$> M.lookup "authority" m
+                  , subjectTerm = metaValueToString <$> M.lookup "term" m }
+        handleMetaValue mv = Subject (metaValueToString mv) Nothing Nothing
 
 metadataFromMeta :: WriterOptions -> Meta -> EPUBMetadata
 metadataFromMeta opts meta = EPUBMetadata{
@@ -352,7 +363,7 @@
            lookupMeta "language" meta `mplus` lookupMeta "lang" meta
         creators = getCreator "creator" meta
         contributors = getCreator "contributor" meta
-        subjects = simpleList "subject" meta
+        subjects = getSubject "subject" meta
         description = metaValueToString <$> lookupMeta "description" meta
         epubtype = metaValueToString <$> lookupMeta "type" meta
         format = metaValueToString <$> lookupMeta "format" meta
@@ -659,7 +670,7 @@
                                    "contributors", "other-credits",
                                    "errata", "revision-history",
                                    "titlepage", "halftitlepage", "seriespage",
-                                   "foreword", "preface",
+                                   "foreword", "preface", "frontispiece",
                                    "seriespage", "titlepage"]
                backMatterTypes = ["appendix", "colophon", "bibliography",
                                   "index"]
@@ -974,7 +985,7 @@
                        epubCreator md
         contributorNodes = withIds "epub-contributor"
                            (toCreatorNode "contributor") $ epubContributor md
-        subjectNodes = map (dcTag "subject") $ epubSubject md
+        subjectNodes = withIds "subject" toSubjectNode $ epubSubject md
         descriptionNodes = maybe [] (dcTag' "description") $ epubDescription md
         typeNodes = maybe [] (dcTag' "type") $ epubType md
         formatNodes = maybe [] (dcTag' "format") $ epubFormat md
@@ -1046,6 +1057,16 @@
              (("id",id') :
                 maybe [] (\x -> [("opf:event",x)]) (dateEvent date)) $
                  dateText date]
+        toSubjectNode id' subject
+          | version == EPUB2 = [dcNode "subject" !
+            [("id",id')] $ subjectText subject]
+          | otherwise = (dcNode "subject" ! [("id",id')] $ subjectText subject)
+            : maybe [] (\x -> (unode "meta" !
+                    [("refines", "#" <> id'),("property","authority")] $ x) :
+                    maybe [] (\y -> [unode "meta" !
+                         [("refines", "#" <> id'),("property","term")] $ y])
+                         (subjectTerm subject))
+                    (subjectAuthority subject)
         schemeToOnix :: Text -> Text
         schemeToOnix "ISBN-10"              = "02"
         schemeToOnix "GTIN-13"              = "03"
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs
--- a/src/Text/Pandoc/Writers/FB2.hs
+++ b/src/Text/Pandoc/Writers/FB2.hs
@@ -299,9 +299,8 @@
 blockToXml (Plain ss) = cMapM toXml ss  -- FIXME: can lead to malformed FB2
 blockToXml (Para [Math DisplayMath formula]) = insertMath NormalImage formula
 -- title beginning with fig: indicates that the image is a figure
-blockToXml (Para [Image atr alt (src,tgt)])
-  | Just tit <- T.stripPrefix "fig:" tgt
-  = insertImage NormalImage (Image atr alt (src,tit))
+blockToXml (SimpleFigure atr alt (src, tit)) =
+    insertImage NormalImage (Image atr alt (src,tit))
 blockToXml (Para ss) = list . el "p" <$> cMapM toXml ss
 blockToXml (CodeBlock _ s) = return . spaceBeforeAfter .
                              map (el "p" . el "code") . T.lines $ s
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -74,9 +74,11 @@
 import Text.XML.Light (elChildren, unode, unqual)
 import qualified Text.XML.Light as XML
 import Text.XML.Light.Output
+import Data.String (fromString)
 
 data WriterState = WriterState
     { stNotes        :: [Html]  -- ^ List of notes
+    , stEmittedNotes :: Int     -- ^ How many notes we've already pushed out to the HTML
     , stMath         :: Bool    -- ^ Math is used in document
     , stQuotes       :: Bool    -- ^ <q> tag is used
     , stHighlighting :: Bool    -- ^ Syntax highlighting is used
@@ -88,10 +90,11 @@
     , stCodeBlockNum :: Int     -- ^ Number of code block
     , stCsl          :: Bool    -- ^ Has CSL references
     , stCslEntrySpacing :: Maybe Int  -- ^ CSL entry spacing
+    , stBlockLevel   :: Int     -- ^ Current block depth, excluding section divs
     }
 
 defaultWriterState :: WriterState
-defaultWriterState = WriterState {stNotes= [], stMath = False, stQuotes = False,
+defaultWriterState = WriterState {stNotes= [], stEmittedNotes = 0, stMath = False, stQuotes = False,
                                   stHighlighting = False,
                                   stHtml5 = False,
                                   stEPUBVersion = Nothing,
@@ -100,7 +103,8 @@
                                   stInSection = False,
                                   stCodeBlockNum = 0,
                                   stCsl = False,
-                                  stCslEntrySpacing = Nothing}
+                                  stCslEntrySpacing = Nothing,
+                                  stBlockLevel = 0}
 
 -- Helpers to render HTML with the appropriate function.
 
@@ -266,8 +270,16 @@
             then fmap renderHtml' <$> tableOfContents opts sects
             else return Nothing
   blocks' <- blockListToHtml opts sects
+  notes <- do
+    -- make the st private just to be safe, since we modify it right afterwards
+    st <- get
+    if null (stNotes st)
+      then return mempty
+      else do
+        notes <- footnoteSection opts EndOfDocument (stEmittedNotes st + 1) (reverse (stNotes st))
+        modify (\st' -> st'{ stNotes = mempty, stEmittedNotes = stEmittedNotes st' + length (stNotes st') })
+        return notes
   st <- get
-  notes <- footnoteSection opts (reverse (stNotes st))
   let thebody = blocks' >> notes
   let math = case writerHTMLMathMethod opts of
         MathJax url
@@ -355,7 +367,7 @@
                          defField "slideNumber" False .
                          defField "showSlideNumber" ("all" :: Text) .
                          defField "hashOneBasedIndex" False .
-                         defField "hash" False .
+                         defField "hash" True .
                          defField "respondToHashChanges" True .
                          defField "history" False .
                          defField "keyboard" True .
@@ -490,28 +502,43 @@
 
 -- | Convert list of Note blocks to a footnote <div>.
 -- Assumes notes are sorted.
-footnoteSection :: PandocMonad m
-                => WriterOptions -> [Html] -> StateT WriterState m Html
-footnoteSection opts notes = do
+footnoteSection ::
+  PandocMonad m => WriterOptions -> ReferenceLocation -> Int -> [Html] -> StateT WriterState m Html
+footnoteSection opts refLocation startCounter notes = do
   html5 <- gets stHtml5
   slideVariant <- gets stSlideVariant
-  let hrtag = if html5 then H5.hr else H.hr
+  let hrtag = if refLocation /= EndOfBlock then (if html5 then H5.hr else H.hr) else mempty
+  let additionalClassName = case refLocation of
+        EndOfBlock -> "footnotes-end-of-block"
+        EndOfDocument -> "footnotes-end-of-document"
+        EndOfSection -> "footnotes-end-of-section"
+  let className = "footnotes " <> additionalClassName
   epubVersion <- gets stEPUBVersion
   let container x
         | html5
         , epubVersion == Just EPUB3
-                = H5.section ! A.class_ "footnotes"
+                = H5.section ! A.class_ className
                              ! customAttribute "epub:type" "footnotes" $ x
-        | html5 = H5.section ! A.class_ "footnotes"
+        | html5 = H5.section ! A.class_ className
                              ! customAttribute "role" "doc-endnotes"
                              $ x
         | slideVariant /= NoSlides = H.div ! A.class_ "footnotes slide" $ x
-        | otherwise = H.div ! A.class_ "footnotes" $ x
+        | otherwise = H.div ! A.class_ className $ x
   return $
     if null notes
        then mempty
-       else nl opts >> container (nl opts >> hrtag >> nl opts >>
-              H.ol (mconcat notes >> nl opts) >> nl opts)
+       else do
+         nl opts
+         container $ do
+           nl opts
+           hrtag
+           nl opts
+           -- Keep the previous output exactly the same if we don't
+           -- have multiple notes sections
+           if startCounter == 1
+             then H.ol $ mconcat notes >> nl opts
+             else H.ol ! A.start (fromString (show startCounter)) $ mconcat notes >> nl opts
+           nl opts
 
 -- | Parse a mailto link; return Just (name, domain) or Nothing.
 parseMailto :: Text -> Maybe (Text, Text)
@@ -702,11 +729,10 @@
    fixnum x = x
    showSecNum = T.intercalate "." . map tshow
 
--- | Convert Pandoc block element to HTML.
-blockToHtml :: PandocMonad m => WriterOptions -> Block -> StateT WriterState m Html
-blockToHtml _ Null = return mempty
-blockToHtml opts (Plain lst) = inlineListToHtml opts lst
-blockToHtml opts (Para [Image attr@(_,classes,_) txt (src,tit)])
+blockToHtmlInner :: PandocMonad m => WriterOptions -> Block -> StateT WriterState m Html
+blockToHtmlInner _ Null = return mempty
+blockToHtmlInner opts (Plain lst) = inlineListToHtml opts lst
+blockToHtmlInner opts (Para [Image attr@(_,classes,_) txt (src,tit)])
   | "stretch" `elem` classes = do
   slideVariant <- gets stSlideVariant
   case slideVariant of
@@ -716,20 +742,20 @@
          inlineToHtml opts (Image attr txt (src, tit))
        _ -> figure opts attr txt (src, tit)
 -- title beginning with fig: indicates that the image is a figure
-blockToHtml opts (Para [Image attr txt (s,T.stripPrefix "fig:" -> Just tit)]) =
-  figure opts attr txt (s,tit)
-blockToHtml opts (Para lst) = do
+blockToHtmlInner opts (SimpleFigure attr caption (src, title)) =
+  figure opts attr caption (src, title)
+blockToHtmlInner opts (Para lst) = do
   contents <- inlineListToHtml opts lst
   case contents of
        Empty _ | not (isEnabled Ext_empty_paragraphs opts) -> return mempty
        _ -> return $ H.p contents
-blockToHtml opts (LineBlock lns) =
+blockToHtmlInner opts (LineBlock lns) =
   if writerWrapText opts == WrapNone
   then blockToHtml opts $ linesToPara lns
   else do
     htmlLines <- inlineListToHtml opts $ intercalate [LineBreak] lns
     return $ H.div ! A.class_ "line-block" $ htmlLines
-blockToHtml opts (Div (ident, "section":dclasses, dkvs)
+blockToHtmlInner opts (Div (ident, "section":dclasses, dkvs)
                    (Header level
                      hattr@(hident,hclasses,hkvs) ils : xs)) = do
   slideVariant <- gets stSlideVariant
@@ -810,7 +836,7 @@
                      if null innerSecs
                         then mempty
                         else nl opts <> innerContents
-blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do
+blockToHtmlInner opts (Div attr@(ident, classes, kvs') bs) = do
   html5 <- gets stHtml5
   slideVariant <- gets stSlideVariant
   let isCslBibBody = ident == "refs" || "csl-bib-body" `elem` classes
@@ -864,7 +890,7 @@
                _              -> return mempty
      else addAttrs opts (ident, classes'', kvs) $
               divtag contents'
-blockToHtml opts (RawBlock f str) = do
+blockToHtmlInner opts (RawBlock f str) = do
   ishtml <- isRawHtml f
   if ishtml
      then return $ preEscapedText str
@@ -875,10 +901,10 @@
              else do
                report $ BlockNotRendered (RawBlock f str)
                return mempty
-blockToHtml _ HorizontalRule = do
+blockToHtmlInner _ HorizontalRule = do
   html5 <- gets stHtml5
   return $ if html5 then H5.hr else H.hr
-blockToHtml opts (CodeBlock (id',classes,keyvals) rawCode) = do
+blockToHtmlInner opts (CodeBlock (id',classes,keyvals) rawCode) = do
   id'' <- if T.null id'
              then do
                modify $ \st -> st{ stCodeBlockNum = stCodeBlockNum st + 1 }
@@ -910,7 +936,7 @@
                     -- we set writerIdentifierPrefix to "" since id'' already
                     -- includes it:
                     addAttrs opts{writerIdentifierPrefix = ""} (id'',[],keyvals) h
-blockToHtml opts (BlockQuote blocks) = do
+blockToHtmlInner opts (BlockQuote blocks) = do
   -- in S5, treat list in blockquote specially
   -- if default is incremental, make it nonincremental;
   -- otherwise incremental
@@ -932,7 +958,7 @@
      else do
        contents <- blockListToHtml opts blocks
        return $ H.blockquote $ nl opts >> contents >> nl opts
-blockToHtml opts (Header level (ident,classes,kvs) lst) = do
+blockToHtmlInner opts (Header level (ident,classes,kvs) lst) = do
   contents <- inlineListToHtml opts lst
   let secnum = fromMaybe mempty $ lookup "number" kvs
   let contents' = if writerNumberSections opts && not (T.null secnum)
@@ -955,12 +981,12 @@
               5 -> H.h5 contents'
               6 -> H.h6 contents'
               _ -> H.p ! A.class_ "heading" $ contents'
-blockToHtml opts (BulletList lst) = do
+blockToHtmlInner opts (BulletList lst) = do
   contents <- mapM (listItemToHtml opts) lst
   let isTaskList = not (null lst) && all isTaskListItem lst
   (if isTaskList then (! A.class_ "task-list") else id) <$>
     unordList opts contents
-blockToHtml opts (OrderedList (startnum, numstyle, _) lst) = do
+blockToHtmlInner opts (OrderedList (startnum, numstyle, _) lst) = do
   contents <- mapM (listItemToHtml opts) lst
   html5 <- gets stHtml5
   let numstyle' = case numstyle of
@@ -983,7 +1009,7 @@
                    else [])
   l <- ordList opts contents
   return $ foldl' (!) l attribs
-blockToHtml opts (DefinitionList lst) = do
+blockToHtmlInner opts (DefinitionList lst) = do
   contents <- mapM (\(term, defs) ->
                   do term' <- liftM H.dt $ inlineListToHtml opts term
                      defs' <- mapM (liftM (\x -> H.dd (x >> nl opts)) .
@@ -991,9 +1017,39 @@
                      return $ mconcat $ nl opts : term' : nl opts :
                                         intersperse (nl opts) defs') lst
   defList opts contents
-blockToHtml opts (Table attr caption colspecs thead tbody tfoot) =
+blockToHtmlInner opts (Table attr caption colspecs thead tbody tfoot) =
   tableToHtml opts (Ann.toTable attr caption colspecs thead tbody tfoot)
 
+-- | Convert Pandoc block element to HTML. All the legwork is done by
+-- 'blockToHtmlInner', this just takes care of emitting the notes after
+-- the block if necessary.
+blockToHtml :: PandocMonad m => WriterOptions -> Block -> StateT WriterState m Html
+blockToHtml opts block = do
+  -- Ignore inserted section divs -- they are not blocks as they came from
+  -- the document itself (at least not when coming from markdown)
+  let isSection = case block of
+        Div (_, classes, _) _ | "section" `elem` classes -> True
+        _ -> False
+  let increaseLevel = not isSection
+  when increaseLevel $
+    modify (\st -> st{ stBlockLevel = stBlockLevel st + 1 })
+  doc <- blockToHtmlInner opts block
+  st <- get
+  let emitNotes =
+        (writerReferenceLocation opts == EndOfBlock && stBlockLevel st == 1) ||
+        (writerReferenceLocation opts == EndOfSection && isSection)
+  res <- if emitNotes
+    then do
+      notes <- if null (stNotes st)
+        then return mempty
+        else footnoteSection opts (writerReferenceLocation opts) (stEmittedNotes st + 1) (reverse (stNotes st))
+      modify (\st' -> st'{ stNotes = mempty, stEmittedNotes = stEmittedNotes st' + length (stNotes st') })
+      return (doc <> notes)
+    else return doc
+  when increaseLevel $
+    modify (\st' -> st'{ stBlockLevel = stBlockLevel st' - 1 })
+  return res
+
 tableToHtml :: PandocMonad m
             => WriterOptions
             -> Ann.Table
@@ -1412,13 +1468,17 @@
       ishtml <- isRawHtml f
       if ishtml
          then return $ preEscapedText str
-         else if (f == Format "latex" || f == Format "tex") &&
-                allowsMathEnvironments (writerHTMLMathMethod opts) &&
-                isMathEnvironment str
-                then inlineToHtml opts $ Math DisplayMath str
-                else do
-                  report $ InlineNotRendered inline
-                  return mempty
+         else do
+           let istex = f == Format "latex" || f == Format "tex"
+           let mm = writerHTMLMathMethod opts
+           case istex of
+             True
+               | allowsMathEnvironments mm && isMathEnvironment str
+                 -> inlineToHtml opts $ Math DisplayMath str
+               | allowsRef mm && isRef str
+                 -> inlineToHtml opts $ Math InlineMath str
+             _ -> do report $ InlineNotRendered inline
+                     return mempty
     (Link attr txt (s,_)) | "mailto:" `T.isPrefixOf` s -> do
                         linkText <- inlineListToHtml opts txt
                         obfuscateLink opts attr linkText s
@@ -1468,7 +1528,8 @@
                         -- note:  null title included, as in Markdown.pl
     (Note contents) -> do
                         notes <- gets stNotes
-                        let number = length notes + 1
+                        emittedNotes <- gets stEmittedNotes
+                        let number = emittedNotes + length notes + 1
                         let ref = tshow number
                         htmlContents <- blockListToNote opts ref contents
                         epubVersion <- gets stEPUBVersion
@@ -1545,6 +1606,9 @@
     (if html5 then H5.div else H.div)
                 x ! A.class_ (toValue cls)
 
+isRef :: Text -> Bool
+isRef t = "\\ref{" `T.isPrefixOf` t || "\\eqref{" `T.isPrefixOf` t
+
 isMathEnvironment :: Text -> Bool
 isMathEnvironment s = "\\begin{" `T.isPrefixOf` s &&
                          envName `elem` mathmlenvs
@@ -1579,9 +1643,14 @@
 
 allowsMathEnvironments :: HTMLMathMethod -> Bool
 allowsMathEnvironments (MathJax _) = True
+allowsMathEnvironments (KaTeX _)   = True
 allowsMathEnvironments MathML      = True
 allowsMathEnvironments (WebTeX _)  = True
 allowsMathEnvironments _           = False
+
+allowsRef :: HTMLMathMethod -> Bool
+allowsRef (MathJax _) = True
+allowsRef _           = False
 
 -- | List of intrinsic event attributes allowed on all elements in HTML4.
 intrinsicEventsHTML4 :: [Text]
diff --git a/src/Text/Pandoc/Writers/Haddock.hs b/src/Text/Pandoc/Writers/Haddock.hs
--- a/src/Text/Pandoc/Writers/Haddock.hs
+++ b/src/Text/Pandoc/Writers/Haddock.hs
@@ -98,8 +98,7 @@
   contents <- inlineListToHaddock opts inlines
   return $ contents <> cr
 -- title beginning with fig: indicates figure
-blockToHaddock opts (Para [Image attr alt (src,tgt)])
-  | Just tit <- T.stripPrefix "fig:" tgt
+blockToHaddock opts (SimpleFigure attr alt (src, tit))
   = blockToHaddock opts (Para [Image attr alt (src,tit)])
 blockToHaddock opts (Para inlines) =
   -- TODO:  if it contains linebreaks, we need to use a @...@ block
diff --git a/src/Text/Pandoc/Writers/ICML.hs b/src/Text/Pandoc/Writers/ICML.hs
--- a/src/Text/Pandoc/Writers/ICML.hs
+++ b/src/Text/Pandoc/Writers/ICML.hs
@@ -1,7 +1,6 @@
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE ViewPatterns #-}
 
 {- |
    Module      : Text.Pandoc.Writers.ICML
@@ -309,9 +308,8 @@
 -- | Convert a Pandoc block element to ICML.
 blockToICML :: PandocMonad m => WriterOptions -> Style -> Block -> WS m (Doc Text)
 blockToICML opts style (Plain lst) = parStyle opts style "" lst
--- title beginning with fig: indicates that the image is a figure
-blockToICML opts style (Para img@[Image _ txt (_,Text.stripPrefix "fig:" -> Just _)]) = do
-  figure  <- parStyle opts (figureName:style) "" img
+blockToICML opts style (SimpleFigure attr txt (src, tit)) = do
+  figure  <- parStyle opts (figureName:style) "" [Image attr txt (src, tit)]
   caption <- parStyle opts (imgCaptionName:style) "" txt
   return $ intersperseBrs [figure, caption]
 blockToICML opts style (Para lst) = parStyle opts (paragraphName:style) "" lst
diff --git a/src/Text/Pandoc/Writers/Ipynb.hs b/src/Text/Pandoc/Writers/Ipynb.hs
--- a/src/Text/Pandoc/Writers/Ipynb.hs
+++ b/src/Text/Pandoc/Writers/Ipynb.hs
@@ -138,17 +138,24 @@
           let format' =
                 case T.toLower f of
                   "html"     -> "text/html"
+                  "html4"    -> "text/html"
+                  "html5"    -> "text/html"
+                  "s5"       -> "text/html"
+                  "slidy"    -> "text/html"
+                  "slideous" -> "text/html"
+                  "dzslides" -> "text/html"
                   "revealjs" -> "text/html"
                   "latex"    -> "text/latex"
                   "markdown" -> "text/markdown"
-                  "rst"      -> "text/x-rst"
+                  "rst"      -> "text/restructuredtext"
+                  "asciidoc" -> "text/asciidoc"
                   _          -> f
           (Ipynb.Cell{
               cellType = Raw
             , cellSource = Source $ breakLines raw
             , cellMetadata = if format' == "ipynb" -- means no format given
                                 then mempty
-                                else M.insert "format"
+                                else M.insert "raw_mimetype"
                                        (Aeson.String format') mempty
             , cellAttachments = Nothing } :) <$> extractCells opts bs
         _ -> extractCells opts bs
diff --git a/src/Text/Pandoc/Writers/JATS.hs b/src/Text/Pandoc/Writers/JATS.hs
--- a/src/Text/Pandoc/Writers/JATS.hs
+++ b/src/Text/Pandoc/Writers/JATS.hs
@@ -291,9 +291,7 @@
   return $ inTagsSimple "title" title'
 -- No Plain, everything needs to be in a block-level tag
 blockToJATS opts (Plain lst) = blockToJATS opts (Para lst)
--- title beginning with fig: indicates that the image is a figure
-blockToJATS opts (Para [Image (ident,_,kvs) txt
-  (src,T.stripPrefix "fig:" -> Just tit)]) = do
+blockToJATS opts (SimpleFigure (ident, _, kvs) txt (src, tit)) = do
   alt <- inlinesToJATS opts txt
   let (maintype, subtype) = imageMimeType src kvs
   let capt = if null txt
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -21,15 +21,13 @@
   ) where
 import Control.Monad.State.Strict
 import Data.Char (isDigit)
-import Data.List (intersperse, nubBy, (\\))
+import Data.List (intersperse, (\\))
 import Data.Maybe (catMaybes, fromMaybe, isJust, mapMaybe, isNothing)
-import qualified Data.Map as M
 import Data.Text (Text)
 import qualified Data.Text as T
 import Network.URI (unEscapeString)
-import Text.DocTemplates (FromContext(lookupContext), renderTemplate,
-                          Val(..), Context(..))
-import Text.Collate.Lang (Lang (..), renderLang)
+import Text.DocTemplates (FromContext(lookupContext), renderTemplate)
+import Text.Collate.Lang (renderLang)
 import Text.Pandoc.Class.PandocMonad (PandocMonad, report, toLang)
 import Text.Pandoc.Definition
 import Text.Pandoc.Highlighting (formatLaTeXBlock, formatLaTeXInline, highlight,
@@ -46,7 +44,7 @@
 import Text.Pandoc.Writers.LaTeX.Citation (citationsToNatbib,
                                            citationsToBiblatex)
 import Text.Pandoc.Writers.LaTeX.Types (LW, WriterState (..), startingState)
-import Text.Pandoc.Writers.LaTeX.Lang (toPolyglossia, toBabel)
+import Text.Pandoc.Writers.LaTeX.Lang (toBabel)
 import Text.Pandoc.Writers.LaTeX.Util (stringToLaTeX, StringContext(..),
                                        toLabel, inCmd,
                                        wrapDiv, hypertarget, labelFor,
@@ -132,12 +130,6 @@
                               ,("tmargin","margin-top")
                               ,("bmargin","margin-bottom")
                               ]
-  let toPolyObj :: Lang -> Val Text
-      toPolyObj lang = MapVal $ Context $
-                        M.fromList [ ("name" , SimpleVal $ literal name)
-                                   , ("options" , SimpleVal $ literal opts) ]
-        where
-          (name, opts) = toPolyglossia lang
   mblang <- toLang $ case getLang options meta of
                           Just l -> Just l
                           Nothing | null docLangs -> Nothing
@@ -216,36 +208,7 @@
                       (literal $ toBabel l)) mblang
         $ defField "babel-otherlangs"
              (map (literal . toBabel) docLangs)
-        $ defField "babel-newcommands" (vcat $
-           map (\(poly, babel) -> literal $
-            -- \textspanish and \textgalician are already used by babel
-            -- save them as \oritext... and let babel use that
-            if poly `elem` ["spanish", "galician"]
-               then "\\let\\oritext" <> poly <> "\\text" <> poly <> "\n" <>
-                    "\\AddBabelHook{" <> poly <> "}{beforeextras}" <>
-                      "{\\renewcommand{\\text" <> poly <> "}{\\oritext"
-                      <> poly <> "}}\n" <>
-                    "\\AddBabelHook{" <> poly <> "}{afterextras}" <>
-                      "{\\renewcommand{\\text" <> poly <> "}[2][]{\\foreignlanguage{"
-                      <> poly <> "}{##2}}}"
-               else (if poly == "latin" -- see #4161
-                        then "\\providecommand{\\textlatin}{}\n\\renewcommand"
-                        else "\\newcommand") <> "{\\text" <> poly <>
-                    "}[2][]{\\foreignlanguage{" <> babel <> "}{#2}}\n" <>
-                    "\\newenvironment{" <> poly <>
-                    "}[2][]{\\begin{otherlanguage}{" <>
-                    babel <> "}}{\\end{otherlanguage}}"
-            )
-            -- eliminate duplicates that have same polyglossia name
-            $ nubBy (\a b -> fst a == fst b)
-            -- find polyglossia and babel names of languages used in the document
-            $ map (\l -> (fst $ toPolyglossia l, toBabel l)) docLangs
-          )
-        $ maybe id (defField "polyglossia-lang" . toPolyObj) mblang
-        $ defField "polyglossia-otherlangs"
-             (ListVal (map toPolyObj docLangs :: [Val Text]))
-        $
-                  defField "latex-dir-rtl"
+        $ defField "latex-dir-rtl"
            ((render Nothing <$> getField "dir" context) ==
                Just ("rtl" :: Text)) context
   return $ render colwidth $
@@ -383,10 +346,7 @@
   wrapNotes <$> wrapDiv (identifier,classes,kvs) result
 blockToLaTeX (Plain lst) =
   inlineListToLaTeX lst
--- title beginning with fig: indicates that the image is a figure
-blockToLaTeX (Para [Image attr@(ident, _, _) txt (src,tgt)])
-  | Just tit <- T.stripPrefix "fig:" tgt
-  = do
+blockToLaTeX (SimpleFigure attr@(ident, _, _) txt (src, tit)) = do
       (capt, captForLof, footnotes) <- getCaption inlineListToLaTeX True txt
       lab <- labelFor ident
       let caption = "\\caption" <> captForLof <> braces capt <> lab
@@ -771,9 +731,8 @@
       kvToCmd _ = Nothing
       langCmds =
         case lang of
-           Just lng -> let (l, o) = toPolyglossia lng
-                           ops = if T.null o then "" else "[" <> o <> "]"
-                       in  ["text" <> l <> ops]
+           Just lng -> let l = toBabel lng
+                       in  ["foreignlanguage{" <> l <> "}"]
            Nothing  -> []
   let cmds = mapMaybe classToCmd classes ++ mapMaybe kvToCmd kvs ++ langCmds
   contents <- inlineListToLaTeX ils
diff --git a/src/Text/Pandoc/Writers/LaTeX/Lang.hs b/src/Text/Pandoc/Writers/LaTeX/Lang.hs
--- a/src/Text/Pandoc/Writers/LaTeX/Lang.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Lang.hs
@@ -10,60 +10,11 @@
    Portability : portable
 -}
 module Text.Pandoc.Writers.LaTeX.Lang
-  ( toPolyglossiaEnv,
-    toPolyglossia,
-    toBabel
+  ( toBabel
   ) where
 import Data.Text (Text)
 import Text.Collate.Lang (Lang(..))
 
-
--- In environments \Arabic instead of \arabic is used
-toPolyglossiaEnv :: Lang -> (Text, Text)
-toPolyglossiaEnv l =
-  case toPolyglossia l of
-    ("arabic", o) -> ("Arabic", o)
-    x             -> x
-
--- Takes a list of the constituents of a BCP47 language code and
--- converts it to a Polyglossia (language, options) tuple
--- http://mirrors.ctan.org/macros/latex/contrib/polyglossia/polyglossia.pdf
-toPolyglossia :: Lang -> (Text, Text)
-toPolyglossia (Lang "ar" _ (Just "DZ") _ _ _)  = ("arabic", "locale=algeria")
-toPolyglossia (Lang "ar" _ (Just "IQ") _ _ _)  = ("arabic", "locale=mashriq")
-toPolyglossia (Lang "ar" _ (Just "JO") _ _ _)  = ("arabic", "locale=mashriq")
-toPolyglossia (Lang "ar" _ (Just "LB") _ _ _)  = ("arabic", "locale=mashriq")
-toPolyglossia (Lang "ar" _ (Just "LY") _ _ _)  = ("arabic", "locale=libya")
-toPolyglossia (Lang "ar" _ (Just "MA") _ _ _)  = ("arabic", "locale=morocco")
-toPolyglossia (Lang "ar" _ (Just "MR") _ _ _)  = ("arabic", "locale=mauritania")
-toPolyglossia (Lang "ar" _ (Just "PS") _ _ _)  = ("arabic", "locale=mashriq")
-toPolyglossia (Lang "ar" _ (Just "SY") _ _ _)  = ("arabic", "locale=mashriq")
-toPolyglossia (Lang "ar" _ (Just "TN") _ _ _)  = ("arabic", "locale=tunisia")
-toPolyglossia (Lang "de" _ _ vars _ _)
-  | "1901" `elem` vars                         = ("german", "spelling=old")
-toPolyglossia (Lang "de" _ (Just "AT") vars _ _)
-  | "1901" `elem` vars         = ("german", "variant=austrian, spelling=old")
-toPolyglossia (Lang "de" _ (Just "AT") _ _ _)  = ("german", "variant=austrian")
-toPolyglossia (Lang "de" _ (Just "CH") vars _ _)
-  | "1901" `elem` vars        = ("german", "variant=swiss, spelling=old")
-toPolyglossia (Lang "de" _ (Just "CH") _ _ _) = ("german", "variant=swiss")
-toPolyglossia (Lang "de" _ _ _ _ _)           = ("german", "")
-toPolyglossia (Lang "dsb" _ _ _ _ _)          = ("lsorbian", "")
-toPolyglossia (Lang "el" _ _ vars _ _)
-  | "polyton" `elem` vars                     = ("greek",   "variant=poly")
-toPolyglossia (Lang "en" _ (Just "AU") _ _ _) = ("english", "variant=australian")
-toPolyglossia (Lang "en" _ (Just "CA") _ _ _) = ("english", "variant=canadian")
-toPolyglossia (Lang "en" _ (Just "GB") _ _ _) = ("english", "variant=british")
-toPolyglossia (Lang "en" _ (Just "NZ") _ _ _) = ("english", "variant=newzealand")
-toPolyglossia (Lang "en" _ (Just "UK") _ _ _) = ("english", "variant=british")
-toPolyglossia (Lang "en" _ (Just "US") _ _ _) = ("english", "variant=american")
-toPolyglossia (Lang "grc" _ _ _ _ _)          = ("greek",   "variant=ancient")
-toPolyglossia (Lang "hsb" _ _ _ _ _)          = ("usorbian", "")
-toPolyglossia (Lang "la" _ _ vars _ _)
-  | "x-classic" `elem` vars                   = ("latin", "variant=classic")
-toPolyglossia (Lang "pt" _ (Just "BR") _ _ _) = ("portuguese", "variant=brazilian")
-toPolyglossia (Lang "sl" _ _ _ _ _)           = ("slovenian", "")
-toPolyglossia x                               = (commonFromBcp47 x, "")
 
 -- Takes a list of the constituents of a BCP47 language code and
 -- converts it to a Babel language string.
diff --git a/src/Text/Pandoc/Writers/LaTeX/Util.hs b/src/Text/Pandoc/Writers/LaTeX/Util.hs
--- a/src/Text/Pandoc/Writers/LaTeX/Util.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Util.hs
@@ -26,7 +26,7 @@
 import Text.Pandoc.Class (PandocMonad, toLang)
 import Text.Pandoc.Options (WriterOptions(..), isEnabled)
 import Text.Pandoc.Writers.LaTeX.Types (LW, WriterState(..))
-import Text.Pandoc.Writers.LaTeX.Lang (toPolyglossiaEnv)
+import Text.Pandoc.Writers.LaTeX.Lang (toBabel)
 import Text.Pandoc.Highlighting (toListingsLanguage)
 import Text.DocLayout
 import Text.Pandoc.Definition
@@ -238,13 +238,11 @@
                   Just "ltr" -> align "LTR"
                   _          -> id
       wrapLang txt = case lang of
-                       Just lng -> let (l, o) = toPolyglossiaEnv lng
-                                       ops = if T.null o
-                                             then ""
-                                             else brackets $ literal o
-                                   in  inCmd "begin" (literal l) <> ops
+                       Just lng -> let l = toBabel lng
+                                   in  inCmd "begin" "otherlanguage"
+                                            <> (braces (literal l))
                                        $$ blankline <> txt <> blankline
-                                       $$ inCmd "end" (literal l)
+                                       $$ inCmd "end" "otherlanguage"
                        Nothing  -> txt
   return $ wrapColumns . wrapColumn . wrapDir . wrapLang $ t
 
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -109,11 +109,10 @@
 blockToMan _ Null = return empty
 blockToMan opts (Div _ bs) = blockListToMan opts bs
 blockToMan opts (Plain inlines) =
-  liftM vcat $ mapM (inlineListToMan opts) $ splitSentences inlines
+  splitSentences <$> inlineListToMan opts inlines
 blockToMan opts (Para inlines) = do
-  contents <- liftM vcat $ mapM (inlineListToMan opts) $
-    splitSentences inlines
-  return $ text ".PP" $$ contents
+  contents <- inlineListToMan opts inlines
+  return $ text ".PP" $$ splitSentences contents
 blockToMan opts (LineBlock lns) =
   blockToMan opts $ linesToPara lns
 blockToMan _ b@(RawBlock f str)
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -2,7 +2,6 @@
 {-# LANGUAGE OverloadedStrings   #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE TupleSections       #-}
-{-# LANGUAGE ViewPatterns        #-}
 {- |
    Module      : Text.Pandoc.Writers.Markdown
    Copyright   : Copyright (C) 2006-2021 John MacFarlane
@@ -365,14 +364,13 @@
                   _ -> inlines
   contents <- inlineListToMarkdown opts inlines'
   return $ contents <> cr
--- title beginning with fig: indicates figure
-blockToMarkdown' opts (Para [Image attr alt (src,tgt@(T.stripPrefix "fig:" -> Just tit))])
+blockToMarkdown' opts (SimpleFigure attr alt (src, tit))
   | isEnabled Ext_raw_html opts &&
     not (isEnabled Ext_link_attributes opts || isEnabled Ext_attributes opts) &&
     attr /= nullAttr = -- use raw HTML
     (<> blankline) . literal . T.strip <$>
       writeHtml5String opts{ writerTemplate = Nothing }
-        (Pandoc nullMeta [Para [Image attr alt (src,tgt)]])
+        (Pandoc nullMeta [SimpleFigure attr alt (src, tit)])
   | otherwise = blockToMarkdown opts (Para [Image attr alt (src,tit)])
 blockToMarkdown' opts (Para inlines) =
   (<> blankline) `fmap` blockToMarkdown opts (Plain inlines)
diff --git a/src/Text/Pandoc/Writers/Markdown/Inline.hs b/src/Text/Pandoc/Writers/Markdown/Inline.hs
--- a/src/Text/Pandoc/Writers/Markdown/Inline.hs
+++ b/src/Text/Pandoc/Writers/Markdown/Inline.hs
@@ -190,11 +190,13 @@
                                          (stKeys s) })
                     return lab'
 
+
+
 -- | Convert list of Pandoc inline elements to markdown.
 inlineListToMarkdown :: PandocMonad m => WriterOptions -> [Inline] -> MD m (Doc Text)
-inlineListToMarkdown opts lst = do
-  inlist <- asks envInList
-  go (if inlist then avoidBadWrapsInList lst else lst)
+inlineListToMarkdown opts ils = do
+    inlist <- asks envInList
+    avoidBadWraps inlist <$> go ils
   where go [] = return empty
         go (x@Math{}:y@(Str t):zs)
           | T.all isDigit (T.take 1 t) -- starts with digit -- see #7058
@@ -235,26 +237,25 @@
                     fmap (iMark <>) (go is)
                 thead = fmap fst . T.uncons
 
-isSp :: Inline -> Bool
-isSp Space     = True
-isSp SoftBreak = True
-isSp _         = False
+-- Remove breaking spaces that might cause bad wraps.
+avoidBadWraps :: Bool -> Doc Text -> Doc Text
+avoidBadWraps inListItem = go . toList
+ where
+  go [] = mempty
+  go (BreakingSpace : Text len t : BreakingSpace : xs)
+    = case T.uncons t of
+        Just (c,t')
+          | c == '>'
+             || ((c == '-' || c == '*' || c == '+') && T.null t')
+             || (inListItem && isOrderedListMarker t)
+             || (t == "1." || t == "1)")
+            -> Text (len + 1) (" " <> t) <> go (BreakingSpace : xs)
+        _   -> BreakingSpace <> Text len t <> go (BreakingSpace : xs)
+  go (x:xs) = x <> go xs
 
-avoidBadWrapsInList :: [Inline] -> [Inline]
-avoidBadWrapsInList [] = []
-avoidBadWrapsInList (s:Str (T.uncons -> Just ('>',cs)):xs) | isSp s =
-  Str (" >" <> cs) : avoidBadWrapsInList xs
-avoidBadWrapsInList [s, Str (T.uncons -> Just (c, cs))]
-  | T.null cs && isSp s && c `elem` ['-','*','+'] = [Str $ T.pack [' ', c]]
-avoidBadWrapsInList (s:Str (T.uncons -> Just (c, cs)):Space:xs)
-  | T.null cs && isSp s && c `elem` ['-','*','+'] =
-    Str (T.pack [' ', c]) : Space : avoidBadWrapsInList xs
-avoidBadWrapsInList (s:Str cs:Space:xs)
-  | isSp s && isOrderedListMarker cs =
-    Str (" " <> cs) : Space : avoidBadWrapsInList xs
-avoidBadWrapsInList [s, Str cs]
-  | isSp s && isOrderedListMarker cs = [Str $ " " <> cs]
-avoidBadWrapsInList (x:xs) = x : avoidBadWrapsInList xs
+  toList (Concat (Concat a b) c) = toList (Concat a (Concat b c))
+  toList (Concat a b) = a : toList b
+  toList x = [x]
 
 isOrderedListMarker :: Text -> Bool
 isOrderedListMarker xs = not (T.null xs) && (T.last xs `elem` ['.',')']) &&
@@ -307,7 +308,7 @@
   case variant of
     PlainText -> return contents
     _     | isEnabled Ext_bracketed_spans opts ->
-            return $ "[" <> contents <> "]" <> "{.ul}"
+            return $ "[" <> contents <> "]" <> "{.underline}"
           | isEnabled Ext_native_spans opts ->
             return $ tagWithAttrs "span" ("", ["underline"], [])
               <> contents
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs
--- a/src/Text/Pandoc/Writers/MediaWiki.hs
+++ b/src/Text/Pandoc/Writers/MediaWiki.hs
@@ -1,5 +1,4 @@
 {-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE ViewPatterns      #-}
 {- |
    Module      : Text.Pandoc.Writers.MediaWiki
    Copyright   : Copyright (C) 2008-2021 John MacFarlane
@@ -91,8 +90,7 @@
 blockToMediaWiki (Plain inlines) =
   inlineListToMediaWiki inlines
 
--- title beginning with fig: indicates that the image is a figure
-blockToMediaWiki (Para [Image attr txt (src,T.stripPrefix "fig:" -> Just tit)]) = do
+blockToMediaWiki (SimpleFigure attr txt (src, tit)) = do
   capt <- inlineListToMediaWiki txt
   img  <- imageToMediaWiki attr
   let opt = if T.null tit
diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs
--- a/src/Text/Pandoc/Writers/Ms.hs
+++ b/src/Text/Pandoc/Writers/Ms.hs
@@ -143,7 +143,7 @@
        setFirstPara
        return $ anchor $$ res
 blockToMs opts (Plain inlines) =
-  liftM vcat $ mapM (inlineListToMs' opts) $ splitSentences inlines
+  splitSentences <$> inlineListToMs' opts inlines
 blockToMs opts (Para [Image attr alt (src,_tit)])
   | let ext = takeExtension (T.unpack src) in (ext == ".ps" || ext == ".eps") = do
   let (mbW,mbH) = (inPoints opts <$> dimension Width attr,
@@ -156,7 +156,7 @@
                               space <>
                               doubleQuotes (literal (tshow (floor hp :: Int)))
                        _ -> empty
-  capt <- inlineListToMs' opts alt
+  capt <- splitSentences <$> inlineListToMs' opts alt
   return $ nowrap (literal ".PSPIC -C " <>
              doubleQuotes (literal (escapeStr opts src)) <>
              sizeAttrs) $$
@@ -166,9 +166,9 @@
 blockToMs opts (Para inlines) = do
   firstPara <- gets stFirstPara
   resetFirstPara
-  contents <- liftM vcat $ mapM (inlineListToMs' opts) $
-    splitSentences inlines
-  return $ literal (if firstPara then ".LP" else ".PP") $$ contents
+  contents <- inlineListToMs' opts inlines
+  return $ literal (if firstPara then ".LP" else ".PP") $$
+           splitSentences contents
 blockToMs _ b@(RawBlock f str)
   | f == Format "ms" = return $ literal str
   | otherwise        = do
diff --git a/src/Text/Pandoc/Writers/Native.hs b/src/Text/Pandoc/Writers/Native.hs
--- a/src/Text/Pandoc/Writers/Native.hs
+++ b/src/Text/Pandoc/Writers/Native.hs
@@ -12,82 +12,20 @@
 -}
 module Text.Pandoc.Writers.Native ( writeNative )
 where
-import Data.List (intersperse)
 import Data.Text (Text)
+import qualified Data.Text as T
 import Text.Pandoc.Class.PandocMonad (PandocMonad)
 import Text.Pandoc.Definition
-import Text.Pandoc.Options (WrapOption (..), WriterOptions (..))
-import Text.DocLayout
-
-prettyList :: [Doc Text] -> Doc Text
-prettyList ds =
-  "[" <>
-  mconcat (intersperse (cr <> ",") $ map (nest 1) ds) <> "]"
-
--- | Prettyprint Pandoc block element.
-prettyBlock :: Block -> Doc Text
-prettyBlock (LineBlock lines') =
-  "LineBlock" $$ prettyList (map (text . show) lines')
-prettyBlock (BlockQuote blocks) =
-  "BlockQuote" $$ prettyList (map prettyBlock blocks)
-prettyBlock (OrderedList attribs blockLists) =
-  "OrderedList" <> space <> text (show attribs) $$
-  prettyList (map (prettyList . map prettyBlock) blockLists)
-prettyBlock (BulletList blockLists) =
-  "BulletList" $$
-  prettyList (map (prettyList . map prettyBlock) blockLists)
-prettyBlock (DefinitionList items) = "DefinitionList" $$
-  prettyList (map deflistitem items)
-    where deflistitem (term, defs) = "(" <> text (show term) <> "," <> cr <>
-           nest 1 (prettyList $ map (prettyList . map prettyBlock) defs) <> ")"
-prettyBlock (Table attr blkCapt specs thead tbody tfoot) =
-  mconcat [ "Table "
-          , text (show attr)
-          , " "
-          , prettyCaption blkCapt ] $$
-  prettyList (map (text . show) specs) $$
-  prettyHead thead $$
-  prettyBodies tbody $$
-  prettyFoot tfoot
-  where prettyRows = prettyList . map prettyRow
-        prettyRow (Row a body) =
-          text ("Row " <> show a) $$ prettyList (map prettyCell body)
-        prettyCell (Cell a ma h w b) =
-          mconcat [ "Cell "
-                  , text (show a)
-                  , " "
-                  , text (show ma)
-                  , " ("
-                  , text (show h)
-                  , ") ("
-                  , text (show w)
-                  , ")" ] $$
-          prettyList (map prettyBlock b)
-        prettyCaption (Caption mshort body) =
-          "(Caption " <> text (showsPrec 11 mshort "") $$ prettyList (map prettyBlock body) <> ")"
-        prettyHead (TableHead thattr body)
-          = "(TableHead " <> text (show thattr) $$ prettyRows body <> ")"
-        prettyBody (TableBody tbattr rhc hd bd)
-          = mconcat [ "(TableBody "
-                    , text (show tbattr)
-                    , " ("
-                    , text (show rhc)
-                    , ")" ] $$ prettyRows hd $$ prettyRows bd <> ")"
-        prettyBodies = prettyList . map prettyBody
-        prettyFoot (TableFoot tfattr body)
-          = "(TableFoot " <> text (show tfattr) $$ prettyRows body <> ")"
-prettyBlock (Div attr blocks) =
-  text ("Div " <> show attr) $$ prettyList (map prettyBlock blocks)
-prettyBlock block = text $ show block
+import Text.Pandoc.Options (WriterOptions (..))
+import Text.Show.Pretty (ppDoc)
+import Text.PrettyPrint (renderStyle, Style(..), style, char)
 
 -- | Prettyprint Pandoc document.
 writeNative :: PandocMonad m => WriterOptions -> Pandoc -> m Text
-writeNative opts (Pandoc meta blocks) = return $
-  let colwidth = if writerWrapText opts == WrapAuto
-                    then Just $ writerColumns opts
-                    else Nothing
-      withHead = case writerTemplate opts of
-                      Just _  -> \bs -> text ("Pandoc (" ++ show meta ++ ")") $$
-                                  bs $$ cr
-                      Nothing -> id
-  in  render colwidth $ withHead $ prettyList $ map prettyBlock blocks
+writeNative opts (Pandoc meta blocks) = do
+  let style' = style{ lineLength = writerColumns opts,
+                      ribbonsPerLine = 1.2 }
+  return $ T.pack $ renderStyle style' $
+    case writerTemplate opts of
+      Just _  -> ppDoc (Pandoc meta blocks) <> char '\n'
+      Nothing -> ppDoc blocks
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -2,7 +2,6 @@
 {-# LANGUAGE LambdaCase        #-}
 {-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE PatternGuards     #-}
-{-# LANGUAGE ViewPatterns      #-}
 {- |
    Module      : Text.Pandoc.Writers.OpenDocument
    Copyright   : Copyright (C) 2008-2020 Andrea Rossato and John MacFarlane
@@ -377,7 +376,7 @@
     Plain          b -> if null b
                         then return empty
                         else inParagraphTags =<< inlinesToOpenDocument o b
-    Para [Image attr c (s,T.stripPrefix "fig:" -> Just t)] -> figure attr c s t
+    SimpleFigure attr c (s, t) -> figure attr c s t
     Para           b -> if null b &&
                            not (isEnabled Ext_empty_paragraphs o)
                         then return empty
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -105,9 +105,7 @@
 blockToOrg Null = return empty
 blockToOrg (Div attr bs) = divToOrg attr bs
 blockToOrg (Plain inlines) = inlineListToOrg inlines
--- title beginning with fig: indicates that the image is a figure
-blockToOrg (Para [Image attr txt (src,tgt)])
-  | Just tit <- T.stripPrefix "fig:" tgt = do
+blockToOrg (SimpleFigure attr txt (src, tit)) = do
       capt <- if null txt
               then return empty
               else ("#+caption: " <>) `fmap` inlineListToOrg txt
@@ -154,7 +152,7 @@
   let (beg, end) = case at of
                       []    -> ("#+begin_example" <> numberlines, "#+end_example")
                       (x:_) -> ("#+begin_src " <> x <> numberlines, "#+end_src")
-  return $ literal beg $$ nest 2 (literal str) $$ text end $$ blankline
+  return $ literal beg $$ literal str $$ text end $$ blankline
 blockToOrg (BlockQuote blocks) = do
   contents <- blockListToOrg blocks
   return $ blankline $$ "#+begin_quote" $$
@@ -461,20 +459,52 @@
     "c"          -> "C"
     "commonlisp" -> "lisp"
     "r"          -> "R"
-    "bash"       -> "shell"
-    "lillypond"  -> "ly"
+    "bash"       -> "sh"
     _            -> cs
 
 -- | List of language identifiers recognized by org-mode.
+-- See <https://orgmode.org/manual/Languages.html>.
 orgLangIdentifiers :: [Text]
 orgLangIdentifiers =
-  [ "abc", "asymptote", "awk", "axiom", "C", "cpp", "calc", "clojure","comint"
-  , "coq", "css", "D", "ditaa", "dot", "ebnf", "elixir", "eukleides", "fomus"
-  , "forth", "F90", "gnuplot", "Translate", "groovy", "haskell" , "browser"
-  , "request", "io", "ipython", "J", "java", "js", "julia", "kotlin", "latex"
-  , "ledger", "ly", "lisp", "Flavored", "makefile", "mathematica", "mathomatic"
-  , "matlab", "max", "mongo", "mscgen", "cypher", "Caml", "octave" , "org", "oz"
-  , "perl", "picolisp", "plantuml", "processing", "prolog", "python" , "R"
-  , "rec", "ruby", "sass", "scala", "scheme", "screen", "sed", "shell", "shen"
-  , "sql", "sqlite", "stan", "ML", "stata", "tcl", "typescript", "vala"
-  ]
+  [ "asymptote"
+  , "lisp"
+  , "awk"
+  , "lua"
+  , "C"
+  , "matlab"
+  , "C++"
+  , "mscgen"
+  , "clojure"
+  , "ocaml"
+  , "css"
+  , "octave"
+  , "D"
+  , "org"
+  , "ditaa"
+  , "oz"
+  , "calc"
+  , "perl"
+  , "emacs-lisp"
+  , "plantuml"
+  , "eshell"
+  , "processing"
+  , "fortran"
+  , "python"
+  , "gnuplot"
+  , "R"
+  , "screen"
+  , "ruby"
+  , "dot"
+  , "sass"
+  , "haskell"
+  , "scheme"
+  , "java"
+  , "sed"
+  , "js"
+  , "sh"
+  , "latex"
+  , "sql"
+  , "ledger"
+  , "sqlite"
+  , "lilypond"
+  , "vala" ]
diff --git a/src/Text/Pandoc/Writers/Powerpoint/Output.hs b/src/Text/Pandoc/Writers/Powerpoint/Output.hs
--- a/src/Text/Pandoc/Writers/Powerpoint/Output.hs
+++ b/src/Text/Pandoc/Writers/Powerpoint/Output.hs
@@ -1,2115 +1,2827 @@
 {-# LANGUAGE DeriveTraversable #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE PatternGuards #-}
-{- |
-   Module      : Text.Pandoc.Writers.Powerpoint.Output
-   Copyright   : Copyright (C) 2017-2020 Jesse Rosenthal
-   License     : GNU GPL, version 2 or above
-
-   Maintainer  : Jesse Rosenthal <jrosenthal@jhu.edu>
-   Stability   : alpha
-   Portability : portable
-
-Conversion of Presentation datatype (defined in
-Text.Pandoc.Writers.Powerpoint.Presentation) to a zip archive.
--}
-
-module Text.Pandoc.Writers.Powerpoint.Output ( presentationToArchive
-                                             ) where
-
-import Control.Monad.Except (throwError, catchError)
-import Control.Monad.Reader
-import Control.Monad.State
-import Codec.Archive.Zip
-import Data.List (intercalate, stripPrefix, nub, union, isPrefixOf, intersperse)
-import Data.CaseInsensitive (CI)
-import qualified Data.CaseInsensitive as CI
-import Data.Default
-import Data.Foldable (toList)
-import Data.List.NonEmpty (nonEmpty, NonEmpty ((:|)))
-import Data.Text (Text)
-import qualified Data.Text as T
-import Data.Text.Read (decimal)
-import Data.Time (formatTime, defaultTimeLocale)
-import Data.Time.Clock (UTCTime)
-import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds, posixSecondsToUTCTime)
-import Data.Traversable (for)
-import System.FilePath.Posix (splitDirectories, splitExtension, takeExtension, takeFileName)
-import Text.Pandoc.XML.Light as XML
-import Text.Pandoc.Definition
-import qualified Text.Pandoc.UTF8 as UTF8
-import Text.Pandoc.Class.PandocMonad (PandocMonad)
-import Text.Pandoc.Error (PandocError(..))
-import qualified Text.Pandoc.Class.PandocMonad as P
-import Text.Pandoc.Options
-import Text.Pandoc.MIME
-import qualified Data.ByteString.Lazy as BL
-import Text.Pandoc.Writers.Shared (metaToContext)
-import Text.Pandoc.Writers.OOXML
-import qualified Data.Map as M
-import Data.Maybe (mapMaybe, listToMaybe, fromMaybe, maybeToList, catMaybes, isJust)
-import Text.Pandoc.ImageSize
-import Control.Applicative ((<|>))
-import System.FilePath.Glob
-import Text.DocTemplates (FromContext(lookupContext), Context)
-import Text.DocLayout (literal)
-import Text.TeXMath
-import Text.Pandoc.Logging (LogMessage(PowerpointTemplateWarning))
-import Text.Pandoc.Writers.Math (convertMath)
-import Text.Pandoc.Writers.Powerpoint.Presentation
-import Text.Pandoc.Shared (tshow, stringify)
-import Skylighting (fromColor)
-
--- |The 'EMU' type is used to specify sizes in English Metric Units.
-type EMU = Integer
-
--- |The 'pixelsToEmu' function converts a size in pixels to one
--- in English Metric Units. It assumes a DPI of 72.
-pixelsToEmu :: Pixels -> EMU
-pixelsToEmu = (12700 *)
-
--- This populates the global ids map with images already in the
--- template, so the ids won't be used by images introduced by the
--- user.
-initialGlobalIds :: Archive -> Archive -> M.Map FilePath Int
-initialGlobalIds refArchive distArchive =
-  let archiveFiles = filesInArchive refArchive `union` filesInArchive distArchive
-      mediaPaths = filter (isPrefixOf "ppt/media/image") archiveFiles
-
-      go :: FilePath -> Maybe (FilePath, Int)
-      go fp = do
-        s <- stripPrefix "ppt/media/image" $ fst $ splitExtension fp
-        (n, _) <- listToMaybe $ reads s
-        return (fp, n)
-  in
-    M.fromList $ mapMaybe go mediaPaths
-
-getPresentationSize :: Archive -> Archive -> Maybe (Integer, Integer)
-getPresentationSize refArchive distArchive = do
-  entry <- findEntryByPath "ppt/presentation.xml" refArchive  `mplus`
-           findEntryByPath "ppt/presentation.xml" distArchive
-  presElement <- either (const Nothing) return $
-                   parseXMLElement $ UTF8.toTextLazy $ fromEntry entry
-  let ns = elemToNameSpaces presElement
-  sldSize <- findChild (elemName ns "p" "sldSz") presElement
-  cxS <- findAttr (QName "cx" Nothing Nothing) sldSize
-  cyS <- findAttr (QName "cy" Nothing Nothing) sldSize
-  cx <- readTextAsInteger cxS
-  cy <- readTextAsInteger cyS
-  return (cx `div` 12700, cy `div` 12700)
-
-readTextAsInteger :: Text -> Maybe Integer
-readTextAsInteger = either (const Nothing) (Just . fst) . Data.Text.Read.decimal
-
-data WriterEnv = WriterEnv { envRefArchive :: Archive
-                           , envDistArchive :: Archive
-                           , envUTCTime :: UTCTime
-                           , envOpts :: WriterOptions
-                           , envContext :: Context Text
-                           , envPresentationSize :: (Integer, Integer)
-                           , envSlideHasHeader :: Bool
-                           , envInList :: Bool
-                           , envInNoteSlide :: Bool
-                           , envCurSlideId :: Int
-                           -- the difference between the number at
-                           -- the end of the slide file name and
-                           -- the rId number
-                           , envSlideIdOffset :: Int
-                           , envContentType :: ContentType
-                           , envSlideIdMap :: M.Map SlideId Int
-                           -- maps the slide number to the
-                           -- corresponding notes id number. If there
-                           -- are no notes for a slide, there will be
-                           -- no entry in the map for it.
-                           , envSpeakerNotesIdMap :: M.Map Int Int
-                           , envInSpeakerNotes :: Bool
-                           , envSlideLayouts :: Maybe SlideLayouts
-                           }
-                 deriving (Show)
-
-instance Default WriterEnv where
-  def = WriterEnv { envRefArchive = emptyArchive
-                  , envDistArchive = emptyArchive
-                  , envUTCTime = posixSecondsToUTCTime 0
-                  , envOpts = def
-                  , envContext = mempty
-                  , envPresentationSize = (720, 540)
-                  , envSlideHasHeader = False
-                  , envInList = False
-                  , envInNoteSlide = False
-                  , envCurSlideId = 1
-                  , envSlideIdOffset = 1
-                  , envContentType = NormalContent
-                  , envSlideIdMap = mempty
-                  , envSpeakerNotesIdMap = mempty
-                  , envInSpeakerNotes = False
-                  , envSlideLayouts = Nothing
-                  }
-
-type SlideLayouts = SlideLayoutsOf SlideLayout
-
-data SlideLayoutsOf a = SlideLayouts
-  { metadata :: a
-  , title :: a
-  , content :: a
-  , twoColumn :: a
-  } deriving (Show, Functor, Foldable, Traversable)
-
-data SlideLayout = SlideLayout
-  { slElement :: Element
-  , slInReferenceDoc :: Bool
-    -- ^ True if the layout is in the provided reference doc, False if it's in
-    -- the default reference doc.
-  , slPath :: FilePath
-  , slEntry :: Entry
-  } deriving (Show)
-
-getSlideLayouts :: PandocMonad m => P m SlideLayouts
-getSlideLayouts = asks envSlideLayouts >>= maybe (throwError e) pure
-  where
-    e = PandocSomeError ("Slide layouts aren't defined, even though they should "
-      <> "always be. This is a bug in pandoc.")
-
-data ContentType = NormalContent
-                 | TwoColumnLeftContent
-                 | TwoColumnRightContent
-                 deriving (Show, Eq)
-
-data MediaInfo = MediaInfo { mInfoFilePath :: FilePath
-                           , mInfoLocalId  :: Int
-                           , mInfoGlobalId :: Int
-                           , mInfoMimeType :: Maybe MimeType
-                           , mInfoExt      :: Maybe T.Text
-                           , mInfoCaption  :: Bool
-                           } deriving (Show, Eq)
-
-data WriterState = WriterState { stLinkIds :: M.Map Int (M.Map Int LinkTarget)
-                               -- (FP, Local ID, Global ID, Maybe Mime)
-                               , stMediaIds :: M.Map Int [MediaInfo]
-                               , stMediaGlobalIds :: M.Map FilePath Int
-                               } deriving (Show, Eq)
-
-instance Default WriterState where
-  def = WriterState { stLinkIds = mempty
-                    , stMediaIds = mempty
-                    , stMediaGlobalIds = mempty
-                    }
-
-type P m = ReaderT WriterEnv (StateT WriterState m)
-
-runP :: Monad m => WriterEnv -> WriterState -> P m a -> m a
-runP env st p = evalStateT (runReaderT p env) st
-
---------------------------------------------------------------------
-
-monospaceFont :: Monad m => P m T.Text
-monospaceFont = do
-  vars <- asks envContext
-  case lookupContext "monofont" vars of
-    Just s -> return s
-    Nothing -> return "Courier"
-
-fontSizeAttributes :: Monad m => RunProps -> P m [(Text, Text)]
-fontSizeAttributes RunProps { rPropForceSize = Just sz } =
-  return [("sz", tshow $ sz * 100)]
-fontSizeAttributes _ = return []
-
-copyFileToArchive :: PandocMonad m => Archive -> FilePath -> P m Archive
-copyFileToArchive arch fp = do
-  refArchive <- asks envRefArchive
-  distArchive <- asks envDistArchive
-  case findEntryByPath fp refArchive `mplus` findEntryByPath fp distArchive of
-    Nothing -> throwError $ PandocSomeError
-                          $ T.pack
-                          $ fp <> " missing in reference file"
-    Just e -> return $ addEntryToArchive e arch
-
-alwaysInheritedPatterns :: [Pattern]
-alwaysInheritedPatterns =
-  map compile [ "docProps/app.xml"
-              , "ppt/slideLayouts/slideLayout*.xml"
-              , "ppt/slideLayouts/_rels/slideLayout*.xml.rels"
-              , "ppt/slideMasters/slideMaster1.xml"
-              , "ppt/slideMasters/_rels/slideMaster1.xml.rels"
-              , "ppt/theme/theme1.xml"
-              , "ppt/theme/_rels/theme1.xml.rels"
-              , "ppt/presProps.xml"
-              , "ppt/tableStyles.xml"
-              , "ppt/media/image*"
-              ]
-
--- We only look for these under special conditions
-contingentInheritedPatterns :: Presentation -> [Pattern]
-contingentInheritedPatterns pres = [] <>
-  if presHasSpeakerNotes pres
-  then map compile [ "ppt/notesMasters/notesMaster*.xml"
-                   , "ppt/notesMasters/_rels/notesMaster*.xml.rels"
-                   , "ppt/theme/theme2.xml"
-                   , "ppt/theme/_rels/theme2.xml.rels"
-                   ]
-  else []
-
-inheritedPatterns :: Presentation -> [Pattern]
-inheritedPatterns pres =
-  alwaysInheritedPatterns <> contingentInheritedPatterns pres
-
-patternToFilePaths :: PandocMonad m => Pattern -> P m [FilePath]
-patternToFilePaths pat = do
-  refArchive <- asks envRefArchive
-  distArchive <- asks envDistArchive
-
-  let archiveFiles = filesInArchive refArchive `union` filesInArchive distArchive
-  return $ filter (match pat) archiveFiles
-
-patternsToFilePaths :: PandocMonad m => [Pattern] -> P m [FilePath]
-patternsToFilePaths pats = concat <$> mapM patternToFilePaths pats
-
--- Here are the files we'll require to make a Powerpoint document. If
--- any of these are missing, we should error out of our build.
-requiredFiles :: [FilePath]
-requiredFiles = [ "docProps/app.xml"
-                , "ppt/presProps.xml"
-                , "ppt/slideLayouts/slideLayout1.xml"
-                , "ppt/slideLayouts/_rels/slideLayout1.xml.rels"
-                , "ppt/slideLayouts/slideLayout2.xml"
-                , "ppt/slideLayouts/_rels/slideLayout2.xml.rels"
-                , "ppt/slideLayouts/slideLayout3.xml"
-                , "ppt/slideLayouts/_rels/slideLayout3.xml.rels"
-                , "ppt/slideLayouts/slideLayout4.xml"
-                , "ppt/slideLayouts/_rels/slideLayout4.xml.rels"
-                , "ppt/slideMasters/slideMaster1.xml"
-                , "ppt/slideMasters/_rels/slideMaster1.xml.rels"
-                , "ppt/theme/theme1.xml"
-                , "ppt/tableStyles.xml"
-                ]
-
-presentationToArchiveP :: PandocMonad m => Presentation -> P m Archive
-presentationToArchiveP p@(Presentation docProps slides) = do
-  filePaths <- patternsToFilePaths $ inheritedPatterns p
-
-  -- make sure all required files are available:
-  let missingFiles = filter (`notElem` filePaths) requiredFiles
-  unless (null missingFiles)
-    (throwError $
-      PandocSomeError $
-      "The following required files are missing:\n" <>
-      T.unlines (map (T.pack . ("  " <>)) missingFiles)
-    )
-
-  newArch <- foldM copyFileToArchive emptyArchive filePaths
-
-  -- Add any layouts taken from the default archive,
-  -- overwriting any already added.
-  slideLayouts <- getSlideLayouts
-  let f layout =
-        if not (slInReferenceDoc layout)
-        then addEntryToArchive (slEntry layout)
-        else id
-  let newArch' = foldr f newArch slideLayouts
-
-  -- Update the master to make sure it includes any layouts we've just added
-  master <- getMaster
-  masterRels <- getMasterRels
-  let (updatedMasterElem, updatedMasterRelElem) = updateMasterElems slideLayouts master masterRels
-  updatedMasterEntry <- elemToEntry "ppt/slideMasters/slideMaster1.xml" updatedMasterElem
-  updatedMasterRelEntry <- elemToEntry "ppt/slideMasters/_rels/slideMaster1.xml.rels" updatedMasterRelElem
-
-  -- we make a modified ppt/viewProps.xml out of the presentation viewProps
-  viewPropsEntry <- makeViewPropsEntry
-  -- we make a docProps/core.xml entry out of the presentation docprops
-  docPropsEntry <- docPropsToEntry docProps
-  -- we make a docProps/custom.xml entry out of the custom properties
-  docCustomPropsEntry <- docCustomPropsToEntry docProps
-  -- we make this ourself in case there's something unexpected in the
-  -- one in the reference doc.
-  relsEntry <- topLevelRelsEntry
-  -- presentation entry and rels. We have to do the rels first to make
-  -- sure we know the correct offset for the rIds.
-  presEntry <- presentationToPresEntry p
-  presRelsEntry <- presentationToRelsEntry p
-  slideEntries <- mapM slideToEntry slides
-  slideRelEntries <- mapM slideToSlideRelEntry slides
-  spkNotesEntries <- catMaybes <$> mapM slideToSpeakerNotesEntry slides
-  spkNotesRelEntries <- catMaybes <$> mapM slideToSpeakerNotesRelEntry slides
-  -- These have to come after everything, because they need the info
-  -- built up in the state.
-  mediaEntries <- makeMediaEntries
-  contentTypesEntry <- presentationToContentTypes p >>= contentTypesToEntry
-  -- fold everything into our inherited archive and return it.
-  return $ foldr addEntryToArchive newArch' $
-    slideEntries <>
-    slideRelEntries <>
-    spkNotesEntries <>
-    spkNotesRelEntries <>
-    mediaEntries <>
-    [updatedMasterEntry, updatedMasterRelEntry]  <>
-    [contentTypesEntry, docPropsEntry, docCustomPropsEntry, relsEntry,
-     presEntry, presRelsEntry, viewPropsEntry]
-
-updateMasterElems :: SlideLayouts -> Element -> Element -> (Element, Element)
-updateMasterElems layouts master masterRels = (updatedMaster, updatedMasterRels)
-  where
-    updatedMaster = master { elContent = updateSldLayoutIdLst <$> elContent master }
-    (updatedRelationshipIds, updatedMasterRels) = addLayoutRels masterRels
-
-    updateSldLayoutIdLst :: Content -> Content
-    updateSldLayoutIdLst (Elem e) = case elName e of
-      (QName "sldLayoutIdLst" _ _) -> let
-        mkChild relationshipId (lastId, children) = let
-          thisId = lastId + 1
-          newChild = Element
-            { elName = QName "sldLayoutId" Nothing (Just "p")
-            , elAttribs =
-              [ Attr (QName "id" Nothing Nothing) (T.pack (show thisId))
-              , Attr (QName "id" Nothing (Just "r")) relationshipId
-              ]
-            , elContent = []
-            , elLine = Nothing
-            }
-          in (thisId, Elem newChild : children)
-        newChildren = snd (foldr mkChild (maxIdNumber' e, []) updatedRelationshipIds)
-        in Elem e { elContent = elContent e <> newChildren }
-      _ -> Elem e
-    updateSldLayoutIdLst c = c
-
-    addLayoutRels ::
-      Element ->
-      ([Text], Element)
-    addLayoutRels e = let
-      layoutsToAdd = filter (not . slInReferenceDoc) (toList layouts)
-      newRelationships = snd (foldr mkRelationship (maxIdNumber e, []) layoutsToAdd)
-      newRelationshipIds = mapMaybe getRelationshipId newRelationships
-      mkRelationship layout (lastId, relationships) = let
-        thisId = lastId + 1
-        slideLayoutPath = "../slideLayouts/" <> T.pack (takeFileName (slPath layout))
-        newRelationship = Element
-          { elName = QName "Relationship" Nothing Nothing
-          , elAttribs =
-            [ Attr (QName "Id" Nothing Nothing) ("rId" <> T.pack (show thisId))
-            , Attr (QName "Type" Nothing Nothing) "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"
-            , Attr (QName "Target" Nothing Nothing) slideLayoutPath
-            ]
-          , elContent = []
-          , elLine = Nothing
-          }
-        in (thisId, Elem newRelationship : relationships)
-      in (newRelationshipIds, e {elContent = elContent e <> newRelationships})
-
-    getRelationshipId :: Content -> Maybe Text
-    getRelationshipId (Elem e) = findAttr (QName "Id" Nothing Nothing) e
-    getRelationshipId _ = Nothing
-
-    maxIdNumber :: Element -> Integer
-    maxIdNumber relationships = maximum (0 : idNumbers)
-      where
-        idNumbers = fst <$> mapMaybe (hush . decimal . T.drop 3) idAttributes
-        idAttributes = mapMaybe getIdAttribute (elContent relationships)
-        getIdAttribute (Elem e) = findAttr (QName "Id" Nothing Nothing) e
-        getIdAttribute _ = Nothing
-
-    maxIdNumber' :: Element -> Integer
-    maxIdNumber' sldLayouts = maximum (0 : idNumbers)
-      where
-        idNumbers = fst <$> mapMaybe (hush . decimal) idAttributes
-        idAttributes = mapMaybe getIdAttribute (elContent sldLayouts)
-        getIdAttribute (Elem e) = findAttr (QName "id" Nothing Nothing) e
-        getIdAttribute _ = Nothing
-
-    hush :: Either a b -> Maybe b
-    hush = either (const Nothing) Just
-
-makeSlideIdMap :: Presentation -> M.Map SlideId Int
-makeSlideIdMap (Presentation _ slides) =
-  M.fromList $ map slideId slides `zip` [1..]
-
-makeSpeakerNotesMap :: Presentation -> M.Map Int Int
-makeSpeakerNotesMap (Presentation _ slides) =
-  M.fromList $
-    mapMaybe f (slides `zip` [1..]) `zip` [1..]
-  where f (Slide _ _ notes, n) = if notes == mempty
-                                 then Nothing
-                                 else Just n
-
-presentationToArchive :: PandocMonad m
-                      => WriterOptions -> Meta -> Presentation -> m Archive
-presentationToArchive opts meta pres = do
-  distArchive <- toArchive . BL.fromStrict <$>
-                      P.readDefaultDataFile "reference.pptx"
-  refArchive <- case writerReferenceDoc opts of
-                     Just f  -> toArchive <$> P.readFileLazy f
-                     Nothing -> toArchive . BL.fromStrict <$>
-                        P.readDataFile "reference.pptx"
-
-  let (referenceLayouts, defaultReferenceLayouts) =
-        (getLayoutsFromArchive refArchive, getLayoutsFromArchive distArchive)
-  let layoutTitles = SlideLayouts { metadata = "Title Slide" :: Text
-                                  , title = "Section Header"
-                                  , content = "Title and Content"
-                                  , twoColumn = "Two Content"
-                                  }
-  layouts <- for layoutTitles $ \layoutTitle -> do
-        let layout = M.lookup (CI.mk layoutTitle) referenceLayouts
-        let defaultLayout = M.lookup (CI.mk layoutTitle) defaultReferenceLayouts
-        case (layout, defaultLayout) of
-          (Nothing, Nothing) ->
-            throwError (PandocSomeError ("Couldn't find layout named \""
-                                         <> layoutTitle <> "\" in the provided "
-                                         <> "reference doc or in the default "
-                                         <> "reference doc included with pandoc."))
-          (Nothing, Just ((element, path, entry) :| _)) -> do
-            P.report (PowerpointTemplateWarning
-                                     ("Couldn't find layout named \""
-                                      <> layoutTitle <> "\" in provided "
-                                      <> "reference doc. Falling back to "
-                                      <> "the default included with pandoc."))
-            pure SlideLayout { slElement = element
-                             , slPath = path
-                             , slEntry = entry
-                             , slInReferenceDoc = False
-                             }
-          (Just ((element, path, entry) :| _), _ ) ->
-            pure SlideLayout { slElement = element
-                             , slPath = path
-                             , slEntry = entry
-                             , slInReferenceDoc = True
-                             }
-
-
-  utctime <- P.getTimestamp
-
-  presSize <- case getPresentationSize refArchive distArchive of
-                Just sz -> return sz
-                Nothing -> throwError $
-                           PandocSomeError
-                           "Could not determine presentation size"
-
-  -- note, we need writerTemplate to be Just _ or metaToContext does
-  -- nothing
-  context <- metaToContext opts{ writerTemplate =
-                                  writerTemplate opts <|> Just mempty }
-                (return . literal . stringify)
-                (return . literal . stringify) meta
-
-  let env = def { envRefArchive = refArchive
-                , envDistArchive = distArchive
-                , envUTCTime = utctime
-                , envOpts = opts
-                , envContext = context
-                , envPresentationSize = presSize
-                , envSlideIdMap = makeSlideIdMap pres
-                , envSpeakerNotesIdMap = makeSpeakerNotesMap pres
-                , envSlideLayouts = Just layouts
-                }
-
-  let st = def { stMediaGlobalIds = initialGlobalIds refArchive distArchive
-               }
-
-  runP env st $ presentationToArchiveP pres
-
--- | Get all slide layouts from an archive, as a map where the layout's name
--- gives the map key.
---
--- For each layout, the map contains its XML representation, its path within
--- the archive, and the archive entry.
-getLayoutsFromArchive :: Archive -> M.Map (CI Text) (NonEmpty (Element, FilePath, Entry))
-getLayoutsFromArchive archive =
-  M.fromListWith (<>) ((\t@(e, _, _) -> (CI.mk (name e), pure t)) <$> layouts)
-  where
-    layouts :: [(Element, FilePath, Entry)]
-    layouts = mapMaybe findElementByPath paths
-    parseXml' entry = case parseXMLElement (UTF8.toTextLazy (fromEntry entry)) of
-            Left _ -> Nothing
-            Right element -> Just element
-    findElementByPath :: FilePath -> Maybe (Element, FilePath, Entry)
-    findElementByPath path = do
-      entry <- findEntryByPath path archive
-      element <- parseXml' entry
-      pure (element, path, entry)
-    paths = filter (match (compile "ppt/slideLayouts/slideLayout*.xml")) (filesInArchive archive)
-    name element = fromMaybe "Untitled layout" $ do
-            let ns = elemToNameSpaces element
-            cSld <- findChild (elemName ns "p" "cSld") element
-            findAttr (QName "name" Nothing Nothing) cSld
-
---------------------------------------------------
-
--- Check to see if the presentation has speaker notes. This will
--- influence whether we import the notesMaster template.
-presHasSpeakerNotes :: Presentation -> Bool
-presHasSpeakerNotes (Presentation _ slides) =
-  not $ all ((mempty ==) . slideSpeakerNotes) slides
-
-curSlideHasSpeakerNotes :: PandocMonad m => P m Bool
-curSlideHasSpeakerNotes =
-  M.member <$> asks envCurSlideId <*> asks envSpeakerNotesIdMap
-
---------------------------------------------------
-
-getLayout :: PandocMonad m => Layout -> P m Element
-getLayout layout = getElement <$> getSlideLayouts
-  where
-    getElement =
-      slElement . case layout of
-        MetadataSlide{}  -> metadata
-        TitleSlide{}     -> title
-        ContentSlide{}   -> content
-        TwoColumnSlide{} -> twoColumn
-
-shapeHasId :: NameSpaces -> T.Text -> Element -> Bool
-shapeHasId ns ident element
-  | Just nvSpPr <- findChild (elemName ns "p" "nvSpPr") element
-  , Just cNvPr <- findChild (elemName ns "p" "cNvPr") nvSpPr
-  , Just nm <- findAttr (QName "id" Nothing Nothing) cNvPr =
-      nm == ident
-  | otherwise = False
-
-getContentShape :: PandocMonad m => NameSpaces -> Element -> P m Element
-getContentShape ns spTreeElem
-  | isElem ns "p" "spTree" spTreeElem = do
-      contentType <- asks envContentType
-      let contentShapes = getShapesByPlaceHolderType ns spTreeElem ObjType
-      case contentType of
-        NormalContent | (sp : _) <- contentShapes -> return sp
-        TwoColumnLeftContent | (sp : _) <- contentShapes -> return sp
-        TwoColumnRightContent | (_ : sp : _) <- contentShapes -> return sp
-        _ -> throwError $ PandocSomeError
-             "Could not find shape for Powerpoint content"
-getContentShape _ _ = throwError $ PandocSomeError
-                      "Attempted to find content on non shapeTree"
-
-getShapeDimensions :: NameSpaces
-                   -> Element
-                   -> Maybe ((Integer, Integer), (Integer, Integer))
-getShapeDimensions ns element
-  | isElem ns "p" "sp" element = do
-      spPr <- findChild (elemName ns "p" "spPr") element
-      xfrm <- findChild (elemName ns "a" "xfrm") spPr
-      off <- findChild (elemName ns "a" "off") xfrm
-      xS <- findAttr (QName "x" Nothing Nothing) off
-      yS <- findAttr (QName "y" Nothing Nothing) off
-      ext <- findChild (elemName ns "a" "ext") xfrm
-      cxS <- findAttr (QName "cx" Nothing Nothing) ext
-      cyS <- findAttr (QName "cy" Nothing Nothing) ext
-      x <- readTextAsInteger xS
-      y <- readTextAsInteger yS
-      cx <- readTextAsInteger cxS
-      cy <- readTextAsInteger cyS
-      return ((x `div` 12700, y `div` 12700),
-              (cx `div` 12700, cy `div` 12700))
-  | otherwise = Nothing
-
-
-getMasterShapeDimensionsById :: T.Text
-                             -> Element
-                             -> Maybe ((Integer, Integer), (Integer, Integer))
-getMasterShapeDimensionsById ident master = do
-  let ns = elemToNameSpaces master
-  cSld <- findChild (elemName ns "p" "cSld") master
-  spTree <- findChild (elemName ns "p" "spTree") cSld
-  sp <- filterChild (\e -> isElem ns "p" "sp" e && shapeHasId ns ident e) spTree
-  getShapeDimensions ns sp
-
-getContentShapeSize :: PandocMonad m
-                    => NameSpaces
-                    -> Element
-                    -> Element
-                    -> P m ((Integer, Integer), (Integer, Integer))
-getContentShapeSize ns layout master
-  | isElem ns "p" "sldLayout" layout
-  , Just cSld <- findChild (elemName ns "p" "cSld") layout
-  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
-      sp  <- getContentShape ns spTree
-      case getShapeDimensions ns sp of
-        Just sz -> return sz
-        Nothing -> do let mbSz =
-                            findChild (elemName ns "p" "nvSpPr") sp >>=
-                            findChild (elemName ns "p" "cNvPr") >>=
-                            findAttr (QName "id" Nothing Nothing) >>=
-                            flip getMasterShapeDimensionsById master
-                      case mbSz of
-                        Just sz' -> return sz'
-                        Nothing -> throwError $ PandocSomeError
-                                   "Couldn't find necessary content shape size"
-getContentShapeSize _ _ _ = throwError $ PandocSomeError
-                            "Attempted to find content shape size in non-layout"
-
-buildSpTree :: NameSpaces -> Element -> [Content] -> Element
-buildSpTree ns spTreeElem newShapes =
-  emptySpTreeElem { elContent = newContent }
-  where newContent = elContent emptySpTreeElem <> newShapes
-        emptySpTreeElem = spTreeElem { elContent = filter fn (elContent spTreeElem) }
-        fn :: Content -> Bool
-        fn (Elem e) = isElem ns "p" "nvGrpSpPr" e ||
-                      isElem ns "p" "grpSpPr" e
-        fn _        = True
-
-replaceNamedChildren :: NameSpaces
-                     -> Text
-                     -> Text
-                     -> [Element]
-                     -> Element
-                     -> Element
-replaceNamedChildren ns prefix name newKids element =
-  element { elContent = concat $ fun True $ elContent element }
-  where
-    fun :: Bool -> [Content] -> [[Content]]
-    fun _ [] = []
-    fun switch (Elem e : conts) | isElem ns prefix name e =
-                                      if switch
-                                      then map Elem newKids : fun False conts
-                                      else fun False conts
-    fun switch (cont : conts) = [cont] : fun switch conts
-
-----------------------------------------------------------------
-
-registerLink :: PandocMonad m => LinkTarget -> P m Int
-registerLink link = do
-  curSlideId <- asks envCurSlideId
-  linkReg <- gets stLinkIds
-  mediaReg <- gets stMediaIds
-  hasSpeakerNotes <- curSlideHasSpeakerNotes
-  let maxLinkId = case M.lookup curSlideId linkReg >>= nonEmpty . M.keys of
-        Just xs -> maximum xs
-        Nothing
-          | hasSpeakerNotes -> 2
-          | otherwise       -> 1
-      maxMediaId = case M.lookup curSlideId mediaReg >>= nonEmpty of
-        Just mInfos -> maximum $ fmap mInfoLocalId mInfos
-        Nothing
-          | hasSpeakerNotes -> 2
-          | otherwise       -> 1
-      maxId = max maxLinkId maxMediaId
-      slideLinks = case M.lookup curSlideId linkReg of
-        Just mp -> M.insert (maxId + 1) link mp
-        Nothing -> M.singleton (maxId + 1) link
-  modify $ \st -> st{ stLinkIds = M.insert curSlideId slideLinks linkReg}
-  return $ maxId + 1
-
-registerMedia :: PandocMonad m => FilePath -> [ParaElem] -> P m MediaInfo
-registerMedia fp caption = do
-  curSlideId <- asks envCurSlideId
-  linkReg <- gets stLinkIds
-  mediaReg <- gets stMediaIds
-  globalIds <- gets stMediaGlobalIds
-  hasSpeakerNotes <- curSlideHasSpeakerNotes
-  let maxLinkId = case M.lookup curSlideId linkReg >>= nonEmpty . M.keys of
-          Just ks -> maximum ks
-          Nothing
-            | hasSpeakerNotes -> 2
-            | otherwise       -> 1
-      maxMediaId = case M.lookup curSlideId mediaReg >>= nonEmpty of
-          Just mInfos -> maximum $ fmap mInfoLocalId mInfos
-          Nothing
-            | hasSpeakerNotes -> 2
-            | otherwise       -> 1
-      maxLocalId = max maxLinkId maxMediaId
-
-      maxGlobalId = maybe 0 maximum $ nonEmpty $ M.elems globalIds
-
-  (imgBytes, mbMt) <- P.fetchItem $ T.pack fp
-  let imgExt = (mbMt >>= extensionFromMimeType >>= (\x -> return $ "." <> x))
-               <|>
-               case imageType imgBytes of
-                 Just Png  -> Just ".png"
-                 Just Jpeg -> Just ".jpeg"
-                 Just Gif  -> Just ".gif"
-                 Just Pdf  -> Just ".pdf"
-                 Just Eps  -> Just ".eps"
-                 Just Svg  -> Just ".svg"
-                 Just Emf  -> Just ".emf"
-                 Just Tiff -> Just ".tiff"
-                 Nothing   -> Nothing
-
-  let newGlobalId = fromMaybe (maxGlobalId + 1) (M.lookup fp globalIds)
-
-  let newGlobalIds = M.insert fp newGlobalId globalIds
-
-  let mediaInfo = MediaInfo { mInfoFilePath = fp
-                            , mInfoLocalId = maxLocalId + 1
-                            , mInfoGlobalId = newGlobalId
-                            , mInfoMimeType = mbMt
-                            , mInfoExt = imgExt
-                            , mInfoCaption = (not . null) caption
-                            }
-
-  let slideMediaInfos = case M.lookup curSlideId mediaReg of
-        Just minfos -> mediaInfo : minfos
-        Nothing     -> [mediaInfo]
-
-
-  modify $ \st -> st{ stMediaIds = M.insert curSlideId slideMediaInfos mediaReg
-                    , stMediaGlobalIds = newGlobalIds
-                    }
-  return mediaInfo
-
-makeMediaEntry :: PandocMonad m => MediaInfo -> P m Entry
-makeMediaEntry mInfo = do
-  epochtime <- floor . utcTimeToPOSIXSeconds <$> asks envUTCTime
-  (imgBytes, _) <- P.fetchItem (T.pack $ mInfoFilePath mInfo)
-  let ext = fromMaybe "" (mInfoExt mInfo)
-  let fp = "ppt/media/image" <>
-          show (mInfoGlobalId mInfo) <> T.unpack ext
-  return $ toEntry fp epochtime $ BL.fromStrict imgBytes
-
-makeMediaEntries :: PandocMonad m => P m [Entry]
-makeMediaEntries = do
-  mediaInfos <- gets stMediaIds
-  let allInfos = mconcat $ M.elems mediaInfos
-  mapM makeMediaEntry allInfos
-
--- -- | Scales the image to fit the page
--- -- sizes are passed in emu
--- fitToPage' :: (Double, Double)  -- image size in emu
---            -> Integer           -- pageWidth
---            -> Integer           -- pageHeight
---            -> (Integer, Integer) -- imagesize
--- fitToPage' (x, y) pageWidth pageHeight
---   -- Fixes width to the page width and scales the height
---   | x <= fromIntegral pageWidth && y <= fromIntegral pageHeight =
---       (floor x, floor y)
---   | x / fromIntegral pageWidth > y / fromIntegral pageWidth =
---       (pageWidth, floor $ ((fromIntegral pageWidth) / x) * y)
---   | otherwise =
---       (floor $ ((fromIntegral pageHeight) / y) * x, pageHeight)
-
--- positionImage :: (Double, Double) -> Integer -> Integer -> (Integer, Integer)
--- positionImage (x, y) pageWidth pageHeight =
---   let (x', y') = fitToPage' (x, y) pageWidth pageHeight
---   in
---     ((pageWidth - x') `div` 2, (pageHeight - y') `div`  2)
-
-getMaster :: PandocMonad m => P m Element
-getMaster = do
-  refArchive <- asks envRefArchive
-  distArchive <- asks envDistArchive
-  parseXml refArchive distArchive "ppt/slideMasters/slideMaster1.xml"
-
-getMasterRels :: PandocMonad m => P m Element
-getMasterRels = do
-  refArchive <- asks envRefArchive
-  distArchive <- asks envDistArchive
-  parseXml refArchive distArchive "ppt/slideMasters/_rels/slideMaster1.xml.rels"
-
--- We want to get the header dimensions, so we can make sure that the
--- image goes underneath it. We only use this in a content slide if it
--- has a header.
-
--- getHeaderSize :: PandocMonad m => P m ((Integer, Integer), (Integer, Integer))
--- getHeaderSize = do
---   master <- getMaster
---   let ns = elemToNameSpaces master
---       sps = [master] >>=
---             findChildren (elemName ns "p" "cSld") >>=
---             findChildren (elemName ns "p" "spTree") >>=
---             findChildren (elemName ns "p" "sp")
---       mbXfrm =
---         listToMaybe (filter (shapeHasName ns "Title Placeholder 1") sps) >>=
---         findChild (elemName ns "p" "spPr") >>=
---         findChild (elemName ns "a" "xfrm")
---       xoff = mbXfrm >>=
---              findChild (elemName ns "a" "off") >>=
---              findAttr (QName "x" Nothing Nothing) >>=
---              (listToMaybe . (\s -> reads s :: [(Integer, String)]))
---       yoff = mbXfrm >>=
---              findChild (elemName ns "a" "off") >>=
---              findAttr (QName "y" Nothing Nothing) >>=
---              (listToMaybe . (\s -> reads s :: [(Integer, String)]))
---       xext = mbXfrm >>=
---              findChild (elemName ns "a" "ext") >>=
---              findAttr (QName "cx" Nothing Nothing) >>=
---              (listToMaybe . (\s -> reads s :: [(Integer, String)]))
---       yext = mbXfrm >>=
---              findChild (elemName ns "a" "ext") >>=
---              findAttr (QName "cy" Nothing Nothing) >>=
---              (listToMaybe . (\s -> reads s :: [(Integer, String)]))
---       off = case xoff of
---               Just (xoff', _) | Just (yoff',_) <- yoff -> (xoff', yoff')
---               _                               -> (1043490, 1027664)
---       ext = case xext of
---               Just (xext', _) | Just (yext',_) <- yext -> (xext', yext')
---               _                               -> (7024744, 1143000)
---   return $ (off, ext)
-
--- Hard-coded for now
--- captionPosition :: ((Integer, Integer), (Integer, Integer))
--- captionPosition = ((457200, 6061972), (8229600, 527087))
-
-captionHeight :: Integer
-captionHeight = 40
-
-createCaption :: PandocMonad m
-              => ((Integer, Integer), (Integer, Integer))
-              -> [ParaElem]
-              -> P m Element
-createCaption contentShapeDimensions paraElements = do
-  let para = Paragraph def{pPropAlign = Just AlgnCenter} paraElements
-  elements <- mapM paragraphToElement [para]
-  let ((x, y), (cx, cy)) = contentShapeDimensions
-  let txBody = mknode "p:txBody" [] $
-               [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <> elements
-  return $
-    mknode "p:sp" [] [ mknode "p:nvSpPr" []
-                       [ mknode "p:cNvPr" [("id","1"), ("name","TextBox 3")] ()
-                       , mknode "p:cNvSpPr" [("txBox", "1")] ()
-                       , mknode "p:nvPr" [] ()
-                       ]
-                     , mknode "p:spPr" []
-                       [ mknode "a:xfrm" []
-                         [ mknode "a:off" [("x", tshow $ 12700 * x),
-                                           ("y", tshow $ 12700 * (y + cy - captionHeight))] ()
-                         , mknode "a:ext" [("cx", tshow $ 12700 * cx),
-                                           ("cy", tshow $ 12700 * captionHeight)] ()
-                         ]
-                       , mknode "a:prstGeom" [("prst", "rect")]
-                         [ mknode "a:avLst" [] ()
-                         ]
-                       , mknode "a:noFill" [] ()
-                       ]
-                     , txBody
-                     ]
-
-makePicElements :: PandocMonad m
-                => Element
-                -> PicProps
-                -> MediaInfo
-                -> Text
-                -> [ParaElem]
-                -> P m [Element]
-makePicElements layout picProps mInfo titleText alt = do
-  opts <- asks envOpts
-  (pageWidth, pageHeight) <- asks envPresentationSize
-  -- hasHeader <- asks envSlideHasHeader
-  let hasCaption = mInfoCaption mInfo
-  (imgBytes, _) <- P.fetchItem (T.pack $ mInfoFilePath mInfo)
-  let (pxX, pxY) = case imageSize opts imgBytes of
-        Right sz -> sizeInPixels sz
-        Left _   -> sizeInPixels def
-  master <- getMaster
-  let ns = elemToNameSpaces layout
-  ((x, y), (cx, cytmp)) <- getContentShapeSize ns layout master
-                           `catchError`
-                           (\_ -> return ((0, 0), (pageWidth, pageHeight)))
-
-  let cy = if hasCaption then cytmp - captionHeight else cytmp
-
-  let imgRatio = fromIntegral pxX / fromIntegral pxY :: Double
-      boxRatio = fromIntegral cx / fromIntegral cy :: Double
-      (dimX, dimY) = if imgRatio > boxRatio
-                     then (fromIntegral cx, fromIntegral cx / imgRatio)
-                     else (fromIntegral cy * imgRatio, fromIntegral cy)
-
-      (dimX', dimY') = (round dimX * 12700, round dimY * 12700) :: (Integer, Integer)
-      (xoff, yoff) = (fromIntegral x + (fromIntegral cx - dimX) / 2,
-                      fromIntegral y + (fromIntegral cy - dimY) / 2)
-      (xoff', yoff') = (round xoff * 12700, round yoff * 12700) :: (Integer, Integer)
-
-  let cNvPicPr = mknode "p:cNvPicPr" [] $
-                 mknode "a:picLocks" [("noGrp","1")
-                                     ,("noChangeAspect","1")] ()
-  -- cNvPr will contain the link information so we do that separately,
-  -- and register the link if necessary.
-  let description = (if T.null titleText
-                      then ""
-                      else titleText <> "\n\n")
-                      <> T.pack (mInfoFilePath mInfo)
-  let cNvPrAttr = [("descr", description),
-                   ("id","0"),
-                   ("name","Picture 1")]
-  cNvPr <- case picPropLink picProps of
-    Just link -> do idNum <- registerLink link
-                    return $ mknode "p:cNvPr" cNvPrAttr $
-                      mknode "a:hlinkClick" [("r:id", "rId" <> tshow idNum)] ()
-    Nothing   -> return $ mknode "p:cNvPr" cNvPrAttr ()
-  let nvPicPr  = mknode "p:nvPicPr" []
-                 [ cNvPr
-                 , cNvPicPr
-                 , mknode "p:nvPr" [] ()]
-  let blipFill = mknode "p:blipFill" []
-                 [ mknode "a:blip" [("r:embed", "rId" <>
-                     tshow (mInfoLocalId mInfo))] ()
-                 , mknode "a:stretch" [] $
-                   mknode "a:fillRect" [] () ]
-  let xfrm =    mknode "a:xfrm" []
-                [ mknode "a:off" [("x", tshow xoff'), ("y", tshow yoff')] ()
-                , mknode "a:ext" [("cx", tshow dimX')
-                                 ,("cy", tshow dimY')] () ]
-  let prstGeom = mknode "a:prstGeom" [("prst","rect")] $
-                 mknode "a:avLst" [] ()
-  let ln =      mknode "a:ln" [("w","9525")]
-                [ mknode "a:noFill" [] ()
-                , mknode "a:headEnd" [] ()
-                , mknode "a:tailEnd" [] () ]
-  let spPr =    mknode "p:spPr" [("bwMode","auto")]
-                [xfrm, prstGeom, mknode "a:noFill" [] (), ln]
-
-  let picShape = mknode "p:pic" []
-                 [ nvPicPr
-                 , blipFill
-                 , spPr ]
-
-  -- And now, maybe create the caption:
-  if hasCaption
-    then do cap <- createCaption ((x, y), (cx, cytmp)) alt
-            return [picShape, cap]
-    else return [picShape]
-
-
-paraElemToElements :: PandocMonad m => ParaElem -> P m [Content]
-paraElemToElements Break = return [Elem $ mknode "a:br" [] ()]
-paraElemToElements (Run rpr s) = do
-  sizeAttrs <- fontSizeAttributes rpr
-  let attrs = sizeAttrs <>
-        (
-        [("b", "1") | rPropBold rpr]) <>
-        (
-        [("i", "1") | rPropItalics rpr]) <>
-        (
-        [("u", "sng") | rPropUnderline rpr]) <>
-        (case rStrikethrough rpr of
-            Just NoStrike     -> [("strike", "noStrike")]
-            Just SingleStrike -> [("strike", "sngStrike")]
-            Just DoubleStrike -> [("strike", "dblStrike")]
-            Nothing -> []) <>
-        (case rBaseline rpr of
-            Just n -> [("baseline", tshow n)]
-            Nothing -> []) <>
-        (case rCap rpr of
-            Just NoCapitals -> [("cap", "none")]
-            Just SmallCapitals -> [("cap", "small")]
-            Just AllCapitals -> [("cap", "all")]
-            Nothing -> []) <>
-        []
-  linkProps <- case rLink rpr of
-                 Just link -> do
-                   idNum <- registerLink link
-                   -- first we have to make sure that if it's an
-                   -- anchor, it's in the anchor map. If not, there's
-                   -- no link.
-                   return $ case link of
-                     InternalTarget _ ->
-                       let linkAttrs =
-                             [ ("r:id", "rId" <> tshow idNum)
-                             , ("action", "ppaction://hlinksldjump")
-                             ]
-                       in [mknode "a:hlinkClick" linkAttrs ()]
-                     -- external
-                     ExternalTarget _ ->
-                       let linkAttrs =
-                             [ ("r:id", "rId" <> tshow idNum)
-                             ]
-                       in [mknode "a:hlinkClick" linkAttrs ()]
-                 Nothing -> return []
-  let colorContents = case rSolidFill rpr of
-                        Just color ->
-                          case fromColor color of
-                            '#':hx ->
-                              [mknode "a:solidFill" []
-                                [mknode "a:srgbClr"
-                                  [("val", T.toUpper $ T.pack hx)] ()]]
-                            _ -> []
-                        Nothing -> []
-  codeFont <- monospaceFont
-  let codeContents =
-        [mknode "a:latin" [("typeface", codeFont)] () | rPropCode rpr]
-  let propContents = linkProps <> colorContents <> codeContents
-  return [Elem $ mknode "a:r" [] [ mknode "a:rPr" attrs propContents
-                                 , mknode "a:t" [] s
-                                 ]]
-paraElemToElements (MathElem mathType texStr) = do
-  isInSpkrNotes <- asks envInSpeakerNotes
-  if isInSpkrNotes
-    then paraElemToElements $ Run def $ unTeXString texStr
-    else do res <- convertMath writeOMML mathType (unTeXString texStr)
-            case fromXLElement <$> res of
-              Right r -> return [Elem $ mknode "a14:m" [] $ addMathInfo r]
-              Left (Str s) -> paraElemToElements (Run def s)
-              Left _       -> throwError $ PandocShouldNeverHappenError "non-string math fallback"
-paraElemToElements (RawOOXMLParaElem str) = return
-  [Text (CData CDataRaw str Nothing)]
-
-
--- This is a bit of a kludge -- really requires adding an option to
--- TeXMath, but since that's a different package, we'll do this one
--- step at a time.
-addMathInfo :: Element -> Element
-addMathInfo element =
-  let mathspace =
-        Attr { attrKey = QName "m" Nothing (Just "xmlns")
-             , attrVal = "http://schemas.openxmlformats.org/officeDocument/2006/math"
-             }
-  in add_attr mathspace element
-
--- We look through the element to see if it contains an a14:m
--- element. If so, we surround it. This is a bit ugly, but it seems
--- more dependable than looking through shapes for math. Plus this is
--- an xml implementation detail, so it seems to make sense to do it at
--- the xml level.
-surroundWithMathAlternate :: Element -> Element
-surroundWithMathAlternate element =
-  case findElement (QName "m" Nothing (Just "a14")) element of
-    Just _ ->
-      mknode "mc:AlternateContent"
-         [("xmlns:mc", "http://schemas.openxmlformats.org/markup-compatibility/2006")
-         ] [ mknode "mc:Choice"
-             [ ("xmlns:a14", "http://schemas.microsoft.com/office/drawing/2010/main")
-             , ("Requires", "a14")] [ element ]
-           ]
-    Nothing -> element
-
-paragraphToElement :: PandocMonad m => Paragraph -> P m Element
-paragraphToElement par = do
-  let
-    attrs = [("lvl", tshow $ pPropLevel $ paraProps par)] <>
-            (case pPropMarginLeft (paraProps par) of
-               Just px -> [("marL", tshow $ pixelsToEmu px)]
-               Nothing -> []
-            ) <>
-            (case pPropIndent (paraProps par) of
-               Just px -> [("indent", tshow $ pixelsToEmu px)]
-               Nothing -> []
-            ) <>
-            (case pPropAlign (paraProps par) of
-               Just AlgnLeft -> [("algn", "l")]
-               Just AlgnRight -> [("algn", "r")]
-               Just AlgnCenter -> [("algn", "ctr")]
-               Nothing -> []
-            )
-    props = [] <>
-            (case pPropSpaceBefore $ paraProps par of
-               Just px -> [mknode "a:spcBef" [] [
-                              mknode "a:spcPts" [("val", tshow $ 100 * px)] ()
-                              ]
-                          ]
-               Nothing -> []
-            ) <>
-            (case pPropBullet $ paraProps par of
-               Just Bullet -> []
-               Just (AutoNumbering attrs') ->
-                 [mknode "a:buAutoNum" (autoNumAttrs attrs') ()]
-               Nothing -> [mknode "a:buNone" [] ()]
-            )
-  paras <- mapM paraElemToElements (paraElems par)
-  return $ mknode "a:p" [] $
-    [Elem $ mknode "a:pPr" attrs props] <> concat paras
-
-shapeToElement :: PandocMonad m => Element -> Shape -> P m Element
-shapeToElement layout (TextBox paras)
-  | ns <- elemToNameSpaces layout
-  , Just cSld <- findChild (elemName ns "p" "cSld") layout
-  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
-      sp <- getContentShape ns spTree
-      elements <- mapM paragraphToElement paras
-      let txBody = mknode "p:txBody" [] $
-                   [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <> elements
-          emptySpPr = mknode "p:spPr" [] ()
-      return
-        . surroundWithMathAlternate
-        . replaceNamedChildren ns "p" "txBody" [txBody]
-        . replaceNamedChildren ns "p" "spPr" [emptySpPr]
-        $ sp
--- GraphicFrame and Pic should never reach this.
-shapeToElement _ _ = return $ mknode "p:sp" [] ()
-
-shapeToElements :: PandocMonad m => Element -> Shape -> P m [Content]
-shapeToElements layout (Pic picProps fp titleText alt) = do
-  mInfo <- registerMedia fp alt
-  case mInfoExt mInfo of
-    Just _ -> map Elem <$>
-      makePicElements layout picProps mInfo titleText alt
-    Nothing -> shapeToElements layout $ TextBox [Paragraph def alt]
-shapeToElements layout (GraphicFrame tbls cptn) = map Elem <$>
-  graphicFrameToElements layout tbls cptn
-shapeToElements _ (RawOOXMLShape str) = return
-  [Text (CData CDataRaw str Nothing)]
-shapeToElements layout shp = do
-  element <- shapeToElement layout shp
-  return [Elem element]
-
-shapesToElements :: PandocMonad m => Element -> [Shape] -> P m [Content]
-shapesToElements layout shps =
- concat <$> mapM (shapeToElements layout) shps
-
-graphicFrameToElements :: PandocMonad m => Element -> [Graphic] -> [ParaElem] -> P m [Element]
-graphicFrameToElements layout tbls caption = do
-  -- get the sizing
-  master <- getMaster
-  (pageWidth, pageHeight) <- asks envPresentationSize
-  let ns = elemToNameSpaces layout
-  ((x, y), (cx, cytmp)) <- getContentShapeSize ns layout master
-                           `catchError`
-                           (\_ -> return ((0, 0), (pageWidth, pageHeight)))
-
-  let cy = if not $ null caption then cytmp - captionHeight else cytmp
-
-  elements <- mapM (graphicToElement cx) tbls
-  let graphicFrameElts =
-        mknode "p:graphicFrame" [] $
-        [ mknode "p:nvGraphicFramePr" []
-          [ mknode "p:cNvPr" [("id", "6"), ("name", "Content Placeholder 5")] ()
-          , mknode "p:cNvGraphicFramePr" []
-            [mknode "a:graphicFrameLocks" [("noGrp", "1")] ()]
-          , mknode "p:nvPr" []
-            [mknode "p:ph" [("idx", "1")] ()]
-          ]
-        , mknode "p:xfrm" []
-          [ mknode "a:off" [("x", tshow $ 12700 * x),
-                            ("y", tshow $ 12700 * y)] ()
-          , mknode "a:ext" [("cx", tshow $ 12700 * cx),
-                            ("cy", tshow $ 12700 * cy)] ()
-          ]
-        ] <> elements
-
-  if not $ null caption
-    then do capElt <- createCaption ((x, y), (cx, cytmp)) caption
-            return [graphicFrameElts, capElt]
-    else return [graphicFrameElts]
-
-getDefaultTableStyle :: PandocMonad m => P m (Maybe T.Text)
-getDefaultTableStyle = do
-  refArchive <- asks envRefArchive
-  distArchive <- asks envDistArchive
-  tblStyleLst <- parseXml refArchive distArchive "ppt/tableStyles.xml"
-  return $ findAttr (QName "def" Nothing Nothing) tblStyleLst
-
-graphicToElement :: PandocMonad m => Integer -> Graphic -> P m Element
-graphicToElement tableWidth (Tbl tblPr hdrCells rows) = do
-  let colWidths = if null hdrCells
-                  then case rows of
-                         r : _ | not (null r) -> replicate (length r) $
-                                                 tableWidth `div` toInteger (length r)
-                         -- satisfy the compiler. This is the same as
-                         -- saying that rows is empty, but the compiler
-                         -- won't understand that `[]` exhausts the
-                         -- alternatives.
-                         _ -> []
-                  else replicate (length hdrCells) $
-                       tableWidth `div` toInteger (length hdrCells)
-
-  let cellToOpenXML paras =
-        do elements <- mapM paragraphToElement paras
-           let elements' = if null elements
-                           then [mknode "a:p" [] [mknode "a:endParaRPr" [] ()]]
-                           else elements
-
-           return
-             [mknode "a:txBody" [] $
-               [ mknode "a:bodyPr" [] ()
-               , mknode "a:lstStyle" [] ()]
-               <> elements']
-  headers' <- mapM cellToOpenXML hdrCells
-  rows' <- mapM (mapM cellToOpenXML) rows
-  let borderProps = mknode "a:tcPr" [] ()
-  let emptyCell' = [mknode "a:p" [] [mknode "a:pPr" [] ()]]
-  let mkcell border contents = mknode "a:tc" []
-                            $ (if null contents
-                               then emptyCell'
-                               else contents) <> [ borderProps | border ]
-  let mkrow border cells = mknode "a:tr" [("h", "0")] $ map (mkcell border) cells
-
-  let mkgridcol w = mknode "a:gridCol"
-                       [("w", tshow ((12700 * w) :: Integer))] ()
-  let hasHeader = not (all null hdrCells)
-
-  mbDefTblStyle <- getDefaultTableStyle
-  let tblPrElt = mknode "a:tblPr"
-                 [ ("firstRow", if tblPrFirstRow tblPr then "1" else "0")
-                 , ("bandRow", if tblPrBandRow tblPr then "1" else "0")
-                 ] (case mbDefTblStyle of
-                      Nothing -> []
-                      Just sty -> [mknode "a:tableStyleId" [] sty])
-
-  return $ mknode "a:graphic" []
-    [mknode "a:graphicData" [("uri", "http://schemas.openxmlformats.org/drawingml/2006/table")]
-     [mknode "a:tbl" [] $
-      [ tblPrElt
-      , mknode "a:tblGrid" [] (if all (==0) colWidths
-                               then []
-                               else map mkgridcol colWidths)
-      ]
-      <> [ mkrow True headers' | hasHeader ] <> map (mkrow False) rows'
-     ]
-    ]
-
-
--- We get the shape by placeholder type. If there is NO type, it
--- defaults to a content placeholder.
-
-data PHType = PHType T.Text | ObjType
-  deriving (Show, Eq)
-
-findPHType :: NameSpaces -> Element -> PHType -> Bool
-findPHType ns spElem phType
-  | isElem ns "p" "sp" spElem =
-    let mbPHElem = (Just spElem >>=
-                   findChild (elemName ns "p" "nvSpPr") >>=
-                   findChild (elemName ns "p" "nvPr") >>=
-                   findChild (elemName ns "p" "ph"))
-    in
-      case mbPHElem of
-        -- if it's a named PHType, we want to check that the attribute
-        -- value matches.
-        Just phElem | (PHType tp) <- phType ->
-                        case findAttr (QName "type" Nothing Nothing) phElem of
-                          Just tp' -> tp == tp'
-                          Nothing -> False
-        -- if it's an ObjType, we want to check that there is NO
-        -- "type" attribute. In other words, a lookup should return nothing.
-        Just phElem | ObjType <- phType ->
-                        case findAttr (QName "type" Nothing Nothing) phElem of
-                          Just _ -> False
-                          Nothing -> True
-        Nothing -> False
-findPHType _ _ _ = False
-
-getShapesByPlaceHolderType :: NameSpaces -> Element -> PHType -> [Element]
-getShapesByPlaceHolderType ns spTreeElem phType
-  | isElem ns "p" "spTree" spTreeElem =
-      filterChildren (\e -> findPHType ns e phType) spTreeElem
-  | otherwise = []
-
-getShapeByPlaceHolderType :: NameSpaces -> Element -> PHType -> Maybe Element
-getShapeByPlaceHolderType ns spTreeElem phType =
-  listToMaybe $ getShapesByPlaceHolderType ns spTreeElem phType
-
--- Like the above, but it tries a number of different placeholder types
-getShapeByPlaceHolderTypes :: NameSpaces -> Element -> [PHType] -> Maybe Element
-getShapeByPlaceHolderTypes _ _ [] = Nothing
-getShapeByPlaceHolderTypes ns spTreeElem (s:ss) =
-  case getShapeByPlaceHolderType ns spTreeElem s of
-    Just element -> Just element
-    Nothing -> getShapeByPlaceHolderTypes ns spTreeElem ss
-
-nonBodyTextToElement :: PandocMonad m => Element -> [PHType] -> [ParaElem] -> P m Element
-nonBodyTextToElement layout phTypes paraElements
-  | ns <- elemToNameSpaces layout
-  , Just cSld <- findChild (elemName ns "p" "cSld") layout
-  , Just spTree <- findChild (elemName ns "p" "spTree") cSld
-  , Just sp <- getShapeByPlaceHolderTypes ns spTree phTypes = do
-      let hdrPara = Paragraph def paraElements
-      element <- paragraphToElement hdrPara
-      let txBody = mknode "p:txBody" [] $
-                   [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <>
-                   [element]
-      return $ replaceNamedChildren ns "p" "txBody" [txBody] sp
-  -- XXX: TODO
-  | otherwise = return $ mknode "p:sp" [] ()
-
-contentToElement :: PandocMonad m => Element -> [ParaElem] -> [Shape] -> P m Element
-contentToElement layout hdrShape shapes
-  | ns <- elemToNameSpaces layout
-  , Just cSld <- findChild (elemName ns "p" "cSld") layout
-  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
-      element <- nonBodyTextToElement layout [PHType "title"] hdrShape
-      let hdrShapeElements = [Elem element | not (null hdrShape)]
-      contentElements <- local
-                         (\env -> env {envContentType = NormalContent})
-                         (shapesToElements layout shapes)
-      return $ buildSpTree ns spTree (hdrShapeElements <> contentElements)
-contentToElement _ _ _ = return $ mknode "p:sp" [] ()
-
-twoColumnToElement :: PandocMonad m => Element -> [ParaElem] -> [Shape] -> [Shape] -> P m Element
-twoColumnToElement layout hdrShape shapesL shapesR
-  | ns <- elemToNameSpaces layout
-  , Just cSld <- findChild (elemName ns "p" "cSld") layout
-  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
-      element <- nonBodyTextToElement layout [PHType "title"] hdrShape
-      let hdrShapeElements = [Elem element | not (null hdrShape)]
-      contentElementsL <- local
-                          (\env -> env {envContentType =TwoColumnLeftContent})
-                          (shapesToElements layout shapesL)
-      contentElementsR <- local
-                          (\env -> env {envContentType =TwoColumnRightContent})
-                          (shapesToElements layout shapesR)
-      -- let contentElementsL' = map (setIdx ns "1") contentElementsL
-      --     contentElementsR' = map (setIdx ns "2") contentElementsR
-      return $ buildSpTree ns spTree $
-        hdrShapeElements <> contentElementsL <> contentElementsR
-twoColumnToElement _ _ _ _= return $ mknode "p:sp" [] ()
-
-
-titleToElement :: PandocMonad m => Element -> [ParaElem] -> P m Element
-titleToElement layout titleElems
-  | ns <- elemToNameSpaces layout
-  , Just cSld <- findChild (elemName ns "p" "cSld") layout
-  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
-      element <- nonBodyTextToElement layout [PHType "title", PHType "ctrTitle"] titleElems
-      let titleShapeElements = [Elem element | not (null titleElems)]
-      return $ buildSpTree ns spTree titleShapeElements
-titleToElement _ _ = return $ mknode "p:sp" [] ()
-
-metadataToElement :: PandocMonad m => Element -> [ParaElem] -> [ParaElem] -> [[ParaElem]] -> [ParaElem] -> P m Element
-metadataToElement layout titleElems subtitleElems authorsElems dateElems
-  | ns <- elemToNameSpaces layout
-  , Just cSld <- findChild (elemName ns "p" "cSld") layout
-  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
-      titleShapeElements <- if null titleElems
-                            then return []
-                            else sequence [nonBodyTextToElement layout [PHType "ctrTitle"] titleElems]
-      let combinedAuthorElems = intercalate [Break] authorsElems
-          subtitleAndAuthorElems = intercalate [Break, Break] [subtitleElems, combinedAuthorElems]
-      subtitleShapeElements <- if null subtitleAndAuthorElems
-                               then return []
-                               else sequence [nonBodyTextToElement layout [PHType "subTitle"] subtitleAndAuthorElems]
-      dateShapeElements <- if null dateElems
-                           then return []
-                           else sequence [nonBodyTextToElement layout [PHType "dt"] dateElems]
-      return . buildSpTree ns spTree . map Elem $
-        (titleShapeElements <> subtitleShapeElements <> dateShapeElements)
-metadataToElement _ _ _ _ _ = return $ mknode "p:sp" [] ()
-
-slideToElement :: PandocMonad m => Slide -> P m Element
-slideToElement (Slide _ l@(ContentSlide hdrElems shapes) _ )= do
-  layout <- getLayout l
-  spTree <- local (\env -> if null hdrElems
-                           then env
-                           else env{envSlideHasHeader=True}) $
-            contentToElement layout hdrElems shapes
-  return $ mknode "p:sld"
-    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
-      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
-      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
-    ] [mknode "p:cSld" [] [spTree]]
-slideToElement (Slide _ l@(TwoColumnSlide hdrElems shapesL shapesR) _) = do
-  layout <- getLayout l
-  spTree <- local (\env -> if null hdrElems
-                           then env
-                           else env{envSlideHasHeader=True}) $
-            twoColumnToElement layout hdrElems shapesL shapesR
-  return $ mknode "p:sld"
-    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
-      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
-      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
-    ] [mknode "p:cSld" [] [spTree]]
-slideToElement (Slide _ l@(TitleSlide hdrElems) _) = do
-  layout <- getLayout l
-  spTree <- titleToElement layout hdrElems
-  return $ mknode "p:sld"
-    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
-      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
-      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
-    ] [mknode "p:cSld" [] [spTree]]
-slideToElement (Slide _ l@(MetadataSlide titleElems subtitleElems authorElems dateElems) _) = do
-  layout <- getLayout l
-  spTree <- metadataToElement layout titleElems subtitleElems authorElems dateElems
-  return $ mknode "p:sld"
-    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
-      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
-      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
-    ] [mknode "p:cSld" [] [spTree]]
-
-
---------------------------------------------------------------------
--- Notes:
-
-getNotesMaster :: PandocMonad m => P m Element
-getNotesMaster = do
-  refArchive <- asks envRefArchive
-  distArchive <- asks envDistArchive
-  parseXml refArchive distArchive "ppt/notesMasters/notesMaster1.xml"
-
-getSlideNumberFieldId :: PandocMonad m => Element -> P m T.Text
-getSlideNumberFieldId notesMaster
-  | ns <- elemToNameSpaces notesMaster
-  , Just cSld <- findChild (elemName ns "p" "cSld") notesMaster
-  , Just spTree <- findChild (elemName ns "p" "spTree") cSld
-  , Just sp <- getShapeByPlaceHolderType ns spTree (PHType "sldNum")
-  , Just txBody <- findChild (elemName ns "p" "txBody") sp
-  , Just p <- findChild (elemName ns "a" "p") txBody
-  , Just fld <- findChild (elemName ns "a" "fld") p
-  , Just fldId <- findAttr (QName "id" Nothing Nothing) fld =
-      return fldId
-  | otherwise = throwError $
-                PandocSomeError
-                "No field id for slide numbers in notesMaster.xml"
-
-speakerNotesSlideImage :: Element
-speakerNotesSlideImage =
-  mknode "p:sp" []
-  [ mknode "p:nvSpPr" []
-    [ mknode "p:cNvPr" [ ("id", "2")
-                       , ("name", "Slide Image Placeholder 1")
-                       ] ()
-    , mknode "p:cNvSpPr" []
-      [ mknode "a:spLocks" [ ("noGrp", "1")
-                           , ("noRot", "1")
-                           , ("noChangeAspect", "1")
-                           ] ()
-      ]
-    , mknode "p:nvPr" []
-      [ mknode "p:ph" [("type", "sldImg")] ()]
-    ]
-  , mknode "p:spPr" [] ()
-  ]
-
--- we want to wipe links from the speaker notes in the
--- paragraphs. Powerpoint doesn't allow you to input them, and it
--- would provide extra complications.
-removeParaLinks :: Paragraph -> Paragraph
-removeParaLinks paragraph = paragraph{paraElems = map f (paraElems paragraph)}
-  where f (Run rProps s) = Run rProps{rLink=Nothing} s
-        f pe             = pe
-
--- put an empty paragraph between paragraphs for more expected spacing.
-spaceParas :: [Paragraph] -> [Paragraph]
-spaceParas = intersperse (Paragraph def [])
-
-speakerNotesBody :: PandocMonad m => [Paragraph] -> P m Element
-speakerNotesBody paras = do
-  elements <- local (\env -> env{envInSpeakerNotes = True}) $
-              mapM paragraphToElement $ spaceParas $ map removeParaLinks paras
-  let txBody = mknode "p:txBody" [] $
-               [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <> elements
-  return $
-    mknode "p:sp" []
-    [ mknode "p:nvSpPr" []
-      [ mknode "p:cNvPr" [ ("id", "3")
-                         , ("name", "Notes Placeholder 2")
-                         ] ()
-      , mknode "p:cNvSpPr" []
-        [ mknode "a:spLocks" [("noGrp", "1")] ()]
-      , mknode "p:nvPr" []
-        [ mknode "p:ph" [("type", "body"), ("idx", "1")] ()]
-      ]
-    , mknode "p:spPr" [] ()
-    , txBody
-    ]
-
-speakerNotesSlideNumber :: Int -> T.Text -> Element
-speakerNotesSlideNumber pgNum fieldId =
-  mknode "p:sp" []
-  [ mknode "p:nvSpPr" []
-    [ mknode "p:cNvPr" [ ("id", "4")
-                       , ("name", "Slide Number Placeholder 3")
-                       ] ()
-    , mknode "p:cNvSpPr" []
-      [ mknode "a:spLocks" [("noGrp", "1")] ()]
-    , mknode "p:nvPr" []
-      [ mknode "p:ph" [ ("type", "sldNum")
-                      , ("sz", "quarter")
-                      , ("idx", "10")
-                      ] ()
-      ]
-    ]
-  , mknode "p:spPr" [] ()
-  , mknode "p:txBody" []
-    [ mknode "a:bodyPr" [] ()
-    , mknode "a:lstStyle" [] ()
-    , mknode "a:p" []
-      [ mknode "a:fld" [ ("id", fieldId)
-                       , ("type", "slidenum")
-                       ]
-        [ mknode "a:rPr" [("lang", "en-US")] ()
-        , mknode "a:t" [] (tshow pgNum)
-        ]
-      , mknode "a:endParaRPr" [("lang", "en-US")] ()
-      ]
-    ]
-  ]
-
-slideToSpeakerNotesElement :: PandocMonad m => Slide -> P m (Maybe Element)
-slideToSpeakerNotesElement (Slide _ _ (SpeakerNotes [])) = return Nothing
-slideToSpeakerNotesElement slide@(Slide _ _ (SpeakerNotes paras)) = do
-  master <- getNotesMaster
-  fieldId  <- getSlideNumberFieldId master
-  num <- slideNum slide
-  let imgShape = speakerNotesSlideImage
-      sldNumShape = speakerNotesSlideNumber num fieldId
-  bodyShape <- speakerNotesBody paras
-  return $ Just $
-    mknode "p:notes"
-    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main")
-    , ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships")
-    , ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
-    ] [ mknode "p:cSld" []
-        [ mknode "p:spTree" []
-          [ mknode "p:nvGrpSpPr" []
-            [ mknode "p:cNvPr" [("id", "1"), ("name", "")] ()
-            , mknode "p:cNvGrpSpPr" [] ()
-            , mknode "p:nvPr" [] ()
-            ]
-          , mknode "p:grpSpPr" []
-            [ mknode "a:xfrm" []
-              [ mknode "a:off" [("x", "0"), ("y", "0")] ()
-              , mknode "a:ext" [("cx", "0"), ("cy", "0")] ()
-              , mknode "a:chOff" [("x", "0"), ("y", "0")] ()
-              , mknode "a:chExt" [("cx", "0"), ("cy", "0")] ()
-              ]
-            ]
-          , imgShape
-          , bodyShape
-          , sldNumShape
-          ]
-        ]
-      ]
-
------------------------------------------------------------------------
-
-getSlideIdNum :: PandocMonad m => SlideId -> P m Int
-getSlideIdNum sldId = do
-  slideIdMap <- asks envSlideIdMap
-  case  M.lookup sldId slideIdMap of
-    Just n -> return n
-    Nothing -> throwError $
-               PandocShouldNeverHappenError $
-               "Slide Id " <> tshow sldId <> " not found."
-
-slideNum :: PandocMonad m => Slide -> P m Int
-slideNum slide = getSlideIdNum $ slideId slide
-
-idNumToFilePath :: Int -> FilePath
-idNumToFilePath idNum = "slide" <> show idNum <> ".xml"
-
-slideToFilePath :: PandocMonad m => Slide -> P m FilePath
-slideToFilePath slide = do
-  idNum <- slideNum slide
-  return $ "slide" <> show idNum <> ".xml"
-
-slideToRelId :: PandocMonad m => Slide -> P m T.Text
-slideToRelId slide = do
-  n <- slideNum slide
-  offset <- asks envSlideIdOffset
-  return $ "rId" <> tshow (n + offset)
-
-
-data Relationship = Relationship { relId :: Int
-                                 , relType :: MimeType
-                                 , relTarget :: FilePath
-                                 } deriving (Show, Eq)
-
-elementToRel :: Element -> Maybe Relationship
-elementToRel element
-  | elName element == QName "Relationship" (Just "http://schemas.openxmlformats.org/package/2006/relationships") Nothing =
-      do rId <- findAttr (QName "Id" Nothing Nothing) element
-         numStr <- T.stripPrefix "rId" rId
-         num <- fromIntegral <$> readTextAsInteger numStr
-         type' <- findAttr (QName "Type" Nothing Nothing) element
-         target <- findAttr (QName "Target" Nothing Nothing) element
-         return $ Relationship num type' (T.unpack target)
-  | otherwise = Nothing
-
-slideToPresRel :: PandocMonad m => Slide -> P m Relationship
-slideToPresRel slide = do
-  idNum <- slideNum slide
-  n <- asks envSlideIdOffset
-  let rId = idNum + n
-      fp = "slides/" <> idNumToFilePath idNum
-  return $ Relationship { relId = rId
-                        , relType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"
-                        , relTarget = fp
-                        }
-
-getRels :: PandocMonad m => P m [Relationship]
-getRels = do
-  refArchive <- asks envRefArchive
-  distArchive <- asks envDistArchive
-  relsElem <- parseXml refArchive distArchive "ppt/_rels/presentation.xml.rels"
-  let globalNS = "http://schemas.openxmlformats.org/package/2006/relationships"
-  let relElems = findChildren (QName "Relationship" (Just globalNS) Nothing) relsElem
-  return $ mapMaybe elementToRel relElems
-
-presentationToRels :: PandocMonad m => Presentation -> P m [Relationship]
-presentationToRels pres@(Presentation _ slides) = do
-  mySlideRels <- mapM slideToPresRel slides
-  let notesMasterRels =
-        [Relationship { relId = length mySlideRels + 2
-                         , relType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster"
-                         , relTarget = "notesMasters/notesMaster1.xml"
-                         } | presHasSpeakerNotes pres]
-      insertedRels = mySlideRels <> notesMasterRels
-  rels <- getRels
-  -- we remove the slide rels and the notesmaster (if it's
-  -- there). We'll put these back in ourselves, if necessary.
-  let relsWeKeep = filter
-                   (\r -> relType r /= "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" &&
-                          relType r /= "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster")
-                   rels
-  -- We want to make room for the slides in the id space. The slides
-  -- will start at Id2 (since Id1 is for the slide master). There are
-  -- two slides in the data file, but that might change in the future,
-  -- so we will do this:
-  --
-  -- 1. We look to see what the minimum relWithoutSlide id (greater than 1) is.
-  -- 2. We add the difference between this and the number of slides to
-  -- all relWithoutSlide rels (unless they're 1)
-  -- 3. If we have a notesmaster slide, we make space for that as well.
-
-  let minRelNotOne = maybe 0 minimum $ nonEmpty
-                                     $ filter (1 <) $ map relId relsWeKeep
-
-      modifyRelNum :: Int -> Int
-      modifyRelNum 1 = 1
-      modifyRelNum n = n - minRelNotOne + 2 + length insertedRels
-
-      relsWeKeep' = map (\r -> r{relId = modifyRelNum $ relId r}) relsWeKeep
-
-  return $ insertedRels <> relsWeKeep'
-
--- We make this ourselves, in case there's a thumbnail in the one from
--- the template.
-topLevelRels :: [Relationship]
-topLevelRels =
-  [ Relationship { relId = 1
-                 , relType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
-                 , relTarget = "ppt/presentation.xml"
-                 }
-  , Relationship { relId = 2
-                 , relType = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
-                 , relTarget = "docProps/core.xml"
-                 }
-  , Relationship { relId = 3
-                 , relType = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/extended-properties"
-                 , relTarget = "docProps/app.xml"
-                 }
-  , Relationship { relId = 4
-                 , relType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"
-                 , relTarget = "docProps/custom.xml"
-                 }
-  ]
-
-topLevelRelsEntry :: PandocMonad m => P m Entry
-topLevelRelsEntry = elemToEntry "_rels/.rels" $ relsToElement topLevelRels
-
-relToElement :: Relationship -> Element
-relToElement rel = mknode "Relationship" [ ("Id", "rId" <> tshow (relId rel))
-                                         , ("Type", relType rel)
-                                         , ("Target", T.pack $ relTarget rel) ] ()
-
-relsToElement :: [Relationship] -> Element
-relsToElement rels = mknode "Relationships"
-                     [("xmlns", "http://schemas.openxmlformats.org/package/2006/relationships")]
-                     (map relToElement rels)
-
-presentationToRelsEntry :: PandocMonad m => Presentation -> P m Entry
-presentationToRelsEntry pres = do
-  rels <- presentationToRels pres
-  elemToEntry "ppt/_rels/presentation.xml.rels" $ relsToElement rels
-
-elemToEntry :: PandocMonad m => FilePath -> Element -> P m Entry
-elemToEntry fp element = do
-  epochtime <- floor . utcTimeToPOSIXSeconds <$> asks envUTCTime
-  return $ toEntry fp epochtime $ renderXml element
-
-slideToEntry :: PandocMonad m => Slide -> P m Entry
-slideToEntry slide = do
-  idNum <- slideNum slide
-  local (\env -> env{envCurSlideId = idNum}) $ do
-    element <- slideToElement slide
-    elemToEntry ("ppt/slides/" <> idNumToFilePath idNum) element
-
-slideToSpeakerNotesEntry :: PandocMonad m => Slide -> P m (Maybe Entry)
-slideToSpeakerNotesEntry slide = do
-  idNum <- slideNum slide
-  local (\env -> env{envCurSlideId = idNum}) $ do
-    mbElement <- slideToSpeakerNotesElement slide
-    mbNotesIdNum <- do mp <- asks envSpeakerNotesIdMap
-                       return $ M.lookup idNum mp
-    case mbElement of
-      Just element | Just notesIdNum <- mbNotesIdNum ->
-                       Just <$>
-                       elemToEntry
-                       ("ppt/notesSlides/notesSlide" <> show notesIdNum <>
-                        ".xml")
-                       element
-      _ -> return Nothing
-
-slideToSpeakerNotesRelElement :: PandocMonad m => Slide -> P m (Maybe Element)
-slideToSpeakerNotesRelElement (Slide _ _ (SpeakerNotes [])) = return Nothing
-slideToSpeakerNotesRelElement slide@Slide{} = do
-  idNum <- slideNum slide
-  return $ Just $
-    mknode "Relationships"
-    [("xmlns", "http://schemas.openxmlformats.org/package/2006/relationships")]
-    [ mknode "Relationship" [ ("Id", "rId2")
-                            , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide")
-                            , ("Target", "../slides/slide" <> tshow idNum <> ".xml")
-                            ] ()
-    , mknode "Relationship" [ ("Id", "rId1")
-                            , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster")
-                            , ("Target", "../notesMasters/notesMaster1.xml")
-                            ] ()
-    ]
-
-
-slideToSpeakerNotesRelEntry :: PandocMonad m => Slide -> P m (Maybe Entry)
-slideToSpeakerNotesRelEntry slide = do
-  idNum <- slideNum slide
-  mbElement <- slideToSpeakerNotesRelElement slide
-  mp <- asks envSpeakerNotesIdMap
-  let mbNotesIdNum = M.lookup idNum mp
-  case mbElement of
-    Just element | Just notesIdNum <- mbNotesIdNum ->
-      Just <$>
-      elemToEntry
-      ("ppt/notesSlides/_rels/notesSlide" <> show notesIdNum <> ".xml.rels")
-      element
-    _ -> return Nothing
-
-slideToSlideRelEntry :: PandocMonad m => Slide -> P m Entry
-slideToSlideRelEntry slide = do
-  idNum <- slideNum slide
-  element <- slideToSlideRelElement slide
-  elemToEntry ("ppt/slides/_rels/" <> idNumToFilePath idNum <> ".rels") element
-
-linkRelElement :: PandocMonad m => (Int, LinkTarget) -> P m Element
-linkRelElement (rIdNum, InternalTarget targetId) = do
-  targetIdNum <- getSlideIdNum targetId
-  return $
-    mknode "Relationship" [ ("Id", "rId" <> tshow rIdNum)
-                          , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide")
-                          , ("Target", "slide" <> tshow targetIdNum <> ".xml")
-                          ] ()
-linkRelElement (rIdNum, ExternalTarget (url, _)) =
-  return $
-    mknode "Relationship" [ ("Id", "rId" <> tshow rIdNum)
-                          , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")
-                          , ("Target", url)
-                          , ("TargetMode", "External")
-                          ] ()
-
-linkRelElements :: PandocMonad m => M.Map Int LinkTarget -> P m [Element]
-linkRelElements mp = mapM linkRelElement (M.toList mp)
-
-mediaRelElement :: MediaInfo -> Element
-mediaRelElement mInfo =
-  let ext = fromMaybe "" (mInfoExt mInfo)
-  in
-    mknode "Relationship" [ ("Id", "rId" <>
-      tshow (mInfoLocalId mInfo))
-                          , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image")
-                          , ("Target", "../media/image" <>
-      tshow (mInfoGlobalId mInfo) <> ext)
-                          ] ()
-
-speakerNotesSlideRelElement :: PandocMonad m => Slide -> P m (Maybe Element)
-speakerNotesSlideRelElement slide = do
-  idNum <- slideNum slide
-  mp <- asks envSpeakerNotesIdMap
-  return $ case M.lookup idNum mp of
-    Nothing -> Nothing
-    Just n ->
-      let target = "../notesSlides/notesSlide" <> tshow n <> ".xml"
-      in Just $
-         mknode "Relationship" [ ("Id", "rId2")
-                               , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide")
-                               , ("Target", target)
-                               ] ()
-
-slideToSlideRelElement :: PandocMonad m => Slide -> P m Element
-slideToSlideRelElement slide = do
-  idNum <- slideNum slide
-  target <- flip fmap getSlideLayouts $
-    T.pack . ("../slideLayouts/" <>) . takeFileName .
-    slPath . case slide of
-        (Slide _ MetadataSlide{} _)  -> metadata
-        (Slide _ TitleSlide{} _)     -> title
-        (Slide _ ContentSlide{} _)   -> content
-        (Slide _ TwoColumnSlide{} _) -> twoColumn
-
-  speakerNotesRels <- maybeToList <$> speakerNotesSlideRelElement slide
-
-  linkIds <- gets stLinkIds
-  mediaIds <- gets stMediaIds
-
-  linkRels <- case M.lookup idNum linkIds of
-                Just mp -> linkRelElements mp
-                Nothing -> return []
-  let mediaRels = case M.lookup idNum mediaIds of
-                   Just mInfos -> map mediaRelElement mInfos
-                   Nothing -> []
-
-  return $
-    mknode "Relationships"
-    [("xmlns", "http://schemas.openxmlformats.org/package/2006/relationships")]
-    ([mknode "Relationship" [ ("Id", "rId1")
-                           , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout")
-                           , ("Target", target)] ()
-    ] <> speakerNotesRels <> linkRels <> mediaRels)
-
-slideToSldIdElement :: PandocMonad m => Slide -> P m Element
-slideToSldIdElement slide = do
-  n <- slideNum slide
-  let id' = tshow $ n + 255
-  rId <- slideToRelId slide
-  return $ mknode "p:sldId" [("id", id'), ("r:id", rId)] ()
-
-presentationToSldIdLst :: PandocMonad m => Presentation -> P m Element
-presentationToSldIdLst (Presentation _ slides) = do
-  ids <- mapM slideToSldIdElement slides
-  return $ mknode "p:sldIdLst" [] ids
-
-presentationToPresentationElement :: PandocMonad m => Presentation -> P m Element
-presentationToPresentationElement pres@(Presentation _ slds) = do
-  refArchive <- asks envRefArchive
-  distArchive <- asks envDistArchive
-  element <- parseXml refArchive distArchive "ppt/presentation.xml"
-  sldIdLst <- presentationToSldIdLst pres
-
-  let modifySldIdLst :: Content -> Content
-      modifySldIdLst (Elem e) = case elName e of
-        (QName "sldIdLst" _ _) -> Elem sldIdLst
-        _                      -> Elem e
-      modifySldIdLst ct = ct
-
-      notesMasterRId = length slds + 2
-
-      notesMasterElem =  mknode "p:notesMasterIdLst" []
-                         [ mknode
-                           "p:NotesMasterId"
-                           [("r:id", "rId" <> tshow notesMasterRId)]
-                           ()
-                         ]
-
-      -- if there's a notesMasterIdLst in the presentation.xml file,
-      -- we want to remove it. We then want to put our own, if
-      -- necessary, after the slideMasterIdLst element. We also remove
-      -- handouts master, since we don't want it.
-
-      removeUnwantedMaster' :: Content -> [Content]
-      removeUnwantedMaster' (Elem e) = case elName e of
-        (QName "notesMasterIdLst" _ _) -> []
-        (QName "handoutMasterIdLst" _ _) -> []
-        _                              -> [Elem e]
-      removeUnwantedMaster' ct = [ct]
-
-      removeUnwantedMaster :: [Content] -> [Content]
-      removeUnwantedMaster = concatMap removeUnwantedMaster'
-
-      insertNotesMaster' :: Content -> [Content]
-      insertNotesMaster' (Elem e) = case elName e of
-        (QName "sldMasterIdLst" _ _) -> [Elem e, Elem notesMasterElem]
-        _                            -> [Elem e]
-      insertNotesMaster' ct = [ct]
-
-      insertNotesMaster :: [Content] -> [Content]
-      insertNotesMaster = if presHasSpeakerNotes pres
-                          then concatMap insertNotesMaster'
-                          else id
-
-      newContent = insertNotesMaster $
-                   removeUnwantedMaster $
-                   map modifySldIdLst $
-                   elContent element
-
-  return $ element{elContent = newContent}
-
-presentationToPresEntry :: PandocMonad m => Presentation -> P m Entry
-presentationToPresEntry pres = presentationToPresentationElement pres >>=
-  elemToEntry "ppt/presentation.xml"
-
--- adapted from the Docx writer
-docPropsElement :: PandocMonad m => DocProps -> P m Element
-docPropsElement docProps = do
-  utctime <- asks envUTCTime
-  let keywords = case dcKeywords docProps of
-        Just xs -> T.intercalate ", " xs
-        Nothing -> ""
-  return $
-    mknode "cp:coreProperties"
-    [("xmlns:cp","http://schemas.openxmlformats.org/package/2006/metadata/core-properties")
-    ,("xmlns:dc","http://purl.org/dc/elements/1.1/")
-    ,("xmlns:dcterms","http://purl.org/dc/terms/")
-    ,("xmlns:dcmitype","http://purl.org/dc/dcmitype/")
-    ,("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance")]
-    $
-      mknode "dc:title" [] (fromMaybe "" $ dcTitle docProps)
-    :
-      mknode "dc:creator" [] (fromMaybe "" $ dcCreator docProps)
-    :
-      mknode "cp:keywords" [] keywords
-    : ( [mknode "dc:subject" [] $ fromMaybe "" $ dcSubject docProps | isJust (dcSubject docProps)])
-    <> ( [mknode "dc:description" [] $ fromMaybe "" $ dcDescription docProps | isJust (dcDescription docProps)])
-    <> ( [mknode "cp:category" [] $ fromMaybe "" $ cpCategory docProps | isJust (cpCategory docProps)])
-    <> (\x -> [ mknode "dcterms:created" [("xsi:type","dcterms:W3CDTF")] x
-              , mknode "dcterms:modified" [("xsi:type","dcterms:W3CDTF")] x
-              ]) (T.pack $ formatTime defaultTimeLocale "%FT%XZ" utctime)
-
-docPropsToEntry :: PandocMonad m => DocProps -> P m Entry
-docPropsToEntry docProps = docPropsElement docProps >>=
-                           elemToEntry "docProps/core.xml"
-
--- adapted from the Docx writer
-docCustomPropsElement :: PandocMonad m => DocProps -> P m Element
-docCustomPropsElement docProps = do
-  let mkCustomProp (k, v) pid = mknode "property"
-         [("fmtid","{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
-         ,("pid", tshow pid)
-         ,("name", k)] $ mknode "vt:lpwstr" [] v
-  return $ mknode "Properties"
-          [("xmlns","http://schemas.openxmlformats.org/officeDocument/2006/custom-properties")
-          ,("xmlns:vt","http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")
-          ] $ zipWith mkCustomProp (fromMaybe [] $ customProperties docProps) [(2 :: Int)..]
-
-docCustomPropsToEntry :: PandocMonad m => DocProps -> P m Entry
-docCustomPropsToEntry docProps = docCustomPropsElement docProps >>=
-                           elemToEntry "docProps/custom.xml"
-
--- We read from the template, but we remove the lastView, so it always
--- opens on slide view. Templates will sometimes be open in master
--- view for editing.
-viewPropsElement :: PandocMonad m => P m Element
-viewPropsElement = do
-  refArchive <- asks envRefArchive
-  distArchive <- asks envDistArchive
-  viewPrElement <- parseXml refArchive distArchive "ppt/viewProps.xml"
-  -- remove  "lastView" if it exists:
-  let notLastView :: XML.Attr -> Bool
-      notLastView attr =
-          qName (attrKey attr) /= "lastView"
-  return $
-    viewPrElement {elAttribs = filter notLastView (elAttribs viewPrElement)}
-
-makeViewPropsEntry :: PandocMonad m => P m Entry
-makeViewPropsEntry = viewPropsElement >>= elemToEntry "ppt/viewProps.xml"
-
-defaultContentTypeToElem :: DefaultContentType -> Element
-defaultContentTypeToElem dct =
-  mknode "Default"
-  [("Extension", defContentTypesExt dct),
-    ("ContentType", defContentTypesType dct)]
-  ()
-
-overrideContentTypeToElem :: OverrideContentType -> Element
-overrideContentTypeToElem oct =
-  mknode "Override"
-  [("PartName", T.pack $ overrideContentTypesPart oct),
-   ("ContentType", overrideContentTypesType oct)]
-  ()
-
-contentTypesToElement :: ContentTypes -> Element
-contentTypesToElement ct =
-  let ns = "http://schemas.openxmlformats.org/package/2006/content-types"
-  in
-    mknode "Types" [("xmlns", ns)] $
-
-      map defaultContentTypeToElem (contentTypesDefaults ct) <>
-      map overrideContentTypeToElem (contentTypesOverrides ct)
-
-data DefaultContentType = DefaultContentType
-                           { defContentTypesExt :: T.Text
-                           , defContentTypesType:: MimeType
-                           }
-                         deriving (Show, Eq)
-
-data OverrideContentType = OverrideContentType
-                           { overrideContentTypesPart :: FilePath
-                           , overrideContentTypesType :: MimeType
-                           }
-                          deriving (Show, Eq)
-
-data ContentTypes = ContentTypes { contentTypesDefaults :: [DefaultContentType]
-                                 , contentTypesOverrides :: [OverrideContentType]
-                                 }
-                    deriving (Show, Eq)
-
-contentTypesToEntry :: PandocMonad m => ContentTypes -> P m Entry
-contentTypesToEntry ct = elemToEntry "[Content_Types].xml" $ contentTypesToElement ct
-
-pathToOverride :: FilePath -> Maybe OverrideContentType
-pathToOverride fp = OverrideContentType ("/" <> fp) <$> getContentType fp
-
-mediaFileContentType :: FilePath -> Maybe DefaultContentType
-mediaFileContentType fp = case takeExtension fp of
-  '.' : ext -> Just $
-               DefaultContentType { defContentTypesExt = T.pack ext
-                                  , defContentTypesType =
-                                      fromMaybe "application/octet-stream" (getMimeType fp)
-                                  }
-  _ -> Nothing
-
-mediaContentType :: MediaInfo -> Maybe DefaultContentType
-mediaContentType mInfo
-  | Just t <- mInfoExt mInfo
-  , Just ('.', ext) <- T.uncons t =
-      Just $ DefaultContentType { defContentTypesExt = ext
-                                , defContentTypesType =
-                                    fromMaybe "application/octet-stream" (mInfoMimeType mInfo)
-                                }
-  | otherwise = Nothing
-
-getSpeakerNotesFilePaths :: PandocMonad m => P m [FilePath]
-getSpeakerNotesFilePaths = do
-  mp <- asks envSpeakerNotesIdMap
-  let notesIdNums = M.elems mp
-  return $ map (\n -> "ppt/notesSlides/notesSlide" <> show n <> ".xml")
-               notesIdNums
-
-presentationToContentTypes :: PandocMonad m => Presentation -> P m ContentTypes
-presentationToContentTypes p@(Presentation _ slides) = do
-  mediaInfos <- mconcat . M.elems <$> gets stMediaIds
-  filePaths <- patternsToFilePaths $ inheritedPatterns p
-  let mediaFps = filter (match (compile "ppt/media/image*")) filePaths
-  let defaults = [ DefaultContentType "xml" "application/xml"
-                 , DefaultContentType "rels" "application/vnd.openxmlformats-package.relationships+xml"
-                 ]
-      mediaDefaults = nub $
-                      mapMaybe mediaContentType mediaInfos <>
-                      mapMaybe mediaFileContentType mediaFps
-
-      inheritedOverrides = mapMaybe pathToOverride filePaths
-      createdOverrides = mapMaybe pathToOverride [ "docProps/core.xml"
-                                                 , "docProps/custom.xml"
-                                                 , "ppt/presentation.xml"
-                                                 , "ppt/viewProps.xml"
-                                                 ]
-  relativePaths <- mapM slideToFilePath slides
-  let slideOverrides = mapMaybe
-                       (\fp -> pathToOverride $ "ppt/slides/" <> fp)
-                       relativePaths
-  speakerNotesOverrides <- mapMaybe pathToOverride <$> getSpeakerNotesFilePaths
-  return $ ContentTypes
-    (defaults <> mediaDefaults)
-    (inheritedOverrides <> createdOverrides <> slideOverrides <> speakerNotesOverrides)
-
-presML :: T.Text
-presML = "application/vnd.openxmlformats-officedocument.presentationml"
-
-noPresML :: T.Text
-noPresML = "application/vnd.openxmlformats-officedocument"
-
-getContentType :: FilePath -> Maybe MimeType
-getContentType fp
-  | fp == "ppt/presentation.xml" = Just $ presML <> ".presentation.main+xml"
-  | fp == "ppt/presProps.xml" = Just $ presML <> ".presProps+xml"
-  | fp == "ppt/viewProps.xml" = Just $ presML <> ".viewProps+xml"
-  | fp == "ppt/tableStyles.xml" = Just $ presML <> ".tableStyles+xml"
-  | fp == "docProps/core.xml" = Just "application/vnd.openxmlformats-package.core-properties+xml"
-  | fp == "docProps/custom.xml" = Just "application/vnd.openxmlformats-officedocument.custom-properties+xml"
-  | fp == "docProps/app.xml" = Just $ noPresML <> ".extended-properties+xml"
-  | ["ppt", "slideMasters", f] <- splitDirectories fp
-  , (_, ".xml") <- splitExtension f =
-      Just $ presML <> ".slideMaster+xml"
-  | ["ppt", "slides", f] <- splitDirectories fp
-  , (_, ".xml") <- splitExtension f =
-      Just $ presML <> ".slide+xml"
-  | ["ppt", "notesMasters", f] <- splitDirectories fp
-  , (_, ".xml") <- splitExtension f =
-      Just $ presML <> ".notesMaster+xml"
-  | ["ppt", "notesSlides", f] <- splitDirectories fp
-  , (_, ".xml") <- splitExtension f =
-      Just $ presML <> ".notesSlide+xml"
-  | ["ppt", "theme", f] <- splitDirectories fp
-  , (_, ".xml") <- splitExtension f =
-      Just $ noPresML <> ".theme+xml"
-  | ["ppt", "slideLayouts", _] <- splitDirectories fp=
-      Just $ presML <> ".slideLayout+xml"
-  | otherwise = Nothing
-
--- Kept as String for XML.Light
-autoNumAttrs :: ListAttributes -> [(Text, Text)]
-autoNumAttrs (startNum, numStyle, numDelim) =
-  numAttr <> typeAttr
-  where
-    numAttr = [("startAt", tshow startNum) | startNum /= 1]
-    typeAttr = [("type", typeString <> delimString)]
-    typeString = case numStyle of
-      Decimal -> "arabic"
-      UpperAlpha -> "alphaUc"
-      LowerAlpha -> "alphaLc"
-      UpperRoman -> "romanUc"
-      LowerRoman -> "romanLc"
-      _          -> "arabic"
-    delimString = case numDelim of
-      Period -> "Period"
-      OneParen -> "ParenR"
-      TwoParens -> "ParenBoth"
-      _         -> "Period"
+{-# LANGUAGE NamedFieldPuns #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE PatternGuards #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE TupleSections #-}
+{- |
+   Module      : Text.Pandoc.Writers.Powerpoint.Output
+   Copyright   : Copyright (C) 2017-2020 Jesse Rosenthal
+   License     : GNU GPL, version 2 or above
+
+   Maintainer  : Jesse Rosenthal <jrosenthal@jhu.edu>
+   Stability   : alpha
+   Portability : portable
+
+Conversion of Presentation datatype (defined in
+Text.Pandoc.Writers.Powerpoint.Presentation) to a zip archive.
+-}
+
+module Text.Pandoc.Writers.Powerpoint.Output ( presentationToArchive
+                                             ) where
+
+import Control.Monad.Except (throwError, catchError)
+import Control.Monad.Reader
+import Control.Monad.State
+import Codec.Archive.Zip
+import Data.List (intercalate, stripPrefix, nub, union, isPrefixOf, intersperse)
+import Data.Bifunctor (bimap)
+import Data.CaseInsensitive (CI)
+import qualified Data.CaseInsensitive as CI
+import Data.Default
+import Data.Foldable (toList)
+import Data.List.NonEmpty (nonEmpty, NonEmpty ((:|)))
+import Data.Ratio ((%), Ratio)
+import Data.Text (Text)
+import qualified Data.Text as T
+import Data.Text.Read (decimal)
+import Data.Time (formatTime, defaultTimeLocale)
+import Data.Time.Clock (UTCTime)
+import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds, posixSecondsToUTCTime)
+import Data.Traversable (for)
+import System.FilePath.Posix (splitDirectories, splitExtension, takeExtension, takeFileName)
+import Text.Pandoc.XML.Light as XML
+import Text.Pandoc.Definition
+import qualified Text.Pandoc.UTF8 as UTF8
+import Text.Pandoc.Class.PandocMonad (PandocMonad)
+import Text.Pandoc.Error (PandocError(..))
+import qualified Text.Pandoc.Class.PandocMonad as P
+import Text.Pandoc.Options
+import Text.Pandoc.MIME
+import qualified Data.ByteString.Lazy as BL
+import Text.Pandoc.Writers.Shared (metaToContext)
+import Text.Pandoc.Writers.OOXML
+import qualified Data.Map as M
+import Data.Maybe (mapMaybe, listToMaybe, fromMaybe, maybeToList, catMaybes, isJust)
+import Text.Pandoc.ImageSize
+import Control.Applicative ((<|>))
+import System.FilePath.Glob
+import Text.DocTemplates (FromContext(lookupContext), Context)
+import Text.DocLayout (literal)
+import Text.TeXMath
+import Text.Pandoc.Logging (LogMessage(PowerpointTemplateWarning))
+import Text.Pandoc.Writers.Math (convertMath)
+import Text.Pandoc.Writers.Powerpoint.Presentation
+import Text.Pandoc.Shared (tshow, stringify)
+import Skylighting (fromColor)
+
+-- |The 'EMU' type is used to specify sizes in English Metric Units.
+type EMU = Integer
+
+-- |The 'pixelsToEmu' function converts a size in pixels to one
+-- in English Metric Units. It assumes a DPI of 72.
+pixelsToEmu :: Pixels -> EMU
+pixelsToEmu = (12700 *)
+
+-- This populates the global ids map with images already in the
+-- template, so the ids won't be used by images introduced by the
+-- user.
+initialGlobalIds :: Archive -> Archive -> M.Map FilePath Int
+initialGlobalIds refArchive distArchive =
+  let archiveFiles = filesInArchive refArchive `union` filesInArchive distArchive
+      mediaPaths = filter (isPrefixOf "ppt/media/image") archiveFiles
+
+      go :: FilePath -> Maybe (FilePath, Int)
+      go fp = do
+        s <- stripPrefix "ppt/media/image" $ fst $ splitExtension fp
+        (n, _) <- listToMaybe $ reads s
+        return (fp, n)
+  in
+    M.fromList $ mapMaybe go mediaPaths
+
+getPresentationSize :: Archive -> Archive -> Maybe (Integer, Integer)
+getPresentationSize refArchive distArchive = do
+  entry <- findEntryByPath "ppt/presentation.xml" refArchive  `mplus`
+           findEntryByPath "ppt/presentation.xml" distArchive
+  presElement <- either (const Nothing) return $
+                   parseXMLElement $ UTF8.toTextLazy $ fromEntry entry
+  let ns = elemToNameSpaces presElement
+  sldSize <- findChild (elemName ns "p" "sldSz") presElement
+  cxS <- findAttr (QName "cx" Nothing Nothing) sldSize
+  cyS <- findAttr (QName "cy" Nothing Nothing) sldSize
+  cx <- readTextAsInteger cxS
+  cy <- readTextAsInteger cyS
+  return (cx `div` 12700, cy `div` 12700)
+
+readTextAsInteger :: Text -> Maybe Integer
+readTextAsInteger = either (const Nothing) (Just . fst) . Data.Text.Read.decimal
+
+data WriterEnv = WriterEnv { envRefArchive :: Archive
+                           , envDistArchive :: Archive
+                           , envUTCTime :: UTCTime
+                           , envOpts :: WriterOptions
+                           , envContext :: Context Text
+                           , envPresentationSize :: (Integer, Integer)
+                           , envSlideHasHeader :: Bool
+                           , envInList :: Bool
+                           , envInNoteSlide :: Bool
+                           , envCurSlideId :: Int
+                           , envPlaceholder :: Placeholder
+                           , envSlideIdMap :: M.Map SlideId Int
+                           -- maps the slide number to the
+                           -- corresponding notes id number. If there
+                           -- are no notes for a slide, there will be
+                           -- no entry in the map for it.
+                           , envSpeakerNotesIdMap :: M.Map Int Int
+                           , envInSpeakerNotes :: Bool
+                           , envSlideLayouts :: Maybe SlideLayouts
+                           , envOtherStyleIndents :: Maybe Indents
+                           }
+                 deriving (Show)
+
+instance Default WriterEnv where
+  def = WriterEnv { envRefArchive = emptyArchive
+                  , envDistArchive = emptyArchive
+                  , envUTCTime = posixSecondsToUTCTime 0
+                  , envOpts = def
+                  , envContext = mempty
+                  , envPresentationSize = (720, 540)
+                  , envSlideHasHeader = False
+                  , envInList = False
+                  , envInNoteSlide = False
+                  , envCurSlideId = 1
+                  , envPlaceholder = Placeholder ObjType 0
+                  , envSlideIdMap = mempty
+                  , envSpeakerNotesIdMap = mempty
+                  , envInSpeakerNotes = False
+                  , envSlideLayouts = Nothing
+                  , envOtherStyleIndents = Nothing
+                  }
+
+type SlideLayouts = SlideLayoutsOf SlideLayout
+
+data SlideLayoutsOf a = SlideLayouts
+  { metadata :: a
+  , title :: a
+  , content :: a
+  , twoColumn :: a
+  , comparison :: a
+  , contentWithCaption :: a
+  , blank :: a
+  } deriving (Show, Eq, Functor, Foldable, Traversable)
+
+data SlideLayout = SlideLayout
+  { slElement :: Element
+  , slInReferenceDoc :: Bool
+    -- ^ True if the layout is in the provided reference doc, False if it's in
+    -- the default reference doc.
+  , slPath :: FilePath
+  , slEntry :: Entry
+  } deriving (Show)
+
+getSlideLayouts :: PandocMonad m => P m SlideLayouts
+getSlideLayouts = asks envSlideLayouts >>= maybe (throwError e) pure
+  where
+    e = PandocSomeError ("Slide layouts aren't defined, even though they should "
+      <> "always be. This is a bug in pandoc.")
+
+-- | A placeholder within a layout, identified by type and index.
+--
+-- E.g., @Placeholder ObjType 2@ is the third placeholder of type 'ObjType' in
+-- the layout.
+data Placeholder = Placeholder
+  { placeholderType :: PHType
+  , index :: Int
+  } deriving (Show, Eq)
+
+-- | Paragraph indentation info.
+data Indents = Indents
+  { level1 :: Maybe LevelIndents
+  , level2 :: Maybe LevelIndents
+  , level3 :: Maybe LevelIndents
+  , level4 :: Maybe LevelIndents
+  , level5 :: Maybe LevelIndents
+  , level6 :: Maybe LevelIndents
+  , level7 :: Maybe LevelIndents
+  , level8 :: Maybe LevelIndents
+  , level9 :: Maybe LevelIndents
+  } deriving (Show, Eq)
+
+levelIndent :: Indents -> Int -> Maybe LevelIndents
+levelIndent is index = getter is
+  where
+    getter = case index of
+      0 -> level1
+      1 -> level2
+      2 -> level3
+      3 -> level4
+      4 -> level5
+      5 -> level6
+      6 -> level7
+      7 -> level8
+      8 -> level9
+      _ -> const Nothing
+
+data LevelIndents = LevelIndents
+  { marL :: EMU
+  , indent :: EMU
+  } deriving (Show, Eq)
+
+data MediaInfo = MediaInfo { mInfoFilePath :: FilePath
+                           , mInfoLocalId  :: Int
+                           , mInfoGlobalId :: Int
+                           , mInfoMimeType :: Maybe MimeType
+                           , mInfoExt      :: Maybe T.Text
+                           , mInfoCaption  :: Bool
+                           } deriving (Show, Eq)
+
+data WriterState = WriterState { stLinkIds :: M.Map Int (M.Map Int LinkTarget)
+                               -- (FP, Local ID, Global ID, Maybe Mime)
+                               , stMediaIds :: M.Map Int [MediaInfo]
+                               , stMediaGlobalIds :: M.Map FilePath Int
+                               , stFooterInfo :: Maybe FooterInfo
+                               } deriving (Show, Eq)
+
+instance Default WriterState where
+  def = WriterState { stLinkIds = mempty
+                    , stMediaIds = mempty
+                    , stMediaGlobalIds = mempty
+                    , stFooterInfo = Nothing
+                    }
+
+type P m = ReaderT WriterEnv (StateT WriterState m)
+
+runP :: Monad m => WriterEnv -> WriterState -> P m a -> m a
+runP env st p = evalStateT (runReaderT p env) st
+
+--------------------------------------------------------------------
+
+monospaceFont :: Monad m => P m T.Text
+monospaceFont = do
+  vars <- asks envContext
+  case lookupContext "monofont" vars of
+    Just s -> return s
+    Nothing -> return "Courier"
+
+fontSizeAttributes :: Monad m => RunProps -> P m [(Text, Text)]
+fontSizeAttributes RunProps { rPropForceSize = Just sz } =
+  return [("sz", tshow $ sz * 100)]
+fontSizeAttributes _ = return []
+
+copyFileToArchive :: PandocMonad m => Archive -> FilePath -> P m Archive
+copyFileToArchive arch fp = do
+  refArchive <- asks envRefArchive
+  distArchive <- asks envDistArchive
+  case findEntryByPath fp refArchive `mplus` findEntryByPath fp distArchive of
+    Nothing -> throwError $ PandocSomeError
+                          $ T.pack
+                          $ fp <> " missing in reference file"
+    Just e -> return $ addEntryToArchive e arch
+
+alwaysInheritedPatterns :: [Pattern]
+alwaysInheritedPatterns =
+  map compile [ "docProps/app.xml"
+              , "ppt/slideLayouts/slideLayout*.xml"
+              , "ppt/slideLayouts/_rels/slideLayout*.xml.rels"
+              , "ppt/slideMasters/slideMaster1.xml"
+              , "ppt/slideMasters/_rels/slideMaster1.xml.rels"
+              , "ppt/theme/theme*.xml"
+              , "ppt/theme/_rels/theme*.xml.rels"
+              , "ppt/presProps.xml"
+              , "ppt/tableStyles.xml"
+              , "ppt/media/image*"
+              , "ppt/fonts/*"
+              ]
+
+-- We only look for these under special conditions
+contingentInheritedPatterns :: Presentation -> [Pattern]
+contingentInheritedPatterns pres = [] <>
+  if presHasSpeakerNotes pres
+  then map compile [ "ppt/notesMasters/notesMaster*.xml"
+                   , "ppt/notesMasters/_rels/notesMaster*.xml.rels"
+                   ]
+  else []
+
+inheritedPatterns :: Presentation -> [Pattern]
+inheritedPatterns pres =
+  alwaysInheritedPatterns <> contingentInheritedPatterns pres
+
+patternToFilePaths :: PandocMonad m => Pattern -> P m [FilePath]
+patternToFilePaths pat = do
+  refArchive <- asks envRefArchive
+  distArchive <- asks envDistArchive
+
+  let archiveFiles = filesInArchive refArchive `union` filesInArchive distArchive
+  return $ filter (match pat) archiveFiles
+
+patternsToFilePaths :: PandocMonad m => [Pattern] -> P m [FilePath]
+patternsToFilePaths pats = concat <$> mapM patternToFilePaths pats
+
+-- Here are the files we'll require to make a Powerpoint document. If
+-- any of these are missing, we should error out of our build.
+requiredFiles :: [FilePath]
+requiredFiles = [ "docProps/app.xml"
+                , "ppt/presProps.xml"
+                , "ppt/slideLayouts/slideLayout1.xml"
+                , "ppt/slideLayouts/_rels/slideLayout1.xml.rels"
+                , "ppt/slideLayouts/slideLayout2.xml"
+                , "ppt/slideLayouts/_rels/slideLayout2.xml.rels"
+                , "ppt/slideLayouts/slideLayout3.xml"
+                , "ppt/slideLayouts/_rels/slideLayout3.xml.rels"
+                , "ppt/slideLayouts/slideLayout4.xml"
+                , "ppt/slideLayouts/_rels/slideLayout4.xml.rels"
+                , "ppt/slideMasters/slideMaster1.xml"
+                , "ppt/slideMasters/_rels/slideMaster1.xml.rels"
+                , "ppt/theme/theme1.xml"
+                , "ppt/tableStyles.xml"
+                ]
+
+presentationToArchiveP :: PandocMonad m => Presentation -> P m Archive
+presentationToArchiveP p@(Presentation docProps slides) = do
+  filePaths <- patternsToFilePaths $ inheritedPatterns p
+
+  -- make sure all required files are available:
+  let missingFiles = filter (`notElem` filePaths) requiredFiles
+  unless (null missingFiles)
+    (throwError $
+      PandocSomeError $
+      "The following required files are missing:\n" <>
+      T.unlines (map (T.pack . ("  " <>)) missingFiles)
+    )
+
+  newArch <- foldM copyFileToArchive emptyArchive filePaths
+
+  -- Add any layouts taken from the default archive,
+  -- overwriting any already added.
+  slideLayouts <- getSlideLayouts
+  let f layout =
+        if not (slInReferenceDoc layout)
+        then addEntryToArchive (slEntry layout)
+        else id
+  let newArch' = foldr f newArch slideLayouts
+
+  master <- getMaster
+  refArchive <- asks envRefArchive
+  distArchive <- asks envDistArchive
+  presentationElement <- parseXml refArchive distArchive "ppt/presentation.xml"
+  modify (\s ->
+    s {stFooterInfo =
+        getFooterInfo (dcDate docProps) slideLayouts master presentationElement
+      })
+
+  -- Update the master to make sure it includes any layouts we've just added
+  masterRels <- getMasterRels
+  let (updatedMasterElem, updatedMasterRelElem) = updateMasterElems slideLayouts master masterRels
+  updatedMasterEntry <- elemToEntry "ppt/slideMasters/slideMaster1.xml" updatedMasterElem
+  updatedMasterRelEntry <- elemToEntry "ppt/slideMasters/_rels/slideMaster1.xml.rels" updatedMasterRelElem
+
+  -- we make a modified ppt/viewProps.xml out of the presentation viewProps
+  viewPropsEntry <- makeViewPropsEntry
+  -- we make a docProps/core.xml entry out of the presentation docprops
+  docPropsEntry <- docPropsToEntry docProps
+  -- we make a docProps/custom.xml entry out of the custom properties
+  docCustomPropsEntry <- docCustomPropsToEntry docProps
+  -- we make this ourself in case there's something unexpected in the
+  -- one in the reference doc.
+  relsEntry <- topLevelRelsEntry
+  -- presentation entry and rels.
+  (presentationRIdUpdateData, presRelsEntry) <- presentationToRelsEntry p
+  presEntry <- presentationToPresEntry presentationRIdUpdateData p
+  slideEntries <- mapM slideToEntry slides
+  slideRelEntries <- mapM slideToSlideRelEntry slides
+  spkNotesEntries <- catMaybes <$> mapM slideToSpeakerNotesEntry slides
+  spkNotesRelEntries <- catMaybes <$> mapM slideToSpeakerNotesRelEntry slides
+  -- These have to come after everything, because they need the info
+  -- built up in the state.
+  mediaEntries <- makeMediaEntries
+  contentTypesEntry <- presentationToContentTypes p >>= contentTypesToEntry
+  -- fold everything into our inherited archive and return it.
+  return $ foldr addEntryToArchive newArch' $
+    slideEntries <>
+    slideRelEntries <>
+    spkNotesEntries <>
+    spkNotesRelEntries <>
+    mediaEntries <>
+    [updatedMasterEntry, updatedMasterRelEntry]  <>
+    [contentTypesEntry, docPropsEntry, docCustomPropsEntry, relsEntry,
+     presEntry, presRelsEntry, viewPropsEntry]
+
+updateMasterElems :: SlideLayouts -> Element -> Element -> (Element, Element)
+updateMasterElems layouts master masterRels = (updatedMaster, updatedMasterRels)
+  where
+    updatedMaster = master { elContent = updateSldLayoutIdLst <$> elContent master }
+    (updatedRelationshipIds, updatedMasterRels) = addLayoutRels masterRels
+
+    updateSldLayoutIdLst :: Content -> Content
+    updateSldLayoutIdLst (Elem e) = case elName e of
+      (QName "sldLayoutIdLst" _ _) -> let
+        mkChild relationshipId (lastId, children) = let
+          thisId = lastId + 1
+          newChild = Element
+            { elName = QName "sldLayoutId" Nothing (Just "p")
+            , elAttribs =
+              [ Attr (QName "id" Nothing Nothing) (T.pack (show thisId))
+              , Attr (QName "id" Nothing (Just "r")) relationshipId
+              ]
+            , elContent = []
+            , elLine = Nothing
+            }
+          in (thisId, Elem newChild : children)
+        newChildren = snd (foldr mkChild (maxIdNumber' e, []) updatedRelationshipIds)
+        in Elem e { elContent = elContent e <> newChildren }
+      _ -> Elem e
+    updateSldLayoutIdLst c = c
+
+    addLayoutRels ::
+      Element ->
+      ([Text], Element)
+    addLayoutRels e = let
+      layoutsToAdd = filter (\l -> not (slInReferenceDoc l) && isNew e l)
+                            (toList layouts)
+      newRelationships = snd (foldr mkRelationship (maxIdNumber e, []) layoutsToAdd)
+      newRelationshipIds =
+        mapMaybe (findElemAttr (QName "Id" Nothing Nothing)) newRelationships
+      mkRelationship layout (lastId, relationships) = let
+        thisId = lastId + 1
+        slideLayoutPath = "../slideLayouts/" <> T.pack (takeFileName (slPath layout))
+        newRelationship = Element
+          { elName = QName "Relationship" Nothing Nothing
+          , elAttribs =
+            [ Attr (QName "Id" Nothing Nothing) ("rId" <> T.pack (show thisId))
+            , Attr (QName "Type" Nothing Nothing) "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"
+            , Attr (QName "Target" Nothing Nothing) slideLayoutPath
+            ]
+          , elContent = []
+          , elLine = Nothing
+          }
+        in (thisId, Elem newRelationship : relationships)
+      in (newRelationshipIds, e {elContent = elContent e <> newRelationships})
+
+    -- | Whether the layout needs to be added to the Relationships element.
+    isNew :: Element -> SlideLayout -> Bool
+    isNew relationships SlideLayout{..} = let
+      toDetails = fmap (takeFileName . T.unpack)
+        . findElemAttr (QName "Target" Nothing Nothing)
+      in takeFileName slPath `notElem` mapMaybe toDetails (elContent relationships)
+
+    findElemAttr :: QName -> Content -> Maybe Text
+    findElemAttr attr (Elem e) = findAttr attr e
+    findElemAttr _ _ = Nothing
+
+    maxIdNumber :: Element -> Integer
+    maxIdNumber relationships = maximum (0 : idNumbers)
+      where
+        idNumbers = mapMaybe (readTextAsInteger . T.drop 3) idAttributes
+        idAttributes = mapMaybe getIdAttribute (elContent relationships)
+        getIdAttribute (Elem e) = findAttr (QName "Id" Nothing Nothing) e
+        getIdAttribute _ = Nothing
+
+    maxIdNumber' :: Element -> Integer
+    maxIdNumber' sldLayouts = maximum (0 : idNumbers)
+      where
+        idNumbers = mapMaybe readTextAsInteger idAttributes
+        idAttributes = mapMaybe getIdAttribute (elContent sldLayouts)
+        getIdAttribute (Elem e) = findAttr (QName "id" Nothing Nothing) e
+        getIdAttribute _ = Nothing
+
+data FooterInfo = FooterInfo
+  { fiDate :: SlideLayoutsOf (Maybe Element)
+  , fiFooter :: SlideLayoutsOf (Maybe Element)
+  , fiSlideNumber :: SlideLayoutsOf (Maybe Element)
+  , fiShowOnFirstSlide :: Bool
+  } deriving (Show, Eq)
+
+getFooterInfo :: Maybe Text -> SlideLayouts -> Element -> Element -> Maybe FooterInfo
+getFooterInfo date layouts master presentation = do
+  let ns = elemToNameSpaces master
+  hf <- findChild (elemName ns "p" "hf") master
+  let fiDate = let
+        f layoutDate =
+          case date of
+            Nothing -> layoutDate
+            Just d ->
+              if dateIsAutomatic (elemToNameSpaces layoutDate) layoutDate
+              then layoutDate
+              else replaceDate d layoutDate
+        in fmap f . getShape "dt" hf . slElement <$> layouts
+      fiFooter = getShape "ftr" hf . slElement <$> layouts
+      fiSlideNumber = getShape "sldNum" hf . slElement <$> layouts
+      fiShowOnFirstSlide =
+        fromMaybe True
+        (getBooleanAttribute "showSpecialPlsOnTitleSld" presentation)
+  pure FooterInfo{..}
+    where
+      getShape t hf layout =
+        if fromMaybe True (getBooleanAttribute t hf)
+        then do
+          let ns = elemToNameSpaces layout
+          cSld <- findChild (elemName ns "p" "cSld") layout
+          spTree <- findChild (elemName ns "p" "spTree") cSld
+          let containsPlaceholder sp = fromMaybe False $ do
+                nvSpPr <- findChild (elemName ns "p" "nvSpPr") sp
+                nvPr <- findChild (elemName ns "p" "nvPr") nvSpPr
+                ph <- findChild (elemName ns "p" "ph") nvPr
+                placeholderType <- findAttr (QName "type" Nothing Nothing) ph
+                pure (placeholderType == t)
+          listToMaybe (filterChildren containsPlaceholder spTree)
+        else Nothing
+
+      dateIsAutomatic :: NameSpaces -> Element -> Bool
+      dateIsAutomatic ns shape = isJust $ do
+        txBody <- findChild (elemName ns "p" "txBody") shape
+        p <- findChild (elemName ns "a" "p") txBody
+        findChild (elemName ns "a" "fld") p
+
+      replaceDate :: Text -> Element -> Element
+      replaceDate newDate e =
+        e { elContent =
+            case (elName e) of
+              QName "t" _ (Just "a") ->
+                [ Text (CData { cdVerbatim = CDataText
+                              , cdData = newDate
+                              , cdLine = Nothing
+                              })
+                ]
+              _ -> ifElem (replaceDate newDate) <$> elContent e
+           }
+
+      ifElem :: (Element -> Element) -> (Content -> Content)
+      ifElem f (Elem e) = Elem (f e)
+      ifElem _ c = c
+
+      getBooleanAttribute t e =
+        (`elem` ["1", "true"]) <$>
+          (findAttr (QName t Nothing Nothing) e)
+
+footerElements ::
+  PandocMonad m =>
+  (forall a. SlideLayoutsOf a -> a) ->
+  P m [Content]
+footerElements layout = do
+  footerInfo <- gets stFooterInfo
+  pure
+    $ Elem <$>
+      (toList (footerInfo >>= layout . fiDate)
+       <> toList (footerInfo >>= layout . fiFooter)
+       <> toList (footerInfo >>= layout . fiSlideNumber))
+
+makeSlideIdMap :: Presentation -> M.Map SlideId Int
+makeSlideIdMap (Presentation _ slides) =
+  M.fromList $ map slideId slides `zip` [1..]
+
+makeSpeakerNotesMap :: Presentation -> M.Map Int Int
+makeSpeakerNotesMap (Presentation _ slides) =
+  M.fromList $
+    mapMaybe f (slides `zip` [1..]) `zip` [1..]
+  where f (Slide _ _ notes _, n) = if notes == mempty
+                                   then Nothing
+                                   else Just n
+
+presentationToArchive :: PandocMonad m
+                      => WriterOptions -> Meta -> Presentation -> m Archive
+presentationToArchive opts meta pres = do
+  distArchive <- toArchive . BL.fromStrict <$>
+                      P.readDefaultDataFile "reference.pptx"
+  refArchive <- case writerReferenceDoc opts of
+                     Just f  -> toArchive <$> P.readFileLazy f
+                     Nothing -> toArchive . BL.fromStrict <$>
+                        P.readDataFile "reference.pptx"
+
+  let (referenceLayouts, defaultReferenceLayouts) =
+        (getLayoutsFromArchive refArchive, getLayoutsFromArchive distArchive)
+  let layoutTitles = SlideLayouts { metadata = "Title Slide" :: Text
+                                  , title = "Section Header"
+                                  , content = "Title and Content"
+                                  , twoColumn = "Two Content"
+                                  , comparison = "Comparison"
+                                  , contentWithCaption = "Content with Caption"
+                                  , blank = "Blank"
+                                  }
+  layouts <- for layoutTitles $ \layoutTitle -> do
+        let layout = M.lookup (CI.mk layoutTitle) referenceLayouts
+        let defaultLayout = M.lookup (CI.mk layoutTitle) defaultReferenceLayouts
+        case (layout, defaultLayout) of
+          (Nothing, Nothing) ->
+            throwError (PandocSomeError ("Couldn't find layout named \""
+                                         <> layoutTitle <> "\" in the provided "
+                                         <> "reference doc or in the default "
+                                         <> "reference doc included with pandoc."))
+          (Nothing, Just ((element, path, entry) :| _)) -> do
+            P.report (PowerpointTemplateWarning
+                                     ("Couldn't find layout named \""
+                                      <> layoutTitle <> "\" in provided "
+                                      <> "reference doc. Falling back to "
+                                      <> "the default included with pandoc."))
+            pure SlideLayout { slElement = element
+                             , slPath = path
+                             , slEntry = entry
+                             , slInReferenceDoc = False
+                             }
+          (Just ((element, path, entry) :| _), _ ) ->
+            pure SlideLayout { slElement = element
+                             , slPath = path
+                             , slEntry = entry
+                             , slInReferenceDoc = True
+                             }
+
+  master <- getMaster' refArchive distArchive
+
+  let otherStyleIndents = do
+        let ns = elemToNameSpaces master
+        txStyles <- findChild (elemName ns "p" "txStyles") master
+        otherStyle <- findChild (elemName ns "p" "otherStyle") txStyles
+        let makeLevelIndents name = do
+              e <- findChild (elemName ns "a" name) otherStyle
+              pure LevelIndents
+                { indent = fromMaybe (-342900)
+                    (findAttr (QName "indent" Nothing Nothing) e
+                    >>= readTextAsInteger)
+                , marL = fromMaybe 347663
+                    (findAttr (QName "marL" Nothing Nothing) e
+                     >>= readTextAsInteger)
+                }
+        pure Indents
+          { level1 = makeLevelIndents "lvl1pPr"
+          , level2 = makeLevelIndents "lvl2pPr"
+          , level3 = makeLevelIndents "lvl3pPr"
+          , level4 = makeLevelIndents "lvl4pPr"
+          , level5 = makeLevelIndents "lvl5pPr"
+          , level6 = makeLevelIndents "lvl6pPr"
+          , level7 = makeLevelIndents "lvl7pPr"
+          , level8 = makeLevelIndents "lvl8pPr"
+          , level9 = makeLevelIndents "lvl9pPr"
+          }
+
+  utctime <- P.getTimestamp
+
+  presSize <- case getPresentationSize refArchive distArchive of
+                Just sz -> return sz
+                Nothing -> throwError $
+                           PandocSomeError
+                           "Could not determine presentation size"
+
+  -- note, we need writerTemplate to be Just _ or metaToContext does
+  -- nothing
+  context <- metaToContext opts{ writerTemplate =
+                                  writerTemplate opts <|> Just mempty }
+                (return . literal . stringify)
+                (return . literal . stringify) meta
+
+  let env = def { envRefArchive = refArchive
+                , envDistArchive = distArchive
+                , envUTCTime = utctime
+                , envOpts = opts
+                , envContext = context
+                , envPresentationSize = presSize
+                , envSlideIdMap = makeSlideIdMap pres
+                , envSpeakerNotesIdMap = makeSpeakerNotesMap pres
+                , envSlideLayouts = Just layouts
+                , envOtherStyleIndents = otherStyleIndents
+                }
+
+  let st = def { stMediaGlobalIds = initialGlobalIds refArchive distArchive
+               }
+
+  runP env st $ presentationToArchiveP pres
+
+-- | Get all slide layouts from an archive, as a map where the layout's name
+-- gives the map key.
+--
+-- For each layout, the map contains its XML representation, its path within
+-- the archive, and the archive entry.
+getLayoutsFromArchive :: Archive -> M.Map (CI Text) (NonEmpty (Element, FilePath, Entry))
+getLayoutsFromArchive archive =
+  M.fromListWith (<>) ((\t@(e, _, _) -> (CI.mk (name e), pure t)) <$> layouts)
+  where
+    layouts :: [(Element, FilePath, Entry)]
+    layouts = mapMaybe findElementByPath paths
+    parseXml' entry = case parseXMLElement (UTF8.toTextLazy (fromEntry entry)) of
+            Left _ -> Nothing
+            Right element -> Just element
+    findElementByPath :: FilePath -> Maybe (Element, FilePath, Entry)
+    findElementByPath path = do
+      entry <- findEntryByPath path archive
+      element <- parseXml' entry
+      pure (element, path, entry)
+    paths = filter (match (compile "ppt/slideLayouts/slideLayout*.xml")) (filesInArchive archive)
+    name element = fromMaybe "Untitled layout" $ do
+            let ns = elemToNameSpaces element
+            cSld <- findChild (elemName ns "p" "cSld") element
+            findAttr (QName "name" Nothing Nothing) cSld
+
+--------------------------------------------------
+
+-- Check to see if the presentation has speaker notes. This will
+-- influence whether we import the notesMaster template.
+presHasSpeakerNotes :: Presentation -> Bool
+presHasSpeakerNotes (Presentation _ slides) =
+  not $ all ((mempty ==) . slideSpeakerNotes) slides
+
+curSlideHasSpeakerNotes :: PandocMonad m => P m Bool
+curSlideHasSpeakerNotes =
+  M.member <$> asks envCurSlideId <*> asks envSpeakerNotesIdMap
+
+--------------------------------------------------
+
+getLayout :: PandocMonad m => Layout -> P m Element
+getLayout layout = getElement <$> getSlideLayouts
+  where
+    getElement =
+      slElement . case layout of
+        MetadataSlide{}           -> metadata
+        TitleSlide{}              -> title
+        ContentSlide{}            -> content
+        TwoColumnSlide{}          -> twoColumn
+        ComparisonSlide{}         -> comparison
+        ContentWithCaptionSlide{} -> contentWithCaption
+        BlankSlide{}              -> blank
+
+shapeHasId :: NameSpaces -> T.Text -> Element -> Bool
+shapeHasId ns ident element = getShapeId ns element == Just ident
+
+getShapeId :: NameSpaces -> Element -> Maybe Text
+getShapeId ns element = do
+  nvSpPr <- findChild (elemName ns "p" "nvSpPr") element
+  cNvPr <- findChild (elemName ns "p" "cNvPr") nvSpPr
+  findAttr (QName "id" Nothing Nothing) cNvPr
+
+type ShapeId = Integer
+
+getContentShape :: PandocMonad m => NameSpaces -> Element -> P m (Maybe ShapeId, Element)
+getContentShape ns spTreeElem
+  | isElem ns "p" "spTree" spTreeElem = do
+      ph@Placeholder{index, placeholderType} <- asks envPlaceholder
+      case drop index (getShapesByPlaceHolderType ns spTreeElem placeholderType) of
+        sp : _ -> let
+          shapeId = getShapeId ns sp >>= readTextAsInteger
+          in return (shapeId, sp)
+        [] -> throwError $ PandocSomeError $ missingPlaceholderMessage ph
+getContentShape _ _ = throwError $ PandocSomeError
+                      "Attempted to find content on non shapeTree"
+
+missingPlaceholderMessage :: Placeholder -> Text
+missingPlaceholderMessage Placeholder{..} =
+  "Could not find a " <> ordinal
+  <> " placeholder of type " <> placeholderText
+  where
+    ordinal = T.pack (show index) <>
+      case (index `mod` 100, index `mod` 10) of
+        (11, _) -> "th"
+        (12, _) -> "th"
+        (13, _) -> "th"
+        (_,  1) -> "st"
+        (_,  2) -> "nd"
+        (_,  3) -> "rd"
+        _       -> "th"
+    placeholderText = case placeholderType of
+      ObjType -> "obj (or nothing)"
+      PHType t -> t
+
+getShapeDimensions :: NameSpaces
+                   -> Element
+                   -> Maybe ((Integer, Integer), (Integer, Integer))
+getShapeDimensions ns element
+  | isElem ns "p" "sp" element = do
+      spPr <- findChild (elemName ns "p" "spPr") element
+      xfrm <- findChild (elemName ns "a" "xfrm") spPr
+      off <- findChild (elemName ns "a" "off") xfrm
+      xS <- findAttr (QName "x" Nothing Nothing) off
+      yS <- findAttr (QName "y" Nothing Nothing) off
+      ext <- findChild (elemName ns "a" "ext") xfrm
+      cxS <- findAttr (QName "cx" Nothing Nothing) ext
+      cyS <- findAttr (QName "cy" Nothing Nothing) ext
+      x <- readTextAsInteger xS
+      y <- readTextAsInteger yS
+      cx <- readTextAsInteger cxS
+      cy <- readTextAsInteger cyS
+      return ((x `div` 12700, y `div` 12700),
+              (cx `div` 12700, cy `div` 12700))
+  | otherwise = Nothing
+
+
+getMasterShapeDimensionsById :: T.Text
+                             -> Element
+                             -> Maybe ((Integer, Integer), (Integer, Integer))
+getMasterShapeDimensionsById ident master = do
+  let ns = elemToNameSpaces master
+  cSld <- findChild (elemName ns "p" "cSld") master
+  spTree <- findChild (elemName ns "p" "spTree") cSld
+  sp <- filterChild (\e -> isElem ns "p" "sp" e && shapeHasId ns ident e) spTree
+  getShapeDimensions ns sp
+
+getContentShapeSize :: PandocMonad m
+                    => NameSpaces
+                    -> Element
+                    -> Element
+                    -> P m ((Integer, Integer), (Integer, Integer))
+getContentShapeSize ns layout master
+  | isElem ns "p" "sldLayout" layout
+  , Just cSld <- findChild (elemName ns "p" "cSld") layout
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
+      (_, sp)  <- getContentShape ns spTree
+      case getShapeDimensions ns sp of
+        Just sz -> return sz
+        Nothing -> do let mbSz =
+                            findChild (elemName ns "p" "nvSpPr") sp >>=
+                            findChild (elemName ns "p" "cNvPr") >>=
+                            findAttr (QName "id" Nothing Nothing) >>=
+                            flip getMasterShapeDimensionsById master
+                      case mbSz of
+                        Just sz' -> return sz'
+                        Nothing -> throwError $ PandocSomeError
+                                   "Couldn't find necessary content shape size"
+getContentShapeSize _ _ _ = throwError $ PandocSomeError
+                            "Attempted to find content shape size in non-layout"
+
+buildSpTree :: NameSpaces -> Element -> [Content] -> Element
+buildSpTree ns spTreeElem newShapes =
+  emptySpTreeElem { elContent = newContent }
+  where newContent = elContent emptySpTreeElem <> newShapes
+        emptySpTreeElem = spTreeElem { elContent = filter fn (elContent spTreeElem) }
+        fn :: Content -> Bool
+        fn (Elem e) = isElem ns "p" "nvGrpSpPr" e ||
+                      isElem ns "p" "grpSpPr" e
+        fn _        = True
+
+replaceNamedChildren :: NameSpaces
+                     -> Text
+                     -> Text
+                     -> [Element]
+                     -> Element
+                     -> Element
+replaceNamedChildren ns prefix name newKids element =
+  element { elContent = concat $ fun True $ elContent element }
+  where
+    fun :: Bool -> [Content] -> [[Content]]
+    fun _ [] = []
+    fun switch (Elem e : conts) | isElem ns prefix name e =
+                                      if switch
+                                      then map Elem newKids : fun False conts
+                                      else fun False conts
+    fun switch (cont : conts) = [cont] : fun switch conts
+
+----------------------------------------------------------------
+
+registerLink :: PandocMonad m => LinkTarget -> P m Int
+registerLink link = do
+  curSlideId <- asks envCurSlideId
+  linkReg <- gets stLinkIds
+  mediaReg <- gets stMediaIds
+  hasSpeakerNotes <- curSlideHasSpeakerNotes
+  let maxLinkId = case M.lookup curSlideId linkReg >>= nonEmpty . M.keys of
+        Just xs -> maximum xs
+        Nothing
+          | hasSpeakerNotes -> 2
+          | otherwise       -> 1
+      maxMediaId = case M.lookup curSlideId mediaReg >>= nonEmpty of
+        Just mInfos -> maximum $ fmap mInfoLocalId mInfos
+        Nothing
+          | hasSpeakerNotes -> 2
+          | otherwise       -> 1
+      maxId = max maxLinkId maxMediaId
+      slideLinks = case M.lookup curSlideId linkReg of
+        Just mp -> M.insert (maxId + 1) link mp
+        Nothing -> M.singleton (maxId + 1) link
+  modify $ \st -> st{ stLinkIds = M.insert curSlideId slideLinks linkReg}
+  return $ maxId + 1
+
+registerMedia :: PandocMonad m => FilePath -> [ParaElem] -> P m MediaInfo
+registerMedia fp caption = do
+  curSlideId <- asks envCurSlideId
+  linkReg <- gets stLinkIds
+  mediaReg <- gets stMediaIds
+  globalIds <- gets stMediaGlobalIds
+  hasSpeakerNotes <- curSlideHasSpeakerNotes
+  let maxLinkId = case M.lookup curSlideId linkReg >>= nonEmpty . M.keys of
+          Just ks -> maximum ks
+          Nothing
+            | hasSpeakerNotes -> 2
+            | otherwise       -> 1
+      maxMediaId = case M.lookup curSlideId mediaReg >>= nonEmpty of
+          Just mInfos -> maximum $ fmap mInfoLocalId mInfos
+          Nothing
+            | hasSpeakerNotes -> 2
+            | otherwise       -> 1
+      maxLocalId = max maxLinkId maxMediaId
+
+      maxGlobalId = maybe 0 maximum $ nonEmpty $ M.elems globalIds
+
+  (imgBytes, mbMt) <- P.fetchItem $ T.pack fp
+  let imgExt = (mbMt >>= extensionFromMimeType >>= (\x -> return $ "." <> x))
+               <|>
+               case imageType imgBytes of
+                 Just Png  -> Just ".png"
+                 Just Jpeg -> Just ".jpeg"
+                 Just Gif  -> Just ".gif"
+                 Just Pdf  -> Just ".pdf"
+                 Just Eps  -> Just ".eps"
+                 Just Svg  -> Just ".svg"
+                 Just Emf  -> Just ".emf"
+                 Just Tiff -> Just ".tiff"
+                 Nothing   -> Nothing
+
+  let newGlobalId = fromMaybe (maxGlobalId + 1) (M.lookup fp globalIds)
+
+  let newGlobalIds = M.insert fp newGlobalId globalIds
+
+  let mediaInfo = MediaInfo { mInfoFilePath = fp
+                            , mInfoLocalId = maxLocalId + 1
+                            , mInfoGlobalId = newGlobalId
+                            , mInfoMimeType = mbMt
+                            , mInfoExt = imgExt
+                            , mInfoCaption = (not . null) caption
+                            }
+
+  let slideMediaInfos = case M.lookup curSlideId mediaReg of
+        Just minfos -> mediaInfo : minfos
+        Nothing     -> [mediaInfo]
+
+
+  modify $ \st -> st{ stMediaIds = M.insert curSlideId slideMediaInfos mediaReg
+                    , stMediaGlobalIds = newGlobalIds
+                    }
+  return mediaInfo
+
+makeMediaEntry :: PandocMonad m => MediaInfo -> P m Entry
+makeMediaEntry mInfo = do
+  epochtime <- floor . utcTimeToPOSIXSeconds <$> asks envUTCTime
+  (imgBytes, _) <- P.fetchItem (T.pack $ mInfoFilePath mInfo)
+  let ext = fromMaybe "" (mInfoExt mInfo)
+  let fp = "ppt/media/image" <>
+          show (mInfoGlobalId mInfo) <> T.unpack ext
+  return $ toEntry fp epochtime $ BL.fromStrict imgBytes
+
+makeMediaEntries :: PandocMonad m => P m [Entry]
+makeMediaEntries = do
+  mediaInfos <- gets stMediaIds
+  let allInfos = mconcat $ M.elems mediaInfos
+  mapM makeMediaEntry allInfos
+
+-- -- | Scales the image to fit the page
+-- -- sizes are passed in emu
+-- fitToPage' :: (Double, Double)  -- image size in emu
+--            -> Integer           -- pageWidth
+--            -> Integer           -- pageHeight
+--            -> (Integer, Integer) -- imagesize
+-- fitToPage' (x, y) pageWidth pageHeight
+--   -- Fixes width to the page width and scales the height
+--   | x <= fromIntegral pageWidth && y <= fromIntegral pageHeight =
+--       (floor x, floor y)
+--   | x / fromIntegral pageWidth > y / fromIntegral pageWidth =
+--       (pageWidth, floor $ ((fromIntegral pageWidth) / x) * y)
+--   | otherwise =
+--       (floor $ ((fromIntegral pageHeight) / y) * x, pageHeight)
+
+-- positionImage :: (Double, Double) -> Integer -> Integer -> (Integer, Integer)
+-- positionImage (x, y) pageWidth pageHeight =
+--   let (x', y') = fitToPage' (x, y) pageWidth pageHeight
+--   in
+--     ((pageWidth - x') `div` 2, (pageHeight - y') `div`  2)
+
+getMaster :: PandocMonad m => P m Element
+getMaster = do
+  refArchive <- asks envRefArchive
+  distArchive <- asks envDistArchive
+  getMaster' refArchive distArchive
+
+getMaster' :: PandocMonad m => Archive -> Archive -> m Element
+getMaster' refArchive distArchive =
+  parseXml refArchive distArchive "ppt/slideMasters/slideMaster1.xml"
+
+getMasterRels :: PandocMonad m => P m Element
+getMasterRels = do
+  refArchive <- asks envRefArchive
+  distArchive <- asks envDistArchive
+  parseXml refArchive distArchive "ppt/slideMasters/_rels/slideMaster1.xml.rels"
+
+-- We want to get the header dimensions, so we can make sure that the
+-- image goes underneath it. We only use this in a content slide if it
+-- has a header.
+
+-- getHeaderSize :: PandocMonad m => P m ((Integer, Integer), (Integer, Integer))
+-- getHeaderSize = do
+--   master <- getMaster
+--   let ns = elemToNameSpaces master
+--       sps = [master] >>=
+--             findChildren (elemName ns "p" "cSld") >>=
+--             findChildren (elemName ns "p" "spTree") >>=
+--             findChildren (elemName ns "p" "sp")
+--       mbXfrm =
+--         listToMaybe (filter (shapeHasName ns "Title Placeholder 1") sps) >>=
+--         findChild (elemName ns "p" "spPr") >>=
+--         findChild (elemName ns "a" "xfrm")
+--       xoff = mbXfrm >>=
+--              findChild (elemName ns "a" "off") >>=
+--              findAttr (QName "x" Nothing Nothing) >>=
+--              (listToMaybe . (\s -> reads s :: [(Integer, String)]))
+--       yoff = mbXfrm >>=
+--              findChild (elemName ns "a" "off") >>=
+--              findAttr (QName "y" Nothing Nothing) >>=
+--              (listToMaybe . (\s -> reads s :: [(Integer, String)]))
+--       xext = mbXfrm >>=
+--              findChild (elemName ns "a" "ext") >>=
+--              findAttr (QName "cx" Nothing Nothing) >>=
+--              (listToMaybe . (\s -> reads s :: [(Integer, String)]))
+--       yext = mbXfrm >>=
+--              findChild (elemName ns "a" "ext") >>=
+--              findAttr (QName "cy" Nothing Nothing) >>=
+--              (listToMaybe . (\s -> reads s :: [(Integer, String)]))
+--       off = case xoff of
+--               Just (xoff', _) | Just (yoff',_) <- yoff -> (xoff', yoff')
+--               _                               -> (1043490, 1027664)
+--       ext = case xext of
+--               Just (xext', _) | Just (yext',_) <- yext -> (xext', yext')
+--               _                               -> (7024744, 1143000)
+--   return $ (off, ext)
+
+-- Hard-coded for now
+-- captionPosition :: ((Integer, Integer), (Integer, Integer))
+-- captionPosition = ((457200, 6061972), (8229600, 527087))
+
+captionHeight :: Integer
+captionHeight = 40
+
+createCaption :: PandocMonad m
+              => ((Integer, Integer), (Integer, Integer))
+              -> [ParaElem]
+              -> P m (ShapeId, Element)
+createCaption contentShapeDimensions paraElements = do
+  let para = Paragraph def{pPropAlign = Just AlgnCenter} paraElements
+  elements <- mapM paragraphToElement [para]
+  let ((x, y), (cx, cy)) = contentShapeDimensions
+  let txBody = mknode "p:txBody" [] $
+               [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <> elements
+  return
+    ( 1
+    ,  mknode "p:sp" [] [ mknode "p:nvSpPr" []
+                          [ mknode "p:cNvPr" [("id","1"), ("name","TextBox 3")] ()
+                          , mknode "p:cNvSpPr" [("txBox", "1")] ()
+                          , mknode "p:nvPr" [] ()
+                          ]
+                        , mknode "p:spPr" []
+                          [ mknode "a:xfrm" []
+                            [ mknode "a:off" [("x", tshow $ 12700 * x),
+                                              ("y", tshow $ 12700 * (y + cy - captionHeight))] ()
+                            , mknode "a:ext" [("cx", tshow $ 12700 * cx),
+                                              ("cy", tshow $ 12700 * captionHeight)] ()
+                            ]
+                          , mknode "a:prstGeom" [("prst", "rect")]
+                            [ mknode "a:avLst" [] ()
+                            ]
+                          , mknode "a:noFill" [] ()
+                          ]
+                        , txBody
+                        ]
+    )
+
+makePicElements :: PandocMonad m
+                => Element
+                -> PicProps
+                -> MediaInfo
+                -> Text
+                -> [ParaElem]
+                -> P m [(ShapeId, Element)]
+makePicElements layout picProps mInfo titleText alt = do
+  opts <- asks envOpts
+  (pageWidth, pageHeight) <- asks envPresentationSize
+  -- hasHeader <- asks envSlideHasHeader
+  let hasCaption = mInfoCaption mInfo
+  (imgBytes, _) <- P.fetchItem (T.pack $ mInfoFilePath mInfo)
+  let (pxX, pxY) = case imageSize opts imgBytes of
+        Right sz -> sizeInPixels sz
+        Left _   -> sizeInPixels def
+  master <- getMaster
+  let ns = elemToNameSpaces layout
+  ((x, y), (cx, cytmp)) <- getContentShapeSize ns layout master
+                           `catchError`
+                           (\_ -> return ((0, 0), (pageWidth, pageHeight)))
+
+  let cy = if hasCaption then cytmp - captionHeight else cytmp
+
+  let imgRatio = fromIntegral pxX / fromIntegral pxY :: Double
+      boxRatio = fromIntegral cx / fromIntegral cy :: Double
+      (dimX, dimY) = if imgRatio > boxRatio
+                     then (fromIntegral cx, fromIntegral cx / imgRatio)
+                     else (fromIntegral cy * imgRatio, fromIntegral cy)
+
+      (dimX', dimY') = (round dimX * 12700, round dimY * 12700) :: (Integer, Integer)
+      (xoff, yoff) = (fromIntegral x + (fromIntegral cx - dimX) / 2,
+                      fromIntegral y + (fromIntegral cy - dimY) / 2)
+      (xoff', yoff') = (round xoff * 12700, round yoff * 12700) :: (Integer, Integer)
+
+  let cNvPicPr = mknode "p:cNvPicPr" [] $
+                 mknode "a:picLocks" [("noGrp","1")
+                                     ,("noChangeAspect","1")] ()
+  -- cNvPr will contain the link information so we do that separately,
+  -- and register the link if necessary.
+  let description = (if T.null titleText
+                      then ""
+                      else titleText <> "\n\n")
+                      <> T.pack (mInfoFilePath mInfo)
+  let cNvPrAttr = [("descr", description),
+                   ("id","0"),
+                   ("name","Picture 1")]
+  cNvPr <- case picPropLink picProps of
+    Just link -> do idNum <- registerLink link
+                    return $ mknode "p:cNvPr" cNvPrAttr $
+                      mknode "a:hlinkClick" [("r:id", "rId" <> tshow idNum)] ()
+    Nothing   -> return $ mknode "p:cNvPr" cNvPrAttr ()
+  let nvPicPr  = mknode "p:nvPicPr" []
+                 [ cNvPr
+                 , cNvPicPr
+                 , mknode "p:nvPr" [] ()]
+  let blipFill = mknode "p:blipFill" []
+                 [ mknode "a:blip" [("r:embed", "rId" <>
+                     tshow (mInfoLocalId mInfo))] ()
+                 , mknode "a:stretch" [] $
+                   mknode "a:fillRect" [] () ]
+  let xfrm =    mknode "a:xfrm" []
+                [ mknode "a:off" [("x", tshow xoff'), ("y", tshow yoff')] ()
+                , mknode "a:ext" [("cx", tshow dimX')
+                                 ,("cy", tshow dimY')] () ]
+  let prstGeom = mknode "a:prstGeom" [("prst","rect")] $
+                 mknode "a:avLst" [] ()
+  let ln =      mknode "a:ln" [("w","9525")]
+                [ mknode "a:noFill" [] ()
+                , mknode "a:headEnd" [] ()
+                , mknode "a:tailEnd" [] () ]
+  let spPr =    mknode "p:spPr" [("bwMode","auto")]
+                [xfrm, prstGeom, mknode "a:noFill" [] (), ln]
+
+  let picShape = ( 0
+                 , mknode "p:pic" []
+                   [ nvPicPr
+                   , blipFill
+                   , spPr ]
+                 )
+
+  -- And now, maybe create the caption:
+  if hasCaption
+    then do cap <- createCaption ((x, y), (cx, cytmp)) alt
+            return [picShape, cap]
+    else return [picShape]
+
+consolidateRuns :: [ParaElem] -> [ParaElem]
+consolidateRuns [] = []
+consolidateRuns (Run pr1 s1 : Run pr2 s2 : xs)
+  | pr1 == pr2 = consolidateRuns (Run pr1 (s1 <> s2) : xs)
+consolidateRuns (x:xs) = x : consolidateRuns xs
+
+
+paraElemToElements :: PandocMonad m => ParaElem -> P m [Content]
+paraElemToElements Break = return [Elem $ mknode "a:br" [] ()]
+paraElemToElements (Run rpr s) = do
+  sizeAttrs <- fontSizeAttributes rpr
+  let attrs = sizeAttrs <>
+        (
+        [("b", "1") | rPropBold rpr]) <>
+        (
+        [("i", "1") | rPropItalics rpr]) <>
+        (
+        [("u", "sng") | rPropUnderline rpr]) <>
+        (case rStrikethrough rpr of
+            Just NoStrike     -> [("strike", "noStrike")]
+            Just SingleStrike -> [("strike", "sngStrike")]
+            Just DoubleStrike -> [("strike", "dblStrike")]
+            Nothing -> []) <>
+        (case rBaseline rpr of
+            Just n -> [("baseline", tshow n)]
+            Nothing -> []) <>
+        (case rCap rpr of
+            Just NoCapitals -> [("cap", "none")]
+            Just SmallCapitals -> [("cap", "small")]
+            Just AllCapitals -> [("cap", "all")]
+            Nothing -> []) <>
+        []
+  linkProps <- case rLink rpr of
+                 Just link -> do
+                   idNum <- registerLink link
+                   -- first we have to make sure that if it's an
+                   -- anchor, it's in the anchor map. If not, there's
+                   -- no link.
+                   return $ case link of
+                     InternalTarget _ ->
+                       let linkAttrs =
+                             [ ("r:id", "rId" <> tshow idNum)
+                             , ("action", "ppaction://hlinksldjump")
+                             ]
+                       in [mknode "a:hlinkClick" linkAttrs ()]
+                     -- external
+                     ExternalTarget _ ->
+                       let linkAttrs =
+                             [ ("r:id", "rId" <> tshow idNum)
+                             ]
+                       in [mknode "a:hlinkClick" linkAttrs ()]
+                 Nothing -> return []
+  let colorContents = case rSolidFill rpr of
+                        Just color ->
+                          case fromColor color of
+                            '#':hx ->
+                              [mknode "a:solidFill" []
+                                [mknode "a:srgbClr"
+                                  [("val", T.toUpper $ T.pack hx)] ()]]
+                            _ -> []
+                        Nothing -> []
+  codeFont <- monospaceFont
+  let codeContents =
+        [mknode "a:latin" [("typeface", codeFont)] () | rPropCode rpr]
+  let propContents = linkProps <> colorContents <> codeContents
+  return [Elem $ mknode "a:r" [] [ mknode "a:rPr" attrs propContents
+                                 , mknode "a:t" [] s
+                                 ]]
+paraElemToElements (MathElem mathType texStr) = do
+  isInSpkrNotes <- asks envInSpeakerNotes
+  if isInSpkrNotes
+    then paraElemToElements $ Run def $ unTeXString texStr
+    else do res <- convertMath writeOMML mathType (unTeXString texStr)
+            case fromXLElement <$> res of
+              Right r -> return [Elem $ mknode "a14:m" [] $ addMathInfo r]
+              Left (Str s) -> paraElemToElements (Run def s)
+              Left _       -> throwError $ PandocShouldNeverHappenError "non-string math fallback"
+paraElemToElements (RawOOXMLParaElem str) = return
+  [Text (CData CDataRaw str Nothing)]
+
+
+-- This is a bit of a kludge -- really requires adding an option to
+-- TeXMath, but since that's a different package, we'll do this one
+-- step at a time.
+addMathInfo :: Element -> Element
+addMathInfo element =
+  let mathspace =
+        Attr { attrKey = QName "m" Nothing (Just "xmlns")
+             , attrVal = "http://schemas.openxmlformats.org/officeDocument/2006/math"
+             }
+  in add_attr mathspace element
+
+-- We look through the element to see if it contains an a14:m
+-- element. If so, we surround it. This is a bit ugly, but it seems
+-- more dependable than looking through shapes for math. Plus this is
+-- an xml implementation detail, so it seems to make sense to do it at
+-- the xml level.
+surroundWithMathAlternate :: Element -> Element
+surroundWithMathAlternate element =
+  case findElement (QName "m" Nothing (Just "a14")) element of
+    Just _ ->
+      mknode "mc:AlternateContent"
+         [("xmlns:mc", "http://schemas.openxmlformats.org/markup-compatibility/2006")
+         ] [ mknode "mc:Choice"
+             [ ("xmlns:a14", "http://schemas.microsoft.com/office/drawing/2010/main")
+             , ("Requires", "a14")] [ element ]
+           ]
+    Nothing -> element
+
+paragraphToElement :: PandocMonad m => Paragraph -> P m Element
+paragraphToElement par = do
+  indents <- asks envOtherStyleIndents
+  let
+    lvl = pPropLevel (paraProps par)
+    attrs = [("lvl", tshow lvl)] <>
+            (case (pPropIndent (paraProps par), pPropMarginLeft (paraProps par)) of
+               (Just px1, Just px2) -> [ ("indent", tshow $ pixelsToEmu px1)
+                                       , ("marL", tshow $ pixelsToEmu px2)
+                                       ]
+               (Just px1, Nothing) -> [("indent", tshow $ pixelsToEmu px1)]
+               (Nothing, Just px2) -> [("marL", tshow $ pixelsToEmu px2)]
+               (Nothing, Nothing) -> fromMaybe [] $ do
+                 indents' <- indents
+                 thisLevel <- levelIndent indents' lvl
+                 nextLevel <- levelIndent indents' (lvl + 1)
+                 let (m, i) =
+                       case pPropBullet (paraProps par) of
+                         Nothing ->
+                           (Just (marL thisLevel), Just 0)
+                         Just (AutoNumbering _) ->
+                           ( Just (marL nextLevel)
+                           , Just (marL thisLevel - marL nextLevel)
+                           )
+                         Just Bullet -> (Nothing, Nothing)
+                 pure ( toList ((,) "indent" . tshow <$> i)
+                      <> toList ((,) "marL" . tshow <$> m)
+                      )
+            ) <>
+            (case pPropAlign (paraProps par) of
+               Just AlgnLeft -> [("algn", "l")]
+               Just AlgnRight -> [("algn", "r")]
+               Just AlgnCenter -> [("algn", "ctr")]
+               Nothing -> []
+            )
+    props = [] <>
+            (case pPropSpaceBefore $ paraProps par of
+               Just px -> [mknode "a:spcBef" [] [
+                              mknode "a:spcPts" [("val", tshow $ 100 * px)] ()
+                              ]
+                          ]
+               Nothing -> []
+            ) <>
+            (case pPropBullet $ paraProps par of
+               Just Bullet -> []
+               Just (AutoNumbering attrs') ->
+                 [mknode "a:buAutoNum" (autoNumAttrs attrs') ()]
+               Nothing -> [mknode "a:buNone" [] ()]
+            )
+  paras <- mconcat <$> mapM paraElemToElements (consolidateRuns (paraElems par))
+  return $ mknode "a:p" [] $ [Elem $ mknode "a:pPr" attrs props] <> paras
+
+shapeToElement :: PandocMonad m => Element -> Shape -> P m (Maybe ShapeId, Element)
+shapeToElement layout (TextBox paras)
+  | ns <- elemToNameSpaces layout
+  , Just cSld <- findChild (elemName ns "p" "cSld") layout
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
+      (shapeId, sp) <- getContentShape ns spTree
+      elements <- mapM paragraphToElement paras
+      let txBody = mknode "p:txBody" [] $
+                   [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <> elements
+          emptySpPr = mknode "p:spPr" [] ()
+      return
+        . (shapeId,)
+        . surroundWithMathAlternate
+        . replaceNamedChildren ns "p" "txBody" [txBody]
+        . replaceNamedChildren ns "p" "spPr" [emptySpPr]
+        $ sp
+-- GraphicFrame and Pic should never reach this.
+shapeToElement _ _ = return (Nothing, mknode "p:sp" [] ())
+
+shapeToElements :: PandocMonad m => Element -> Shape -> P m [(Maybe ShapeId, Content)]
+shapeToElements layout (Pic picProps fp titleText alt) = do
+  mInfo <- registerMedia fp alt
+  case mInfoExt mInfo of
+    Just _ -> map (bimap Just Elem) <$>
+      makePicElements layout picProps mInfo titleText alt
+    Nothing -> shapeToElements layout $ TextBox [Paragraph def alt]
+shapeToElements layout (GraphicFrame tbls cptn) = map (bimap Just Elem) <$>
+  graphicFrameToElements layout tbls cptn
+shapeToElements _ (RawOOXMLShape str) = return
+  [(Nothing, Text (CData CDataRaw str Nothing))]
+shapeToElements layout shp = do
+  (shapeId, element) <- shapeToElement layout shp
+  return [(shapeId, Elem element)]
+
+shapesToElements :: PandocMonad m => Element -> [Shape] -> P m [(Maybe ShapeId, Content)]
+shapesToElements layout shps =
+ concat <$> mapM (shapeToElements layout) shps
+
+graphicFrameToElements ::
+  PandocMonad m =>
+  Element ->
+  [Graphic] ->
+  [ParaElem] ->
+  P m [(ShapeId, Element)]
+graphicFrameToElements layout tbls caption = do
+  -- get the sizing
+  master <- getMaster
+  (pageWidth, pageHeight) <- asks envPresentationSize
+  let ns = elemToNameSpaces layout
+  ((x, y), (cx, cytmp)) <- getContentShapeSize ns layout master
+                           `catchError`
+                           (\_ -> return ((0, 0), (pageWidth, pageHeight)))
+
+  let cy = if not $ null caption then cytmp - captionHeight else cytmp
+
+  elements <- mapM (graphicToElement cx) tbls
+  let graphicFrameElts =
+        ( 6
+        , mknode "p:graphicFrame" [] $
+          [ mknode "p:nvGraphicFramePr" []
+            [ mknode "p:cNvPr" [("id", "6"), ("name", "Content Placeholder 5")] ()
+            , mknode "p:cNvGraphicFramePr" []
+              [mknode "a:graphicFrameLocks" [("noGrp", "1")] ()]
+            , mknode "p:nvPr" []
+              [mknode "p:ph" [("idx", "1")] ()]
+            ]
+          , mknode "p:xfrm" []
+            [ mknode "a:off" [("x", tshow $ 12700 * x),
+                              ("y", tshow $ 12700 * y)] ()
+            , mknode "a:ext" [("cx", tshow $ 12700 * cx),
+                              ("cy", tshow $ 12700 * cy)] ()
+            ]
+          ] <> elements
+        )
+
+  if not $ null caption
+    then do capElt <- createCaption ((x, y), (cx, cytmp)) caption
+            return [graphicFrameElts, capElt]
+    else return [graphicFrameElts]
+
+getDefaultTableStyle :: PandocMonad m => P m (Maybe T.Text)
+getDefaultTableStyle = do
+  refArchive <- asks envRefArchive
+  distArchive <- asks envDistArchive
+  tblStyleLst <- parseXml refArchive distArchive "ppt/tableStyles.xml"
+  return $ findAttr (QName "def" Nothing Nothing) tblStyleLst
+
+graphicToElement :: PandocMonad m => Integer -> Graphic -> P m Element
+graphicToElement tableWidth (Tbl tblPr hdrCells rows) = do
+  let colWidths = if null hdrCells
+                  then case rows of
+                         r : _ | not (null r) -> replicate (length r) $
+                                                 tableWidth `div` toInteger (length r)
+                         -- satisfy the compiler. This is the same as
+                         -- saying that rows is empty, but the compiler
+                         -- won't understand that `[]` exhausts the
+                         -- alternatives.
+                         _ -> []
+                  else replicate (length hdrCells) $
+                       tableWidth `div` toInteger (length hdrCells)
+
+  let cellToOpenXML paras =
+        do elements <- mapM paragraphToElement paras
+           let elements' = if null elements
+                           then [mknode "a:p" [] [mknode "a:endParaRPr" [] ()]]
+                           else elements
+
+           return
+             [mknode "a:txBody" [] $
+               [ mknode "a:bodyPr" [] ()
+               , mknode "a:lstStyle" [] ()]
+               <> elements']
+  headers' <- mapM cellToOpenXML hdrCells
+  rows' <- mapM (mapM cellToOpenXML) rows
+  let borderProps = mknode "a:tcPr" [] ()
+  let emptyCell' = [mknode "a:p" [] [mknode "a:pPr" [] ()]]
+  let mkcell border contents = mknode "a:tc" []
+                            $ (if null contents
+                               then emptyCell'
+                               else contents) <> [ borderProps | border ]
+  let mkrow border cells = mknode "a:tr" [("h", "0")] $ map (mkcell border) cells
+
+  let mkgridcol w = mknode "a:gridCol"
+                       [("w", tshow ((12700 * w) :: Integer))] ()
+  let hasHeader = not (all null hdrCells)
+
+  mbDefTblStyle <- getDefaultTableStyle
+  let tblPrElt = mknode "a:tblPr"
+                 [ ("firstRow", if tblPrFirstRow tblPr then "1" else "0")
+                 , ("bandRow", if tblPrBandRow tblPr then "1" else "0")
+                 ] (case mbDefTblStyle of
+                      Nothing -> []
+                      Just sty -> [mknode "a:tableStyleId" [] sty])
+
+  return $ mknode "a:graphic" []
+    [mknode "a:graphicData" [("uri", "http://schemas.openxmlformats.org/drawingml/2006/table")]
+     [mknode "a:tbl" [] $
+      [ tblPrElt
+      , mknode "a:tblGrid" [] (if all (==0) colWidths
+                               then []
+                               else map mkgridcol colWidths)
+      ]
+      <> [ mkrow True headers' | hasHeader ] <> map (mkrow False) rows'
+     ]
+    ]
+
+
+-- We get the shape by placeholder type. If there is NO type, it
+-- defaults to a content placeholder.
+
+data PHType = PHType T.Text | ObjType
+  deriving (Show, Eq)
+
+findPHType :: NameSpaces -> Element -> PHType -> Bool
+findPHType ns spElem phType
+  | isElem ns "p" "sp" spElem =
+    let mbPHElem = (Just spElem >>=
+                   findChild (elemName ns "p" "nvSpPr") >>=
+                   findChild (elemName ns "p" "nvPr") >>=
+                   findChild (elemName ns "p" "ph"))
+    in
+      case mbPHElem of
+        -- if it's a named PHType, we want to check that the attribute
+        -- value matches.
+        Just phElem | (PHType tp) <- phType ->
+                        case findAttr (QName "type" Nothing Nothing) phElem of
+                          Just tp' -> tp == tp'
+                          Nothing -> False
+        -- if it's an ObjType, we want to check that there is NO
+        -- "type" attribute. In other words, a lookup should return nothing.
+        Just phElem | ObjType <- phType ->
+                        case findAttr (QName "type" Nothing Nothing) phElem of
+                          Just _ -> False
+                          Nothing -> True
+        Nothing -> False
+findPHType _ _ _ = False
+
+getShapesByPlaceHolderType :: NameSpaces -> Element -> PHType -> [Element]
+getShapesByPlaceHolderType ns spTreeElem phType
+  | isElem ns "p" "spTree" spTreeElem =
+      filterChildren (\e -> findPHType ns e phType) spTreeElem
+  | otherwise = []
+
+getShapeByPlaceHolderType :: NameSpaces -> Element -> PHType -> Maybe Element
+getShapeByPlaceHolderType ns spTreeElem phType =
+  listToMaybe $ getShapesByPlaceHolderType ns spTreeElem phType
+
+-- Like the above, but it tries a number of different placeholder types
+getShapeByPlaceHolderTypes :: NameSpaces -> Element -> [PHType] -> Maybe Element
+getShapeByPlaceHolderTypes _ _ [] = Nothing
+getShapeByPlaceHolderTypes ns spTreeElem (s:ss) =
+  case getShapeByPlaceHolderType ns spTreeElem s of
+    Just element -> Just element
+    Nothing -> getShapeByPlaceHolderTypes ns spTreeElem ss
+
+nonBodyTextToElement ::
+  PandocMonad m =>
+  Element ->
+  [PHType] ->
+  [ParaElem] ->
+  P m (Maybe ShapeId, Element)
+nonBodyTextToElement layout phTypes paraElements
+  | ns <- elemToNameSpaces layout
+  , Just cSld <- findChild (elemName ns "p" "cSld") layout
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld
+  , Just sp <- getShapeByPlaceHolderTypes ns spTree phTypes
+  , Just nvSpPr <- findChild (elemName ns "p" "nvSpPr") sp
+  , Just cNvPr <- findChild (elemName ns "p" "cNvPr") nvSpPr
+  , Just shapeId <- findAttr (nodename "id") cNvPr
+  , Right (shapeIdNum, _) <- decimal shapeId = do
+      let hdrPara = Paragraph def paraElements
+      element <- paragraphToElement hdrPara
+      let txBody = mknode "p:txBody" [] $
+                   [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <>
+                   [element]
+      return (Just shapeIdNum, replaceNamedChildren ns "p" "txBody" [txBody] sp)
+  -- XXX: TODO
+  | otherwise = return (Nothing, mknode "p:sp" [] ())
+
+data ContentShapeIds = ContentShapeIds
+  { contentHeaderId :: Maybe ShapeId
+  , contentContentIds :: [ShapeId]
+  }
+
+contentToElement ::
+  PandocMonad m =>
+  Element ->
+  [ParaElem] ->
+  [Shape] ->
+  P m (Maybe ContentShapeIds, Element)
+contentToElement layout hdrShape shapes
+  | ns <- elemToNameSpaces layout
+  , Just cSld <- findChild (elemName ns "p" "cSld") layout
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
+      (shapeId, element) <- nonBodyTextToElement layout [PHType "title"] hdrShape
+      let hdrShapeElements = [Elem element | not (null hdrShape)]
+          contentHeaderId = if null hdrShape then Nothing else shapeId
+      content' <- local
+                         (\env -> env {envPlaceholder = Placeholder ObjType 0})
+                         (shapesToElements layout shapes)
+      let contentContentIds = mapMaybe fst content'
+          contentElements = snd <$> content'
+      footer <- footerElements content
+      return ( Just ContentShapeIds{..}
+             , buildSpTree ns spTree (hdrShapeElements <> contentElements <> footer)
+             )
+contentToElement _ _ _ = return (Nothing, mknode "p:sp" [] ())
+
+data TwoColumnShapeIds = TwoColumnShapeIds
+  { twoColumnHeaderId :: Maybe ShapeId
+  , twoColumnLeftIds :: [ShapeId]
+  , twoColumnRightIds :: [ShapeId]
+  }
+
+twoColumnToElement ::
+  PandocMonad m =>
+  Element ->
+  [ParaElem] ->
+  [Shape] ->
+  [Shape] ->
+  P m (Maybe TwoColumnShapeIds, Element)
+twoColumnToElement layout hdrShape shapesL shapesR
+  | ns <- elemToNameSpaces layout
+  , Just cSld <- findChild (elemName ns "p" "cSld") layout
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
+      (headerId, element) <- nonBodyTextToElement layout [PHType "title"] hdrShape
+      let hdrShapeElements = [Elem element | not (null hdrShape)]
+          twoColumnHeaderId = if null hdrShape then Nothing else headerId
+      contentL <- local (\env -> env {envPlaceholder = Placeholder ObjType 0})
+                        (shapesToElements layout shapesL)
+      let twoColumnLeftIds = mapMaybe fst contentL
+          contentElementsL = snd <$> contentL
+      contentR <- local (\env -> env {envPlaceholder = Placeholder ObjType 1})
+                        (shapesToElements layout shapesR)
+      let (twoColumnRightIds) = (mapMaybe fst contentR)
+          contentElementsR = snd <$> contentR
+      -- let contentElementsL' = map (setIdx ns "1") contentElementsL
+      --     contentElementsR' = map (setIdx ns "2") contentElementsR
+      footer <- footerElements twoColumn
+      return
+        $ (Just TwoColumnShapeIds{..}, )
+        $ buildSpTree ns spTree
+        $ hdrShapeElements <> contentElementsL <> contentElementsR <> footer
+twoColumnToElement _ _ _ _ = return (Nothing, mknode "p:sp" [] ())
+
+data ComparisonShapeIds = ComparisonShapeIds
+  { comparisonHeaderId :: Maybe ShapeId
+  , comparisonLeftTextIds :: [ShapeId]
+  , comparisonLeftContentIds :: [ShapeId]
+  , comparisonRightTextIds :: [ShapeId]
+  , comparisonRightContentIds :: [ShapeId]
+  }
+
+comparisonToElement ::
+  PandocMonad m =>
+  Element ->
+  [ParaElem] ->
+  ([Shape], [Shape]) ->
+  ([Shape], [Shape]) ->
+  P m (Maybe ComparisonShapeIds, Element)
+comparisonToElement layout hdrShape (shapesL1, shapesL2) (shapesR1, shapesR2)
+  | ns <- elemToNameSpaces layout
+  , Just cSld <- findChild (elemName ns "p" "cSld") layout
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
+      (headerShapeId, element) <- nonBodyTextToElement layout [PHType "title"] hdrShape
+      let hdrShapeElements = [Elem element | not (null hdrShape)]
+          comparisonHeaderId = if null hdrShape then Nothing else headerShapeId
+      contentL1 <- local (\env -> env {envPlaceholder = Placeholder (PHType "body") 0})
+                         (shapesToElements layout shapesL1)
+      let comparisonLeftTextIds = mapMaybe fst contentL1
+          contentElementsL1 = snd <$> contentL1
+      contentL2 <- local (\env -> env {envPlaceholder = Placeholder ObjType 0})
+                         (shapesToElements layout shapesL2)
+      let comparisonLeftContentIds = mapMaybe fst contentL2
+          contentElementsL2 = snd <$> contentL2
+      contentR1 <- local (\env -> env {envPlaceholder = Placeholder (PHType "body") 1})
+                         (shapesToElements layout shapesR1)
+      let comparisonRightTextIds = mapMaybe fst contentR1
+          contentElementsR1 = snd <$> contentR1
+      contentR2 <- local (\env -> env {envPlaceholder = Placeholder ObjType 1})
+                         (shapesToElements layout shapesR2)
+      let comparisonRightContentIds = mapMaybe fst contentR2
+          contentElementsR2 = snd <$> contentR2
+      footer <- footerElements comparison
+      return
+        $ (Just ComparisonShapeIds{..}, )
+        $ buildSpTree ns spTree
+        $ mconcat [ hdrShapeElements
+                  , contentElementsL1
+                  , contentElementsL2
+                  , contentElementsR1
+                  , contentElementsR2
+                  ] <> footer
+comparisonToElement _ _ _ _= return (Nothing, mknode "p:sp" [] ())
+
+data ContentWithCaptionShapeIds = ContentWithCaptionShapeIds
+  { contentWithCaptionHeaderId :: Maybe ShapeId
+  , contentWithCaptionCaptionIds :: [ShapeId]
+  , contentWithCaptionContentIds :: [ShapeId]
+  }
+
+contentWithCaptionToElement ::
+  PandocMonad m =>
+  Element ->
+  [ParaElem] ->
+  [Shape] ->
+  [Shape] ->
+  P m (Maybe ContentWithCaptionShapeIds, Element)
+contentWithCaptionToElement layout hdrShape textShapes contentShapes
+  | ns <- elemToNameSpaces layout
+  , Just cSld <- findChild (elemName ns "p" "cSld") layout
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
+      (shapeId, element) <- nonBodyTextToElement layout [PHType "title"] hdrShape
+      let hdrShapeElements = [Elem element | not (null hdrShape)]
+          contentWithCaptionHeaderId = if null hdrShape then Nothing else shapeId
+      text <- local (\env -> env {envPlaceholder = Placeholder (PHType "body") 0})
+                    (shapesToElements layout textShapes)
+      let contentWithCaptionCaptionIds = mapMaybe fst text
+          textElements = snd <$> text
+      content <- local (\env -> env {envPlaceholder = Placeholder ObjType 0})
+                       (shapesToElements layout contentShapes)
+      let contentWithCaptionContentIds = mapMaybe fst content
+          contentElements = snd <$> content
+      footer <- footerElements contentWithCaption
+      return
+        $ (Just ContentWithCaptionShapeIds{..}, )
+        $ buildSpTree ns spTree
+        $ mconcat [ hdrShapeElements
+                  , textElements
+                  , contentElements
+                  ] <> footer
+contentWithCaptionToElement _ _ _ _ = return (Nothing, mknode "p:sp" [] ())
+
+blankToElement ::
+  PandocMonad m =>
+  Element ->
+  P m Element
+blankToElement layout
+  | ns <- elemToNameSpaces layout
+  , Just cSld <- findChild (elemName ns "p" "cSld") layout
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld =
+      buildSpTree ns spTree <$> footerElements blank
+blankToElement _ = return $ mknode "p:sp" [] ()
+
+newtype TitleShapeIds = TitleShapeIds
+  { titleHeaderId :: Maybe ShapeId
+  }
+
+titleToElement ::
+  PandocMonad m =>
+  Element ->
+  [ParaElem] ->
+  P m (Maybe TitleShapeIds, Element)
+titleToElement layout titleElems
+  | ns <- elemToNameSpaces layout
+  , Just cSld <- findChild (elemName ns "p" "cSld") layout
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
+      (shapeId, element) <- nonBodyTextToElement layout [PHType "title", PHType "ctrTitle"] titleElems
+      let titleShapeElements = [Elem element | not (null titleElems)]
+          titleHeaderId = if null titleElems then Nothing else shapeId
+      footer <- footerElements title
+      return
+        $ (Just TitleShapeIds{..}, )
+        $ buildSpTree ns spTree (titleShapeElements <> footer)
+titleToElement _ _ = return (Nothing, mknode "p:sp" [] ())
+
+data MetadataShapeIds = MetadataShapeIds
+  { metadataTitleId :: Maybe ShapeId
+  , metadataSubtitleId :: Maybe ShapeId
+  , metadataDateId :: Maybe ShapeId
+  }
+
+metadataToElement ::
+  PandocMonad m =>
+  Element ->
+  [ParaElem] ->
+  [ParaElem] ->
+  [[ParaElem]] ->
+  [ParaElem] ->
+  P m (Maybe MetadataShapeIds, Element)
+metadataToElement layout titleElems subtitleElems authorsElems dateElems
+  | ns <- elemToNameSpaces layout
+  , Just cSld <- findChild (elemName ns "p" "cSld") layout
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do
+      let combinedAuthorElems = intercalate [Break] authorsElems
+          subtitleAndAuthorElems = intercalate [Break, Break] [subtitleElems, combinedAuthorElems]
+      (titleId, titleElement) <- nonBodyTextToElement layout [PHType "ctrTitle"] titleElems
+      (subtitleId, subtitleElement) <- nonBodyTextToElement layout [PHType "subTitle"] subtitleAndAuthorElems
+      (dateId, dateElement) <- nonBodyTextToElement layout [PHType "dt"] dateElems
+      let titleShapeElements = [titleElement | not (null titleElems)]
+          metadataTitleId = if null titleElems then Nothing else titleId
+          subtitleShapeElements = [subtitleElement | not (null subtitleAndAuthorElems)]
+          metadataSubtitleId = if null subtitleAndAuthorElems then Nothing else subtitleId
+      footerInfo <- gets stFooterInfo
+      footer <- (if maybe False fiShowOnFirstSlide footerInfo
+                 then id
+                 else const []) <$> footerElements metadata
+      let dateShapeElements = [dateElement
+                              | not (null dateElems
+                                || isJust (footerInfo >>= metadata . fiDate))
+                              ]
+          metadataDateId = if null dateElems then Nothing else dateId
+      return
+        $ (Just MetadataShapeIds{..}, )
+        $ buildSpTree ns spTree
+        $ map Elem (titleShapeElements <> subtitleShapeElements <> dateShapeElements)
+        <> footer
+metadataToElement _ _ _ _ _ = return (Nothing, mknode "p:sp" [] ())
+
+slideToElement :: PandocMonad m => Slide -> P m Element
+slideToElement (Slide _ l@(ContentSlide hdrElems shapes) _ backgroundImage) = do
+  layout <- getLayout l
+  backgroundImageElement <- traverse backgroundImageToElement backgroundImage
+  (shapeIds, spTree)
+     <- local (\env -> if null hdrElems
+                       then env
+                       else env{envSlideHasHeader=True})
+              (contentToElement layout hdrElems shapes)
+  let animations = case shapeIds of
+        Nothing -> []
+        Just ContentShapeIds{..} ->
+          slideToIncrementalAnimations (zip contentContentIds shapes)
+  return $ mknode "p:sld"
+    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
+      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
+      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
+    ] (mknode "p:cSld" [] (toList backgroundImageElement <> [spTree]) : animations)
+slideToElement (Slide _ l@(TwoColumnSlide hdrElems shapesL shapesR) _ backgroundImage) = do
+  layout <- getLayout l
+  backgroundImageElement <- traverse backgroundImageToElement backgroundImage
+  (shapeIds, spTree) <- local (\env -> if null hdrElems
+                           then env
+                           else env{envSlideHasHeader=True}) $
+            twoColumnToElement layout hdrElems shapesL shapesR
+  let animations = case shapeIds of
+        Nothing -> []
+        Just TwoColumnShapeIds{..} ->
+          slideToIncrementalAnimations (zip twoColumnLeftIds shapesL
+                                        <> zip twoColumnRightIds shapesR)
+  return $ mknode "p:sld"
+    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
+      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
+      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
+    ] (mknode "p:cSld" [] (toList backgroundImageElement <> [spTree]) : animations)
+slideToElement (Slide _ l@(ComparisonSlide hdrElems shapesL shapesR) _ backgroundImage) = do
+  layout <- getLayout l
+  backgroundImageElement <- traverse backgroundImageToElement backgroundImage
+  (shapeIds, spTree) <- local (\env -> if null hdrElems
+                           then env
+                           else env{envSlideHasHeader=True}) $
+            comparisonToElement layout hdrElems shapesL shapesR
+  let animations = case shapeIds of
+        Nothing -> []
+        Just ComparisonShapeIds{..} ->
+          slideToIncrementalAnimations
+            (zip comparisonLeftTextIds (fst shapesL)
+            <> zip comparisonLeftContentIds (snd shapesL)
+            <> zip comparisonRightTextIds (fst shapesR)
+            <> zip comparisonRightContentIds (snd shapesR))
+  return $ mknode "p:sld"
+    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
+      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
+      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
+    ] (mknode "p:cSld" [] (toList backgroundImageElement <> [spTree]) : animations)
+slideToElement (Slide _ l@(TitleSlide hdrElems) _ backgroundImage) = do
+  layout <- getLayout l
+  backgroundImageElement <- traverse backgroundImageToElement backgroundImage
+  (_, spTree) <- titleToElement layout hdrElems
+  return $ mknode "p:sld"
+    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
+      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
+      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
+    ] [mknode "p:cSld" [] (toList backgroundImageElement <> [spTree])]
+slideToElement (Slide
+                _
+                l@(MetadataSlide titleElems subtitleElems authorElems dateElems)
+                _
+                backgroundImage) = do
+  layout <- getLayout l
+  backgroundImageElement <- traverse backgroundImageToElement backgroundImage
+  (_, spTree) <- metadataToElement layout titleElems subtitleElems authorElems dateElems
+  return $ mknode "p:sld"
+    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
+      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
+      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
+    ] [mknode "p:cSld" [] (toList backgroundImageElement <> [spTree])]
+slideToElement (Slide
+                _
+                l@(ContentWithCaptionSlide hdrElems captionShapes contentShapes)
+                _
+                backgroundImage) = do
+  layout <- getLayout l
+  backgroundImageElement <- traverse backgroundImageToElement backgroundImage
+  (shapeIds, spTree) <- contentWithCaptionToElement layout hdrElems captionShapes contentShapes
+  let animations = case shapeIds of
+        Nothing -> []
+        Just ContentWithCaptionShapeIds{..} ->
+          slideToIncrementalAnimations
+            (zip contentWithCaptionCaptionIds captionShapes
+             <> zip contentWithCaptionContentIds contentShapes)
+  return $ mknode "p:sld"
+    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
+      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
+      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
+    ] (mknode "p:cSld" [] (toList backgroundImageElement <> [spTree]) : animations)
+slideToElement (Slide _ BlankSlide _ backgroundImage) = do
+  layout <- getLayout BlankSlide
+  backgroundImageElement <- traverse backgroundImageToElement backgroundImage
+  spTree <- blankToElement layout
+  return $ mknode "p:sld"
+    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
+      ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
+      ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
+    ] [mknode "p:cSld" [] (toList backgroundImageElement <> [spTree])]
+
+backgroundImageToElement :: PandocMonad m => FilePath -> P m Element
+backgroundImageToElement path = do
+  MediaInfo{mInfoLocalId, mInfoFilePath} <- registerMedia path []
+  (imgBytes, _) <- P.fetchItem (T.pack mInfoFilePath)
+  opts <- asks envOpts
+  let imageDimensions = either (const Nothing)
+                               (Just . sizeInPixels)
+                               (imageSize opts imgBytes)
+  pageSize <- asks envPresentationSize
+  let fillRectAttributes = maybe [] (offsetAttributes pageSize) imageDimensions
+  let rId = "rId" <> T.pack (show mInfoLocalId)
+  return
+    $ mknode "p:bg" []
+    $ mknode "p:bgPr" []
+    [ mknode "a:blipFill" [("dpi", "0"), ("rotWithShape", "1")]
+      [ mknode "a:blip" [("r:embed", rId)]
+        $ mknode "a:lum" [] ()
+      , mknode "a:srcRect" [] ()
+      , mknode "a:stretch" []
+        $ mknode "a:fillRect" fillRectAttributes ()
+      ]
+    , mknode "a:effectsLst" [] ()
+    ]
+  where
+    offsetAttributes :: (Integer, Integer) -> (Integer, Integer) -> [(Text, Text)]
+    offsetAttributes (pageWidth, pageHeight) (pictureWidth, pictureHeight) = let
+      widthRatio = pictureWidth % pageWidth
+      heightRatio = pictureHeight % pageHeight
+      getOffset :: Ratio Integer -> Text
+      getOffset proportion = let
+          percentageOffset = (proportion - 1) * (-100 % 2)
+          integerOffset = round percentageOffset * 1000 :: Integer
+        in T.pack (show integerOffset)
+      in case compare widthRatio heightRatio of
+        EQ -> []
+        LT -> let
+          offset = getOffset ((pictureHeight % pageHeight) / widthRatio)
+          in [ ("t", offset)
+             , ("b", offset)
+             ]
+        GT -> let
+          offset = getOffset ((pictureWidth % pageWidth) / heightRatio)
+          in [ ("l", offset)
+             , ("r", offset)
+             ]
+
+
+slideToIncrementalAnimations ::
+  [(ShapeId, Shape)] ->
+  [Element]
+slideToIncrementalAnimations shapes = let
+  incrementals :: [(ShapeId, [Bool])]
+  incrementals = do
+    (shapeId, TextBox ps) <- shapes
+    pure . (shapeId,) $ do
+      Paragraph ParaProps{pPropIncremental} _ <- ps
+      pure pPropIncremental
+  toIndices :: [Bool] -> Maybe (NonEmpty (Integer, Integer))
+  toIndices bs = do
+        let indexed = zip [0..] bs
+        ts <- nonEmpty (filter snd indexed)
+        pure (fmap (\(n, _) -> (n, n)) ts)
+  indices :: [(ShapeId, NonEmpty (Integer, Integer))]
+  indices = do
+    (shapeId, bs) <- incrementals
+    toList ((,) shapeId <$> toIndices bs)
+  in toList (incrementalAnimation <$> nonEmpty indices)
+
+--------------------------------------------------------------------
+-- Notes:
+
+getNotesMaster :: PandocMonad m => P m Element
+getNotesMaster = do
+  refArchive <- asks envRefArchive
+  distArchive <- asks envDistArchive
+  parseXml refArchive distArchive "ppt/notesMasters/notesMaster1.xml"
+
+getSlideNumberFieldId :: PandocMonad m => Element -> P m T.Text
+getSlideNumberFieldId notesMaster
+  | ns <- elemToNameSpaces notesMaster
+  , Just cSld <- findChild (elemName ns "p" "cSld") notesMaster
+  , Just spTree <- findChild (elemName ns "p" "spTree") cSld
+  , Just sp <- getShapeByPlaceHolderType ns spTree (PHType "sldNum")
+  , Just txBody <- findChild (elemName ns "p" "txBody") sp
+  , Just p <- findChild (elemName ns "a" "p") txBody
+  , Just fld <- findChild (elemName ns "a" "fld") p
+  , Just fldId <- findAttr (QName "id" Nothing Nothing) fld =
+      return fldId
+  | otherwise = throwError $
+                PandocSomeError
+                "No field id for slide numbers in notesMaster.xml"
+
+speakerNotesSlideImage :: Element
+speakerNotesSlideImage =
+  mknode "p:sp" []
+  [ mknode "p:nvSpPr" []
+    [ mknode "p:cNvPr" [ ("id", "2")
+                       , ("name", "Slide Image Placeholder 1")
+                       ] ()
+    , mknode "p:cNvSpPr" []
+      [ mknode "a:spLocks" [ ("noGrp", "1")
+                           , ("noRot", "1")
+                           , ("noChangeAspect", "1")
+                           ] ()
+      ]
+    , mknode "p:nvPr" []
+      [ mknode "p:ph" [("type", "sldImg")] ()]
+    ]
+  , mknode "p:spPr" [] ()
+  ]
+
+-- we want to wipe links from the speaker notes in the
+-- paragraphs. Powerpoint doesn't allow you to input them, and it
+-- would provide extra complications.
+removeParaLinks :: Paragraph -> Paragraph
+removeParaLinks paragraph = paragraph{paraElems = map f (paraElems paragraph)}
+  where f (Run rProps s) = Run rProps{rLink=Nothing} s
+        f pe             = pe
+
+-- put an empty paragraph between paragraphs for more expected spacing.
+spaceParas :: [Paragraph] -> [Paragraph]
+spaceParas = intersperse (Paragraph def [])
+
+speakerNotesBody :: PandocMonad m => [Paragraph] -> P m Element
+speakerNotesBody paras = do
+  elements <- local (\env -> env{envInSpeakerNotes = True}) $
+              mapM paragraphToElement $ spaceParas $ map removeParaLinks paras
+  let txBody = mknode "p:txBody" [] $
+               [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <> elements
+  return $
+    mknode "p:sp" []
+    [ mknode "p:nvSpPr" []
+      [ mknode "p:cNvPr" [ ("id", "3")
+                         , ("name", "Notes Placeholder 2")
+                         ] ()
+      , mknode "p:cNvSpPr" []
+        [ mknode "a:spLocks" [("noGrp", "1")] ()]
+      , mknode "p:nvPr" []
+        [ mknode "p:ph" [("type", "body"), ("idx", "1")] ()]
+      ]
+    , mknode "p:spPr" [] ()
+    , txBody
+    ]
+
+speakerNotesSlideNumber :: Int -> T.Text -> Element
+speakerNotesSlideNumber pgNum fieldId =
+  mknode "p:sp" []
+  [ mknode "p:nvSpPr" []
+    [ mknode "p:cNvPr" [ ("id", "4")
+                       , ("name", "Slide Number Placeholder 3")
+                       ] ()
+    , mknode "p:cNvSpPr" []
+      [ mknode "a:spLocks" [("noGrp", "1")] ()]
+    , mknode "p:nvPr" []
+      [ mknode "p:ph" [ ("type", "sldNum")
+                      , ("sz", "quarter")
+                      , ("idx", "10")
+                      ] ()
+      ]
+    ]
+  , mknode "p:spPr" [] ()
+  , mknode "p:txBody" []
+    [ mknode "a:bodyPr" [] ()
+    , mknode "a:lstStyle" [] ()
+    , mknode "a:p" []
+      [ mknode "a:fld" [ ("id", fieldId)
+                       , ("type", "slidenum")
+                       ]
+        [ mknode "a:rPr" [("lang", "en-US")] ()
+        , mknode "a:t" [] (tshow pgNum)
+        ]
+      , mknode "a:endParaRPr" [("lang", "en-US")] ()
+      ]
+    ]
+  ]
+
+slideToSpeakerNotesElement :: PandocMonad m => Slide -> P m (Maybe Element)
+slideToSpeakerNotesElement (Slide _ _ (SpeakerNotes []) _) = return Nothing
+slideToSpeakerNotesElement slide@(Slide _ _ (SpeakerNotes paras) _) = do
+  master <- getNotesMaster
+  fieldId  <- getSlideNumberFieldId master
+  num <- slideNum slide
+  let imgShape = speakerNotesSlideImage
+      sldNumShape = speakerNotesSlideNumber num fieldId
+  bodyShape <- speakerNotesBody paras
+  return $ Just $
+    mknode "p:notes"
+    [ ("xmlns:a", "http://schemas.openxmlformats.org/drawingml/2006/main")
+    , ("xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships")
+    , ("xmlns:p", "http://schemas.openxmlformats.org/presentationml/2006/main")
+    ] [ mknode "p:cSld" []
+        [ mknode "p:spTree" []
+          [ mknode "p:nvGrpSpPr" []
+            [ mknode "p:cNvPr" [("id", "1"), ("name", "")] ()
+            , mknode "p:cNvGrpSpPr" [] ()
+            , mknode "p:nvPr" [] ()
+            ]
+          , mknode "p:grpSpPr" []
+            [ mknode "a:xfrm" []
+              [ mknode "a:off" [("x", "0"), ("y", "0")] ()
+              , mknode "a:ext" [("cx", "0"), ("cy", "0")] ()
+              , mknode "a:chOff" [("x", "0"), ("y", "0")] ()
+              , mknode "a:chExt" [("cx", "0"), ("cy", "0")] ()
+              ]
+            ]
+          , imgShape
+          , bodyShape
+          , sldNumShape
+          ]
+        ]
+      ]
+
+-----------------------------------------------------------------------
+
+getSlideIdNum :: PandocMonad m => SlideId -> P m Int
+getSlideIdNum sldId = do
+  slideIdMap <- asks envSlideIdMap
+  case  M.lookup sldId slideIdMap of
+    Just n -> return n
+    Nothing -> throwError $
+               PandocShouldNeverHappenError $
+               "Slide Id " <> tshow sldId <> " not found."
+
+slideNum :: PandocMonad m => Slide -> P m Int
+slideNum slide = getSlideIdNum $ slideId slide
+
+idNumToFilePath :: Int -> FilePath
+idNumToFilePath idNum = "slide" <> show idNum <> ".xml"
+
+slideToFilePath :: PandocMonad m => Slide -> P m FilePath
+slideToFilePath slide = do
+  idNum <- slideNum slide
+  return $ "slide" <> show idNum <> ".xml"
+
+slideToRelId ::
+  PandocMonad m =>
+  MinimumRId ->
+  Slide ->
+  P m T.Text
+slideToRelId minSlideRId slide = do
+  n <- slideNum slide
+  return $ "rId" <> tshow (n + minSlideRId - 1)
+
+
+data Relationship = Relationship { relId :: Int
+                                 , relType :: MimeType
+                                 , relTarget :: FilePath
+                                 } deriving (Show, Eq)
+
+elementToRel :: Element -> Maybe Relationship
+elementToRel element
+  | elName element == QName "Relationship" (Just "http://schemas.openxmlformats.org/package/2006/relationships") Nothing =
+      do rId <- findAttr (QName "Id" Nothing Nothing) element
+         numStr <- T.stripPrefix "rId" rId
+         num <- fromIntegral <$> readTextAsInteger numStr
+         type' <- findAttr (QName "Type" Nothing Nothing) element
+         target <- findAttr (QName "Target" Nothing Nothing) element
+         return $ Relationship num type' (T.unpack target)
+  | otherwise = Nothing
+
+slideToPresRel :: PandocMonad m => Int -> Slide -> P m Relationship
+slideToPresRel minimumSlideRId slide = do
+  idNum <- slideNum slide
+  let rId = idNum + minimumSlideRId - 1
+      fp = "slides/" <> idNumToFilePath idNum
+  return $ Relationship { relId = rId
+                        , relType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"
+                        , relTarget = fp
+                        }
+
+getPresentationRels :: PandocMonad m => P m [Relationship]
+getPresentationRels = do
+  refArchive <- asks envRefArchive
+  distArchive <- asks envDistArchive
+  relsElem <- parseXml refArchive distArchive "ppt/_rels/presentation.xml.rels"
+  let globalNS = "http://schemas.openxmlformats.org/package/2006/relationships"
+  let relElems = findChildren (QName "Relationship" (Just globalNS) Nothing) relsElem
+  return $ mapMaybe elementToRel relElems
+
+-- | Info required to update a presentation rId from the reference doc for the
+-- output.
+type PresentationRIdUpdateData = (ReferenceMinRIdAfterSlides, NewRIdBounds)
+
+-- | The minimum and maximum rIds for presentation relationships created from
+-- the presentation content (as opposed to from the reference doc).
+--
+-- Relationships taken from the reference doc should have their rId number
+-- adjusted to make sure it sits outside this range.
+type NewRIdBounds = (MinimumRId, MaximumRId)
+
+-- | The minimum presentation rId from the reference doc which comes after the
+-- first slide rId (in the reference doc).
+type ReferenceMinRIdAfterSlides = Int
+type MinimumRId = Int
+type MaximumRId = Int
+
+-- | Given a presentation rId from the reference doc, return the value it should
+-- have in the output.
+updatePresentationRId :: PresentationRIdUpdateData -> Int -> Int
+updatePresentationRId (minOverlappingRId, (minNewId, maxNewId)) n
+  | n < minNewId = n
+  | otherwise = n - minOverlappingRId + maxNewId + 1
+
+presentationToRels ::
+  PandocMonad m =>
+  Presentation ->
+  P m (PresentationRIdUpdateData, [Relationship])
+presentationToRels pres@(Presentation _ slides) = do
+  rels <- getPresentationRels
+
+  -- We want to make room for the slides in the id space. We'll assume the slide
+  -- masters come first (this seems to be what PowerPoint does by default, and
+  -- is true of the reference doc), and we'll put the slides next. So we find
+  -- the starting rId for the slides by finding the maximum rId for the masters
+  -- and adding 1.
+  --
+  -- Then:
+  -- 1. We look to see what the minimum rId which is greater than or equal to
+  --    the minimum slide rId is, in the rels we're keeping from the reference
+  --    doc (i.e. the minimum rId which might overlap with the slides).
+  -- 2. We increase this minimum overlapping rId to 1 higher than the last slide
+  --    rId (or the notesMaster rel, if we're including one), and increase all
+  --    rIds higher than this minimum by the same amount.
+
+  let masterRels = filter (T.isSuffixOf "slideMaster" . relType) rels
+      slideStartId = maybe 1 ((+ 1) . maximum . fmap relId) (nonEmpty masterRels)
+      -- we remove the slide rels and the notesmaster (if it's
+      -- there). We'll put these back in ourselves, if necessary.
+      relsWeKeep = filter
+                   (\r -> relType r /= "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" &&
+                          relType r /= "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster")
+                   rels
+      minOverlappingRel = maybe 0 minimum
+                                 (nonEmpty (filter (slideStartId <=)
+                                                   (relId <$> relsWeKeep)))
+
+  mySlideRels <- mapM (slideToPresRel slideStartId) slides
+
+  let notesMasterRels =
+        [Relationship { relId = slideStartId + length mySlideRels
+                         , relType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster"
+                         , relTarget = "notesMasters/notesMaster1.xml"
+                         } | presHasSpeakerNotes pres]
+      insertedRels = mySlideRels <> notesMasterRels
+      newRIdBounds = (slideStartId, slideStartId + length insertedRels - 1)
+      updateRId = updatePresentationRId (minOverlappingRel, newRIdBounds)
+
+      relsWeKeep' = map (\r -> r{relId = updateRId $ relId r}) relsWeKeep
+
+  return ((minOverlappingRel, newRIdBounds), insertedRels <> relsWeKeep')
+
+-- We make this ourselves, in case there's a thumbnail in the one from
+-- the template.
+topLevelRels :: [Relationship]
+topLevelRels =
+  [ Relationship { relId = 1
+                 , relType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
+                 , relTarget = "ppt/presentation.xml"
+                 }
+  , Relationship { relId = 2
+                 , relType = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
+                 , relTarget = "docProps/core.xml"
+                 }
+  , Relationship { relId = 3
+                 , relType = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/extended-properties"
+                 , relTarget = "docProps/app.xml"
+                 }
+  , Relationship { relId = 4
+                 , relType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"
+                 , relTarget = "docProps/custom.xml"
+                 }
+  ]
+
+topLevelRelsEntry :: PandocMonad m => P m Entry
+topLevelRelsEntry = elemToEntry "_rels/.rels" $ relsToElement topLevelRels
+
+relToElement :: Relationship -> Element
+relToElement rel = mknode "Relationship" [ ("Id", "rId" <> tshow (relId rel))
+                                         , ("Type", relType rel)
+                                         , ("Target", T.pack $ relTarget rel) ] ()
+
+relsToElement :: [Relationship] -> Element
+relsToElement rels = mknode "Relationships"
+                     [("xmlns", "http://schemas.openxmlformats.org/package/2006/relationships")]
+                     (map relToElement rels)
+
+presentationToRelsEntry ::
+  PandocMonad m =>
+  Presentation ->
+  P m (PresentationRIdUpdateData, Entry)
+presentationToRelsEntry pres = do
+  (presentationRIdUpdateData, rels) <- presentationToRels pres
+  element <- elemToEntry "ppt/_rels/presentation.xml.rels" $ relsToElement rels
+  pure (presentationRIdUpdateData, element)
+
+elemToEntry :: PandocMonad m => FilePath -> Element -> P m Entry
+elemToEntry fp element = do
+  epochtime <- floor . utcTimeToPOSIXSeconds <$> asks envUTCTime
+  return $ toEntry fp epochtime $ renderXml element
+
+slideToEntry :: PandocMonad m => Slide -> P m Entry
+slideToEntry slide = do
+  idNum <- slideNum slide
+  local (\env -> env{envCurSlideId = idNum}) $ do
+    element <- slideToElement slide
+    elemToEntry ("ppt/slides/" <> idNumToFilePath idNum) element
+
+slideToSpeakerNotesEntry :: PandocMonad m => Slide -> P m (Maybe Entry)
+slideToSpeakerNotesEntry slide = do
+  idNum <- slideNum slide
+  local (\env -> env{envCurSlideId = idNum}) $ do
+    mbElement <- slideToSpeakerNotesElement slide
+    mbNotesIdNum <- do mp <- asks envSpeakerNotesIdMap
+                       return $ M.lookup idNum mp
+    case mbElement of
+      Just element | Just notesIdNum <- mbNotesIdNum ->
+                       Just <$>
+                       elemToEntry
+                       ("ppt/notesSlides/notesSlide" <> show notesIdNum <>
+                        ".xml")
+                       element
+      _ -> return Nothing
+
+slideToSpeakerNotesRelElement :: PandocMonad m => Slide -> P m (Maybe Element)
+slideToSpeakerNotesRelElement (Slide _ _ (SpeakerNotes []) _) = return Nothing
+slideToSpeakerNotesRelElement slide@Slide{} = do
+  idNum <- slideNum slide
+  return $ Just $
+    mknode "Relationships"
+    [("xmlns", "http://schemas.openxmlformats.org/package/2006/relationships")]
+    [ mknode "Relationship" [ ("Id", "rId2")
+                            , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide")
+                            , ("Target", "../slides/slide" <> tshow idNum <> ".xml")
+                            ] ()
+    , mknode "Relationship" [ ("Id", "rId1")
+                            , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster")
+                            , ("Target", "../notesMasters/notesMaster1.xml")
+                            ] ()
+    ]
+
+
+slideToSpeakerNotesRelEntry :: PandocMonad m => Slide -> P m (Maybe Entry)
+slideToSpeakerNotesRelEntry slide = do
+  idNum <- slideNum slide
+  mbElement <- slideToSpeakerNotesRelElement slide
+  mp <- asks envSpeakerNotesIdMap
+  let mbNotesIdNum = M.lookup idNum mp
+  case mbElement of
+    Just element | Just notesIdNum <- mbNotesIdNum ->
+      Just <$>
+      elemToEntry
+      ("ppt/notesSlides/_rels/notesSlide" <> show notesIdNum <> ".xml.rels")
+      element
+    _ -> return Nothing
+
+slideToSlideRelEntry :: PandocMonad m => Slide -> P m Entry
+slideToSlideRelEntry slide = do
+  idNum <- slideNum slide
+  element <- slideToSlideRelElement slide
+  elemToEntry ("ppt/slides/_rels/" <> idNumToFilePath idNum <> ".rels") element
+
+linkRelElement :: PandocMonad m => (Int, LinkTarget) -> P m Element
+linkRelElement (rIdNum, InternalTarget targetId) = do
+  targetIdNum <- getSlideIdNum targetId
+  return $
+    mknode "Relationship" [ ("Id", "rId" <> tshow rIdNum)
+                          , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide")
+                          , ("Target", "slide" <> tshow targetIdNum <> ".xml")
+                          ] ()
+linkRelElement (rIdNum, ExternalTarget (url, _)) =
+  return $
+    mknode "Relationship" [ ("Id", "rId" <> tshow rIdNum)
+                          , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")
+                          , ("Target", url)
+                          , ("TargetMode", "External")
+                          ] ()
+
+linkRelElements :: PandocMonad m => M.Map Int LinkTarget -> P m [Element]
+linkRelElements mp = mapM linkRelElement (M.toList mp)
+
+mediaRelElement :: MediaInfo -> Element
+mediaRelElement mInfo =
+  let ext = fromMaybe "" (mInfoExt mInfo)
+  in
+    mknode "Relationship" [ ("Id", "rId" <>
+      tshow (mInfoLocalId mInfo))
+                          , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image")
+                          , ("Target", "../media/image" <>
+      tshow (mInfoGlobalId mInfo) <> ext)
+                          ] ()
+
+speakerNotesSlideRelElement :: PandocMonad m => Slide -> P m (Maybe Element)
+speakerNotesSlideRelElement slide = do
+  idNum <- slideNum slide
+  mp <- asks envSpeakerNotesIdMap
+  return $ case M.lookup idNum mp of
+    Nothing -> Nothing
+    Just n ->
+      let target = "../notesSlides/notesSlide" <> tshow n <> ".xml"
+      in Just $
+         mknode "Relationship" [ ("Id", "rId2")
+                               , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide")
+                               , ("Target", target)
+                               ] ()
+
+slideToSlideRelElement :: PandocMonad m => Slide -> P m Element
+slideToSlideRelElement slide = do
+  idNum <- slideNum slide
+  target <- flip fmap getSlideLayouts $
+    T.pack . ("../slideLayouts/" <>) . takeFileName .
+    slPath . case slide of
+        (Slide _ MetadataSlide{} _ _)           -> metadata
+        (Slide _ TitleSlide{} _ _)              -> title
+        (Slide _ ContentSlide{} _ _)            -> content
+        (Slide _ TwoColumnSlide{} _ _)          -> twoColumn
+        (Slide _ ComparisonSlide{} _ _)         -> comparison
+        (Slide _ ContentWithCaptionSlide{} _ _) -> contentWithCaption
+        (Slide _ BlankSlide _ _)                -> blank
+
+  speakerNotesRels <- maybeToList <$> speakerNotesSlideRelElement slide
+
+  linkIds <- gets stLinkIds
+  mediaIds <- gets stMediaIds
+
+  linkRels <- case M.lookup idNum linkIds of
+                Just mp -> linkRelElements mp
+                Nothing -> return []
+  let mediaRels = case M.lookup idNum mediaIds of
+                   Just mInfos -> map mediaRelElement mInfos
+                   Nothing -> []
+
+  return $
+    mknode "Relationships"
+    [("xmlns", "http://schemas.openxmlformats.org/package/2006/relationships")]
+    ([mknode "Relationship" [ ("Id", "rId1")
+                           , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout")
+                           , ("Target", target)] ()
+    ] <> speakerNotesRels <> linkRels <> mediaRels)
+
+slideToSldIdElement ::
+  PandocMonad m =>
+  MinimumRId ->
+  Slide ->
+  P m Element
+slideToSldIdElement minimumSlideRId slide = do
+  n <- slideNum slide
+  let id' = tshow $ n + 255
+  rId <- slideToRelId minimumSlideRId slide
+  return $ mknode "p:sldId" [("id", id'), ("r:id", rId)] ()
+
+presentationToSldIdLst ::
+  PandocMonad m =>
+  MinimumRId ->
+  Presentation ->
+  P m Element
+presentationToSldIdLst minimumSlideRId (Presentation _ slides) = do
+  ids <- mapM (slideToSldIdElement minimumSlideRId) slides
+  return $ mknode "p:sldIdLst" [] ids
+
+presentationToPresentationElement ::
+  PandocMonad m =>
+  PresentationRIdUpdateData ->
+  Presentation ->
+  P m Element
+presentationToPresentationElement presentationUpdateRIdData pres = do
+  let (_, (minSlideRId, maxSlideRId)) = presentationUpdateRIdData
+  refArchive <- asks envRefArchive
+  distArchive <- asks envDistArchive
+  element <- parseXml refArchive distArchive "ppt/presentation.xml"
+  sldIdLst <- presentationToSldIdLst minSlideRId pres
+
+  let modifySldIdLst :: Content -> Content
+      modifySldIdLst (Elem e) = case elName e of
+        (QName "sldIdLst" _ _) -> Elem sldIdLst
+        _                      -> Elem e
+      modifySldIdLst ct = ct
+
+      notesMasterRId = maxSlideRId
+
+      notesMasterElem =  mknode "p:notesMasterIdLst" []
+                         [ mknode
+                           "p:notesMasterId"
+                           [("r:id", "rId" <> tshow notesMasterRId)]
+                           ()
+                         ]
+
+      -- if there's a notesMasterIdLst in the presentation.xml file,
+      -- we want to remove it. We then want to put our own, if
+      -- necessary, after the slideMasterIdLst element. We also remove
+      -- handouts master, since we don't want it.
+
+      removeUnwantedMaster' :: Content -> [Content]
+      removeUnwantedMaster' (Elem e) = case elName e of
+        (QName "notesMasterIdLst" _ _) -> []
+        (QName "handoutMasterIdLst" _ _) -> []
+        _                              -> [Elem e]
+      removeUnwantedMaster' ct = [ct]
+
+      removeUnwantedMaster :: [Content] -> [Content]
+      removeUnwantedMaster = concatMap removeUnwantedMaster'
+
+      insertNotesMaster' :: Content -> [Content]
+      insertNotesMaster' (Elem e) = case elName e of
+        (QName "sldMasterIdLst" _ _) -> [Elem e, Elem notesMasterElem]
+        _                            -> [Elem e]
+      insertNotesMaster' ct = [ct]
+
+      insertNotesMaster :: [Content] -> [Content]
+      insertNotesMaster = if presHasSpeakerNotes pres
+                          then concatMap insertNotesMaster'
+                          else id
+
+      updateRIds :: Content -> Content
+      updateRIds (Elem el) =
+        Elem (el { elAttribs = fmap updateRIdAttribute (elAttribs el)
+                 , elContent = fmap updateRIds (elContent el)
+                 })
+      updateRIds content = content
+
+      updateRIdAttribute :: XML.Attr -> XML.Attr
+      updateRIdAttribute attr = fromMaybe attr $ do
+        oldValue <- case attrKey attr of
+          QName "id" _ (Just "r") ->
+            T.stripPrefix "rId" (attrVal attr)
+            >>= fmap fromIntegral . readTextAsInteger
+          _ -> Nothing
+        let newValue = updatePresentationRId presentationUpdateRIdData oldValue
+        pure attr {attrVal = "rId" <> T.pack (show newValue)}
+
+      newContent = insertNotesMaster $
+                   removeUnwantedMaster $
+                   (modifySldIdLst . updateRIds) <$>
+                   elContent element
+
+  return $ element{elContent = newContent}
+
+presentationToPresEntry :: PandocMonad m => PresentationRIdUpdateData -> Presentation -> P m Entry
+presentationToPresEntry presentationRIdUpdateData pres =
+  presentationToPresentationElement presentationRIdUpdateData pres >>=
+    elemToEntry "ppt/presentation.xml"
+
+-- adapted from the Docx writer
+docPropsElement :: PandocMonad m => DocProps -> P m Element
+docPropsElement docProps = do
+  utctime <- asks envUTCTime
+  let keywords = case dcKeywords docProps of
+        Just xs -> T.intercalate ", " xs
+        Nothing -> ""
+  return $
+    mknode "cp:coreProperties"
+    [("xmlns:cp","http://schemas.openxmlformats.org/package/2006/metadata/core-properties")
+    ,("xmlns:dc","http://purl.org/dc/elements/1.1/")
+    ,("xmlns:dcterms","http://purl.org/dc/terms/")
+    ,("xmlns:dcmitype","http://purl.org/dc/dcmitype/")
+    ,("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance")]
+    $
+      mknode "dc:title" [] (fromMaybe "" $ dcTitle docProps)
+    :
+      mknode "dc:creator" [] (fromMaybe "" $ dcCreator docProps)
+    :
+      mknode "cp:keywords" [] keywords
+    : ( [mknode "dc:subject" [] $ fromMaybe "" $ dcSubject docProps | isJust (dcSubject docProps)])
+    <> ( [mknode "dc:description" [] $ fromMaybe "" $ dcDescription docProps | isJust (dcDescription docProps)])
+    <> ( [mknode "cp:category" [] $ fromMaybe "" $ cpCategory docProps | isJust (cpCategory docProps)])
+    <> (\x -> [ mknode "dcterms:created" [("xsi:type","dcterms:W3CDTF")] x
+              , mknode "dcterms:modified" [("xsi:type","dcterms:W3CDTF")] x
+              ]) (T.pack $ formatTime defaultTimeLocale "%FT%XZ" utctime)
+
+docPropsToEntry :: PandocMonad m => DocProps -> P m Entry
+docPropsToEntry docProps = docPropsElement docProps >>=
+                           elemToEntry "docProps/core.xml"
+
+-- adapted from the Docx writer
+docCustomPropsElement :: PandocMonad m => DocProps -> P m Element
+docCustomPropsElement docProps = do
+  let mkCustomProp (k, v) pid = mknode "property"
+         [("fmtid","{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
+         ,("pid", tshow pid)
+         ,("name", k)] $ mknode "vt:lpwstr" [] v
+  return $ mknode "Properties"
+          [("xmlns","http://schemas.openxmlformats.org/officeDocument/2006/custom-properties")
+          ,("xmlns:vt","http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")
+          ] $ zipWith mkCustomProp (fromMaybe [] $ customProperties docProps) [(2 :: Int)..]
+
+docCustomPropsToEntry :: PandocMonad m => DocProps -> P m Entry
+docCustomPropsToEntry docProps = docCustomPropsElement docProps >>=
+                           elemToEntry "docProps/custom.xml"
+
+-- We read from the template, but we remove the lastView, so it always
+-- opens on slide view. Templates will sometimes be open in master
+-- view for editing.
+viewPropsElement :: PandocMonad m => P m Element
+viewPropsElement = do
+  refArchive <- asks envRefArchive
+  distArchive <- asks envDistArchive
+  viewPrElement <- parseXml refArchive distArchive "ppt/viewProps.xml"
+  -- remove  "lastView" if it exists:
+  let notLastView :: XML.Attr -> Bool
+      notLastView attr =
+          qName (attrKey attr) /= "lastView"
+  return $
+    viewPrElement {elAttribs = filter notLastView (elAttribs viewPrElement)}
+
+makeViewPropsEntry :: PandocMonad m => P m Entry
+makeViewPropsEntry = viewPropsElement >>= elemToEntry "ppt/viewProps.xml"
+
+defaultContentTypeToElem :: DefaultContentType -> Element
+defaultContentTypeToElem dct =
+  mknode "Default"
+  [("Extension", defContentTypesExt dct),
+    ("ContentType", defContentTypesType dct)]
+  ()
+
+overrideContentTypeToElem :: OverrideContentType -> Element
+overrideContentTypeToElem oct =
+  mknode "Override"
+  [("PartName", T.pack $ overrideContentTypesPart oct),
+   ("ContentType", overrideContentTypesType oct)]
+  ()
+
+contentTypesToElement :: ContentTypes -> Element
+contentTypesToElement ct =
+  let ns = "http://schemas.openxmlformats.org/package/2006/content-types"
+  in
+    mknode "Types" [("xmlns", ns)] $
+
+      map defaultContentTypeToElem (contentTypesDefaults ct) <>
+      map overrideContentTypeToElem (contentTypesOverrides ct)
+
+data DefaultContentType = DefaultContentType
+                           { defContentTypesExt :: T.Text
+                           , defContentTypesType:: MimeType
+                           }
+                         deriving (Show, Eq)
+
+data OverrideContentType = OverrideContentType
+                           { overrideContentTypesPart :: FilePath
+                           , overrideContentTypesType :: MimeType
+                           }
+                          deriving (Show, Eq)
+
+data ContentTypes = ContentTypes { contentTypesDefaults :: [DefaultContentType]
+                                 , contentTypesOverrides :: [OverrideContentType]
+                                 }
+                    deriving (Show, Eq)
+
+contentTypesToEntry :: PandocMonad m => ContentTypes -> P m Entry
+contentTypesToEntry ct = elemToEntry "[Content_Types].xml" $ contentTypesToElement ct
+
+pathToOverride :: FilePath -> Maybe OverrideContentType
+pathToOverride fp = OverrideContentType ("/" <> fp) <$> getContentType fp
+
+mediaFileContentType :: FilePath -> Maybe DefaultContentType
+mediaFileContentType fp = case takeExtension fp of
+  '.' : ext -> Just $
+               DefaultContentType { defContentTypesExt = T.pack ext
+                                  , defContentTypesType =
+                                      fromMaybe "application/octet-stream" (getMimeType fp)
+                                  }
+  _ -> Nothing
+
+mediaContentType :: MediaInfo -> Maybe DefaultContentType
+mediaContentType mInfo
+  | Just t <- mInfoExt mInfo
+  , Just ('.', ext) <- T.uncons t =
+      Just $ DefaultContentType { defContentTypesExt = ext
+                                , defContentTypesType =
+                                    fromMaybe "application/octet-stream" (mInfoMimeType mInfo)
+                                }
+  | otherwise = Nothing
+
+getSpeakerNotesFilePaths :: PandocMonad m => P m [FilePath]
+getSpeakerNotesFilePaths = do
+  mp <- asks envSpeakerNotesIdMap
+  let notesIdNums = M.elems mp
+  return $ map (\n -> "ppt/notesSlides/notesSlide" <> show n <> ".xml")
+               notesIdNums
+
+presentationToContentTypes :: PandocMonad m => Presentation -> P m ContentTypes
+presentationToContentTypes p@(Presentation _ slides) = do
+  mediaInfos <- mconcat . M.elems <$> gets stMediaIds
+  filePaths <- patternsToFilePaths $ inheritedPatterns p
+  let mediaFps = filter (match (compile "ppt/media/image*")) filePaths
+  let defaults = [ DefaultContentType "xml" "application/xml"
+                 , DefaultContentType "rels" "application/vnd.openxmlformats-package.relationships+xml"
+                 ]
+      mediaDefaults = nub $
+                      mapMaybe mediaContentType mediaInfos <>
+                      mapMaybe mediaFileContentType mediaFps
+
+      inheritedOverrides = mapMaybe pathToOverride filePaths
+      createdOverrides = mapMaybe pathToOverride [ "docProps/core.xml"
+                                                 , "docProps/custom.xml"
+                                                 , "ppt/presentation.xml"
+                                                 , "ppt/viewProps.xml"
+                                                 ]
+  relativePaths <- mapM slideToFilePath slides
+  let slideOverrides = mapMaybe
+                       (\fp -> pathToOverride $ "ppt/slides/" <> fp)
+                       relativePaths
+  speakerNotesOverrides <- mapMaybe pathToOverride <$> getSpeakerNotesFilePaths
+  return $ ContentTypes
+    (defaults <> mediaDefaults)
+    (inheritedOverrides <> createdOverrides <> slideOverrides <> speakerNotesOverrides)
+
+presML :: T.Text
+presML = "application/vnd.openxmlformats-officedocument.presentationml"
+
+noPresML :: T.Text
+noPresML = "application/vnd.openxmlformats-officedocument"
+
+getContentType :: FilePath -> Maybe MimeType
+getContentType fp
+  | fp == "ppt/presentation.xml" = Just $ presML <> ".presentation.main+xml"
+  | fp == "ppt/presProps.xml" = Just $ presML <> ".presProps+xml"
+  | fp == "ppt/viewProps.xml" = Just $ presML <> ".viewProps+xml"
+  | fp == "ppt/tableStyles.xml" = Just $ presML <> ".tableStyles+xml"
+  | fp == "docProps/core.xml" = Just "application/vnd.openxmlformats-package.core-properties+xml"
+  | fp == "docProps/custom.xml" = Just "application/vnd.openxmlformats-officedocument.custom-properties+xml"
+  | fp == "docProps/app.xml" = Just $ noPresML <> ".extended-properties+xml"
+  | ["ppt", "slideMasters", f] <- splitDirectories fp
+  , (_, ".xml") <- splitExtension f =
+      Just $ presML <> ".slideMaster+xml"
+  | ["ppt", "slides", f] <- splitDirectories fp
+  , (_, ".xml") <- splitExtension f =
+      Just $ presML <> ".slide+xml"
+  | ["ppt", "notesMasters", f] <- splitDirectories fp
+  , (_, ".xml") <- splitExtension f =
+      Just $ presML <> ".notesMaster+xml"
+  | ["ppt", "notesSlides", f] <- splitDirectories fp
+  , (_, ".xml") <- splitExtension f =
+      Just $ presML <> ".notesSlide+xml"
+  | ["ppt", "theme", f] <- splitDirectories fp
+  , (_, ".xml") <- splitExtension f =
+      Just $ noPresML <> ".theme+xml"
+  | ["ppt", "slideLayouts", _] <- splitDirectories fp=
+      Just $ presML <> ".slideLayout+xml"
+  | otherwise = Nothing
+
+-- Kept as String for XML.Light
+autoNumAttrs :: ListAttributes -> [(Text, Text)]
+autoNumAttrs (startNum, numStyle, numDelim) =
+  numAttr <> typeAttr
+  where
+    numAttr = [("startAt", tshow startNum) | startNum /= 1]
+    typeAttr = [("type", typeString <> delimString)]
+    typeString = case numStyle of
+      Decimal -> "arabic"
+      UpperAlpha -> "alphaUc"
+      LowerAlpha -> "alphaLc"
+      UpperRoman -> "romanUc"
+      LowerRoman -> "romanLc"
+      _          -> "arabic"
+    delimString = case numDelim of
+      Period -> "Period"
+      OneParen -> "ParenR"
+      TwoParens -> "ParenBoth"
+      _         -> "Period"
+
+-- | The XML required to insert an "appear" animation for each of the given
+-- groups of paragraphs, identified by index.
+incrementalAnimation ::
+  -- | (ShapeId, [(startParagraphIndex, endParagraphIndex)])
+  NonEmpty (ShapeId, NonEmpty (Integer, Integer)) ->
+  Element
+incrementalAnimation indices = mknode "p:timing" [] [tnLst, bldLst]
+  where
+    triples :: NonEmpty (ShapeId, Integer, Integer)
+    triples = do
+      (shapeId, paragraphIds) <- indices
+      (start, end) <- paragraphIds
+      pure (shapeId, start, end)
+
+    tnLst = mknode "p:tnLst" []
+      $ mknode "p:par" []
+      $ mknode "p:cTn" [ ("id", "1")
+                       , ("dur", "indefinite")
+                       , ("restart", "never")
+                       , ("nodeType", "tmRoot")
+                       ]
+      $ mknode "p:childTnLst" []
+      $ mknode "p:seq" [ ("concurrent", "1")
+                       , ("nextAc", "seek")
+                       ]
+      [ mknode "p:cTn" [ ("id", "2")
+                       , ("dur", "indefinite")
+                       , ("nodeType", "mainSeq")
+                       ]
+        $ mknode "p:childTnLst" []
+        $ zipWith makePar [3, 7 ..] (toList triples)
+      , mknode "p:prevCondLst" []
+        $ mknode "p:cond" ([("evt", "onPrev"), ("delay", "0")])
+        $ mknode "p:tgtEl" []
+        $ mknode "p:sldTgt" [] ()
+      , mknode "p:nextCondLst" []
+        $ mknode "p:cond" ([("evt", "onNext"), ("delay", "0")])
+        $ mknode "p:tgtEl" []
+        $ mknode "p:sldTgt" [] ()
+      ]
+    bldLst = mknode "p:bldLst" []
+      [ mknode "p:bldP" [ ("spid", T.pack (show shapeId))
+                        , ("grpId", "0")
+                        , ("uiExpand", "1")
+                        , ("build", "p")
+                        ]
+        () | (shapeId, _) <- toList indices
+      ]
+
+    makePar :: Integer -> (ShapeId, Integer, Integer) -> Element
+    makePar nextId (shapeId, start, end) =
+      mknode "p:par" []
+        $ mknode "p:cTn" [("id", T.pack (show nextId)), ("fill", "hold")]
+        [ mknode "p:stCondLst" []
+          $ mknode "p:cond" [("delay", "indefinite")] ()
+        , mknode "p:childTnLst" []
+          $ mknode "p:par" []
+          $ mknode "p:cTn" [ ("id", T.pack (show (nextId + 1)))
+                           , ("fill", "hold")
+                           ]
+          [ mknode "p:stCondLst" []
+            $ mknode "p:cond" [("delay", "0")] ()
+          , mknode "p:childTnLst" []
+            $ mknode "p:par" []
+            $ mknode "p:cTn" [ ("id", T.pack (show (nextId + 2)))
+                             , ("presetID", "1")
+                             , ("presetClass", "entr")
+                             , ("presetSubtype", "0")
+                             , ("fill", "hold")
+                             , ("grpId", "0")
+                             , ("nodeType", "clickEffect")
+                             ]
+            [ mknode "p:stCondLst" []
+              $ mknode "p:cond" [("delay", "0")] ()
+            , mknode "p:childTnLst" []
+              $ mknode "p:set" []
+              [ mknode "p:cBhvr" []
+                [ mknode "p:cTn" [ ("id", T.pack (show (nextId + 3)))
+                                 , ("dur", "1")
+                                 , ("fill", "hold")
+                                 ]
+                  $ mknode "p:stCondLst" []
+                  $ mknode "p:cond" [("delay", "0")] ()
+                , mknode "p:tgtEl" []
+                  $ mknode "p:spTgt" [("spid", T.pack (show shapeId))]
+                  $ mknode "p:txEl" []
+                  $ mknode "p:pRg" [ ("st", T.pack (show start))
+                                   , ("end", T.pack (show end))]
+                    ()
+                , mknode "p:attrNameLst" []
+                  $ mknode "p:attrName" [] ("style.visibility" :: Text)
+                ]
+              , mknode "p:to" []
+                $ mknode "p:strVal" [("val", "visible")] ()
+              ]
+            ]
+          ]
+        ]
diff --git a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs
--- a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs
+++ b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs
@@ -1,7 +1,9 @@
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE LambdaCase                 #-}
+{-# LANGUAGE MultiWayIf                 #-}
 {-# LANGUAGE OverloadedStrings          #-}
 {-# LANGUAGE PatternGuards              #-}
 {-# LANGUAGE ViewPatterns               #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {- |
    Module      : Text.Pandoc.Writers.Powerpoint.Presentation
    Copyright   : Copyright (C) 2017-2020 Jesse Rosenthal
@@ -53,7 +55,6 @@
 import Text.Pandoc.Options
 import Text.Pandoc.Logging
 import Text.Pandoc.Walk
-import Data.Time (UTCTime)
 import qualified Text.Pandoc.Shared as Shared -- so we don't overlap "Element"
 import Text.Pandoc.Shared (tshow)
 import Text.Pandoc.Writers.Shared (lookupMetaInlines, lookupMetaBlocks
@@ -61,11 +62,13 @@
                                  , toLegacyTable)
 import qualified Data.Map as M
 import qualified Data.Set as S
-import Data.Maybe (maybeToList, fromMaybe)
+import Data.Maybe (maybeToList, fromMaybe, listToMaybe, isNothing)
 import Text.Pandoc.Highlighting
 import qualified Data.Text as T
 import Control.Applicative ((<|>))
 import Skylighting
+import Data.Bifunctor (bimap)
+import Data.Char (isSpace)
 
 data WriterEnv = WriterEnv { envMetadata :: Meta
                            , envRunProps :: RunProps
@@ -77,6 +80,8 @@
                            , envInNoteSlide :: Bool
                            , envCurSlideId :: SlideId
                            , envInSpeakerNotes :: Bool
+                           , envInIncrementalDiv :: Maybe InIncrementalDiv
+                           , envInListInBlockQuote :: Bool
                            }
                  deriving (Show)
 
@@ -91,6 +96,8 @@
                   , envInNoteSlide = False
                   , envCurSlideId = SlideId "Default"
                   , envInSpeakerNotes = False
+                  , envInIncrementalDiv = Nothing
+                  , envInListInBlockQuote = False
                   }
 
 
@@ -111,6 +118,23 @@
                     , stSpeakerNotes = mempty
                     }
 
+data InIncrementalDiv
+  = InIncremental
+  -- ^ The current content is contained within an "incremental" div.
+  | InNonIncremental
+  -- ^ The current content is contained within a "nonincremental" div.
+  deriving (Show)
+
+listShouldBeIncremental :: Pres Bool
+listShouldBeIncremental = do
+  incrementalOption <- asks (writerIncremental . envOpts)
+  inIncrementalDiv <- asks envInIncrementalDiv
+  inBlockQuote <- asks envInListInBlockQuote
+  let toBoolean = (\case InIncremental -> True
+                         InNonIncremental -> False)
+      maybeInvert = if inBlockQuote then not else id
+  pure (maybeInvert (maybe incrementalOption toBoolean inIncrementalDiv))
+
 metadataSlideId :: SlideId
 metadataSlideId = SlideId "Metadata"
 
@@ -168,7 +192,7 @@
                          , dcKeywords :: Maybe [T.Text]
                          , dcDescription :: Maybe T.Text
                          , cpCategory :: Maybe T.Text
-                         , dcCreated :: Maybe UTCTime
+                         , dcDate :: Maybe T.Text
                          , customProperties :: Maybe [(T.Text, T.Text)]
                          } deriving (Show, Eq)
 
@@ -176,6 +200,7 @@
 data Slide = Slide { slideId :: SlideId
                    , slideLayout :: Layout
                    , slideSpeakerNotes :: SpeakerNotes
+                   , slideBackgroundImage :: Maybe FilePath
                    } deriving (Show, Eq)
 
 newtype SlideId = SlideId T.Text
@@ -195,6 +220,11 @@
             --             heading    content
             | TwoColumnSlide [ParaElem] [Shape] [Shape]
             --               heading    left    right
+            | ComparisonSlide [ParaElem] ([Shape], [Shape]) ([Shape], [Shape])
+            --                heading  left@(text, content) right@(text, content)
+            | ContentWithCaptionSlide [ParaElem] [Shape] [Shape]
+            --                        heading     text    content
+            | BlankSlide
             deriving (Show, Eq)
 
 data Shape = Pic PicProps FilePath T.Text [ParaElem]
@@ -219,7 +249,7 @@
 
 
 data Paragraph = Paragraph { paraProps :: ParaProps
-                           , paraElems  :: [ParaElem]
+                           , paraElems :: [ParaElem]
                            } deriving (Show, Eq)
 
 data BulletType = Bullet
@@ -236,6 +266,7 @@
                            , pPropAlign :: Maybe Algnment
                            , pPropSpaceBefore :: Maybe Pixels
                            , pPropIndent :: Maybe Pixels
+                           , pPropIncremental :: Bool
                            } deriving (Show, Eq)
 
 instance Default ParaProps where
@@ -246,6 +277,7 @@
                   , pPropAlign = Nothing
                   , pPropSpaceBefore = Nothing
                   , pPropIndent = Just 0
+                  , pPropIncremental = False
                   }
 
 newtype TeXString = TeXString {unTeXString :: T.Text}
@@ -316,7 +348,7 @@
 --------------------------------------------------
 
 inlinesToParElems :: [Inline] -> Pres [ParaElem]
-inlinesToParElems ils = concatMapM inlineToParElems ils
+inlinesToParElems = concatMapM inlineToParElems
 
 inlineToParElems :: Inline -> Pres [ParaElem]
 inlineToParElems (Str s) = do
@@ -441,7 +473,8 @@
 -- (BlockQuote List) as a list to maintain compatibility with other
 -- formats.
 blockToParagraphs (BlockQuote (blk : blks)) | isListType blk = do
-  ps  <- blockToParagraphs blk
+  ps  <- local (\env -> env { envInListInBlockQuote = True })
+           (blockToParagraphs blk)
   ps' <- blockToParagraphs $ BlockQuote blks
   return $ ps ++ ps'
 blockToParagraphs (BlockQuote blks) =
@@ -466,25 +499,26 @@
   return [Paragraph def{pPropSpaceBefore = Just 30} parElems]
 blockToParagraphs (BulletList blksLst) = do
   pProps <- asks envParaProps
-  let lvl = pPropLevel pProps
+  incremental <- listShouldBeIncremental
   local (\env -> env{ envInList = True
-                    , envParaProps = pProps{ pPropLevel = lvl + 1
-                                           , pPropBullet = Just Bullet
+                    , envParaProps = pProps{ pPropBullet = Just Bullet
                                            , pPropMarginLeft = Nothing
                                            , pPropIndent = Nothing
+                                           , pPropIncremental = incremental
                                            }}) $
-    concatMapM multiParBullet blksLst
+    concatMapM multiParList blksLst
 blockToParagraphs (OrderedList listAttr blksLst) = do
   pProps <- asks envParaProps
-  let lvl = pPropLevel pProps
+  incremental <- listShouldBeIncremental
   local (\env -> env{ envInList = True
-                    , envParaProps = pProps{ pPropLevel = lvl + 1
-                                           , pPropBullet = Just (AutoNumbering listAttr)
+                    , envParaProps = pProps{ pPropBullet = Just (AutoNumbering listAttr)
                                            , pPropMarginLeft = Nothing
                                            , pPropIndent = Nothing
+                                           , pPropIncremental = incremental
                                            }}) $
-    concatMapM multiParBullet blksLst
+    concatMapM multiParList blksLst
 blockToParagraphs (DefinitionList entries) = do
+  incremental <- listShouldBeIncremental
   let go :: ([Inline], [[Block]]) -> Pres [Paragraph]
       go (ils, blksLst) = do
         term <-blockToParagraphs $ Para [Strong ils]
@@ -492,20 +526,35 @@
         -- blockquote. We can extend this further later.
         definition <- concatMapM (blockToParagraphs . BlockQuote) blksLst
         return $ term ++ definition
-  concatMapM go entries
-blockToParagraphs (Div _ blks)  = concatMapM blockToParagraphs blks
+  local (\env -> env {envParaProps =
+                       (envParaProps env) {pPropIncremental = incremental}})
+    $ concatMapM go entries
+blockToParagraphs (Div (_, classes, _) blks) = let
+  hasIncremental = "incremental" `elem` classes
+  hasNonIncremental = "nonincremental" `elem` classes
+  incremental = if | hasIncremental -> Just InIncremental
+                   | hasNonIncremental -> Just InNonIncremental
+                   | otherwise -> Nothing
+  addIncremental env = env { envInIncrementalDiv = incremental }
+  in local addIncremental (concatMapM blockToParagraphs blks)
 blockToParagraphs blk = do
   addLogMessage $ BlockNotRendered blk
   return []
 
--- Make sure the bullet env gets turned off after the first para.
-multiParBullet :: [Block] -> Pres [Paragraph]
-multiParBullet [] = return []
-multiParBullet (b:bs) = do
+-- | Make sure the bullet env gets turned off after the first para.
+multiParList :: [Block] -> Pres [Paragraph]
+multiParList [] = return []
+multiParList (b:bs) = do
   pProps <- asks envParaProps
   p <- blockToParagraphs b
-  ps <- local (\env -> env{envParaProps = pProps{pPropBullet = Nothing}}) $
-    concatMapM blockToParagraphs bs
+  let level = pPropLevel pProps
+  ps <- local (\env -> env
+                { envParaProps = pProps
+                  { pPropBullet = Nothing
+                  , pPropLevel = level + 1
+                  }
+                })
+        $ concatMapM blockToParagraphs bs
   return $ p ++ ps
 
 cellToParagraphs :: Alignment -> SimpleCell -> Pres [Paragraph]
@@ -584,7 +633,30 @@
 isImage (Link _ (Image{} : _) _) = True
 isImage _ = False
 
-splitBlocks' :: [Block] -> [[Block]] -> [Block] -> Pres [[Block]]
+plainOrPara :: Block -> Maybe [Inline]
+plainOrPara (Plain ils) = Just ils
+plainOrPara (Para ils) = Just ils
+plainOrPara _ = Nothing
+
+notText :: Block -> Bool
+notText block | startsWithImage block = True
+notText Table{} = True
+notText _ = False
+
+startsWithImage :: Block -> Bool
+startsWithImage block = fromMaybe False $ do
+  inline <- plainOrPara block >>= listToMaybe
+  pure (isImage inline)
+
+-- | Group blocks into a number of "splits"
+splitBlocks' ::
+  -- | Blocks so far in the current split
+  [Block] ->
+  -- | Splits so far
+  [[Block]] ->
+  -- | All remaining blocks
+  [Block] ->
+  Pres [[Block]]
 splitBlocks' cur acc [] = return $ acc ++ ([cur | not (null cur)])
 splitBlocks' cur acc (HorizontalRule : blks) =
   splitBlocks' [] (acc ++ ([cur | not (null cur)])) blks
@@ -604,25 +676,31 @@
                      then span isNotesDiv blks
                      else ([], blks)
   case cur of
-    [Header n _ _] | n == slideLevel ->
+    [Header n _ _] | n == slideLevel || slideLevel == 0 ->
                             splitBlocks' []
                             (acc ++ [cur ++ [Para [il]] ++ nts])
                             (if null ils then blks' else Para ils : blks')
     _ -> splitBlocks' []
-         (acc ++ ([cur | not (null cur)]) ++ [Para [il] : nts])
+         (if any notText cur
+          then acc ++ ([cur | not (null cur)]) ++ [Para [il] : nts]
+          else acc ++ [cur ++ [Para [il]] ++ nts])
          (if null ils then blks' else Para ils : blks')
 splitBlocks' cur acc (tbl@Table{} : blks) = do
   slideLevel <- asks envSlideLevel
   let (nts, blks') = span isNotesDiv blks
   case cur of
-    [Header n _ _] | n == slideLevel ->
+    [Header n _ _] | n == slideLevel || slideLevel == 0 ->
                             splitBlocks' [] (acc ++ [cur ++ [tbl] ++ nts]) blks'
-    _ ->  splitBlocks' [] (acc ++ ([cur | not (null cur)]) ++ [tbl : nts]) blks'
+    _ -> splitBlocks' []
+         (if any notText cur
+          then acc ++ ([cur | not (null cur)]) ++ [tbl : nts]
+          else acc ++ ([cur ++ [tbl] ++ nts]))
+         blks'
 splitBlocks' cur acc (d@(Div (_, classes, _) _): blks) | "columns" `elem` classes =  do
   slideLevel <- asks envSlideLevel
   let (nts, blks') = span isNotesDiv blks
   case cur of
-    [Header n _ _] | n == slideLevel ->
+    [Header n _ _] | n == slideLevel || slideLevel == 0 ->
                             splitBlocks' [] (acc ++ [cur ++ [d] ++ nts]) blks'
     _ ->  splitBlocks' [] (acc ++ ([cur | not (null cur)]) ++ [d : nts]) blks'
 splitBlocks' cur acc (blk : blks) = splitBlocks' (cur ++ [blk]) acc blks
@@ -630,63 +708,96 @@
 splitBlocks :: [Block] -> Pres [[Block]]
 splitBlocks = splitBlocks' [] []
 
+-- | Assuming the slide title is already handled, convert these blocks to the
+-- body content for the slide.
+bodyBlocksToSlide :: Int -> [Block] -> SpeakerNotes -> Pres Slide
+bodyBlocksToSlide _ (blk : blks) spkNotes
+  | Div (_, classes, _) divBlks <- blk
+  , "columns" `elem` classes
+  , Div (_, clsL, _) blksL : Div (_, clsR, _) blksR : remaining <- divBlks
+  , "column" `elem` clsL, "column" `elem` clsR = do
+      mapM_ (addLogMessage . BlockNotRendered) (blks ++ remaining)
+      let mkTwoColumn left right = do
+            blksL' <- join . take 1 <$> splitBlocks left
+            blksR' <- join . take 1 <$> splitBlocks right
+            shapesL <- blocksToShapes blksL'
+            shapesR <- blocksToShapes blksR'
+            sldId <- asks envCurSlideId
+            return $ Slide
+              sldId
+              (TwoColumnSlide [] shapesL shapesR)
+              spkNotes
+              Nothing
+      let mkComparison blksL1  blksL2 blksR1 blksR2 = do
+            shapesL1 <- blocksToShapes blksL1
+            shapesL2 <- blocksToShapes blksL2
+            shapesR1 <- blocksToShapes blksR1
+            shapesR2 <- blocksToShapes blksR2
+            sldId <- asks envCurSlideId
+            return $ Slide
+              sldId
+              (ComparisonSlide [] (shapesL1, shapesL2) (shapesR1, shapesR2))
+              spkNotes
+              Nothing
+      let (blksL1, blksL2) = break notText blksL
+          (blksR1, blksR2) = break notText blksR
+      if (any null [blksL1, blksL2]) && (any null [blksR1, blksR2])
+      then mkTwoColumn blksL blksR
+      else mkComparison blksL1 blksL2 blksR1 blksR2
+bodyBlocksToSlide _ (blk : blks) spkNotes = do
+      sldId <- asks envCurSlideId
+      inNoteSlide <- asks envInNoteSlide
+      let mkSlide s =
+            Slide sldId s spkNotes Nothing
+      if inNoteSlide
+      then mkSlide . ContentSlide [] <$>
+          forceFontSize noteSize (blocksToShapes (blk : blks))
+      else let
+        contentOrBlankSlide =
+          if makesBlankSlide (blk : blks)
+          then pure (mkSlide BlankSlide)
+          else mkSlide . ContentSlide [] <$> blocksToShapes (blk : blks)
+        in case break notText (blk : blks) of
+          ([], _) -> contentOrBlankSlide
+          (_, []) -> contentOrBlankSlide
+          (textBlocks, contentBlocks) -> do
+            textShapes <- blocksToShapes textBlocks
+            contentShapes <- blocksToShapes contentBlocks
+            return (mkSlide (ContentWithCaptionSlide [] textShapes contentShapes))
+bodyBlocksToSlide _ [] spkNotes = do
+  sldId <- asks envCurSlideId
+  return $
+    Slide
+    sldId
+    BlankSlide
+    spkNotes
+    Nothing
+
 blocksToSlide' :: Int -> [Block] -> SpeakerNotes -> Pres Slide
-blocksToSlide' lvl (Header n (ident, _, _) ils : blks) spkNotes
+blocksToSlide' lvl (Header n (ident, _, attributes) ils : blks) spkNotes
   | n < lvl = do
       registerAnchorId ident
       sldId <- asks envCurSlideId
       hdr <- inlinesToParElems ils
-      return $ Slide sldId (TitleSlide hdr) spkNotes
-  | n == lvl = do
+      return $ Slide sldId (TitleSlide hdr) spkNotes backgroundImage
+  | n == lvl || lvl == 0 = do
       registerAnchorId ident
       hdr <- inlinesToParElems ils
       -- Now get the slide without the header, and then add the header
       -- in.
-      slide <- blocksToSlide' lvl blks spkNotes
+      slide <- bodyBlocksToSlide lvl blks spkNotes
       let layout = case slideLayout slide of
             ContentSlide _ cont          -> ContentSlide hdr cont
             TwoColumnSlide _ contL contR -> TwoColumnSlide hdr contL contR
+            ComparisonSlide _ contL contR -> ComparisonSlide hdr contL contR
+            ContentWithCaptionSlide _ text content -> ContentWithCaptionSlide hdr text content
+            BlankSlide -> if all inlineIsBlank ils then BlankSlide else ContentSlide hdr []
             layout'                     -> layout'
-      return $ slide{slideLayout = layout}
-blocksToSlide' _ (blk : blks) spkNotes
-  | Div (_, classes, _) divBlks <- blk
-  , "columns" `elem` classes
-  , Div (_, clsL, _) blksL : Div (_, clsR, _) blksR : remaining <- divBlks
-  , "column" `elem` clsL, "column" `elem` clsR = do
-      mapM_ (addLogMessage . BlockNotRendered) (blks ++ remaining)
-      mbSplitBlksL <- splitBlocks blksL
-      mbSplitBlksR <- splitBlocks blksR
-      let blksL' = case mbSplitBlksL of
-            bs : _ -> bs
-            []     -> []
-      let blksR' = case mbSplitBlksR of
-            bs : _ -> bs
-            []     -> []
-      shapesL <- blocksToShapes blksL'
-      shapesR <- blocksToShapes blksR'
-      sldId <- asks envCurSlideId
-      return $ Slide
-        sldId
-        (TwoColumnSlide [] shapesL shapesR)
-        spkNotes
-blocksToSlide' _ (blk : blks) spkNotes = do
-      inNoteSlide <- asks envInNoteSlide
-      shapes <- if inNoteSlide
-                then forceFontSize noteSize $ blocksToShapes (blk : blks)
-                else blocksToShapes (blk : blks)
-      sldId <- asks envCurSlideId
-      return $
-        Slide
-        sldId
-        (ContentSlide [] shapes)
-        spkNotes
-blocksToSlide' _ [] spkNotes = do
-  sldId <- asks envCurSlideId
-  return $
-    Slide
-    sldId
-    (ContentSlide [] [])
-    spkNotes
+      return $ slide{slideLayout = layout, slideBackgroundImage = backgroundImage}
+  where
+    backgroundImage = T.unpack <$> (lookup "background-image" attributes
+                                   <|> lookup "data-background-image" attributes)
+blocksToSlide' lvl blks spkNotes = bodyBlocksToSlide lvl blks spkNotes
 
 blockToSpeakerNotes :: Block -> Pres SpeakerNotes
 blockToSpeakerNotes (Div (_, ["notes"], _) blks) =
@@ -766,12 +877,13 @@
          metadataSlideId
          (MetadataSlide title subtitle authors date)
          mempty
+         Nothing
 
 addSpeakerNotesToMetaSlide :: Slide -> [Block] -> Pres (Slide, [Block])
-addSpeakerNotesToMetaSlide (Slide sldId layout@MetadataSlide{} spkNotes) blks =
+addSpeakerNotesToMetaSlide (Slide sldId layout@MetadataSlide{} spkNotes backgroundImage) blks =
   do let (ntsBlks, blks') = span isNotesDiv blks
      spkNotes' <- mconcat <$> mapM blockToSpeakerNotes ntsBlks
-     return (Slide sldId layout (spkNotes <> spkNotes'), blks')
+     return (Slide sldId layout (spkNotes <> spkNotes') backgroundImage, blks')
 addSpeakerNotesToMetaSlide sld blks = return (sld, blks)
 
 makeTOCSlide :: [Block] -> Pres Slide
@@ -829,6 +941,19 @@
   contentL' <- mapM (applyToShape f) contentL
   contentR' <- mapM (applyToShape f) contentR
   return $ TwoColumnSlide hdr' contentL' contentR'
+applyToLayout f (ComparisonSlide hdr (contentL1, contentL2) (contentR1, contentR2)) = do
+  hdr' <- mapM f hdr
+  contentL1' <- mapM (applyToShape f) contentL1
+  contentL2' <- mapM (applyToShape f) contentL2
+  contentR1' <- mapM (applyToShape f) contentR1
+  contentR2' <- mapM (applyToShape f) contentR2
+  return $ ComparisonSlide hdr' (contentL1', contentL2') (contentR1', contentR2')
+applyToLayout f (ContentWithCaptionSlide hdr textShapes contentShapes) = do
+  hdr' <- mapM f hdr
+  textShapes' <- mapM (applyToShape f) textShapes
+  contentShapes' <- mapM (applyToShape f) contentShapes
+  return $ ContentWithCaptionSlide hdr' textShapes' contentShapes'
+applyToLayout _ BlankSlide = pure BlankSlide
 
 applyToSlide :: Monad m => (ParaElem -> m ParaElem) -> Slide -> m Slide
 applyToSlide f slide = do
@@ -880,10 +1005,73 @@
     all emptyParaElem hdr &&
     all emptyShape shapes1 &&
     all emptyShape shapes2
+  ComparisonSlide hdr (shapesL1, shapesL2) (shapesR1, shapesR2) ->
+    all emptyParaElem hdr &&
+    all emptyShape shapesL1 &&
+    all emptyShape shapesL2 &&
+    all emptyShape shapesR1 &&
+    all emptyShape shapesR2
+  ContentWithCaptionSlide hdr textShapes contentShapes ->
+    all emptyParaElem hdr &&
+    all emptyShape textShapes &&
+    all emptyShape contentShapes
+  BlankSlide -> False
 
+
 emptySlide :: Slide -> Bool
-emptySlide (Slide _ layout notes) = (notes == mempty) && emptyLayout layout
+emptySlide (Slide _ layout notes backgroundImage)
+  = (notes == mempty)
+  && emptyLayout layout
+  && isNothing backgroundImage
 
+makesBlankSlide :: [Block] -> Bool
+makesBlankSlide = all blockIsBlank
+
+blockIsBlank :: Block -> Bool
+blockIsBlank
+  = \case
+      Plain ins -> all inlineIsBlank ins
+      Para ins -> all inlineIsBlank ins
+      LineBlock inss -> all (all inlineIsBlank) inss
+      CodeBlock _ txt -> textIsBlank txt
+      RawBlock _ txt -> textIsBlank txt
+      BlockQuote bls -> all blockIsBlank bls
+      OrderedList _ blss -> all (all blockIsBlank) blss
+      BulletList blss -> all (all blockIsBlank) blss
+      DefinitionList ds -> all (uncurry (&&) . bimap (all inlineIsBlank) (all (all blockIsBlank))) ds
+      Header _ _ ils -> all inlineIsBlank ils
+      HorizontalRule -> True
+      Table{} -> False
+      Div _ bls -> all blockIsBlank bls
+      Null -> True
+
+textIsBlank :: T.Text -> Bool
+textIsBlank = T.all isSpace
+
+inlineIsBlank :: Inline -> Bool
+inlineIsBlank
+  = \case
+      (Str txt) -> textIsBlank txt
+      (Emph ins) -> all inlineIsBlank ins
+      (Underline ins) -> all inlineIsBlank ins
+      (Strong ins) -> all inlineIsBlank ins
+      (Strikeout ins) -> all inlineIsBlank ins
+      (Superscript ins) -> all inlineIsBlank ins
+      (Subscript ins) -> all inlineIsBlank ins
+      (SmallCaps ins) -> all inlineIsBlank ins
+      (Quoted _ ins) -> all inlineIsBlank ins
+      (Cite _ _) -> False
+      (Code _ txt) -> textIsBlank txt
+      Space -> True
+      SoftBreak -> True
+      LineBreak -> True
+      (Math _ txt) -> textIsBlank txt
+      (RawInline _ txt) -> textIsBlank txt
+      (Link _ ins (t1, t2)) -> all inlineIsBlank ins && textIsBlank t1 && textIsBlank t2
+      (Image _ ins (t1, t2)) -> all inlineIsBlank ins && textIsBlank t1 && textIsBlank t2
+      (Note bls) -> all blockIsBlank bls
+      (Span _ ins) -> all inlineIsBlank ins
+
 blocksToPresentationSlides :: [Block] -> Pres [Slide]
 blocksToPresentationSlides blks = do
   opts <- asks envOpts
@@ -962,7 +1150,11 @@
             , dcKeywords = keywords
             , dcDescription = description
             , cpCategory = Shared.stringify <$> lookupMeta "category" meta
-            , dcCreated = Nothing
+            , dcDate =
+              let t = Shared.stringify (docDate meta)
+              in if T.null t
+                 then Nothing
+                 else Just t
             , customProperties = customProperties'
             }
 
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -219,28 +219,34 @@
            nest 3 contents $$
            blankline
 blockToRST (Plain inlines) = inlineListToRST inlines
-blockToRST (Para [Image attr txt (src, rawtit)]) = do
+blockToRST (SimpleFigure attr txt (src, tit)) = do
   description <- inlineListToRST txt
   dims <- imageDimsToRST attr
-  -- title beginning with fig: indicates that the image is a figure
-  let (isfig, tit) = case T.stripPrefix "fig:" rawtit of
-                          Nothing   -> (False, rawtit)
-                          Just tit' -> (True, tit')
-  let fig | isfig = "figure:: " <> literal src
-          | otherwise = "image:: " <> literal src
-      alt | isfig = ":alt: " <> if T.null tit then description else literal tit
-          | null txt = empty
+  let fig = "figure:: " <> literal src
+      alt = ":alt: " <> if T.null tit then description else literal tit
+      capt = description
+      (_,cls,_) = attr
+      classes = case cls of
+                   []               -> empty
+                   ["align-right"]  -> ":align: right"
+                   ["align-left"]   -> ":align: left"
+                   ["align-center"] -> ":align: center"
+                   _ -> ":figclass: " <> literal (T.unwords cls)
+  return $ hang 3 ".. " (fig $$ alt $$ classes $$ dims $+$ capt) $$ blankline
+blockToRST (Para [Image attr txt (src, _)]) = do
+  description <- inlineListToRST txt
+  dims <- imageDimsToRST attr
+  let fig = "image:: " <> literal src
+      alt | null txt = empty
           | otherwise = ":alt: " <> description
-      capt | isfig = description
-           | otherwise = empty
+      capt = empty
       (_,cls,_) = attr
       classes = case cls of
                    []               -> empty
                    ["align-right"]  -> ":align: right"
                    ["align-left"]   -> ":align: left"
                    ["align-center"] -> ":align: center"
-                   _ | isfig        -> ":figclass: " <> literal (T.unwords cls)
-                     | otherwise    -> ":class: " <> literal (T.unwords cls)
+                   _ -> ":class: " <> literal (T.unwords cls)
   return $ hang 3 ".. " (fig $$ alt $$ classes $$ dims $+$ capt) $$ blankline
 blockToRST (Para inlines)
   | LineBreak `elem` inlines =
@@ -270,7 +276,12 @@
           let headerChar = if level > 5 then ' ' else "=-~^'" !! (level - 1)
           let border = literal $ T.replicate (offset contents) $ T.singleton headerChar
           let anchor | T.null name || name == autoId = empty
-                     | otherwise = ".. _" <> literal name <> ":" $$ blankline
+                     | otherwise = ".. _" <>
+                                   (if T.any (==':') name ||
+                                        T.take 1 name == "_"
+                                       then "`" <> literal name <> "`"
+                                       else literal name) <>
+                                   ":" $$ blankline
           return $ nowrap $ anchor $$ contents $$ border $$ blankline
     else do
           let rub     = "rubric:: " <> contents
@@ -402,7 +413,7 @@
           toClose Header{}                 = False
           toClose LineBlock{}              = False
           toClose HorizontalRule           = False
-          toClose (Para [Image _ _ (_,t)]) = "fig:" `T.isPrefixOf` t
+          toClose SimpleFigure{}           = True
           toClose Para{}                   = False
           toClose _                        = True
           commentSep  = RawBlock "rst" "..\n\n"
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -36,6 +36,7 @@
                      , toTableOfContents
                      , endsWithPlain
                      , toLegacyTable
+                     , splitSentences
                      )
 where
 import Safe (lastMay)
@@ -49,6 +50,7 @@
 import Data.Text.Conversions (FromText(..))
 import qualified Data.Map as M
 import qualified Data.Text as T
+import Data.Text (Text)
 import qualified Text.Pandoc.Builder as Builder
 import Text.Pandoc.Definition
 import Text.Pandoc.Options
@@ -119,13 +121,13 @@
 
 
 -- | Retrieve a field value from a template context.
-getField   :: FromContext a b => T.Text -> Context a -> Maybe b
+getField   :: FromContext a b => Text -> Context a -> Maybe b
 getField field (Context m) = M.lookup field m >>= fromVal
 
 -- | Set a field of a template context.  If the field already has a value,
 -- convert it into a list with the new value appended to the old value(s).
 -- This is a utility function to be used in preparing template contexts.
-setField   :: ToContext a b => T.Text -> b -> Context a -> Context a
+setField   :: ToContext a b => Text -> b -> Context a -> Context a
 setField field val (Context m) =
   Context $ M.insertWith combine field (toVal val) m
  where
@@ -135,21 +137,21 @@
 -- | Reset a field of a template context.  If the field already has a
 -- value, the new value replaces it.
 -- This is a utility function to be used in preparing template contexts.
-resetField :: ToContext a b => T.Text -> b -> Context a -> Context a
+resetField :: ToContext a b => Text -> b -> Context a -> Context a
 resetField field val (Context m) =
   Context (M.insert field (toVal val) m)
 
 -- | Set a field of a template context if it currently has no value.
 -- If it has a value, do nothing.
 -- This is a utility function to be used in preparing template contexts.
-defField   :: ToContext a b => T.Text -> b -> Context a -> Context a
+defField   :: ToContext a b => Text -> b -> Context a -> Context a
 defField field val (Context m) =
   Context (M.insertWith f field (toVal val) m)
   where
     f _newval oldval = oldval
 
 -- | Get the contents of the `lang` metadata field or variable.
-getLang :: WriterOptions -> Meta -> Maybe T.Text
+getLang :: WriterOptions -> Meta -> Maybe Text
 getLang opts meta =
   case lookupContext "lang" (writerVariables opts) of
         Just s -> Just s
@@ -162,7 +164,7 @@
                _                                 -> Nothing
 
 -- | Produce an HTML tag with the given pandoc attributes.
-tagWithAttrs :: HasChars a => T.Text -> Attr -> Doc a
+tagWithAttrs :: HasChars a => Text -> Attr -> Doc a
 tagWithAttrs tag (ident,classes,kvs) = hsep
   ["<" <> text (T.unpack tag)
   ,if T.null ident
@@ -213,7 +215,7 @@
 
 -- | Converts a Unicode character into the ASCII sequence used to
 -- represent the character in "smart" Markdown.
-unsmartify :: WriterOptions -> T.Text -> T.Text
+unsmartify :: WriterOptions -> Text -> Text
 unsmartify opts = T.concatMap $ \c -> case c of
   '\8217' -> "'"
   '\8230' -> "..."
@@ -345,7 +347,7 @@
 
 -- | Retrieve the metadata value for a given @key@
 -- and convert to Bool.
-lookupMetaBool :: T.Text -> Meta -> Bool
+lookupMetaBool :: Text -> Meta -> Bool
 lookupMetaBool key meta =
   case lookupMeta key meta of
       Just (MetaBlocks _)  -> True
@@ -356,7 +358,7 @@
 
 -- | Retrieve the metadata value for a given @key@
 -- and extract blocks.
-lookupMetaBlocks :: T.Text -> Meta -> [Block]
+lookupMetaBlocks :: Text -> Meta -> [Block]
 lookupMetaBlocks key meta =
   case lookupMeta key meta of
          Just (MetaBlocks bs)   -> bs
@@ -366,7 +368,7 @@
 
 -- | Retrieve the metadata value for a given @key@
 -- and extract inlines.
-lookupMetaInlines :: T.Text -> Meta -> [Inline]
+lookupMetaInlines :: Text -> Meta -> [Inline]
 lookupMetaInlines key meta =
   case lookupMeta key meta of
          Just (MetaString s)           -> [Str s]
@@ -377,7 +379,7 @@
 
 -- | Retrieve the metadata value for a given @key@
 -- and convert to String.
-lookupMetaString :: T.Text -> Meta -> T.Text
+lookupMetaString :: Text -> Meta -> Text
 lookupMetaString key meta =
   case lookupMeta key meta of
          Just (MetaString s)    -> s
@@ -519,3 +521,27 @@
 
     getComponents (Cell _ _ (RowSpan h) (ColSpan w) body)
       = (h, w, body)
+
+splitSentences :: Doc Text -> Doc Text
+splitSentences = go . toList
+ where
+  go [] = mempty
+  go (Text len t : BreakingSpace : xs) =
+     if isSentenceEnding t
+        then Text len t <> NewLine <> go xs
+        else Text len t <> BreakingSpace <> go xs
+  go (x:xs) = x <> go xs
+
+  toList (Concat (Concat a b) c) = toList (Concat a (Concat b c))
+  toList (Concat a b) = a : toList b
+  toList x = [x]
+
+  isSentenceEnding t =
+    case T.unsnoc t of
+      Just (t',c)
+        | c == '.' || c == '!' || c == '?' -> True
+        | c == ')' || c == ']' || c == '"' || c == '\x201D' ->
+           case T.unsnoc t' of
+             Just (_,d) -> d == '.' || d == '!' || d == '?'
+             _ -> False
+      _ -> False
diff --git a/src/Text/Pandoc/Writers/Texinfo.hs b/src/Text/Pandoc/Writers/Texinfo.hs
--- a/src/Text/Pandoc/Writers/Texinfo.hs
+++ b/src/Text/Pandoc/Writers/Texinfo.hs
@@ -123,8 +123,7 @@
   inlineListToTexinfo lst
 
 -- title beginning with fig: indicates that the image is a figure
-blockToTexinfo (Para [Image attr txt (src,tgt)])
-  | Just tit <- T.stripPrefix "fig:" tgt = do
+blockToTexinfo (SimpleFigure attr txt (src, tit)) = do
       capt <- if null txt
               then return empty
               else (\c -> text "@caption" <> braces c) `fmap`
diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs
--- a/src/Text/Pandoc/Writers/Textile.hs
+++ b/src/Text/Pandoc/Writers/Textile.hs
@@ -1,5 +1,4 @@
 {-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE ViewPatterns      #-}
 {- |
    Module      : Text.Pandoc.Writers.Textile
    Copyright   : Copyright (C) 2010-2021 John MacFarlane
@@ -111,8 +110,7 @@
 blockToTextile opts (Plain inlines) =
   inlineListToTextile opts inlines
 
--- title beginning with fig: indicates that the image is a figure
-blockToTextile opts (Para [Image attr txt (src,T.stripPrefix "fig:" -> Just tit)]) = do
+blockToTextile opts (SimpleFigure attr txt (src, tit)) = do
   capt <- blockToTextile opts (Para txt)
   im <- inlineToTextile opts (Image attr txt (src,tit))
   return $ im <> "\n" <> capt
diff --git a/src/Text/Pandoc/Writers/ZimWiki.hs b/src/Text/Pandoc/Writers/ZimWiki.hs
--- a/src/Text/Pandoc/Writers/ZimWiki.hs
+++ b/src/Text/Pandoc/Writers/ZimWiki.hs
@@ -1,5 +1,4 @@
 {-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE ViewPatterns      #-}
 {- |
    Module      : Text.Pandoc.Writers.ZimWiki
    Copyright   : © 2008-2021 John MacFarlane,
@@ -86,9 +85,8 @@
 
 blockToZimWiki opts (Plain inlines) = inlineListToZimWiki opts inlines
 
--- title beginning with fig: indicates that the image is a figure
 -- ZimWiki doesn't support captions - so combine together alt and caption into alt
-blockToZimWiki opts (Para [Image attr txt (src,T.stripPrefix "fig:" -> Just tit)]) = do
+blockToZimWiki opts (SimpleFigure attr txt (src, tit)) = do
   capt <- if null txt
              then return ""
              else (" " <>) `fmap` inlineListToZimWiki opts txt
diff --git a/stack.yaml b/stack.yaml
--- a/stack.yaml
+++ b/stack.yaml
@@ -7,17 +7,33 @@
 packages:
 - '.'
 extra-deps:
-- commonmark-0.2.1
-- commonmark-pandoc-0.2.1.1
-- skylighting-core-0.11
-- skylighting-0.11
+- skylighting-core-0.12
+- skylighting-0.12
 - doctemplates-0.10
-- texmath-0.12.3.1
-- citeproc-0.5
+- emojis-0.1.2
+- doclayout-0.3.1.1
+- hslua-2.0.0
+- hslua-classes-2.0.0
+- hslua-core-2.0.0
+- hslua-marshalling-2.0.0
+- hslua-module-path-1.0.0
+- hslua-module-system-1.0.0
+- hslua-module-text-1.0.0
+- hslua-module-version-1.0.0
+- hslua-objectorientation-2.0.0
+- hslua-packaging-2.0.0
+- lua-2.0.0
+- tasty-hslua-1.0.0
+- tasty-lua-1.0.0
+- pandoc-types-1.22.1
+- texmath-0.12.3.2
+- commonmark-0.2.1.1
+- commonmark-extensions-0.2.2
+- citeproc-0.6
+- aeson-pretty-0.8.9
+- ipynb-0.1.0.2
 ghc-options:
    "$locals": -fhide-source-paths -Wno-missing-home-modules
-resolver: lts-18.0
+resolver: lts-18.10
 nix:
   packages: [zlib]
-
-
diff --git a/test/Tests/Command.hs b/test/Tests/Command.hs
--- a/test/Tests/Command.hs
+++ b/test/Tests/Command.hs
@@ -12,6 +12,7 @@
 module Tests.Command (runTest, tests)
 where
 
+import Data.Maybe (fromMaybe)
 import Data.Algorithm.Diff
 import System.Environment (getExecutablePath)
 import qualified Data.ByteString as BS
@@ -90,18 +91,19 @@
 extractCode (CodeBlock _ code) = T.unpack code
 extractCode _                  = ""
 
-dropPercent :: String -> String
-dropPercent ('%':xs) = dropWhile (== ' ') xs
-dropPercent xs       = xs
+dropPercent :: String -> Maybe String
+dropPercent ('%':xs) = Just $ dropWhile (== ' ') xs
+dropPercent _        = Nothing
 
 runCommandTest :: FilePath -> FilePath -> Int -> String -> TestTree
-runCommandTest testExePath fp num code =
+runCommandTest testExePath fp num code = do
   goldenTest testname getExpected getActual compareValues' updateGolden
  where
   testname = "#" <> show num
   codelines = lines code
   (continuations, r1) = span ("\\" `isSuffixOf`) codelines
-  cmd = dropPercent (unwords (map init continuations ++ take 1 r1))
+  cmd = fromMaybe (error "Command test line does not begin with %")
+            (dropPercent (unwords (map init continuations ++ take 1 r1)))
   r2 = drop 1 r1
   (inplines, r3) = break (=="^D") r2
   normlines = takeWhile (/=".") (drop 1 r3)
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs
--- a/test/Tests/Lua.hs
+++ b/test/Tests/Lua.hs
@@ -1,5 +1,6 @@
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE OverloadedStrings   #-}
 {-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeApplications    #-}
 {- |
    Module      : Tests.Lua
    Copyright   : © 2017-2021 Albert Krewinkel
@@ -14,9 +15,10 @@
 module Tests.Lua ( runLuaTest, tests ) where
 
 import Control.Monad (when)
+import HsLua as Lua hiding (Operation (Div), error)
 import System.FilePath ((</>))
 import Test.Tasty (TestTree, localOption)
-import Test.Tasty.HUnit (Assertion, assertEqual, testCase)
+import Test.Tasty.HUnit (Assertion, HasCallStack, assertEqual, testCase)
 import Test.Tasty.QuickCheck (QuickCheckTests (..), ioProperty, testProperty)
 import Text.Pandoc.Arbitrary ()
 import Text.Pandoc.Builder (bulletList, definitionList, displayMath, divWith,
@@ -25,8 +27,8 @@
                             singleQuoted, space, str, strong,
                             HasMeta (setMeta))
 import Text.Pandoc.Class (runIOorExplode, setUserDataDir)
-import Text.Pandoc.Definition (Block (BlockQuote, Div, Para), Inline (Emph, Str),
-                               Attr, Meta, Pandoc, pandocTypesVersion)
+import Text.Pandoc.Definition (Attr, Block (BlockQuote, Div, Para), Pandoc,
+                               Inline (Emph, Str), Meta, pandocTypesVersion)
 import Text.Pandoc.Error (PandocError (PandocLuaError))
 import Text.Pandoc.Filter (Filter (LuaFilter), applyFilters)
 import Text.Pandoc.Lua (runLua)
@@ -34,23 +36,22 @@
 import Text.Pandoc.Shared (pandocVersion)
 
 import qualified Control.Monad.Catch as Catch
-import qualified Foreign.Lua as Lua
 import qualified Data.Text as T
 import qualified Data.Text.Encoding as TE
 
 tests :: [TestTree]
 tests = map (localOption (QuickCheckTests 20))
   [ testProperty "inline elements can be round-tripped through the lua stack" $
-    \x -> ioProperty (roundtripEqual (x::Inline))
+    ioProperty . roundtripEqual @Inline
 
   , testProperty "block elements can be round-tripped through the lua stack" $
-    \x -> ioProperty (roundtripEqual (x::Block))
+    ioProperty . roundtripEqual @Block
 
   , testProperty "meta blocks can be round-tripped through the lua stack" $
-    \x -> ioProperty (roundtripEqual (x::Meta))
+    ioProperty . roundtripEqual @Meta
 
   , testProperty "documents can be round-tripped through the lua stack" $
-    \x -> ioProperty (roundtripEqual (x::Pandoc))
+    ioProperty . roundtripEqual @Pandoc
 
   , testCase "macro expansion via filter" $
     assertFilterConversion "a '{{helloworld}}' string is expanded"
@@ -163,12 +164,12 @@
       Lua.getglobal "PANDOC_VERSION"
       Lua.liftIO .
         assertEqual "pandoc version is wrong" (TE.encodeUtf8 pandocVersion)
-        =<< Lua.tostring' Lua.stackTop
+        =<< Lua.tostring' Lua.top
 
   , testCase "Pandoc types version is set" . runLuaTest $ do
       Lua.getglobal "PANDOC_API_VERSION"
       Lua.liftIO . assertEqual "pandoc-types version is wrong" pandocTypesVersion
-        =<< Lua.peek Lua.stackTop
+        =<< Lua.peek Lua.top
 
   , testCase "require file" $
     assertFilterConversion "requiring file failed"
@@ -177,38 +178,47 @@
       (doc $ para (str . T.pack $ "lua" </> "require-file.lua"))
 
   , testCase "Allow singleton inline in constructors" . runLuaTest $ do
-      Lua.liftIO . assertEqual "Not the expected Emph" (Emph [Str "test"])
-        =<< Lua.callFunc "pandoc.Emph" (Str "test")
-      Lua.liftIO . assertEqual "Unexpected element" (Para [Str "test"])
-        =<< Lua.callFunc "pandoc.Para" ("test" :: String)
+      Lua.liftIO . assertEqual "Not the expected Emph"
+        (Emph [Str "test"]) =<< do
+        Lua.OK <- Lua.dostring "return pandoc.Emph"
+        Lua.push @Inline (Str "test")
+        Lua.call 1 1
+        Lua.peek @Inline top
+      Lua.liftIO . assertEqual "Unexpected element"
+        (Para [Str "test"]) =<< do
+        Lua.getglobal' "pandoc.Para"
+        Lua.pushString "test"
+        Lua.call 1 1
+        Lua.peek @Block top
       Lua.liftIO . assertEqual "Unexptected element"
         (BlockQuote [Para [Str "foo"]]) =<< (
         do
           Lua.getglobal' "pandoc.BlockQuote"
           Lua.push (Para [Str "foo"])
           _ <- Lua.call 1 1
-          Lua.peek Lua.stackTop
+          Lua.peek @Block Lua.top
         )
 
   , testCase "Elements with Attr have `attr` accessor" . runLuaTest $ do
       Lua.push (Div ("hi", ["moin"], [])
                 [Para [Str "ignored"]])
-      Lua.getfield Lua.stackTop "attr"
+      Lua.getfield Lua.top "attr"
       Lua.liftIO . assertEqual "no accessor" (("hi", ["moin"], []) :: Attr)
-        =<< Lua.peek Lua.stackTop
+        =<< Lua.peek @Attr Lua.top
 
   , testCase "module `pandoc.system` is present" . runLuaTest $ do
       Lua.getglobal' "pandoc.system"
-      ty <- Lua.ltype Lua.stackTop
+      ty <- Lua.ltype Lua.top
       Lua.liftIO $ assertEqual "module should be a table" Lua.TypeTable ty
 
   , testCase "informative error messages" . runLuaTest $ do
       Lua.pushboolean True
-      eitherPandoc <- Catch.try (Lua.peek Lua.stackTop :: Lua.Lua Pandoc)
+      -- Lua.newtable
+      eitherPandoc <- Catch.try (peek @Pandoc Lua.top)
       case eitherPandoc of
         Left (PandocLuaError msg) -> do
-          let expectedMsg = "Could not get Pandoc value: "
-                            <> "table expected, got boolean"
+          let expectedMsg = "Pandoc expected, got boolean\n"
+                <> "\twhile retrieving Pandoc value"
           Lua.liftIO $ assertEqual "unexpected error message" expectedMsg msg
         Left e -> error ("Expected a Lua error, but got " <> show e)
         Right _ -> error "Getting a Pandoc element from a bool should fail."
@@ -221,19 +231,20 @@
     applyFilters def [LuaFilter ("lua" </> filterPath)] ["HTML"] docIn
   assertEqual msg expectedDoc actualDoc
 
-roundtripEqual :: (Eq a, Lua.Peekable a, Lua.Pushable a) => a -> IO Bool
+roundtripEqual :: forall a. (Eq a, Lua.Pushable a, Lua.Peekable a)
+               => a -> IO Bool
 roundtripEqual x = (x ==) <$> roundtripped
  where
-  roundtripped :: Lua.Peekable a => IO a
+  roundtripped :: IO a
   roundtripped = runLuaTest $ do
     oldSize <- Lua.gettop
     Lua.push x
     size <- Lua.gettop
     when (size - oldSize /= 1) $
       error ("not exactly one additional element on the stack: " ++ show size)
-    Lua.peek (-1)
+    Lua.peek Lua.top
 
-runLuaTest :: Lua.Lua a -> IO a
+runLuaTest :: HasCallStack => Lua.LuaE PandocError a -> IO a
 runLuaTest op = runIOorExplode $ do
   setUserDataDir (Just "../data")
   res <- runLua op
diff --git a/test/Tests/Old.hs b/test/Tests/Old.hs
--- a/test/Tests/Old.hs
+++ b/test/Tests/Old.hs
@@ -146,7 +146,7 @@
       "dokuwiki_external_images.native" "dokuwiki_external_images.dokuwiki"
     ]
   , testGroup "opml"
-    [ test' "basic" ["-r", "native", "-w", "opml", "--columns=78", "-s"]
+    [ test' "basic" ["-r", "native", "-w", "opml", "--columns=80", "-s"]
        "testsuite.native" "writer.opml"
     , test' "reader" ["-r", "opml", "-w", "native", "-s"]
       "opml-reader.opml" "opml-reader.native"
@@ -262,7 +262,7 @@
        "tables" opts             "tables.native"    ("tables" <.> format)
     ]
   where
-    opts = ["-r", "native", "-w", format, "--columns=78",
+    opts = ["-r", "native", "-w", format, "--columns=80",
             "--variable", "pandoc-version="]
 
 extendedWriterTests :: FilePath -> String -> [TestTree]
@@ -276,7 +276,7 @@
                ("tables" </> name <.> format)
     in map testForTable ["planets", "nordics", "students"]
   where
-    opts = ["-r", "native", "-w", format, "--columns=78",
+    opts = ["-r", "native", "-w", format, "--columns=80",
             "--variable", "pandoc-version="]
 
 s5WriterTest :: FilePath -> String -> [String] -> String -> TestTree
diff --git a/test/Tests/Readers/Docx.hs b/test/Tests/Readers/Docx.hs
--- a/test/Tests/Readers/Docx.hs
+++ b/test/Tests/Readers/Docx.hs
@@ -148,6 +148,18 @@
             "docx/instrText_hyperlink.docx"
             "docx/instrText_hyperlink.native"
           , testCompare
+            "nested fields with <w:instrText> tag"
+            "docx/nested_instrText.docx"
+            "docx/nested_instrText.native"
+          , testCompare
+            "empty fields with <w:instrText> tag"
+            "docx/empty_field.docx"
+            "docx/empty_field.native"
+          , testCompare
+            "pageref hyperlinks in <w:instrText> tag"
+            "docx/pageref.docx"
+            "docx/pageref.native"
+          , testCompare
             "inline image"
             "docx/image.docx"
             "docx/image_no_embed.native"
@@ -305,6 +317,10 @@
             "blockquotes (parsing indent as blockquote)"
             "docx/block_quotes.docx"
             "docx/block_quotes_parse_indent.native"
+          , testCompare
+            "blockquotes (parsing indent relative to the indent of the parent style as blockquote)"
+            "docx/relative_indentation_blockquotes.docx"
+            "docx/relative_indentation_blockquotes.native"
           , testCompare
             "hanging indents"
             "docx/hanging_indent.docx"
diff --git a/test/Tests/Readers/Org/Meta.hs b/test/Tests/Readers/Org/Meta.hs
--- a/test/Tests/Readers/Org/Meta.hs
+++ b/test/Tests/Readers/Org/Meta.hs
@@ -238,7 +238,7 @@
                 , "  :setting: foo"
                 , "  :END:"
                 ] =?>
-      (mempty::Blocks)
+      (setMeta "setting" ("foo" :: T.Text) (doc mempty))
 
   , "Logbook drawer" =:
       T.unlines [ "  :LogBook:"
diff --git a/test/Tests/Writers/AsciiDoc.hs b/test/Tests/Writers/AsciiDoc.hs
--- a/test/Tests/Writers/AsciiDoc.hs
+++ b/test/Tests/Writers/AsciiDoc.hs
@@ -38,6 +38,22 @@
                para (singleQuoted (strong (text "foo"))) =?>
                  "`**foo**'"
           ]
+        , testGroup "blocks"
+          [ testAsciidoc "code block without line numbers" $
+               codeBlockWith ("", [ "haskell" ], []) "foo" =?> unlines
+                                           [ "[source,haskell]"
+                                           , "----"
+                                           , "foo"
+                                           , "----"
+                                           ]
+          , testAsciidoc "code block with line numbers" $
+               codeBlockWith ("", [ "haskell", "numberLines" ], []) "foo" =?> unlines
+                                           [ "[source%linesnum,haskell]"
+                                           , "----"
+                                           , "foo"
+                                           , "----"
+                                           ]
+          ]
         , testGroup "tables"
           [ testAsciidoc "empty cells" $
                simpleTable [] [[mempty],[mempty]] =?> unlines
diff --git a/test/Tests/Writers/HTML.hs b/test/Tests/Writers/HTML.hs
--- a/test/Tests/Writers/HTML.hs
+++ b/test/Tests/Writers/HTML.hs
@@ -8,8 +8,11 @@
 import Text.Pandoc.Arbitrary ()
 import Text.Pandoc.Builder
 
+htmlWithOpts :: (ToPandoc a) => WriterOptions -> a -> String
+htmlWithOpts opts = unpack . purely (writeHtml4String opts{ writerWrapText = WrapNone }) . toPandoc
+
 html :: (ToPandoc a) => a -> String
-html = unpack . purely (writeHtml4String def{ writerWrapText = WrapNone }) . toPandoc
+html = htmlWithOpts def
 
 htmlQTags :: (ToPandoc a) => a -> String
 htmlQTags = unpack
@@ -33,6 +36,21 @@
      => String -> (a, String) -> TestTree
 (=:) = test html
 
+noteTestDoc :: Blocks
+noteTestDoc =
+  header 1 "Page title" <>
+  header 2 "First section" <>
+  para ("This is a footnote." <>
+        note (para "Down here.") <>
+        " And this is a " <>
+        link "https://www.google.com" "" "link" <>
+        ".") <>
+  blockQuote (para ("A note inside a block quote." <>
+                    note (para "The second note.")) <>
+              para "A second paragraph.") <>
+  header 2 "Second section" <>
+  para "Some more text."
+
 tests :: [TestTree]
 tests =
   [ testGroup "inline code"
@@ -86,6 +104,61 @@
       =?> ("<var><code class=\"sourceCode haskell\">" ++
           "<span class=\"op\">&gt;&gt;=</span></code></var>")
     ]
+  , testGroup "footnotes"
+      [ test (htmlWithOpts def{writerReferenceLocation=EndOfDocument})
+        "at the end of a document" $
+        noteTestDoc =?>
+        concat
+          [ "<h1>Page title</h1>"
+          , "<h2>First section</h2>"
+          , "<p>This is a footnote.<a href=\"#fn1\" class=\"footnote-ref\" id=\"fnref1\"><sup>1</sup></a> And this is a <a href=\"https://www.google.com\">link</a>.</p>"
+          , "<blockquote><p>A note inside a block quote.<a href=\"#fn2\" class=\"footnote-ref\" id=\"fnref2\"><sup>2</sup></a></p><p>A second paragraph.</p></blockquote>"
+          , "<h2>Second section</h2>"
+          , "<p>Some more text.</p>"
+          , "<div class=\"footnotes footnotes-end-of-document\"><hr /><ol><li id=\"fn1\"><p>Down here.<a href=\"#fnref1\" class=\"footnote-back\">↩︎</a></p></li><li id=\"fn2\"><p>The second note.<a href=\"#fnref2\" class=\"footnote-back\">↩︎</a></p></li></ol></div>"
+          ]
+      , test (htmlWithOpts def{writerReferenceLocation=EndOfBlock})
+        "at the end of a block" $
+        noteTestDoc =?>
+        concat
+          [ "<h1>Page title</h1>"
+          , "<h2>First section</h2>"
+          , "<p>This is a footnote.<a href=\"#fn1\" class=\"footnote-ref\" id=\"fnref1\"><sup>1</sup></a> And this is a <a href=\"https://www.google.com\">link</a>.</p>"
+          , "<div class=\"footnotes footnotes-end-of-block\"><ol><li id=\"fn1\"><p>Down here.<a href=\"#fnref1\" class=\"footnote-back\">↩︎</a></p></li></ol></div>"
+          , "<blockquote><p>A note inside a block quote.<a href=\"#fn2\" class=\"footnote-ref\" id=\"fnref2\"><sup>2</sup></a></p><p>A second paragraph.</p></blockquote>"
+          , "<div class=\"footnotes footnotes-end-of-block\"><ol start=\"2\"><li id=\"fn2\"><p>The second note.<a href=\"#fnref2\" class=\"footnote-back\">↩︎</a></p></li></ol></div>"
+          , "<h2>Second section</h2>"
+          , "<p>Some more text.</p>"
+          ]
+      , test (htmlWithOpts def{writerReferenceLocation=EndOfSection})
+        "at the end of a section" $
+        noteTestDoc =?>
+        concat
+          [ "<h1>Page title</h1>"
+          , "<h2>First section</h2>"
+          , "<p>This is a footnote.<a href=\"#fn1\" class=\"footnote-ref\" id=\"fnref1\"><sup>1</sup></a> And this is a <a href=\"https://www.google.com\">link</a>.</p>"
+          , "<blockquote><p>A note inside a block quote.<a href=\"#fn2\" class=\"footnote-ref\" id=\"fnref2\"><sup>2</sup></a></p><p>A second paragraph.</p></blockquote>"
+          , "<div class=\"footnotes footnotes-end-of-section\"><hr /><ol><li id=\"fn1\"><p>Down here.<a href=\"#fnref1\" class=\"footnote-back\">↩︎</a></p></li><li id=\"fn2\"><p>The second note.<a href=\"#fnref2\" class=\"footnote-back\">↩︎</a></p></li></ol></div>"
+          , "<h2>Second section</h2>"
+          , "<p>Some more text.</p>"
+          ]
+      , test (htmlWithOpts def{writerReferenceLocation=EndOfSection, writerSectionDivs=True})
+        "at the end of a section, with section divs" $
+        noteTestDoc =?>
+        -- Footnotes are rendered _after_ their section (in this case after the level2 section
+        -- that contains it).
+        concat
+          [ "<div class=\"section level1\">"
+          , "<h1>Page title</h1>"
+          , "<div class=\"section level2\">"
+          , "<h2>First section</h2>"
+          , "<p>This is a footnote.<a href=\"#fn1\" class=\"footnote-ref\" id=\"fnref1\"><sup>1</sup></a> And this is a <a href=\"https://www.google.com\">link</a>.</p><blockquote><p>A note inside a block quote.<a href=\"#fn2\" class=\"footnote-ref\" id=\"fnref2\"><sup>2</sup></a></p><p>A second paragraph.</p></blockquote>"
+          , "</div>"
+          , "<div class=\"footnotes footnotes-end-of-section\"><hr /><ol><li id=\"fn1\"><p>Down here.<a href=\"#fnref1\" class=\"footnote-back\">↩︎</a></p></li><li id=\"fn2\"><p>The second note.<a href=\"#fnref2\" class=\"footnote-back\">↩︎</a></p></li></ol></div>"
+          , "<div class=\"section level2\"><h2>Second section</h2><p>Some more text.</p></div>"
+          , "</div>"
+          ]
+      ]
   ]
   where
     tQ :: (ToString a, ToPandoc a)
diff --git a/test/Tests/Writers/OOXML.hs b/test/Tests/Writers/OOXML.hs
--- a/test/Tests/Writers/OOXML.hs
+++ b/test/Tests/Writers/OOXML.hs
@@ -23,15 +23,15 @@
 -- We make a special exception for times at the moment, and just pass
 -- them because we can't control the utctime when running IO. Besides,
 -- so long as we have two times, we're okay.
-compareXML (Elem myElem) (Elem goodElem)
+compareXML (Elem goodElem) (Elem myElem)
   | (QName "created" _ (Just "dcterms")) <- elName myElem
   , (QName "created" _ (Just "dcterms")) <- elName goodElem =
       Nothing
-compareXML (Elem myElem) (Elem goodElem)
+compareXML (Elem goodElem) (Elem myElem)
   | (QName "modified" _ (Just "dcterms")) <- elName myElem
   , (QName "modified" _ (Just "dcterms")) <- elName goodElem =
       Nothing
-compareXML (Elem myElem) (Elem goodElem) =
+compareXML (Elem goodElem) (Elem myElem) =
   (if elName myElem == elName goodElem
    then Nothing
    else Just
@@ -46,16 +46,16 @@
                  , good = sort (elAttribs goodElem)
                  })))
   <|> asum (zipWith compareXML (elContent myElem) (elContent goodElem))
-compareXML (Text myCData) (Text goodCData) =
+compareXML (Text goodCData) (Text myCData) =
   (if cdVerbatim myCData == cdVerbatim goodCData
     && cdData myCData == cdData goodCData
    then Nothing
    else Just (CDatasDiffer (Comparison { mine = myCData, good = goodCData })))
-compareXML (CRef myStr) (CRef goodStr) =
+compareXML (CRef goodStr) (CRef myStr) =
   if myStr == goodStr
   then Nothing
   else Just (CRefsDiffer (Comparison { mine = myStr, good = goodStr }))
-compareXML m g = Just (OtherContentsDiffer (Comparison {mine = m, good = g}))
+compareXML g m = Just (OtherContentsDiffer (Comparison {mine = m, good = g}))
 
 data XMLDifference
   = ElemNamesDiffer (Comparison QName)
@@ -68,10 +68,10 @@
 data Comparison a = Comparison { good :: a, mine :: a }
   deriving (Show)
 
-displayDiff :: Content -> Content -> String
+displayDiff :: Element -> Element -> String
 displayDiff elemA elemB =
   showDiff (1,1)
-    (getDiff (lines $ showContent elemA) (lines $ showContent elemB))
+    (getDiff (lines $ ppElement elemA) (lines $ ppElement elemB))
 
 goldenArchive :: FilePath -> IO Archive
 goldenArchive fp = toArchive . BL.fromStrict <$> BS.readFile fp
@@ -137,7 +137,7 @@
       display difference = "Non-matching xml in "
         ++ fp ++ ":\n"
         ++ "* " ++ show difference ++ "\n"
-        ++ displayDiff testContent goldenContent
+        ++ displayDiff testXMLDoc goldenXMLDoc
 
 
   maybe (Right ()) (Left . display) (compareXML goldenContent testContent)
diff --git a/test/Tests/Writers/Powerpoint.hs b/test/Tests/Writers/Powerpoint.hs
--- a/test/Tests/Writers/Powerpoint.hs
+++ b/test/Tests/Writers/Powerpoint.hs
@@ -7,7 +7,6 @@
 import Text.DocTemplates (ToContext(toVal), Context(..))
 import qualified Data.Map as M
 import Data.Text (pack)
-import Data.List (unzip4)
 
 -- templating is important enough, and can break enough things, that
 -- we want to run all our tests with both default formatting and a
@@ -15,13 +14,11 @@
 
 modifyPptxName :: FilePath -> String -> FilePath
 modifyPptxName fp suffix =
-  addExtension (dropExtension fp ++ suffix) "pptx"
+  addExtension (takeDirectory fp ++ suffix) "pptx"
 
-pptxTests :: String -> WriterOptions -> FilePath -> FilePath -> (TestTree, TestTree, TestTree, TestTree)
+pptxTests :: String -> WriterOptions -> FilePath -> FilePath -> (TestTree, TestTree)
 pptxTests name opts native pptx =
-  let referenceDoc = "pptx/reference_depth.pptx"
-      movedLayoutsReferenceDoc = "pptx/reference_moved_layouts.pptx"
-      deletedLayoutsReferenceDoc = "pptx/reference_deleted_layouts.pptx"
+  let referenceDoc = "pptx/reference-depth.pptx"
   in
     ( ooxmlTest
       writePowerpoint
@@ -34,116 +31,245 @@
       name
       opts{writerReferenceDoc=Just referenceDoc}
       native
-      (modifyPptxName pptx "_templated")
-    , ooxmlTest
-      writePowerpoint
-      name
-      opts{writerReferenceDoc=Just movedLayoutsReferenceDoc}
-      native
-      (modifyPptxName pptx "_moved_layouts")
-    , ooxmlTest
-      writePowerpoint
-      name
-      opts{writerReferenceDoc=Just deletedLayoutsReferenceDoc}
-      native
-      (modifyPptxName pptx "_deleted_layouts")
+      (modifyPptxName pptx "/templated")
     )
 
-groupPptxTests :: [(TestTree, TestTree, TestTree, TestTree)] -> [TestTree]
+groupPptxTests :: [(TestTree, TestTree)] -> [TestTree]
 groupPptxTests pairs =
-  let (noRefs, refs, movedLayouts, deletedLayouts) = unzip4 pairs
+  let (noRefs, refs) = unzip pairs
   in
     [ testGroup "Default slide formatting" noRefs
     , testGroup "With `--reference-doc` pptx file" refs
-    , testGroup "With layouts in reference doc moved" movedLayouts
-    , testGroup "With layouts in reference doc deleted" deletedLayouts
     ]
 
 
 tests :: [TestTree]
-tests = groupPptxTests [ pptxTests "Inline formatting"
-                         def
-                         "pptx/inline_formatting.native"
-                         "pptx/inline_formatting.pptx"
-                       , pptxTests "Slide breaks (default slide-level)"
-                         def
-                         "pptx/slide_breaks.native"
-                         "pptx/slide_breaks.pptx"
-                       , pptxTests "slide breaks (slide-level set to 1)"
-                         def{ writerSlideLevel = Just 1 }
-                         "pptx/slide_breaks.native"
-                         "pptx/slide_breaks_slide_level_1.pptx"
-                       , pptxTests "lists"
-                         def
-                         "pptx/lists.native"
-                         "pptx/lists.pptx"
-                       , pptxTests "start ordered list at specified num"
-                         def
-                         "pptx/start_numbering_at.native"
-                         "pptx/start_numbering_at.pptx"
-                       , pptxTests "tables"
-                         def
-                         "pptx/tables.native"
-                         "pptx/tables.pptx"
-                       , pptxTests "table of contents"
-                         def{ writerTableOfContents = True }
-                         "pptx/slide_breaks.native"
-                         "pptx/slide_breaks_toc.pptx"
-                       , pptxTests "end notes"
-                         def
-                         "pptx/endnotes.native"
-                         "pptx/endnotes.pptx"
-                       , pptxTests "end notes, with table of contents"
-                         def { writerTableOfContents = True }
-                         "pptx/endnotes.native"
-                         "pptx/endnotes_toc.pptx"
-                       , pptxTests "images"
-                         def
-                         "pptx/images.native"
-                         "pptx/images.pptx"
-                       , pptxTests "two-column layout"
-                         def
-                         "pptx/two_column.native"
-                         "pptx/two_column.pptx"
-                       , pptxTests "speaker notes"
-                         def
-                         "pptx/speaker_notes.native"
-                         "pptx/speaker_notes.pptx"
-                       , pptxTests "speaker notes after a separating block"
-                         def
-                         "pptx/speaker_notes_afterseps.native"
-                         "pptx/speaker_notes_afterseps.pptx"
-                       , pptxTests "speaker notes after a separating header"
-                         def
-                         "pptx/speaker_notes_afterheader.native"
-                         "pptx/speaker_notes_afterheader.pptx"
-                       , pptxTests "speaker notes after metadata"
-                         def
-                         "pptx/speaker_notes_after_metadata.native"
-                         "pptx/speaker_notes_after_metadata.pptx"
-                       , pptxTests "remove empty slides"
-                         def
-                         "pptx/remove_empty_slides.native"
-                         "pptx/remove_empty_slides.pptx"
-                       , pptxTests "raw ooxml"
-                         def
-                         "pptx/raw_ooxml.native"
-                         "pptx/raw_ooxml.pptx"
-                       , pptxTests "metadata, custom properties"
-                         def
-                         "pptx/document-properties.native"
-                         "pptx/document-properties.pptx"
-                       , pptxTests "metadata, short description"
-                         def
-                         "pptx/document-properties-short-desc.native"
-                         "pptx/document-properties-short-desc.pptx"
-                       , pptxTests "inline code and code blocks"
-                         def
-                         "pptx/code.native"
-                         "pptx/code.pptx"
-                       , pptxTests "inline code and code blocks, custom formatting"
-                         def { writerVariables = Context $ M.fromList
-                                 [(pack "monofont", toVal $ pack "Consolas")] }
-                         "pptx/code.native"
-                         "pptx/code-custom.pptx"
-                       ]
+tests = let
+  regularTests =
+    groupPptxTests [ pptxTests "Inline formatting"
+                     def
+                     "pptx/inline-formatting/input.native"
+                     "pptx/inline-formatting/output.pptx"
+                   , pptxTests "Slide breaks (default slide-level)"
+                     def
+                     "pptx/slide-breaks/input.native"
+                     "pptx/slide-breaks/output.pptx"
+                   , pptxTests "slide breaks (slide-level set to 1)"
+                     def{ writerSlideLevel = Just 1 }
+                     "pptx/slide-breaks/input.native"
+                     "pptx/slide-breaks-slide-level-1/output.pptx"
+                   , pptxTests "lists"
+                     def
+                     "pptx/lists/input.native"
+                     "pptx/lists/output.pptx"
+                   , pptxTests "start ordered list at specified num"
+                     def
+                     "pptx/start-numbering-at/input.native"
+                     "pptx/start-numbering-at/output.pptx"
+                   , pptxTests "List continuation paragraph indentation"
+                     def
+                     "pptx/list-level/input.native"
+                     "pptx/list-level/output.pptx"
+                   , pptxTests "tables"
+                     def
+                     "pptx/tables/input.native"
+                     "pptx/tables/output.pptx"
+                   , pptxTests "table of contents"
+                     def{ writerTableOfContents = True }
+                     "pptx/slide-breaks/input.native"
+                     "pptx/slide-breaks-toc/output.pptx"
+                   , pptxTests "end notes"
+                     def
+                     "pptx/endnotes/input.native"
+                     "pptx/endnotes/output.pptx"
+                   , pptxTests "end notes, with table of contents"
+                     def { writerTableOfContents = True }
+                     "pptx/endnotes/input.native"
+                     "pptx/endnotes-toc/output.pptx"
+                   , pptxTests "images"
+                     def
+                     "pptx/images/input.native"
+                     "pptx/images/output.pptx"
+                   , pptxTests "two-column layout"
+                     def
+                     "pptx/two-column/all-text/input.native"
+                     "pptx/two-column/all-text/output.pptx"
+                   , pptxTests "two-column (not comparison)"
+                     def
+                     "pptx/two-column/text-and-image/input.native"
+                     "pptx/two-column/text-and-image/output.pptx"
+                   , pptxTests "speaker notes"
+                     def
+                     "pptx/speaker-notes/input.native"
+                     "pptx/speaker-notes/output.pptx"
+                   , pptxTests "speaker notes after a separating block"
+                     def
+                     "pptx/speaker-notes-afterseps/input.native"
+                     "pptx/speaker-notes-afterseps/output.pptx"
+                   , pptxTests "speaker notes after a separating header"
+                     def
+                     "pptx/speaker-notes-afterheader/input.native"
+                     "pptx/speaker-notes-afterheader/output.pptx"
+                   , pptxTests "speaker notes after metadata"
+                     def
+                     "pptx/speaker-notes-after-metadata/input.native"
+                     "pptx/speaker-notes-after-metadata/output.pptx"
+                   , pptxTests "remove empty slides"
+                     def
+                     "pptx/remove-empty-slides/input.native"
+                     "pptx/remove-empty-slides/output.pptx"
+                   , pptxTests "raw ooxml"
+                     def
+                     "pptx/raw-ooxml/input.native"
+                     "pptx/raw-ooxml/output.pptx"
+                   , pptxTests "metadata, custom properties"
+                     def
+                     "pptx/document-properties/input.native"
+                     "pptx/document-properties/output.pptx"
+                   , pptxTests "metadata, short description"
+                     def
+                     "pptx/document-properties-short-desc/input.native"
+                     "pptx/document-properties-short-desc/output.pptx"
+                   , pptxTests "inline code and code blocks"
+                     def
+                     "pptx/code/input.native"
+                     "pptx/code/output.pptx"
+                   , pptxTests "inline code and code blocks, custom formatting"
+                     def { writerVariables = Context $ M.fromList
+                             [(pack "monofont", toVal $ pack "Consolas")] }
+                     "pptx/code/input.native"
+                     "pptx/code-custom/output.pptx"
+                   , pptxTests ("Using slide level 0, if the first thing on "
+                                <> "a slide is a h1 it's used as the "
+                                <> "slide title")
+                     def { writerSlideLevel = Just 0 }
+                     "pptx/slide-level-0/h1-with-image/input.native"
+                     "pptx/slide-level-0/h1-with-image/output.pptx"
+                   , pptxTests ("Using slide level 0, if the first thing on "
+                                <> "a slide is a h2 it's used as the "
+                                <> "slide title")
+                     def { writerSlideLevel = Just 0 }
+                     "pptx/slide-level-0/h2-with-image/input.native"
+                     "pptx/slide-level-0/h2-with-image/output.pptx"
+                   , pptxTests ("Using slide level 0, if the first thing on "
+                                <> "a slide is a heading it's used as the "
+                                <> "slide title (works with a table)")
+                     def { writerSlideLevel = Just 0 }
+                     "pptx/slide-level-0/h1-with-table/input.native"
+                     "pptx/slide-level-0/h1-with-table/output.pptx"
+                   , pptxTests ("Using slide level 0, if the first thing on "
+                                <> "a slide is a heading it's used as the "
+                                <> "slide title (content with caption layout)")
+                     def { writerSlideLevel = Just 0 }
+                     "pptx/slide-level-0/h1-h2-with-table/input.native"
+                     "pptx/slide-level-0/h1-h2-with-table/output.pptx"
+                   , pptxTests ("comparison layout used when two columns "
+                                <> "contain text plus non-text")
+                     def
+                     "pptx/comparison/both-columns/input.native"
+                     "pptx/comparison/both-columns/output.pptx"
+                   , pptxTests ("comparison layout used even when only one "
+                                <> "column contains text plus non-text")
+                     def
+                     "pptx/comparison/one-column/input.native"
+                     "pptx/comparison/one-column/output.pptx"
+                   , pptxTests ("extra text in one column in comparison "
+                                <> "layout gets overlaid")
+                     def
+                     "pptx/comparison/extra-text/input.native"
+                     "pptx/comparison/extra-text/output.pptx"
+                   , pptxTests ("extra image in one column in comparison "
+                               <> "layout gets overlaid")
+                     def
+                     "pptx/comparison/extra-image/input.native"
+                     "pptx/comparison/extra-image/output.pptx"
+                   , pptxTests "comparison not used if the non-text comes first"
+                     def
+                     "pptx/comparison/non-text-first/input.native"
+                     "pptx/comparison/non-text-first/output.pptx"
+                   , pptxTests ("Heading, text and an image on the same "
+                                <> "slide uses the Content with Caption "
+                                <> "layout")
+                     def
+                     "pptx/content-with-caption/heading-text-image/input.native"
+                     "pptx/content-with-caption/heading-text-image/output.pptx"
+                   , pptxTests ("Text and an image on the same "
+                                <> "slide uses the Content with Caption "
+                                <> "layout")
+                     def
+                     "pptx/content-with-caption/text-image/input.native"
+                     "pptx/content-with-caption/text-image/output.pptx"
+                   , pptxTests ("If the image comes first, Content with "
+                                <> "Caption is not used")
+                     def
+                     "pptx/content-with-caption/image-text/input.native"
+                     "pptx/content-with-caption/image-text/output.pptx"
+                   , pptxTests ("If a slide contains only speaker notes, the "
+                                <> "Blank layout is used")
+                     def
+                     "pptx/blanks/just-speaker-notes/input.native"
+                     "pptx/blanks/just-speaker-notes/output.pptx"
+                   , pptxTests ("If a slide contains only an empty heading "
+                                <> "with a body of only non-breaking spaces"
+                                <> ", the Blank layout is used")
+                     def
+                     "pptx/blanks/nbsp-in-body/input.native"
+                     "pptx/blanks/nbsp-in-body/output.pptx"
+                   , pptxTests ("If a slide contains only a heading "
+                                <> "containing only non-breaking spaces, "
+                                <> "the Blank layout is used")
+                     def
+                     "pptx/blanks/nbsp-in-heading/input.native"
+                     "pptx/blanks/nbsp-in-heading/output.pptx"
+                   , pptxTests ("Incremental lists are supported")
+                     def { writerIncremental = True }
+                     "pptx/incremental-lists/with-flag/input.native"
+                     "pptx/incremental-lists/with-flag/output.pptx"
+                   , pptxTests ("One-off incremental lists are supported")
+                     def
+                     "pptx/incremental-lists/without-flag/input.native"
+                     "pptx/incremental-lists/without-flag/output.pptx"
+                   , pptxTests "Background images"
+                     def
+                     "pptx/background-image/input.native"
+                     "pptx/background-image/output.pptx"
+                   ]
+  referenceSpecificTests =
+    [ ooxmlTest
+      writePowerpoint
+      "Basic footer"
+      def { writerReferenceDoc = Just "pptx/footer/basic/reference.pptx"}
+      "pptx/footer/input.native"
+      "pptx/footer/basic/output.pptx"
+    , ooxmlTest
+      writePowerpoint
+      "Footer with fixed date, replaced by meta block date"
+      def { writerReferenceDoc = Just "pptx/footer/fixed-date/reference.pptx"}
+      "pptx/footer/input.native"
+      "pptx/footer/fixed-date/output.pptx"
+    , ooxmlTest
+      writePowerpoint
+      "Footer not shown on title slide"
+      def { writerReferenceDoc = Just "pptx/footer/no-title-slide/reference.pptx"}
+      "pptx/footer/input.native"
+      "pptx/footer/no-title-slide/output.pptx"
+    , ooxmlTest
+      writePowerpoint
+      "Footer with slide number starting from 3"
+      def { writerReferenceDoc = Just "pptx/footer/higher-slide-number/reference.pptx"}
+      "pptx/footer/input.native"
+      "pptx/footer/higher-slide-number/output.pptx"
+    , ooxmlTest
+      writePowerpoint
+      "Layouts can be moved around in reference doc"
+      def {writerReferenceDoc = Just "pptx/reference-moved-layouts.pptx"}
+      "pptx/layouts/input.native"
+      "pptx/layouts/moved.pptx"
+    , ooxmlTest
+      writePowerpoint
+      "Layouts can be missing from the reference doc"
+      def {writerReferenceDoc = Just "pptx/reference-deleted-layouts.pptx"}
+      "pptx/layouts/input.native"
+      "pptx/layouts/deleted.pptx"
+    ]
+  in regularTests <> referenceSpecificTests
diff --git a/test/command/1279.md b/test/command/1279.md
--- a/test/command/1279.md
+++ b/test/command/1279.md
@@ -1,5 +1,5 @@
 ```
-pandoc -s -t markdown
+% pandoc -s -t markdown
 ---
 author: 'John Doe[^1]'
 date: 2014
diff --git a/test/command/1390.md b/test/command/1390.md
--- a/test/command/1390.md
+++ b/test/command/1390.md
@@ -3,7 +3,13 @@
 \newcommand\foo{+}
 Testing: $\mu\foo\eta$.
 ^D
-[Para [Str "Testing:",Space,Math InlineMath "\\mu+\\eta",Str "."]]
+[ Para
+    [ Str "Testing:"
+    , Space
+    , Math InlineMath "\\mu+\\eta"
+    , Str "."
+    ]
+]
 ```
 
 <!-- It would be nice to handle this case, but I don't
diff --git a/test/command/1592.md b/test/command/1592.md
--- a/test/command/1592.md
+++ b/test/command/1592.md
@@ -2,35 +2,35 @@
 % pandoc -t native
 [hi]{.smallcaps}
 ^D
-[Para [SmallCaps [Str "hi"]]]
+[ Para [ SmallCaps [ Str "hi" ] ] ]
 ```
 
 ```
 % pandoc -t native
 [hi]{style="font-variant: small-caps;"}
 ^D
-[Para [SmallCaps [Str "hi"]]]
+[ Para [ SmallCaps [ Str "hi" ] ] ]
 ```
 
 ```
 % pandoc -t native
 <span class="smallcaps">hi</span>
 ^D
-[Para [SmallCaps [Str "hi"]]]
+[ Para [ SmallCaps [ Str "hi" ] ] ]
 ```
 
 ```
 % pandoc -f html -t native
 <p><span class="smallcaps">hi</span></p>
 ^D
-[Para [SmallCaps [Str "hi"]]]
+[ Para [ SmallCaps [ Str "hi" ] ] ]
 ```
 
 ```
 % pandoc -f html -t native
 <p><span style="font-variant:small-caps">hi</span></p>
 ^D
-[Para [SmallCaps [Str "hi"]]]
+[ Para [ SmallCaps [ Str "hi" ] ] ]
 ```
 
 ```
@@ -41,7 +41,7 @@
 ```
 
 ```
-pandoc -f native -t markdown
+% pandoc -f native -t markdown
 [Para [SmallCaps [Str "hi"]]]
 ^D
 [hi]{.smallcaps}
@@ -51,14 +51,24 @@
 % pandoc -f html -t native
 <bdo dir="ltr">foo</bdo>
 ^D
-[Plain [Span ("",[],[("dir","ltr")]) [Str "foo"]]]
+[ Plain
+    [ Span ( "" , [] , [ ( "dir" , "ltr" ) ] ) [ Str "foo" ] ]
+]
 ```
 
 ```
 % pandoc -f html -t native
 <bdo dir="rtl">foo<bdo dir="ltr">bar</bdo>baz</bdo>
 ^D
-[Plain [Span ("",[],[("dir","rtl")]) [Str "foo",Span ("",[],[("dir","ltr")]) [Str "bar"],Str "baz"]]]
+[ Plain
+    [ Span
+        ( "" , [] , [ ( "dir" , "rtl" ) ] )
+        [ Str "foo"
+        , Span ( "" , [] , [ ( "dir" , "ltr" ) ] ) [ Str "bar" ]
+        , Str "baz"
+        ]
+    ]
+]
 ```
 
 ```
@@ -66,5 +76,23 @@
 <p><bdo dir="rtl">This text will go right
 to left.</bdo></p>
 ^D
-[Para [Span ("",[],[("dir","rtl")]) [Str "This",Space,Str "text",Space,Str "will",Space,Str "go",Space,Str "right",SoftBreak,Str "to",Space,Str "left."]]]
+[ Para
+    [ Span
+        ( "" , [] , [ ( "dir" , "rtl" ) ] )
+        [ Str "This"
+        , Space
+        , Str "text"
+        , Space
+        , Str "will"
+        , Space
+        , Str "go"
+        , Space
+        , Str "right"
+        , SoftBreak
+        , Str "to"
+        , Space
+        , Str "left."
+        ]
+    ]
+]
 ```
diff --git a/test/command/1608.md b/test/command/1608.md
--- a/test/command/1608.md
+++ b/test/command/1608.md
@@ -28,14 +28,178 @@
 These are all pretty interesting facts.
 \end{remark}
 ^D
-[Div ("def:tri",["definition"],[])
- [Para [Strong [Str "Definition",Space,Str "1"],Space,Str "(right-angled",Space,Str "triangles).",Space,Space,Str "A",Space,Emph [Str "right-angled",Space,Str "triangle"],Space,Str "is",Space,Str "a",Space,Str "triangle",Space,Str "whose",Space,Str "sides",Space,Str "of",Space,Str "length\160",Math InlineMath "a",Str ",",Space,Math InlineMath "b",Space,Str "and\160",Math InlineMath "c",Str ",",Space,Str "in",Space,Str "some",Space,Str "permutation",Space,Str "of",Space,Str "order,",Space,Str "satisfies",Space,Math InlineMath "a^2+b^2=c^2",Str "."]]
-,Div ("",["lemma"],[])
- [Para [Strong [Str "Lemma",Space,Str "2"],Str ".",Space,Space,Emph [Str "The",Space,Str "triangle",Space,Str "with",Space,Str "sides",Space,Str "of",Space,Str "length\160",Math InlineMath "3",Str ",",Space,Math InlineMath "4",Space,Str "and\160",Math InlineMath "5",Space,Str "is",Space,Str "right-angled."]]]
-,Div ("",["proof"],[])
- [Para [Emph [Str "Proof."],Space,Str "This",Space,Str "lemma",Space,Str "follows",Space,Str "from",Space,Link ("",[],[("reference-type","ref"),("reference","def:tri")]) [Str "Definition\160\&1"] ("#def:tri",""),Space,Str "since",Space,Math InlineMath "3^2+4^2=9+16=25=5^2",Str ".",Str "\160\9723"]]
-,Div ("thm:py",["theorem"],[])
- [Para [Strong [Str "Theorem",Space,Str "3"],Space,Str "(Pythagorean",Space,Str "triplets).",Space,Space,Emph [Str "Triangles",Space,Str "with",Space,Str "sides",Space,Str "of",Space,Str "length",Space,Math InlineMath "a=p^2-q^2",Str ",",Space,Math InlineMath "b=2pq",Space,Str "and",Space,Math InlineMath "c=p^2+q^2",Space,Str "are",Space,Str "right-angled",Space,Str "triangles."]]]
-,Div ("",["remark"],[])
- [Para [Emph [Str "Remark",Space,Str "1"],Str ".",Space,Space,Str "These",Space,Str "are",Space,Str "all",Space,Str "pretty",Space,Str "interesting",Space,Str "facts."]]]
+[ Div
+    ( "def:tri" , [ "definition" ] , [] )
+    [ Para
+        [ Strong [ Str "Definition" , Space , Str "1" ]
+        , Space
+        , Str "(right-angled"
+        , Space
+        , Str "triangles)."
+        , Space
+        , Space
+        , Str "A"
+        , Space
+        , Emph [ Str "right-angled" , Space , Str "triangle" ]
+        , Space
+        , Str "is"
+        , Space
+        , Str "a"
+        , Space
+        , Str "triangle"
+        , Space
+        , Str "whose"
+        , Space
+        , Str "sides"
+        , Space
+        , Str "of"
+        , Space
+        , Str "length\160"
+        , Math InlineMath "a"
+        , Str ","
+        , Space
+        , Math InlineMath "b"
+        , Space
+        , Str "and\160"
+        , Math InlineMath "c"
+        , Str ","
+        , Space
+        , Str "in"
+        , Space
+        , Str "some"
+        , Space
+        , Str "permutation"
+        , Space
+        , Str "of"
+        , Space
+        , Str "order,"
+        , Space
+        , Str "satisfies"
+        , Space
+        , Math InlineMath "a^2+b^2=c^2"
+        , Str "."
+        ]
+    ]
+, Div
+    ( "" , [ "lemma" ] , [] )
+    [ Para
+        [ Strong [ Str "Lemma" , Space , Str "2" ]
+        , Str "."
+        , Space
+        , Space
+        , Emph
+            [ Str "The"
+            , Space
+            , Str "triangle"
+            , Space
+            , Str "with"
+            , Space
+            , Str "sides"
+            , Space
+            , Str "of"
+            , Space
+            , Str "length\160"
+            , Math InlineMath "3"
+            , Str ","
+            , Space
+            , Math InlineMath "4"
+            , Space
+            , Str "and\160"
+            , Math InlineMath "5"
+            , Space
+            , Str "is"
+            , Space
+            , Str "right-angled."
+            ]
+        ]
+    ]
+, Div
+    ( "" , [ "proof" ] , [] )
+    [ Para
+        [ Emph [ Str "Proof." ]
+        , Space
+        , Str "This"
+        , Space
+        , Str "lemma"
+        , Space
+        , Str "follows"
+        , Space
+        , Str "from"
+        , Space
+        , Link
+            ( ""
+            , []
+            , [ ( "reference-type" , "ref" )
+              , ( "reference" , "def:tri" )
+              ]
+            )
+            [ Str "Definition\160\&1" ]
+            ( "#def:tri" , "" )
+        , Space
+        , Str "since"
+        , Space
+        , Math InlineMath "3^2+4^2=9+16=25=5^2"
+        , Str "."
+        , Str "\160\9723"
+        ]
+    ]
+, Div
+    ( "thm:py" , [ "theorem" ] , [] )
+    [ Para
+        [ Strong [ Str "Theorem" , Space , Str "3" ]
+        , Space
+        , Str "(Pythagorean"
+        , Space
+        , Str "triplets)."
+        , Space
+        , Space
+        , Emph
+            [ Str "Triangles"
+            , Space
+            , Str "with"
+            , Space
+            , Str "sides"
+            , Space
+            , Str "of"
+            , Space
+            , Str "length"
+            , Space
+            , Math InlineMath "a=p^2-q^2"
+            , Str ","
+            , Space
+            , Math InlineMath "b=2pq"
+            , Space
+            , Str "and"
+            , Space
+            , Math InlineMath "c=p^2+q^2"
+            , Space
+            , Str "are"
+            , Space
+            , Str "right-angled"
+            , Space
+            , Str "triangles."
+            ]
+        ]
+    ]
+, Div
+    ( "" , [ "remark" ] , [] )
+    [ Para
+        [ Emph [ Str "Remark" , Space , Str "1" ]
+        , Str "."
+        , Space
+        , Space
+        , Str "These"
+        , Space
+        , Str "are"
+        , Space
+        , Str "all"
+        , Space
+        , Str "pretty"
+        , Space
+        , Str "interesting"
+        , Space
+        , Str "facts."
+        ]
+    ]
+]
 ```
diff --git a/test/command/168.md b/test/command/168.md
--- a/test/command/168.md
+++ b/test/command/168.md
@@ -11,13 +11,25 @@
 :::
 :::::::::::::::::::::::::::::::
 ^D
-[Div ("",["warning"],[])
- [Para [Str "This",Space,Str "is",Space,Str "the",Space,Str "warning!"]
- ,OrderedList (1,Decimal,Period)
-  [[Plain [Str "list"]]
-  ,[Plain [Str "another"]]]
- ,Div ("myid",["class"],[("key","val")])
-  [Para [Str "nested",Space,Str "div"]]]]
+[ Div
+    ( "" , [ "warning" ] , [] )
+    [ Para
+        [ Str "This"
+        , Space
+        , Str "is"
+        , Space
+        , Str "the"
+        , Space
+        , Str "warning!"
+        ]
+    , OrderedList
+        ( 1 , Decimal , Period )
+        [ [ Plain [ Str "list" ] ] , [ Plain [ Str "another" ] ] ]
+    , Div
+        ( "myid" , [ "class" ] , [ ( "key" , "val" ) ] )
+        [ Para [ Str "nested" , Space , Str "div" ] ]
+    ]
+]
 ```
 
 ```
@@ -26,7 +38,14 @@
 :::
 bar
 ^D
-[Para [Str "foo",SoftBreak,Str ":::",SoftBreak,Str "bar"]]
+[ Para
+    [ Str "foo"
+    , SoftBreak
+    , Str ":::"
+    , SoftBreak
+    , Str "bar"
+    ]
+]
 ```
 
 ```
@@ -37,7 +56,18 @@
 And another.
 :::::
 ^D
-[Div ("",["Warning"],[])
- [Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "paragraph."]
- ,Para [Str "And",Space,Str "another."]]]
+[ Div
+    ( "" , [ "Warning" ] , [] )
+    [ Para
+        [ Str "Here"
+        , Space
+        , Str "is"
+        , Space
+        , Str "a"
+        , Space
+        , Str "paragraph."
+        ]
+    , Para [ Str "And" , Space , Str "another." ]
+    ]
+]
 ```
diff --git a/test/command/1718.md b/test/command/1718.md
--- a/test/command/1718.md
+++ b/test/command/1718.md
@@ -7,5 +7,13 @@
 [^2]: the second, unused, note.
 ^D
 [WARNING] Note with key '2' defined at line 5 column 1 but not used.
-[Para [Str "Note",Note [Para [Str "the",Space,Str "first",Space,Str "note."]],Str "."]]
+[ Para
+    [ Str "Note"
+    , Note
+        [ Para
+            [ Str "the" , Space , Str "first" , Space , Str "note." ]
+        ]
+    , Str "."
+    ]
+]
 ```
diff --git a/test/command/1773.md b/test/command/1773.md
--- a/test/command/1773.md
+++ b/test/command/1773.md
@@ -2,5 +2,7 @@
 % pandoc -f latex+raw_tex -t native
 \noindent hi
 ^D
-[Para [RawInline (Format "latex") "\\noindent ",Str "hi"]]
+[ Para
+    [ RawInline (Format "latex") "\\noindent " , Str "hi" ]
+]
 ```
diff --git a/test/command/1881.md b/test/command/1881.md
--- a/test/command/1881.md
+++ b/test/command/1881.md
@@ -20,35 +20,92 @@
 </tbody>
 </table>
 ^D
-[Table ("",[],[]) (Caption Nothing
- [Plain [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",["header"],[])
-  [Cell ("",[],[]) AlignRight (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignLeft (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",["odd"],[])
-   [Cell ("",[],[]) AlignRight (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignLeft (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption
+       Nothing
+       [ Plain
+           [ Str "Demonstration"
+           , Space
+           , Str "of"
+           , Space
+           , Str "simple"
+           , Space
+           , Str "table"
+           , Space
+           , Str "syntax."
+           ]
+       ])
+    [ ( AlignRight , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [ "header" ] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignRight
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignLeft
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignCenter
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Center" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [ "odd" ] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignRight
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignLeft
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 
 ```
@@ -62,26 +119,49 @@
 </tr>
 </table>
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",["odd"],[])
-   [Cell ("",[],[]) AlignRight (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignLeft (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignRight (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignRight , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    , ( AlignRight , ColWidthDefault )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [ "odd" ] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignRight
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignLeft
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignRight
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 
diff --git a/test/command/2103.md b/test/command/2103.md
--- a/test/command/2103.md
+++ b/test/command/2103.md
@@ -1,5 +1,5 @@
 ```
-pandoc -t latex
+% pandoc -t latex
 | A happy pandoc user said "fix this bug please
 | or I'll go crazy!"
 ^D
diff --git a/test/command/2118.md b/test/command/2118.md
--- a/test/command/2118.md
+++ b/test/command/2118.md
@@ -7,5 +7,11 @@
   \label{fig:setminus}
 \end{figure}
 ^D
-[Para [Image ("fig:setminus",[],[("width","80%")]) [Str "Set",Space,Str "subtraction"] ("setminus.png","fig:")]]
+[ Para
+    [ Image
+        ( "fig:setminus" , [] , [ ( "width" , "80%" ) ] )
+        [ Str "Set" , Space , Str "subtraction" ]
+        ( "setminus.png" , "fig:" )
+    ]
+]
 ```
diff --git a/test/command/2549.md b/test/command/2549.md
--- a/test/command/2549.md
+++ b/test/command/2549.md
@@ -4,7 +4,9 @@
 \section{A section}\label{foo}
 }
 ^D
-[Header 1 ("foo",[],[]) [Str "A",Space,Str "section"]]
+[ Header
+    1 ( "foo" , [] , [] ) [ Str "A" , Space , Str "section" ]
+]
 ```
 
 ```
@@ -13,15 +15,24 @@
 \section{A section}\label{foo}
 }
 ^D
-[Div ("bar",[],[])
- [Header 1 ("foo",[],[]) [Str "A",Space,Str "section"]]]
+[ Div
+    ( "bar" , [] , [] )
+    [ Header
+        1 ( "foo" , [] , [] ) [ Str "A" , Space , Str "section" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 Bar \hypertarget{foo}{Foo}
 ^D
-[Para [Str "Bar",Space,Span ("foo",[],[]) [Str "Foo"]]]
+[ Para
+    [ Str "Bar"
+    , Space
+    , Span ( "foo" , [] , [] ) [ Str "Foo" ]
+    ]
+]
 ```
 
 ```
@@ -32,7 +43,8 @@
 \end{verbatim}
 }
 ^D
-[Div ("foo",[],[])
- [CodeBlock ("",[],[]) "bar"]]
+[ Div
+    ( "foo" , [] , [] ) [ CodeBlock ( "" , [] , [] ) "bar" ]
+]
 ```
 
diff --git a/test/command/256.md b/test/command/256.md
--- a/test/command/256.md
+++ b/test/command/256.md
@@ -2,11 +2,41 @@
 % pandoc --abbreviations=command/abbrevs -t native
 Foo. bar baz h.k. and e.g. and Mr. Brown.
 ^D
-[Para [Str "Foo.\160bar",Space,Str "baz",Space,Str "h.k.\160and",Space,Str "e.g.",Space,Str "and",Space,Str "Mr.",Space,Str "Brown."]]
+[ Para
+    [ Str "Foo.\160bar"
+    , Space
+    , Str "baz"
+    , Space
+    , Str "h.k.\160and"
+    , Space
+    , Str "e.g."
+    , Space
+    , Str "and"
+    , Space
+    , Str "Mr."
+    , Space
+    , Str "Brown."
+    ]
+]
 ```
 ```
 % pandoc -t native
 Foo. bar baz h.k. and e.g. and Mr. Brown.
 ^D
-[Para [Str "Foo.",Space,Str "bar",Space,Str "baz",Space,Str "h.k.",Space,Str "and",Space,Str "e.g.\160and",Space,Str "Mr.\160Brown."]]
+[ Para
+    [ Str "Foo."
+    , Space
+    , Str "bar"
+    , Space
+    , Str "baz"
+    , Space
+    , Str "h.k."
+    , Space
+    , Str "and"
+    , Space
+    , Str "e.g.\160and"
+    , Space
+    , Str "Mr.\160Brown."
+    ]
+]
 ```
diff --git a/test/command/3113.md b/test/command/3113.md
--- a/test/command/3113.md
+++ b/test/command/3113.md
@@ -8,6 +8,11 @@
 E&=&F
 \end{eqnarray}
 ^D
-[Para [Math DisplayMath "\\begin{aligned}\nA&=&B,\\\\\nC&=&D,\\\\\n%\\end{eqnarray}\n%\\begin{eqnarray}\nE&=&F\\end{aligned}"]]
+[ Para
+    [ Math
+        DisplayMath
+        "\\begin{aligned}\nA&=&B,\\\\\nC&=&D,\\\\\n%\\end{eqnarray}\n%\\begin{eqnarray}\nE&=&F\\end{aligned}"
+    ]
+]
 ```
 
diff --git a/test/command/3123.md b/test/command/3123.md
--- a/test/command/3123.md
+++ b/test/command/3123.md
@@ -2,12 +2,16 @@
 % pandoc -f markdown -t native
 <?php echo "1" ; ?>
 ^D
-[RawBlock (Format "html") "<?php echo \"1\" ; ?>"]
+[ RawBlock (Format "html") "<?php echo \"1\" ; ?>" ]
 ```
 
 ```
 % pandoc -f markdown -t native
 a<?php echo "1" ; ?>
 ^D
-[Para [Str "a",RawInline (Format "html") "<?php echo \"1\" ; ?>"]]
+[ Para
+    [ Str "a"
+    , RawInline (Format "html") "<?php echo \"1\" ; ?>"
+    ]
+]
 ```
diff --git a/test/command/3236.md b/test/command/3236.md
--- a/test/command/3236.md
+++ b/test/command/3236.md
@@ -1,9 +1,21 @@
 ```
-pandoc -f latex -t native
+% pandoc -f latex -t native
 \newcommand{\mycolor}{red}
 
 \includegraphics[width=17cm]{\mycolor /header}
 Magnificent \mycolor{} header.
 ^D
-[Para [Image ("",[],[("width","17cm")]) [Str "image"] ("red/header",""),SoftBreak,Str "Magnificent",Space,Str "red",Space,Str "header."]]
+[ Para
+    [ Image
+        ( "" , [] , [ ( "width" , "17cm" ) ] )
+        [ Str "image" ]
+        ( "red/header" , "" )
+    , SoftBreak
+    , Str "Magnificent"
+    , Space
+    , Str "red"
+    , Space
+    , Str "header."
+    ]
+]
 ```
diff --git a/test/command/3257.md b/test/command/3257.md
--- a/test/command/3257.md
+++ b/test/command/3257.md
@@ -2,12 +2,12 @@
 % pandoc -t native
 (i<j)
 ^D
-[Para [Str "(i<j)"]]
+[ Para [ Str "(i<j)" ] ]
 ```
 
 ```
 % pandoc -t native
 i<j-1, j>k
 ^D
-[Para [Str "i<j-1,",Space,Str "j>k"]]
+[ Para [ Str "i<j-1," , Space , Str "j>k" ] ]
 ```
diff --git a/test/command/3324.md b/test/command/3324.md
--- a/test/command/3324.md
+++ b/test/command/3324.md
@@ -1,5 +1,5 @@
 ```
-pandoc -t latex
+% pandoc -t latex
 Signatures
 
 \
diff --git a/test/command/3348.md b/test/command/3348.md
--- a/test/command/3348.md
+++ b/test/command/3348.md
@@ -7,24 +7,64 @@
         line of text
   ----- ------------------------------------------------
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidth 8.333333333333333e-2)
- ,(AlignLeft,ColWidth 0.6805555555555556)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "foo"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "bar"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "foo"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "this",Space,Str "is",Space,Str "a",Space,Str "long",SoftBreak,Str "line",Space,Str "of",Space,Str "text"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignRight , ColWidth 8.333333333333333e-2 )
+    , ( AlignLeft , ColWidth 0.6805555555555556 )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "foo" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "bar" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "foo" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "this"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "long"
+                    , SoftBreak
+                    , Str "line"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "text"
+                    ]
+                ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/3401.md b/test/command/3401.md
--- a/test/command/3401.md
+++ b/test/command/3401.md
@@ -5,7 +5,7 @@
 #+MACRO: HELLO /Hello, $1/
 {{{HELLO(World)}}}
 ^D
-[Para [Emph [Str "Hello,",Space,Str "World"]]]
+[ Para [ Emph [ Str "Hello," , Space , Str "World" ] ] ]
 ```
 
 Inverted argument order
@@ -15,5 +15,5 @@
 #+MACRO: A $2,$1
 {{{A(1,2)}}}
 ^D
-[Para [Str "2,1"]]
+[ Para [ Str "2,1" ] ]
 ```
diff --git a/test/command/3407.md b/test/command/3407.md
--- a/test/command/3407.md
+++ b/test/command/3407.md
@@ -9,5 +9,10 @@
 % pandoc -f rst -t native
 :foo:`text`
 ^D
-[Para [Code ("",["interpreted-text"],[("role","foo")]) "text"]]
+[ Para
+    [ Code
+        ( "" , [ "interpreted-text" ] , [ ( "role" , "foo" ) ] )
+        "text"
+    ]
+]
 ```
diff --git a/test/command/3475.md b/test/command/3475.md
--- a/test/command/3475.md
+++ b/test/command/3475.md
@@ -1,7 +1,7 @@
 RST implicit internal links to headers:
 
 ```
-pandoc -f rst
+% pandoc -f rst
 Years
 -----
 
@@ -12,7 +12,7 @@
 ```
 
 ```
-pandoc -f rst
+% pandoc -f rst
 Years_
 
 Years
@@ -23,7 +23,7 @@
 ```
 
 ```
-pandoc -f rst
+% pandoc -f rst
 Years and years
 ---------------
 
@@ -34,7 +34,7 @@
 ```
 
 ```
-pandoc -f rst
+% pandoc -f rst
 Years and *years*
 -----------------
 
diff --git a/test/command/3510.md b/test/command/3510.md
--- a/test/command/3510.md
+++ b/test/command/3510.md
@@ -10,11 +10,13 @@
 
 More text
 ^D
-[Para [Str "Text"]
-,Header 1 ("subsection",[],[]) [Str "Subsection"]
-,Para [Str "Included",Space,Str "text"]
-,Plain [Str "Lorem",Space,Str "ipsum."]
-,CodeBlock ("",["haskell"],[]) "putStrLn outString\n"
-,RawBlock (Format "latex") "\\emph{Hello}"
-,Para [Str "More",Space,Str "text"]]
+[ Para [ Str "Text" ]
+, Header 1 ( "subsection" , [] , [] ) [ Str "Subsection" ]
+, Para [ Str "Included" , Space , Str "text" ]
+, Plain [ Str "Lorem" , Space , Str "ipsum." ]
+, CodeBlock
+    ( "" , [ "haskell" ] , [] ) "putStrLn outString\n"
+, RawBlock (Format "latex") "\\emph{Hello}"
+, Para [ Str "More" , Space , Str "text" ]
+]
 ```
diff --git a/test/command/3511.md b/test/command/3511.md
--- a/test/command/3511.md
+++ b/test/command/3511.md
@@ -10,16 +10,20 @@
 
     not continuation
 ^D
-[BulletList
- [[Plain [Str "a"]
-  ,BulletList
-   [[Plain [Str "b"]
-    ,BulletList
-     [[Plain [Str "c"]]]]]]
- ,[CodeBlock ("",[],[]) "code"]]
-,OrderedList (1000,Decimal,Period)
- [[Plain [Str "one"]]]
-,CodeBlock ("",[],[]) "not continuation"]
+[ BulletList
+    [ [ Plain [ Str "a" ]
+      , BulletList
+          [ [ Plain [ Str "b" ]
+            , BulletList [ [ Plain [ Str "c" ] ] ]
+            ]
+          ]
+      ]
+    , [ CodeBlock ( "" , [] , [] ) "code" ]
+    ]
+, OrderedList
+    ( 1000 , Decimal , Period ) [ [ Plain [ Str "one" ] ] ]
+, CodeBlock ( "" , [] , [] ) "not continuation"
+]
 ```
 
 ```
@@ -34,13 +38,15 @@
 
     continuation
 ^D
-[BulletList
- [[Plain [Str "a"]]
- ,[Plain [Str "b"]
-  ,BulletList
-   [[Plain [Str "c"]]]]
- ,[CodeBlock ("",[],[]) "not code"]]
-,OrderedList (1000,Decimal,Period)
- [[Para [Str "one"]
-  ,Para [Str "continuation"]]]]
+[ BulletList
+    [ [ Plain [ Str "a" ] ]
+    , [ Plain [ Str "b" ]
+      , BulletList [ [ Plain [ Str "c" ] ] ]
+      ]
+    , [ CodeBlock ( "" , [] , [] ) "not code" ]
+    ]
+, OrderedList
+    ( 1000 , Decimal , Period )
+    [ [ Para [ Str "one" ] , Para [ Str "continuation" ] ] ]
+]
 ```
diff --git a/test/command/3516.md b/test/command/3516.md
--- a/test/command/3516.md
+++ b/test/command/3516.md
@@ -24,26 +24,43 @@
 |   |   |
 +---+---+
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 5.555555555555555e-2)
- ,(AlignDefault,ColWidth 5.555555555555555e-2)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidth 5.555555555555555e-2 )
+    , ( AlignDefault , ColWidth 5.555555555555555e-2 )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "2" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+            , Cell
+                ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 
 ```
diff --git a/test/command/3518.md b/test/command/3518.md
--- a/test/command/3518.md
+++ b/test/command/3518.md
@@ -1,5 +1,5 @@
 ```
-pandoc -f latex -t plain
+% pandoc -f latex -t plain
 $\alpha^2 \cdot \alpha^{2+3} \equiv \alpha^7$
 ^D
 α² ⋅ α² ⁺ ³ ≡ α⁷
diff --git a/test/command/3530.md b/test/command/3530.md
--- a/test/command/3530.md
+++ b/test/command/3530.md
@@ -3,10 +3,55 @@
 \subfile{command/sub-file-chapter-1}
 \subfile{command/sub-file-chapter-2}
 ^D
-[Header 1 ("chapter-1",[],[]) [Str "Chapter",Space,Str "1"]
-,Para [Str "This",Space,Str "is",Space,Str "Chapter",Space,Str "1,",Space,Str "provided",Space,Str "in",Space,Str "a",Space,Str "sub",Space,Str "file."]
-,Header 1 ("chapter-2",[],[]) [Str "Chapter",Space,Str "2"]
-,Para [Str "This",Space,Str "is",Space,Str "Chapter",Space,Str "2,",Space,Str "provided",Space,Str "in",Space,Str "a",Space,Str "second",Space,Str "sub",Space,Str "file."]]
+[ Header
+    1
+    ( "chapter-1" , [] , [] )
+    [ Str "Chapter" , Space , Str "1" ]
+, Para
+    [ Str "This"
+    , Space
+    , Str "is"
+    , Space
+    , Str "Chapter"
+    , Space
+    , Str "1,"
+    , Space
+    , Str "provided"
+    , Space
+    , Str "in"
+    , Space
+    , Str "a"
+    , Space
+    , Str "sub"
+    , Space
+    , Str "file."
+    ]
+, Header
+    1
+    ( "chapter-2" , [] , [] )
+    [ Str "Chapter" , Space , Str "2" ]
+, Para
+    [ Str "This"
+    , Space
+    , Str "is"
+    , Space
+    , Str "Chapter"
+    , Space
+    , Str "2,"
+    , Space
+    , Str "provided"
+    , Space
+    , Str "in"
+    , Space
+    , Str "a"
+    , Space
+    , Str "second"
+    , Space
+    , Str "sub"
+    , Space
+    , Str "file."
+    ]
+]
 ```
 
 ```
@@ -14,6 +59,9 @@
 \subfile{command/sub-file-chapter-1}
 \subfile{command/sub-file-chapter-2}
 ^D
-[RawBlock (Format "latex") "\\subfile{command/sub-file-chapter-1}"
-,RawBlock (Format "latex") "\\subfile{command/sub-file-chapter-2}"]
+[ RawBlock
+    (Format "latex") "\\subfile{command/sub-file-chapter-1}"
+, RawBlock
+    (Format "latex") "\\subfile{command/sub-file-chapter-2}"
+]
 ```
diff --git a/test/command/3533-rst-csv-tables.md b/test/command/3533-rst-csv-tables.md
--- a/test/command/3533-rst-csv-tables.md
+++ b/test/command/3533-rst-csv-tables.md
@@ -5,37 +5,121 @@
    :header: Flavor,Price,Slogan
    :file: command/3533-rst-csv-tables.csv
 ^D
-[Table ("",[],[]) (Caption Nothing
- [Plain [Str "Test"]])
- [(AlignDefault,ColWidth 0.4)
- ,(AlignDefault,ColWidth 0.2)
- ,(AlignDefault,ColWidth 0.4)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Flavor"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Price"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Slogan"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Albatross"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2.99"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "On",Space,Str "a",Space,Str "stick!"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Crunchy",Space,Str "Frog"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1.49"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "If",Space,Str "we",Space,Str "took",Space,Str "the",Space,Str "bones",Space,Str "out,",Space,Str "it",Space,Str "wouldn't",Space,Str "be",SoftBreak,Str "crunchy,",Space,Str "now",Space,Str "would",Space,Str "it?"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [ Plain [ Str "Test" ] ])
+    [ ( AlignDefault , ColWidth 0.4 )
+    , ( AlignDefault , ColWidth 0.2 )
+    , ( AlignDefault , ColWidth 0.4 )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Flavor" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Price" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Slogan" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Albatross" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "2.99" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "On"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "stick!"
+                    ]
+                ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Crunchy" , Space , Str "Frog" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1.49" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "If"
+                    , Space
+                    , Str "we"
+                    , Space
+                    , Str "took"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "bones"
+                    , Space
+                    , Str "out,"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "wouldn't"
+                    , Space
+                    , Str "be"
+                    , SoftBreak
+                    , Str "crunchy,"
+                    , Space
+                    , Str "now"
+                    , Space
+                    , Str "would"
+                    , Space
+                    , Str "it?"
+                    ]
+                ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 
 ```
@@ -49,37 +133,83 @@
    'cat''s' 3 4
    'dog''s' 2 3
 ^D
-[Table ("",[],[]) (Caption Nothing
- [Plain [Str "Test"]])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "a"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "b"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "cat's"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "dog's"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [ Plain [ Str "Test" ] ])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "a" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "b" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "cat's" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "3" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "4" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "dog's" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "3" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 
 ```
@@ -89,20 +219,35 @@
 
    "1","\""
 ^D
-[Table ("",[],[]) (Caption Nothing
- [Plain [Str "Test"]])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "\""]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [ Plain [ Str "Test" ] ])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "\"" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 
diff --git a/test/command/3534.md b/test/command/3534.md
--- a/test/command/3534.md
+++ b/test/command/3534.md
@@ -18,7 +18,25 @@
 % pandoc -f latex -t native
 I want to explain the interface of \lstinline[language=Java]{public class MyClass}.
 ^D
-[Para [Str "I",Space,Str "want",Space,Str "to",Space,Str "explain",Space,Str "the",Space,Str "interface",Space,Str "of",Space,Code ("",["java"],[]) "public class MyClass",Str "."]]
+[ Para
+    [ Str "I"
+    , Space
+    , Str "want"
+    , Space
+    , Str "to"
+    , Space
+    , Str "explain"
+    , Space
+    , Str "the"
+    , Space
+    , Str "interface"
+    , Space
+    , Str "of"
+    , Space
+    , Code ( "" , [ "java" ] , [] ) "public class MyClass"
+    , Str "."
+    ]
+]
 ```
 
 ```
@@ -41,5 +59,23 @@
 % pandoc -f latex -t native
 I want to explain the interface of \mintinline[linenos]{java}{public class MyClass}.
 ^D
-[Para [Str "I",Space,Str "want",Space,Str "to",Space,Str "explain",Space,Str "the",Space,Str "interface",Space,Str "of",Space,Code ("",["java"],[]) "public class MyClass",Str "."]]
+[ Para
+    [ Str "I"
+    , Space
+    , Str "want"
+    , Space
+    , Str "to"
+    , Space
+    , Str "explain"
+    , Space
+    , Str "the"
+    , Space
+    , Str "interface"
+    , Space
+    , Str "of"
+    , Space
+    , Code ( "" , [ "java" ] , [] ) "public class MyClass"
+    , Str "."
+    ]
+]
 ```
diff --git a/test/command/3537.md b/test/command/3537.md
--- a/test/command/3537.md
+++ b/test/command/3537.md
@@ -7,14 +7,20 @@
 foo bar
 ```
 ^D
-[RawBlock (Format "ms") ".MACRO\nfoo bar"]
+[ RawBlock (Format "ms") ".MACRO\nfoo bar" ]
 ````
 
 ````
 % pandoc -t native
 Hi `there`{=ms}.
 ^D
-[Para [Str "Hi",Space,RawInline (Format "ms") "there",Str "."]]
+[ Para
+    [ Str "Hi"
+    , Space
+    , RawInline (Format "ms") "there"
+    , Str "."
+    ]
+]
 ````
 
 ````
@@ -24,5 +30,5 @@
 foo bar
 ~~~
 ^D
-[RawBlock (Format "ms") ".MACRO\nfoo bar"]
+[ RawBlock (Format "ms") ".MACRO\nfoo bar" ]
 ````
diff --git a/test/command/3539.md b/test/command/3539.md
--- a/test/command/3539.md
+++ b/test/command/3539.md
@@ -4,35 +4,205 @@
 % pandoc -f latex -t native
 Many programming languages provide \glspl{API}. Each \gls{API} should provide a documentation.
 ^D
-[Para [Str "Many",Space,Str "programming",Space,Str "languages",Space,Str "provide",Space,Span ("",[],[("acronym-label","API"),("acronym-form","plural+short")]) [Str "APIs"],Str ".",Space,Str "Each",Space,Span ("",[],[("acronym-label","API"),("acronym-form","singular+short")]) [Str "API"],Space,Str "should",Space,Str "provide",Space,Str "a",Space,Str "documentation."]]
+[ Para
+    [ Str "Many"
+    , Space
+    , Str "programming"
+    , Space
+    , Str "languages"
+    , Space
+    , Str "provide"
+    , Space
+    , Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "plural+short" )
+          ]
+        )
+        [ Str "APIs" ]
+    , Str "."
+    , Space
+    , Str "Each"
+    , Space
+    , Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "singular+short" )
+          ]
+        )
+        [ Str "API" ]
+    , Space
+    , Str "should"
+    , Space
+    , Str "provide"
+    , Space
+    , Str "a"
+    , Space
+    , Str "documentation."
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \Glsdesc{API} XYZ ist not as performant as \glsdesc{API} ZXY.
 ^D
-[Para [Span ("",[],[("acronym-label","API"),("acronym-form","singular+long")]) [Str "API"],Space,Str "XYZ",Space,Str "ist",Space,Str "not",Space,Str "as",Space,Str "performant",Space,Str "as",Space,Span ("",[],[("acronym-label","API"),("acronym-form","singular+long")]) [Str "API"],Space,Str "ZXY."]]
+[ Para
+    [ Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "singular+long" )
+          ]
+        )
+        [ Str "API" ]
+    , Space
+    , Str "XYZ"
+    , Space
+    , Str "ist"
+    , Space
+    , Str "not"
+    , Space
+    , Str "as"
+    , Space
+    , Str "performant"
+    , Space
+    , Str "as"
+    , Space
+    , Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "singular+long" )
+          ]
+        )
+        [ Str "API" ]
+    , Space
+    , Str "ZXY."
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \Acrlong{API} XYZ ist not as performant as \acrlong{API} ZXY.
 ^D
-[Para [Span ("",[],[("acronym-label","API"),("acronym-form","singular+long")]) [Str "API"],Space,Str "XYZ",Space,Str "ist",Space,Str "not",Space,Str "as",Space,Str "performant",Space,Str "as",Space,Span ("",[],[("acronym-label","API"),("acronym-form","singular+long")]) [Str "API"],Space,Str "ZXY."]]
+[ Para
+    [ Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "singular+long" )
+          ]
+        )
+        [ Str "API" ]
+    , Space
+    , Str "XYZ"
+    , Space
+    , Str "ist"
+    , Space
+    , Str "not"
+    , Space
+    , Str "as"
+    , Space
+    , Str "performant"
+    , Space
+    , Str "as"
+    , Space
+    , Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "singular+long" )
+          ]
+        )
+        [ Str "API" ]
+    , Space
+    , Str "ZXY."
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \Acrfull{API} XYZ ist not as performant as \acrfull{API} ZXY.
 ^D
-[Para [Span ("",[],[("acronym-label","API"),("acronym-form","singular+full")]) [Str "API"],Space,Str "XYZ",Space,Str "ist",Space,Str "not",Space,Str "as",Space,Str "performant",Space,Str "as",Space,Span ("",[],[("acronym-label","API"),("acronym-form","singular+full")]) [Str "API"],Space,Str "ZXY."]]
+[ Para
+    [ Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "singular+full" )
+          ]
+        )
+        [ Str "API" ]
+    , Space
+    , Str "XYZ"
+    , Space
+    , Str "ist"
+    , Space
+    , Str "not"
+    , Space
+    , Str "as"
+    , Space
+    , Str "performant"
+    , Space
+    , Str "as"
+    , Space
+    , Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "singular+full" )
+          ]
+        )
+        [ Str "API" ]
+    , Space
+    , Str "ZXY."
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \Acrshort{API} XYZ ist not as performant as \acrshort{API} ZXY.
 ^D
-[Para [Span ("",[],[("acronym-label","API"),("acronym-form","singular+abbrv")]) [Str "API"],Space,Str "XYZ",Space,Str "ist",Space,Str "not",Space,Str "as",Space,Str "performant",Space,Str "as",Space,Span ("",[],[("acronym-label","API"),("acronym-form","singular+abbrv")]) [Str "API"],Space,Str "ZXY."]]
+[ Para
+    [ Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "singular+abbrv" )
+          ]
+        )
+        [ Str "API" ]
+    , Space
+    , Str "XYZ"
+    , Space
+    , Str "ist"
+    , Space
+    , Str "not"
+    , Space
+    , Str "as"
+    , Space
+    , Str "performant"
+    , Space
+    , Str "as"
+    , Space
+    , Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "singular+abbrv" )
+          ]
+        )
+        [ Str "API" ]
+    , Space
+    , Str "ZXY."
+    ]
+]
 ```
 
 # Commands of [acronym package](ftp://ftp.mpi-sb.mpg.de/pub/tex/mirror/ftp.dante.de/pub/tex/macros/latex/contrib/acronym/acronym.pdf)
@@ -41,5 +211,43 @@
 % pandoc -f latex -t native
 Many programming languages provide \acp{API}. Each \ac{API} should provide a documentation.
 ^D
-[Para [Str "Many",Space,Str "programming",Space,Str "languages",Space,Str "provide",Space,Span ("",[],[("acronym-label","API"),("acronym-form","plural+short")]) [Str "APIs"],Str ".",Space,Str "Each",Space,Span ("",[],[("acronym-label","API"),("acronym-form","singular+short")]) [Str "API"],Space,Str "should",Space,Str "provide",Space,Str "a",Space,Str "documentation."]]
+[ Para
+    [ Str "Many"
+    , Space
+    , Str "programming"
+    , Space
+    , Str "languages"
+    , Space
+    , Str "provide"
+    , Space
+    , Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "plural+short" )
+          ]
+        )
+        [ Str "APIs" ]
+    , Str "."
+    , Space
+    , Str "Each"
+    , Space
+    , Span
+        ( ""
+        , []
+        , [ ( "acronym-label" , "API" )
+          , ( "acronym-form" , "singular+short" )
+          ]
+        )
+        [ Str "API" ]
+    , Space
+    , Str "should"
+    , Space
+    , Str "provide"
+    , Space
+    , Str "a"
+    , Space
+    , Str "documentation."
+    ]
+]
 ```
diff --git a/test/command/3558.md b/test/command/3558.md
--- a/test/command/3558.md
+++ b/test/command/3558.md
@@ -6,7 +6,8 @@
 
 \endmulti
 ^D
-[RawBlock (Format "tex") "\\multi"
-,Para [Str "hello"]
-,RawBlock (Format "tex") "\\endmulti"]
+[ RawBlock (Format "tex") "\\multi"
+, Para [ Str "hello" ]
+, RawBlock (Format "tex") "\\endmulti"
+]
 ```
diff --git a/test/command/3585.md b/test/command/3585.md
--- a/test/command/3585.md
+++ b/test/command/3585.md
@@ -4,13 +4,32 @@
 
 Same but bzip2 it and nice it <tt>zfs send tank/storage/data/svn@daily-2014-03-20_00.00.00--2w | nice -15 bzip2 | ssh user@hyper.somewhere.org "> /storage/c-3po/tank-storage-data-svn.dmp.bz2"</tt>
 ^D
-[Para [Quoted DoubleQuote [Str "Hello"]]
-,Para [Str "Same",Space,Str "but",Space,Str "bzip2",Space,Str "it",Space,Str "and",Space,Str "nice",Space,Str "it",Space,Code ("",[],[]) "zfs send tank/storage/data/svn@daily-2014-03-20_00.00.00--2w | nice -15 bzip2 | ssh user@hyper.somewhere.org \"> /storage/c-3po/tank-storage-data-svn.dmp.bz2\""]]
+[ Para [ Quoted DoubleQuote [ Str "Hello" ] ]
+, Para
+    [ Str "Same"
+    , Space
+    , Str "but"
+    , Space
+    , Str "bzip2"
+    , Space
+    , Str "it"
+    , Space
+    , Str "and"
+    , Space
+    , Str "nice"
+    , Space
+    , Str "it"
+    , Space
+    , Code
+        ( "" , [] , [] )
+        "zfs send tank/storage/data/svn@daily-2014-03-20_00.00.00--2w | nice -15 bzip2 | ssh user@hyper.somewhere.org \"> /storage/c-3po/tank-storage-data-svn.dmp.bz2\""
+    ]
+]
 ```
 
 ```
 % pandoc -f mediawiki -t native
 "Hello"
 ^D
-[Para [Str "\"Hello\""]]
+[ Para [ Str "\"Hello\"" ] ]
 ```
diff --git a/test/command/3587.md b/test/command/3587.md
--- a/test/command/3587.md
+++ b/test/command/3587.md
@@ -2,14 +2,36 @@
 % pandoc -f latex -t native
 \SI[round-precision=2]{1}{m} is equal to \SI{1000}{mm}
 ^D
-[Para [Str "1\160m",Space,Str "is",Space,Str "equal",Space,Str "to",Space,Str "1000\160mm"]]
+[ Para
+    [ Str "1\160m"
+    , Space
+    , Str "is"
+    , Space
+    , Str "equal"
+    , Space
+    , Str "to"
+    , Space
+    , Str "1000\160mm"
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \SI[round-precision=2]{1}[\$]{} is equal to \SI{0.938094}{\euro}
 ^D
-[Para [Str "$\160\&1",Space,Str "is",Space,Str "equal",Space,Str "to",Space,Str "0.938094\160\8364"]]
+[ Para
+    [ Str "$\160\&1"
+    , Space
+    , Str "is"
+    , Space
+    , Str "equal"
+    , Space
+    , Str "to"
+    , Space
+    , Str "0.938094\160\8364"
+    ]
+]
 ```
 
 
@@ -17,35 +39,35 @@
 % pandoc -f latex -t native
 \SI{30}{\milli\meter}
 ^D
-[Para [Str "30\160mm"]]
+[ Para [ Str "30\160mm" ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 \SI{6}{\gram}
 ^D
-[Para [Str "6\160g"]]
+[ Para [ Str "6\160g" ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 \SI{25}{\square\meter}
 ^D
-[Para [Str "25\160m",Superscript [Str "2"]]]
+[ Para [ Str "25\160m" , Superscript [ Str "2" ] ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 \SI{18.2}{\degreeCelsius}
 ^D
-[Para [Str "18.2\160\176C"]]
+[ Para [ Str "18.2\160\176C" ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 \SI{18.2}{\celsius}
 ^D
-[Para [Str "18.2\160\176C"]]
+[ Para [ Str "18.2\160\176C" ] ]
 ```
 
 # SIrange tests
@@ -56,19 +78,19 @@
 % pandoc -f latex -t native
 \SIrange{10}{20}{\gram}
 ^D
-[Para [Str "10\160g\8211\&20\160g"]]
+[ Para [ Str "10\160g\8211\&20\160g" ] ]
 ```
 ```
 % pandoc -f latex -t native
 \SIrange{35}{9}{\milli\meter}
 ^D
-[Para [Str "35\160mm\8211\&9\160mm"]]
+[ Para [ Str "35\160mm\8211\&9\160mm" ] ]
 ```
 ```
 % pandoc -f latex -t native
 \SIrange{4}{97367265}{\celsius}
 ^D
-[Para [Str "4\160\176C\8211\&97367265\160\176C"]]
+[ Para [ Str "4\160\176C\8211\&97367265\160\176C" ] ]
 ```
 
 ## Decimal range with simple units
@@ -77,7 +99,7 @@
 % pandoc -f latex -t native
 \SIrange{4.5}{97367265.5}{\celsius}
 ^D
-[Para [Str "4.5\160\176C\8211\&97367265.5\160\176C"]]
+[ Para [ Str "4.5\160\176C\8211\&97367265.5\160\176C" ] ]
 ```
 
 ## Squared, cubed etc. units
@@ -86,21 +108,39 @@
 % pandoc -f latex -t native
 \SIrange{10}{20}{\square\meter}
 ^D
-[Para [Str "10\160m",Superscript [Str "2"],Str "\8211\&20\160m",Superscript [Str "2"]]]
+[ Para
+    [ Str "10\160m"
+    , Superscript [ Str "2" ]
+    , Str "\8211\&20\160m"
+    , Superscript [ Str "2" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \SIrange{10}{20}{\cubic\meter}
 ^D
-[Para [Str "10\160m",Superscript [Str "3"],Str "\8211\&20\160m",Superscript [Str "3"]]]
+[ Para
+    [ Str "10\160m"
+    , Superscript [ Str "3" ]
+    , Str "\8211\&20\160m"
+    , Superscript [ Str "3" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \SIrange{10}{20}{\raisetothe{4}\meter}
 ^D
-[Para [Str "10\160m",Superscript [Str "4"],Str "\8211\&20\160m",Superscript [Str "4"]]]
+[ Para
+    [ Str "10\160m"
+    , Superscript [ Str "4" ]
+    , Str "\8211\&20\160m"
+    , Superscript [ Str "4" ]
+    ]
+]
 ```
 
 
@@ -108,21 +148,39 @@
 % pandoc -f latex -t native
 \SIrange{10}{20}{\meter\squared}
 ^D
-[Para [Str "10\160m",Superscript [Str "2"],Str "\8211\&20\160m",Superscript [Str "2"]]]
+[ Para
+    [ Str "10\160m"
+    , Superscript [ Str "2" ]
+    , Str "\8211\&20\160m"
+    , Superscript [ Str "2" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \SIrange{10}{20}{\meter\cubed}
 ^D
-[Para [Str "10\160m",Superscript [Str "3"],Str "\8211\&20\160m",Superscript [Str "3"]]]
+[ Para
+    [ Str "10\160m"
+    , Superscript [ Str "3" ]
+    , Str "\8211\&20\160m"
+    , Superscript [ Str "3" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \SIrange{10}{20}{\meter\tothe{4}}
 ^D
-[Para [Str "10\160m",Superscript [Str "4"],Str "\8211\&20\160m",Superscript [Str "4"]]]
+[ Para
+    [ Str "10\160m"
+    , Superscript [ Str "4" ]
+    , Str "\8211\&20\160m"
+    , Superscript [ Str "4" ]
+    ]
+]
 ```
 
 
@@ -136,12 +194,12 @@
 % pandoc -f latex -t native
 \SIrange[round-precision=2]{10}{20}{\gram}
 ^D
-[Para [Str "10\160g\8211\&20\160g"]]
+[ Para [ Str "10\160g\8211\&20\160g" ] ]
 ```
 ```
 % pandoc -f latex -t native
 \SIrange[round-precision=2]{10.0}{20.25}{\gram}
 ^D
-[Para [Str "10.0\160g\8211\&20.25\160g"]]
+[ Para [ Str "10.0\160g\8211\&20.25\160g" ] ]
 ```
 
diff --git a/test/command/3681.md b/test/command/3681.md
--- a/test/command/3681.md
+++ b/test/command/3681.md
@@ -4,7 +4,34 @@
 
 Software developers create \cicd pipelines to… Following issue can be resolved by \cicd:
 ^D
-[Para [Str "Software",Space,Str "developers",Space,Str "create",Space,Str "CI/CD",Space,Str "pipelines",Space,Str "to\8230",Space,Str "Following",Space,Str "issue",Space,Str "can",Space,Str "be",Space,Str "resolved",Space,Str "by",Space,Str "CI/CD:"]]
+[ Para
+    [ Str "Software"
+    , Space
+    , Str "developers"
+    , Space
+    , Str "create"
+    , Space
+    , Str "CI/CD"
+    , Space
+    , Str "pipelines"
+    , Space
+    , Str "to\8230"
+    , Space
+    , Str "Following"
+    , Space
+    , Str "issue"
+    , Space
+    , Str "can"
+    , Space
+    , Str "be"
+    , Space
+    , Str "resolved"
+    , Space
+    , Str "by"
+    , Space
+    , Str "CI/CD:"
+    ]
+]
 ```
 
 ```
@@ -13,7 +40,22 @@
 
 \cicd\footnote{\url{https://en.wikipedia.org/wiki/CI/CD}} is awesome.
 ^D
-[Para [Str "CI/CD",Note [Para [Link ("",[],[]) [Str "https://en.wikipedia.org/wiki/CI/CD"] ("https://en.wikipedia.org/wiki/CI/CD","")]],Space,Str "is",Space,Str "awesome."]]
+[ Para
+    [ Str "CI/CD"
+    , Note
+        [ Para
+            [ Link
+                ( "" , [] , [] )
+                [ Str "https://en.wikipedia.org/wiki/CI/CD" ]
+                ( "https://en.wikipedia.org/wiki/CI/CD" , "" )
+            ]
+        ]
+    , Space
+    , Str "is"
+    , Space
+    , Str "awesome."
+    ]
+]
 ```
 
 ```
@@ -23,5 +65,5 @@
 
 \cicd\pipeline.
 ^D
-[Para [Str "CI/CD",Space,Str "pipeline."]]
+[ Para [ Str "CI/CD" , Space , Str "pipeline." ] ]
 ```
diff --git a/test/command/3706.md b/test/command/3706.md
--- a/test/command/3706.md
+++ b/test/command/3706.md
@@ -1,7 +1,7 @@
 Results marker can be hidden in block attributes (#3706)
 
 ```
-pandoc -f org -t native
+% pandoc -f org -t native
 #+begin_src r :exports results :colnames yes
    data.frame(Id = 1:3, Desc = rep("La",3))
 #+end_src
@@ -15,40 +15,90 @@
 |  2 | La   |
 |  3 | La   |
 ^D
-[Div ("tab",[],[])
- [Table ("",[],[]) (Caption Nothing
-  [Plain [Str "Lalelu."]])
-  [(AlignDefault,ColWidthDefault)
-  ,(AlignDefault,ColWidthDefault)]
-  (TableHead ("",[],[])
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Id"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Desc"]]]])
-  [(TableBody ("",[],[]) (RowHeadColumns 0)
-   []
-   [Row ("",[],[])
-    [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "1"]]
-    ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "La"]]]
-   ,Row ("",[],[])
-    [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "2"]]
-    ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "La"]]]
-   ,Row ("",[],[])
-    [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "3"]]
-    ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "La"]]]])]
-  (TableFoot ("",[],[])
-  [])]]
+[ Div
+    ( "tab" , [] , [] )
+    [ Table
+        ( "" , [] , [] )
+        (Caption Nothing [ Plain [ Str "Lalelu." ] ])
+        [ ( AlignDefault , ColWidthDefault )
+        , ( AlignDefault , ColWidthDefault )
+        ]
+        (TableHead
+           ( "" , [] , [] )
+           [ Row
+               ( "" , [] , [] )
+               [ Cell
+                   ( "" , [] , [] )
+                   AlignDefault
+                   (RowSpan 1)
+                   (ColSpan 1)
+                   [ Plain [ Str "Id" ] ]
+               , Cell
+                   ( "" , [] , [] )
+                   AlignDefault
+                   (RowSpan 1)
+                   (ColSpan 1)
+                   [ Plain [ Str "Desc" ] ]
+               ]
+           ])
+        [ TableBody
+            ( "" , [] , [] )
+            (RowHeadColumns 0)
+            []
+            [ Row
+                ( "" , [] , [] )
+                [ Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "1" ] ]
+                , Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "La" ] ]
+                ]
+            , Row
+                ( "" , [] , [] )
+                [ Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "2" ] ]
+                , Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "La" ] ]
+                ]
+            , Row
+                ( "" , [] , [] )
+                [ Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "3" ] ]
+                , Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "La" ] ]
+                ]
+            ]
+        ]
+        (TableFoot ( "" , [] , [] ) [])
+    ]
+]
 ```
 
 ```
-pandoc -f org -t native
+% pandoc -f org -t native
 #+begin_src R :exports none :colnames yes
    data.frame(Id = 1:2, Desc = rep("La",2))
 #+end_src
diff --git a/test/command/3708.md b/test/command/3708.md
--- a/test/command/3708.md
+++ b/test/command/3708.md
@@ -5,24 +5,49 @@
     C & D
 \end{tabular}
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "A"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "B&1"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "C"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "D"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignCenter , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "A" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "B&1" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "C" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "D" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/3733.md b/test/command/3733.md
--- a/test/command/3733.md
+++ b/test/command/3733.md
@@ -6,8 +6,8 @@
 some: code
 ```
 ^D
-[BulletList
- [[Plain [Str "Item1"]]
- ,[Plain [Str "Item2"]]]
-,CodeBlock ("",["yaml"],[]) "some: code"]
+[ BulletList
+    [ [ Plain [ Str "Item1" ] ] , [ Plain [ Str "Item2" ] ] ]
+, CodeBlock ( "" , [ "yaml" ] , [] ) "some: code"
+]
 ````
diff --git a/test/command/3755.md b/test/command/3755.md
--- a/test/command/3755.md
+++ b/test/command/3755.md
@@ -5,8 +5,18 @@
 date: '22. Juni 2017'
 ---
 ^D
-Pandoc (Meta {unMeta = fromList [("date",MetaInlines [Str "22.",Space,Str "Juni",Space,Str "2017"]),("title",MetaInlines [Str "Titel"])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "date"
+            , MetaInlines
+                [ Str "22." , Space , Str "Juni" , Space , Str "2017" ]
+            )
+          , ( "title" , MetaInlines [ Str "Titel" ] )
+          ]
+    }
+  []
 ```
 
 ```
@@ -17,7 +27,23 @@
   22. Juni 2017
 ---
 ^D
-Pandoc (Meta {unMeta = fromList [("date",MetaBlocks [OrderedList (22,Decimal,Period) [[Plain [Str "Juni",Space,Str "2017"]]]]),("title",MetaBlocks [Div ("",[],[]) [Plain [Str "foo"]]])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "date"
+            , MetaBlocks
+                [ OrderedList
+                    ( 22 , Decimal , Period )
+                    [ [ Plain [ Str "Juni" , Space , Str "2017" ] ] ]
+                ]
+            )
+          , ( "title"
+            , MetaBlocks
+                [ Div ( "" , [] , [] ) [ Plain [ Str "foo" ] ] ]
+            )
+          ]
+    }
+  []
 ```
 
diff --git a/test/command/3779.md b/test/command/3779.md
--- a/test/command/3779.md
+++ b/test/command/3779.md
@@ -20,9 +20,38 @@
     Pandoc is 300\% awesome.
 }
 ^D
-[BulletList
- [[Para [Str "Pandoc",Space,Str "is",Space,Str "100%",Space,Str "awesome."]]]
-,BulletList
- [[Para [Str "Pandoc",Space,Str "is",Space,Str "200%",Space,Str "awesome."]]]
-,Para [Str "Pandoc",Space,Str "is",Space,Str "300%",Space,Str "awesome."]]
+[ BulletList
+    [ [ Para
+          [ Str "Pandoc"
+          , Space
+          , Str "is"
+          , Space
+          , Str "100%"
+          , Space
+          , Str "awesome."
+          ]
+      ]
+    ]
+, BulletList
+    [ [ Para
+          [ Str "Pandoc"
+          , Space
+          , Str "is"
+          , Space
+          , Str "200%"
+          , Space
+          , Str "awesome."
+          ]
+      ]
+    ]
+, Para
+    [ Str "Pandoc"
+    , Space
+    , Str "is"
+    , Space
+    , Str "300%"
+    , Space
+    , Str "awesome."
+    ]
+]
 ```
diff --git a/test/command/3794.md b/test/command/3794.md
--- a/test/command/3794.md
+++ b/test/command/3794.md
@@ -2,6 +2,5 @@
 % pandoc -f html -t native
 <div><p>hello</div>
 ^D
-[Div ("",[],[])
- [Para [Str "hello"]]]
+[ Div ( "" , [] , [] ) [ Para [ Str "hello" ] ] ]
 ```
diff --git a/test/command/3804.md b/test/command/3804.md
--- a/test/command/3804.md
+++ b/test/command/3804.md
@@ -2,5 +2,8 @@
 % pandoc -t native
 \titleformat{\chapter}[display]{\normalfont\large\bfseries}{第\thechapter{}章}{20pt}{\Huge}
 ^D
-[RawBlock (Format "tex") "\\titleformat{\\chapter}[display]{\\normalfont\\large\\bfseries}{\31532\\thechapter{}\31456}{20pt}{\\Huge}"]
+[ RawBlock
+    (Format "tex")
+    "\\titleformat{\\chapter}[display]{\\normalfont\\large\\bfseries}{\31532\\thechapter{}\31456}{20pt}{\\Huge}"
+]
 ```
diff --git a/test/command/3853.md b/test/command/3853.md
--- a/test/command/3853.md
+++ b/test/command/3853.md
@@ -20,7 +20,9 @@
 
 hello \iftoggle{ebook}{ebook}{noebook}
 ^D
-[Para [Str "ebook",SoftBreak,Str "more"]
-,Para [Str "not",Space,Str "ebook",SoftBreak,Str "more"]
-,Para [Str "hello",Space,Str "noebook"]]
+[ Para [ Str "ebook" , SoftBreak , Str "more" ]
+, Para
+    [ Str "not" , Space , Str "ebook" , SoftBreak , Str "more" ]
+, Para [ Str "hello" , Space , Str "noebook" ]
+]
 ```
diff --git a/test/command/3880.md b/test/command/3880.md
--- a/test/command/3880.md
+++ b/test/command/3880.md
@@ -1,6 +1,6 @@
 ```
-pandoc -f rst -t native
+% pandoc -f rst -t native
 .. include:: command/3880.txt
 ^D
-[Para [Str "hi"]]
+[ Para [ Str "hi" ] ]
 ```
diff --git a/test/command/3916.md b/test/command/3916.md
--- a/test/command/3916.md
+++ b/test/command/3916.md
@@ -4,8 +4,12 @@
 <pre>blabla</pre>
 # more
 ^D
-[OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "text",Space,Str "text"]
-  ,CodeBlock ("",[],[]) "blabla"]
- ,[Plain [Str "more"]]]]
+[ OrderedList
+    ( 1 , DefaultStyle , DefaultDelim )
+    [ [ Plain [ Str "text" , Space , Str "text" ]
+      , CodeBlock ( "" , [] , [] ) "blabla"
+      ]
+    , [ Plain [ Str "more" ] ]
+    ]
+]
 ```
diff --git a/test/command/3947.md b/test/command/3947.md
--- a/test/command/3947.md
+++ b/test/command/3947.md
@@ -6,6 +6,8 @@
 
 	Another Code block
 ^D
-[RawBlock (Format "tex") "\\newpage"
-,CodeBlock ("",[],[]) "Code block\n\nAnother Code block"]
+[ RawBlock (Format "tex") "\\newpage"
+, CodeBlock
+    ( "" , [] , [] ) "Code block\n\nAnother Code block"
+]
 ```
diff --git a/test/command/3958.md b/test/command/3958.md
--- a/test/command/3958.md
+++ b/test/command/3958.md
@@ -2,19 +2,19 @@
 % pandoc -f latex -t native
 \texttt{"hi"}
 ^D
-[Para [Code ("",[],[]) "\"hi\""]]
+[ Para [ Code ( "" , [] , [] ) "\"hi\"" ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 \texttt{``hi''}
 ^D
-[Para [Code ("",[],[]) "\8220hi\8221"]]
+[ Para [ Code ( "" , [] , [] ) "\8220hi\8221" ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 \texttt{`hi'}
 ^D
-[Para [Code ("",[],[]) "\8216hi\8217"]]
+[ Para [ Code ( "" , [] , [] ) "\8216hi\8217" ] ]
 ```
diff --git a/test/command/3971.md b/test/command/3971.md
--- a/test/command/3971.md
+++ b/test/command/3971.md
@@ -5,5 +5,5 @@
 \code{f}
 \end{document}
 ^D
-[Para [Code ("",[],[]) "f"]]
+[ Para [ Code ( "" , [] , [] ) "f" ] ]
 ```
diff --git a/test/command/3983.md b/test/command/3983.md
--- a/test/command/3983.md
+++ b/test/command/3983.md
@@ -1,29 +1,31 @@
 ```
-pandoc -f latex+raw_tex -t native
+% pandoc -f latex+raw_tex -t native
 \def\filename@area{foo:bar:baz}
 \makeatletter
 \graphicspath\expandafter{\expandafter{\filename@area}}%
 \makeatother
 ^D
-[RawBlock (Format "latex") "\\makeatletter"
-,RawBlock (Format "latex") "\\makeatother"]
+[ RawBlock (Format "latex") "\\makeatletter"
+, RawBlock (Format "latex") "\\makeatother"
+]
 ```
 
 ```
-pandoc -f latex+raw_tex -t native
+% pandoc -f latex+raw_tex -t native
 \makeatletter
   \newcommand\urlfootnote@[1]{\footnote{\url@{#1}}}
   \DeclareRobustCommand{\urlfootnote}{\hyper@normalise\urlfootnote@}
 \makeatother
 ^D
-[RawBlock (Format "latex") "\\makeatletter"
-,RawBlock (Format "latex") "\\makeatother"]
+[ RawBlock (Format "latex") "\\makeatletter"
+, RawBlock (Format "latex") "\\makeatother"
+]
 ```
 
 ```
-pandoc -f latex+raw_tex -t native
+% pandoc -f latex+raw_tex -t native
 \def\foo{bar}
 \expandafter\bam\foo
 ^D
-[RawBlock (Format "latex") "\\bambar"]
+[ RawBlock (Format "latex") "\\bambar" ]
 ```
diff --git a/test/command/3989.md b/test/command/3989.md
--- a/test/command/3989.md
+++ b/test/command/3989.md
@@ -1,7 +1,22 @@
 ```
-pandoc -f markdown -t native
+% pandoc -f markdown -t native
 <span title="1st line of text <br> 2nd line of text">foo</span>
  <span title="1st line of text <br> 2nd line of text">foo</span>
 ^D
-[Para [Span ("",[],[("title","1st line of text <br> 2nd line of text")]) [Str "foo"],SoftBreak,Span ("",[],[("title","1st line of text <br> 2nd line of text")]) [Str "foo"]]]
+[ Para
+    [ Span
+        ( ""
+        , []
+        , [ ( "title" , "1st line of text <br> 2nd line of text" ) ]
+        )
+        [ Str "foo" ]
+    , SoftBreak
+    , Span
+        ( ""
+        , []
+        , [ ( "title" , "1st line of text <br> 2nd line of text" ) ]
+        )
+        [ Str "foo" ]
+    ]
+]
 ```
diff --git a/test/command/4007.md b/test/command/4007.md
--- a/test/command/4007.md
+++ b/test/command/4007.md
@@ -1,23 +1,23 @@
 ```
-pandoc -f latex -t native
+% pandoc -f latex -t native
 \newcommand\arrow\to
 $a\arrow b$
 ^D
-[Para [Math InlineMath "a\\to b"]]
+[ Para [ Math InlineMath "a\\to b" ] ]
 ```
 
 ```
-pandoc -f latex -t native
+% pandoc -f latex -t native
 \newcommand\pfeil[1]{\to #1}
 $a\pfeil b$
 ^D
-[Para [Math InlineMath "a\\to b"]]
+[ Para [ Math InlineMath "a\\to b" ] ]
 ```
 
 ```
-pandoc -f latex -t native
+% pandoc -f latex -t native
 \newcommand\fleche{\to}
 $a\fleche b$
 ^D
-[Para [Math InlineMath "a\\to b"]]
+[ Para [ Math InlineMath "a\\to b" ] ]
 ```
diff --git a/test/command/4012.md b/test/command/4012.md
--- a/test/command/4012.md
+++ b/test/command/4012.md
@@ -1,5 +1,5 @@
 ```
-pandoc -f markdown-implicit_figures
+% pandoc -f markdown-implicit_figures
 ![image]
 
 [image]: http://example.com/image.jpg {height=35mm}
diff --git a/test/command/4016.md b/test/command/4016.md
--- a/test/command/4016.md
+++ b/test/command/4016.md
@@ -1,5 +1,5 @@
 ```
-pandoc -t beamer
+% pandoc -t beamer
 # Level 2 blocks
 
 <div class="columns">
diff --git a/test/command/4019.md b/test/command/4019.md
--- a/test/command/4019.md
+++ b/test/command/4019.md
@@ -1,5 +1,5 @@
 ```
-pandoc --wrap=preserve
+% pandoc --wrap=preserve
 This <!-- x > 0 --> works!
 This <!-- x > 0 --> fails?
 ^D
diff --git a/test/command/4054.md b/test/command/4054.md
--- a/test/command/4054.md
+++ b/test/command/4054.md
@@ -2,13 +2,20 @@
 % pandoc -t native -s -M title=New
 % Old
 ^D
-Pandoc (Meta {unMeta = fromList [("title",MetaString "New")]})
-[]
+Pandoc
+  Meta
+    { unMeta = fromList [ ( "title" , MetaString "New" ) ] }
+  []
 ```
 
 ```
 % pandoc -t native -s -M foo=1 -M foo=2
 ^D
-Pandoc (Meta {unMeta = fromList [("foo",MetaList [MetaString "1",MetaString "2"])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "foo" , MetaList [ MetaString "1" , MetaString "2" ] ) ]
+    }
+  []
 ```
diff --git a/test/command/4056.md b/test/command/4056.md
--- a/test/command/4056.md
+++ b/test/command/4056.md
@@ -5,7 +5,10 @@
 \end{shaded}
 }
 ^D
-[RawBlock (Format "tex") "\\parbox[t]{0.4\\textwidth}{\n\\begin{shaded}\n\\end{shaded}\n}"]
+[ RawBlock
+    (Format "tex")
+    "\\parbox[t]{0.4\\textwidth}{\n\\begin{shaded}\n\\end{shaded}\n}"
+]
 ```
 
 ```
@@ -14,22 +17,41 @@
 Blah & Foo & Bar \\
 \end{tabular}
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Blah"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Foo"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Bar"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignLeft , ColWidthDefault )
+    , ( AlignRight , ColWidthDefault )
+    , ( AlignRight , ColWidthDefault )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Blah" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Foo" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Bar" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/4063.md b/test/command/4063.md
--- a/test/command/4063.md
+++ b/test/command/4063.md
@@ -11,19 +11,34 @@
 </tr>
 </table>
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.3)
- ,(AlignDefault,ColWidth 0.7)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidth 0.3 )
+    , ( AlignDefault , ColWidth 0.7 )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "2" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/4068.md b/test/command/4068.md
--- a/test/command/4068.md
+++ b/test/command/4068.md
@@ -1,9 +1,33 @@
 ```
-pandoc -f mediawiki -t native
+% pandoc -f mediawiki -t native
 [https://domain.com/script.php?a=1&b=2&c=&d=4 open productname bugs]
 
 [http://domain.com?a=. open productname bugs]
 ^D
-[Para [Link ("",[],[]) [Str "open",Space,Str "productname",Space,Str "bugs"] ("https://domain.com/script.php?a=1&b=2&c=&d=4","")]
-,Para [Str "[",Link ("",[],[]) [Str "http://domain.com?a="] ("http://domain.com?a=",""),Str ".",Space,Str "open",Space,Str "productname",Space,Str "bugs]"]]
+[ Para
+    [ Link
+        ( "" , [] , [] )
+        [ Str "open"
+        , Space
+        , Str "productname"
+        , Space
+        , Str "bugs"
+        ]
+        ( "https://domain.com/script.php?a=1&b=2&c=&d=4" , "" )
+    ]
+, Para
+    [ Str "["
+    , Link
+        ( "" , [] , [] )
+        [ Str "http://domain.com?a=" ]
+        ( "http://domain.com?a=" , "" )
+    , Str "."
+    , Space
+    , Str "open"
+    , Space
+    , Str "productname"
+    , Space
+    , Str "bugs]"
+    ]
+]
 ```
diff --git a/test/command/4119.md b/test/command/4119.md
--- a/test/command/4119.md
+++ b/test/command/4119.md
@@ -1,5 +1,5 @@
 ```
-pandoc -t native
+% pandoc -t native
 | col1 | col2 |
 | ---- | ---- |
 | 1    | 2    |
@@ -8,25 +8,56 @@
 not a caption!
 ::::::::::::::::
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col2"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]]])]
- (TableFoot ("",[],[])
- [])
-,Div ("",["notes"],[])
- [Para [Str "not",Space,Str "a",Space,Str "caption!"]]]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "col1" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "col2" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "2" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Div
+    ( "" , [ "notes" ] , [] )
+    [ Para
+        [ Str "not" , Space , Str "a" , Space , Str "caption!" ]
+    ]
+]
 ```
diff --git a/test/command/4134.md b/test/command/4134.md
--- a/test/command/4134.md
+++ b/test/command/4134.md
@@ -3,7 +3,7 @@
 Hello.\
 world.
 ^D
-[Para [Str "Hello.\160world."]]
+[ Para [ Str "Hello.\160world." ] ]
 ```
 
 ```
@@ -11,7 +11,7 @@
 Hello.\  
  world.
 ^D
-[Para [Str "Hello.\160world."]]
+[ Para [ Str "Hello.\160world." ] ]
 ```
 
 ```
@@ -20,6 +20,5 @@
 
 World.
 ^D
-[Para [Str "Hello.\160"]
-,Para [Str "World."]]
+[ Para [ Str "Hello.\160" ] , Para [ Str "World." ] ]
 ```
diff --git a/test/command/4159.md b/test/command/4159.md
--- a/test/command/4159.md
+++ b/test/command/4159.md
@@ -3,6 +3,7 @@
 \newcommand{\gen}{a\ Gen\ b}
 abc
 ^D
-[RawBlock (Format "tex") "\\newcommand{\\gen}{a\\ Gen\\ b}"
-,Para [Str "abc"]]
+[ RawBlock (Format "tex") "\\newcommand{\\gen}{a\\ Gen\\ b}"
+, Para [ Str "abc" ]
+]
 ```
diff --git a/test/command/4162.md b/test/command/4162.md
--- a/test/command/4162.md
+++ b/test/command/4162.md
@@ -3,8 +3,5 @@
 <div class="line-block">hi<br /><br>
  there</div>
 ^D
-[LineBlock
- [[Str "hi"]
- ,[]
- ,[Str "\160there"]]]
+[ LineBlock [ [ Str "hi" ] , [] , [ Str "\160there" ] ] ]
 ```
diff --git a/test/command/4183.md b/test/command/4183.md
--- a/test/command/4183.md
+++ b/test/command/4183.md
@@ -4,7 +4,7 @@
   <img src="foo" alt="bar">
 </figure>
 ^D
-[Para [Image ("",[],[]) [] ("foo","fig:")]]
+[ Para [ Image ( "" , [] , [] ) [] ( "foo" , "fig:" ) ] ]
 ```
 
 ```
@@ -18,7 +18,9 @@
   </figcaption>
 </figure>
 ^D
-[Para [Image ("",[],[]) [Str "baz"] ("foo","fig:")]]
+[ Para
+    [ Image ( "" , [] , [] ) [ Str "baz" ] ( "foo" , "fig:" ) ]
+]
 ```
 
 ```
@@ -28,5 +30,9 @@
   <figcaption><p><em>baz</em></p></figcaption>
 </figure>
 ^D
-[Para [Image ("",[],[]) [Emph [Str "baz"]] ("foo","fig:")]]
+[ Para
+    [ Image
+        ( "" , [] , [] ) [ Emph [ Str "baz" ] ] ( "foo" , "fig:" )
+    ]
+]
 ```
diff --git a/test/command/4186.md b/test/command/4186.md
--- a/test/command/4186.md
+++ b/test/command/4186.md
@@ -4,7 +4,10 @@
     This should retain the four leading spaces
 #+end_example
 ^D
-[CodeBlock ("",["example"],[]) "    This should retain the four leading spaces\n"]
+[ CodeBlock
+    ( "" , [ "example" ] , [] )
+    "    This should retain the four leading spaces\n"
+]
 ```
 
 ```
diff --git a/test/command/4193.md b/test/command/4193.md
--- a/test/command/4193.md
+++ b/test/command/4193.md
@@ -4,7 +4,7 @@
  a
 - b
 ^D
-[BulletList
- [[Plain [Str "a"]]
- ,[Plain [Str "b"]]]]
+[ BulletList
+    [ [ Plain [ Str "a" ] ] , [ Plain [ Str "b" ] ] ]
+]
 ```
diff --git a/test/command/4199.md b/test/command/4199.md
--- a/test/command/4199.md
+++ b/test/command/4199.md
@@ -2,5 +2,8 @@
 % pandoc -f latex -t native
 \foreignlanguage{ngerman}{foo}
 ^D
-[Para [Span ("",[],[("lang","de-DE")]) [Str "foo"]]]
+[ Para
+    [ Span ( "" , [] , [ ( "lang" , "de-DE" ) ] ) [ Str "foo" ]
+    ]
+]
 ```
diff --git a/test/command/4235.md b/test/command/4235.md
--- a/test/command/4235.md
+++ b/test/command/4235.md
@@ -3,7 +3,7 @@
 This.^[Has a footnote.]
 ^D
 <p>This.<a href="#foofn1" class="footnote-ref" id="foofnref1" role="doc-noteref"><sup>1</sup></a></p>
-<section class="footnotes" role="doc-endnotes">
+<section class="footnotes footnotes-end-of-document" role="doc-endnotes">
 <hr />
 <ol>
 <li id="foofn1" role="doc-endnote"><p>Has a footnote.<a href="#foofnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
diff --git a/test/command/4240.md b/test/command/4240.md
--- a/test/command/4240.md
+++ b/test/command/4240.md
@@ -25,9 +25,20 @@
 header4
 ~~~~~~~
 ^D
-Pandoc (Meta {unMeta = fromList [("subtitle",MetaInlines [Str "Subtitle"]),("title",MetaInlines [Str "Title"])]})
-[Header 1 ("header1",[],[]) [Str "header1"]
-,Header 2 ("header2",[],[]) [Str "header2"]
-,Header 3 ("id",[],[]) [Str "header3"]
-,Header 3 ("id3",[],[]) [Str "header4",Span ("id2",[],[]) []]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "subtitle" , MetaInlines [ Str "Subtitle" ] )
+          , ( "title" , MetaInlines [ Str "Title" ] )
+          ]
+    }
+  [ Header 1 ( "header1" , [] , [] ) [ Str "header1" ]
+  , Header 2 ( "header2" , [] , [] ) [ Str "header2" ]
+  , Header 3 ( "id" , [] , [] ) [ Str "header3" ]
+  , Header
+      3
+      ( "id3" , [] , [] )
+      [ Str "header4" , Span ( "id2" , [] , [] ) [] ]
+  ]
 ```
diff --git a/test/command/4253.md b/test/command/4253.md
--- a/test/command/4253.md
+++ b/test/command/4253.md
@@ -4,5 +4,5 @@
 \noop{\newcommand{\foo}[1]{#1}}
 \foo{hi}
 ^D
-[Para [Str "hi"]]
+[ Para [ Str "hi" ] ]
 ```
diff --git a/test/command/4280.md b/test/command/4280.md
--- a/test/command/4280.md
+++ b/test/command/4280.md
@@ -3,5 +3,5 @@
 Driver 
 ------
 ^D
-[Header 1 ("driver",[],[]) [Str "Driver"]]
+[ Header 1 ( "driver" , [] , [] ) [ Str "Driver" ] ]
 ```
diff --git a/test/command/4281.md b/test/command/4281.md
--- a/test/command/4281.md
+++ b/test/command/4281.md
@@ -9,10 +9,13 @@
   :::
 ::::
 ^D
-[Div ("",["a"],[])
- [BulletList
-  [[Div ("",["b"],[])
-    [Para [Str "text"]]
-   ,Div ("",["c"],[])
-    [Para [Str "text"]]]]]]
+[ Div
+    ( "" , [ "a" ] , [] )
+    [ BulletList
+        [ [ Div ( "" , [ "b" ] , [] ) [ Para [ Str "text" ] ]
+          , Div ( "" , [ "c" ] , [] ) [ Para [ Str "text" ] ]
+          ]
+        ]
+    ]
+]
 ```
diff --git a/test/command/4284.md b/test/command/4284.md
--- a/test/command/4284.md
+++ b/test/command/4284.md
@@ -8,7 +8,34 @@
 ** Children of headers with excluded tags should not appear       :xylophone:
 * This should not appear                                                  :%:
 ^D
-[Header 1 ("noexport-should-appear-if-not-specified-in-excludetags",[],[]) [Str "NOEXPORT",Space,Str "should",Space,Str "appear",Space,Str "if",Space,Str "not",Space,Str "specified",Space,Str "in",Space,Str "EXCLUDE",Subscript [Str "TAGS"],Space,Span ("",["tag"],[("tag-name","noexport")]) [SmallCaps [Str "noexport"]]]]
+[ Header
+    1
+    ( "noexport-should-appear-if-not-specified-in-excludetags"
+    , []
+    , []
+    )
+    [ Str "NOEXPORT"
+    , Space
+    , Str "should"
+    , Space
+    , Str "appear"
+    , Space
+    , Str "if"
+    , Space
+    , Str "not"
+    , Space
+    , Str "specified"
+    , Space
+    , Str "in"
+    , Space
+    , Str "EXCLUDE"
+    , Subscript [ Str "TAGS" ]
+    , Space
+    , Span
+        ( "" , [ "tag" ] , [ ( "tag-name" , "noexport" ) ] )
+        [ SmallCaps [ Str "noexport" ] ]
+    ]
+]
 ```
 
 ```
@@ -17,7 +44,20 @@
 * This should not appear                                           :elephant:
 * This should appear                                                   :fawn:
 ^D
-[Header 1 ("this-should-appear",[],[]) [Str "This",Space,Str "should",Space,Str "appear",Space,Span ("",["tag"],[("tag-name","fawn")]) [SmallCaps [Str "fawn"]]]]
+[ Header
+    1
+    ( "this-should-appear" , [] , [] )
+    [ Str "This"
+    , Space
+    , Str "should"
+    , Space
+    , Str "appear"
+    , Space
+    , Span
+        ( "" , [ "tag" ] , [ ( "tag-name" , "fawn" ) ] )
+        [ SmallCaps [ Str "fawn" ] ]
+    ]
+]
 ```
 
 ```
@@ -28,7 +68,20 @@
 * This should not appear                                              :hippo:
 * This should appear                                               :noexport:
 ^D
-[Header 1 ("this-should-appear",[],[]) [Str "This",Space,Str "should",Space,Str "appear",Space,Span ("",["tag"],[("tag-name","noexport")]) [SmallCaps [Str "noexport"]]]]
+[ Header
+    1
+    ( "this-should-appear" , [] , [] )
+    [ Str "This"
+    , Space
+    , Str "should"
+    , Space
+    , Str "appear"
+    , Space
+    , Span
+        ( "" , [ "tag" ] , [ ( "tag-name" , "noexport" ) ] )
+        [ SmallCaps [ Str "noexport" ] ]
+    ]
+]
 ```
 
 ```
@@ -36,5 +89,32 @@
 #+EXCLUDE_TAGS:
 * NOEXPORT should appear if not specified in EXCLUDE_TAGS          :noexport:
 ^D
-[Header 1 ("noexport-should-appear-if-not-specified-in-excludetags",[],[]) [Str "NOEXPORT",Space,Str "should",Space,Str "appear",Space,Str "if",Space,Str "not",Space,Str "specified",Space,Str "in",Space,Str "EXCLUDE",Subscript [Str "TAGS"],Space,Span ("",["tag"],[("tag-name","noexport")]) [SmallCaps [Str "noexport"]]]]
+[ Header
+    1
+    ( "noexport-should-appear-if-not-specified-in-excludetags"
+    , []
+    , []
+    )
+    [ Str "NOEXPORT"
+    , Space
+    , Str "should"
+    , Space
+    , Str "appear"
+    , Space
+    , Str "if"
+    , Space
+    , Str "not"
+    , Space
+    , Str "specified"
+    , Space
+    , Str "in"
+    , Space
+    , Str "EXCLUDE"
+    , Subscript [ Str "TAGS" ]
+    , Space
+    , Span
+        ( "" , [ "tag" ] , [ ( "tag-name" , "noexport" ) ] )
+        [ SmallCaps [ Str "noexport" ] ]
+    ]
+]
 ```
diff --git a/test/command/4306.md b/test/command/4306.md
--- a/test/command/4306.md
+++ b/test/command/4306.md
@@ -1,10 +1,22 @@
 ```
-pandoc -f latex -t native
+% pandoc -f latex -t native
 \documentclass{article}
 \usepackage{hyperref}
 \begin{document}
 The file id is \nolinkurl{ESP_123_5235}.
 \end{document}
 ^D
-[Para [Str "The",Space,Str "file",Space,Str "id",Space,Str "is",Space,Code ("",[],[]) "ESP_123_5235",Str "."]]
+[ Para
+    [ Str "The"
+    , Space
+    , Str "file"
+    , Space
+    , Str "id"
+    , Space
+    , Str "is"
+    , Space
+    , Code ( "" , [] , [] ) "ESP_123_5235"
+    , Str "."
+    ]
+]
 ```
diff --git a/test/command/4374.md b/test/command/4374.md
--- a/test/command/4374.md
+++ b/test/command/4374.md
@@ -3,5 +3,18 @@
 \cite{a%
 }
 ^D
-[Para [Cite [Citation {citationId = "a", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cite{a%\n}"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "a"
+            , citationPrefix = []
+            , citationSuffix = []
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        ]
+        [ RawInline (Format "latex") "\\cite{a%\n}" ]
+    ]
+]
 ```
diff --git a/test/command/4382.md b/test/command/4382.md
--- a/test/command/4382.md
+++ b/test/command/4382.md
@@ -4,7 +4,5 @@
 
 =====
 ^D
-[BulletList
- [[]]
-,HorizontalRule]
+[ BulletList [ [] ] , HorizontalRule ]
 ```
diff --git a/test/command/4424.md b/test/command/4424.md
--- a/test/command/4424.md
+++ b/test/command/4424.md
@@ -6,5 +6,5 @@
 Test
 \end{document}
 ^D
-[Para [Str "Test"]]
+[ Para [ Str "Test" ] ]
 ```
diff --git a/test/command/4454.md b/test/command/4454.md
--- a/test/command/4454.md
+++ b/test/command/4454.md
@@ -3,7 +3,7 @@
 • a
 • b
 ^D
-[BulletList
- [[Plain [Str "a"]]
- ,[Plain [Str "b"]]]]
+[ BulletList
+    [ [ Plain [ Str "a" ] ] , [ Plain [ Str "b" ] ] ]
+]
 ```
diff --git a/test/command/4499.md b/test/command/4499.md
--- a/test/command/4499.md
+++ b/test/command/4499.md
@@ -9,7 +9,7 @@
 % pandoc -f latex+raw_tex -t native
 \mbox{abc def}
 ^D
-[Para [RawInline (Format "latex") "\\mbox{abc def}"]]
+[ Para [ RawInline (Format "latex") "\\mbox{abc def}" ] ]
 ```
 
 ```
@@ -53,7 +53,7 @@
 % pandoc -f latex+raw_tex -t native
 \hbox{abc def}
 ^D
-[Para [RawInline (Format "latex") "\\hbox{abc def}"]]
+[ Para [ RawInline (Format "latex") "\\hbox{abc def}" ] ]
 ```
 
 ```
diff --git a/test/command/4513.md b/test/command/4513.md
--- a/test/command/4513.md
+++ b/test/command/4513.md
@@ -2,19 +2,31 @@
 % pandoc -f textile -t native
 |_. heading 1 |_. heading 2|
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "heading",Space,Str "1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "heading",Space,Str "2"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "heading" , Space , Str "1" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "heading" , Space , Str "2" ] ]
+           ]
+       ])
+    [ TableBody ( "" , [] , [] ) (RowHeadColumns 0) [] [] ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/4528.md b/test/command/4528.md
--- a/test/command/4528.md
+++ b/test/command/4528.md
@@ -15,7 +15,6 @@
 ^D
 This has <span class="smallcaps">small caps</span> in it.
 ```
-```
 
 ```
 % pandoc --wrap=none -f latex -t markdown_strict+raw_html
@@ -31,6 +30,7 @@
 This has <s>strikeout</s> in it.
 ^D
 This has strikeout in it.
+```
 
 ```
 % pandoc --wrap=none -f html -t commonmark+raw_html-strikeout
diff --git a/test/command/4553.md b/test/command/4553.md
--- a/test/command/4553.md
+++ b/test/command/4553.md
@@ -1,15 +1,21 @@
 ```
-pandoc -f latex -t native
+% pandoc -f latex -t native
 foo \include{command/bar}
 ^D
-[Para [Str "foo"]
-,Para [Emph [Str "hi",Space,Str "there"]]]
+[ Para [ Str "foo" ]
+, Para [ Emph [ Str "hi" , Space , Str "there" ] ]
+]
 ```
 
 ```
-pandoc -f latex -t native
+% pandoc -f latex -t native
 foo \input{command/bar}
 ^D
-[Para [Str "foo",Space,Emph [Str "hi",Space,Str "there"]]]
+[ Para
+    [ Str "foo"
+    , Space
+    , Emph [ Str "hi" , Space , Str "there" ]
+    ]
+]
 ```
 
diff --git a/test/command/4576.md b/test/command/4576.md
--- a/test/command/4576.md
+++ b/test/command/4576.md
@@ -2,5 +2,5 @@
 % pandoc -f latex -t native
 $\rho_\text{D$_2$O}=866$
 ^D
-[Para [Math InlineMath "\\rho_\\text{D$_2$O}=866"]]
+[ Para [ Math InlineMath "\\rho_\\text{D$_2$O}=866" ] ]
 ```
diff --git a/test/command/4579.md b/test/command/4579.md
--- a/test/command/4579.md
+++ b/test/command/4579.md
@@ -8,23 +8,51 @@
   * - spam
     - ham
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Foo"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Bar"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "spam"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "ham"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Foo" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Bar" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "spam" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "ham" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/4624.md b/test/command/4624.md
--- a/test/command/4624.md
+++ b/test/command/4624.md
@@ -22,9 +22,12 @@
 \begin{verbatim}
 code5\end{verbatim}
 ^D
-[CodeBlock ("",[],[("key1","value1")]) "code1\n"
-,CodeBlock ("",[],[("key2","value2")]) "code2\n  "
-,CodeBlock ("",[],[]) "code3"
-,CodeBlock ("",[],[]) "code4"
-,CodeBlock ("",[],[]) "code5"]
+[ CodeBlock
+    ( "" , [] , [ ( "key1" , "value1" ) ] ) "code1\n"
+, CodeBlock
+    ( "" , [] , [ ( "key2" , "value2" ) ] ) "code2\n  "
+, CodeBlock ( "" , [] , [] ) "code3"
+, CodeBlock ( "" , [] , [] ) "code4"
+, CodeBlock ( "" , [] , [] ) "code5"
+]
 ```
diff --git a/test/command/4635.md b/test/command/4635.md
--- a/test/command/4635.md
+++ b/test/command/4635.md
@@ -3,7 +3,7 @@
 (cf.
 foo)
 ^D
-[Para [Str "(cf.",SoftBreak,Str "foo)"]]
+[ Para [ Str "(cf." , SoftBreak , Str "foo)" ] ]
 ```
 
 ```
@@ -11,7 +11,9 @@
 a (cf.
 foo)
 ^D
-[Para [Str "a",Space,Str "(cf.",SoftBreak,Str "foo)"]]
+[ Para
+    [ Str "a" , Space , Str "(cf." , SoftBreak , Str "foo)" ]
+]
 ```
 
 ```
@@ -19,7 +21,7 @@
 cf.
 foo
 ^D
-[Para [Str "cf.",SoftBreak,Str "foo"]]
+[ Para [ Str "cf." , SoftBreak , Str "foo" ] ]
 ```
 
 ```
@@ -27,5 +29,7 @@
 a cf.
 foo
 ^D
-[Para [Str "a",Space,Str "cf.",SoftBreak,Str "foo"]]
+[ Para
+    [ Str "a" , Space , Str "cf." , SoftBreak , Str "foo" ]
+]
 ```
diff --git a/test/command/4667.md b/test/command/4667.md
--- a/test/command/4667.md
+++ b/test/command/4667.md
@@ -1,5 +1,5 @@
 ```
-pandoc -t latex
+% pandoc -t latex
 ---
 header-includes:
 - \newcommand{\blandscape}{\begin{landscape}}
diff --git a/test/command/4669.md b/test/command/4669.md
--- a/test/command/4669.md
+++ b/test/command/4669.md
@@ -6,8 +6,10 @@
   while (n > 0) {
 \end{verbatim}
 ^D
-[Para [Span ("",[],[]) [Code ("",[],[]) "<-"]]
-,CodeBlock ("",[],[]) "  while (n > 0) {"]
+[ Para
+    [ Span ( "" , [] , [] ) [ Code ( "" , [] , [] ) "<-" ] ]
+, CodeBlock ( "" , [] , [] ) "  while (n > 0) {"
+]
 ```
 
 ```
@@ -20,10 +22,12 @@
 \item<beamer:2> five
 \end{itemize}
 ^D
-[BulletList
- [[Para [Str "one"]]
- ,[Para [Str "two"]]
- ,[Para [Str "three"]]
- ,[Para [Str "four"]]
- ,[Para [Str "five"]]]]
+[ BulletList
+    [ [ Para [ Str "one" ] ]
+    , [ Para [ Str "two" ] ]
+    , [ Para [ Str "three" ] ]
+    , [ Para [ Str "four" ] ]
+    , [ Para [ Str "five" ] ]
+    ]
+]
 ```
diff --git a/test/command/4715.md b/test/command/4715.md
--- a/test/command/4715.md
+++ b/test/command/4715.md
@@ -11,6 +11,21 @@
    acquisizione-software.rst
    riuso-software.rst
 ^D
-[Div ("tree1",["toctree","foo","bar"],[("caption","Indice dei contenuti"),("numbered",""),("maxdepth","3")])
- [Para [Str "premessa.rst",SoftBreak,Str "acquisizione-software.rst",SoftBreak,Str "riuso-software.rst"]]]
+[ Div
+    ( "tree1"
+    , [ "toctree" , "foo" , "bar" ]
+    , [ ( "caption" , "Indice dei contenuti" )
+      , ( "numbered" , "" )
+      , ( "maxdepth" , "3" )
+      ]
+    )
+    [ Para
+        [ Str "premessa.rst"
+        , SoftBreak
+        , Str "acquisizione-software.rst"
+        , SoftBreak
+        , Str "riuso-software.rst"
+        ]
+    ]
+]
  ```
diff --git a/test/command/4722.md b/test/command/4722.md
--- a/test/command/4722.md
+++ b/test/command/4722.md
@@ -6,14 +6,18 @@
 ***Level 3
 *Level 1
 ^D
-[BulletList
- [[Plain [Str "Level",Space,Str "1"]]
- ,[Plain [Str "Level",Space,Str "1"]
-  ,BulletList
-   [[Plain [Str "Level",Space,Str "2"]
-    ,BulletList
-     [[Plain [Str "Level",Space,Str "3"]]]]]]
- ,[Plain [Str "Level",Space,Str "1"]]]]
+[ BulletList
+    [ [ Plain [ Str "Level" , Space , Str "1" ] ]
+    , [ Plain [ Str "Level" , Space , Str "1" ]
+      , BulletList
+          [ [ Plain [ Str "Level" , Space , Str "2" ]
+            , BulletList [ [ Plain [ Str "Level" , Space , Str "3" ] ] ]
+            ]
+          ]
+      ]
+    , [ Plain [ Str "Level" , Space , Str "1" ] ]
+    ]
+]
 ```
 ```
 % pandoc -f tikiwiki -t native
@@ -23,12 +27,20 @@
 ###Level 3
 #Level 1
 ^D
-[OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Level",Space,Str "1"]]
- ,[Plain [Str "Level",Space,Str "1"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "Level",Space,Str "2"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "Level",Space,Str "3"]]]]]]
- ,[Plain [Str "Level",Space,Str "1"]]]]
+[ OrderedList
+    ( 1 , DefaultStyle , DefaultDelim )
+    [ [ Plain [ Str "Level" , Space , Str "1" ] ]
+    , [ Plain [ Str "Level" , Space , Str "1" ]
+      , OrderedList
+          ( 1 , DefaultStyle , DefaultDelim )
+          [ [ Plain [ Str "Level" , Space , Str "2" ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Level" , Space , Str "3" ] ] ]
+            ]
+          ]
+      ]
+    , [ Plain [ Str "Level" , Space , Str "1" ] ]
+    ]
+]
 ```
diff --git a/test/command/4742.md b/test/command/4742.md
--- a/test/command/4742.md
+++ b/test/command/4742.md
@@ -5,7 +5,18 @@
 % pandoc -f commonmark+gfm_auto_identifiers+ascii_identifiers -t native
 # non ascii ⚠️ räksmörgås
 ^D
-[Header 1 ("non-ascii--raksmorgas",[],[]) [Str "non",Space,Str "ascii",Space,Str "\9888\65039",Space,Str "r\228ksm\246rg\229s"]]
+[ Header
+    1
+    ( "non-ascii--raksmorgas" , [] , [] )
+    [ Str "non"
+    , Space
+    , Str "ascii"
+    , Space
+    , Str "\9888\65039"
+    , Space
+    , Str "r\228ksm\246rg\229s"
+    ]
+]
 ```
 
 Note that the emoji here is actually a composite character,
@@ -16,7 +27,18 @@
 % pandoc -f commonmark+gfm_auto_identifiers-ascii_identifiers -t native
 # non ascii ⚠️ räksmörgås
 ^D
-[Header 1 ("non-ascii-\65039-r\228ksm\246rg\229s",[],[]) [Str "non",Space,Str "ascii",Space,Str "\9888\65039",Space,Str "r\228ksm\246rg\229s"]]
+[ Header
+    1
+    ( "non-ascii-\65039-r\228ksm\246rg\229s" , [] , [] )
+    [ Str "non"
+    , Space
+    , Str "ascii"
+    , Space
+    , Str "\9888\65039"
+    , Space
+    , Str "r\228ksm\246rg\229s"
+    ]
+]
 ```
 
 `gfm` should have `ascii_identifiers` disabled by default.
@@ -25,5 +47,16 @@
 % pandoc -f gfm -t native
 # non ascii ⚠️ räksmörgås
 ^D
-[Header 1 ("non-ascii-\65039-r\228ksm\246rg\229s",[],[]) [Str "non",Space,Str "ascii",Space,Str "\9888\65039",Space,Str "r\228ksm\246rg\229s"]]
+[ Header
+    1
+    ( "non-ascii-\65039-r\228ksm\246rg\229s" , [] , [] )
+    [ Str "non"
+    , Space
+    , Str "ascii"
+    , Space
+    , Str "\9888\65039"
+    , Space
+    , Str "r\228ksm\246rg\229s"
+    ]
+]
 ```
diff --git a/test/command/4743.md b/test/command/4743.md
--- a/test/command/4743.md
+++ b/test/command/4743.md
@@ -4,14 +4,34 @@
 % pandoc -f commonmark+emoji -t native
 My:thumbsup:emoji:heart:
 ^D
-[Para [Str "My",Span ("",["emoji"],[("data-emoji","thumbsup")]) [Str "\128077"],Str "emoji",Span ("",["emoji"],[("data-emoji","heart")]) [Str "\10084\65039"]]]
+[ Para
+    [ Str "My"
+    , Span
+        ( "" , [ "emoji" ] , [ ( "data-emoji" , "thumbsup" ) ] )
+        [ Str "\128077" ]
+    , Str "emoji"
+    , Span
+        ( "" , [ "emoji" ] , [ ( "data-emoji" , "heart" ) ] )
+        [ Str "\10084\65039" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f markdown+emoji -t native
 My:thumbsup:emoji:heart:
 ^D
-[Para [Str "My",Span ("",["emoji"],[("data-emoji","thumbsup")]) [Str "\128077"],Str "emoji",Span ("",["emoji"],[("data-emoji","heart")]) [Str "\10084\65039"]]]
+[ Para
+    [ Str "My"
+    , Span
+        ( "" , [ "emoji" ] , [ ( "data-emoji" , "thumbsup" ) ] )
+        [ Str "\128077" ]
+    , Str "emoji"
+    , Span
+        ( "" , [ "emoji" ] , [ ( "data-emoji" , "heart" ) ] )
+        [ Str "\10084\65039" ]
+    ]
+]
 ```
 
 ```
diff --git a/test/command/4781.md b/test/command/4781.md
--- a/test/command/4781.md
+++ b/test/command/4781.md
@@ -6,9 +6,19 @@
 
 *But not here*
 ^D
-[Para [Str "Markdown",Space,Str "parsed",Space,Emph [Str "here"]]
-,RawBlock (Format "tex") "\\include{command/bar}"
-,Para [Emph [Str "But",Space,Str "not",Space,Str "here"]]]
+[ Para
+    [ Str "Markdown"
+    , Space
+    , Str "parsed"
+    , Space
+    , Emph [ Str "here" ]
+    ]
+, RawBlock (Format "tex") "\\include{command/bar}"
+, Para
+    [ Emph
+        [ Str "But" , Space , Str "not" , Space , Str "here" ]
+    ]
+]
 ```
 
 ```
@@ -17,6 +27,14 @@
 
 *But not here*
 ^D
-[Para [Emph [Str "here"],Space,RawInline (Format "tex") "\\input{command/bar}"]
-,Para [Emph [Str "But",Space,Str "not",Space,Str "here"]]]
+[ Para
+    [ Emph [ Str "here" ]
+    , Space
+    , RawInline (Format "tex") "\\input{command/bar}"
+    ]
+, Para
+    [ Emph
+        [ Str "But" , Space , Str "not" , Space , Str "here" ]
+    ]
+]
 ```
diff --git a/test/command/4805-beamer-columns-alignment.md b/test/command/4805-beamer-columns-alignment.md
--- a/test/command/4805-beamer-columns-alignment.md
+++ b/test/command/4805-beamer-columns-alignment.md
@@ -1,5 +1,5 @@
 ```
-pandoc -t beamer
+% pandoc -t beamer
 :::: { .columns }                                
 ::: { .column align=center }
 :::
diff --git a/test/command/4811.md b/test/command/4811.md
--- a/test/command/4811.md
+++ b/test/command/4811.md
@@ -6,8 +6,7 @@
 
 blank`:myrole:
 ^D
-[Para [Str "`no"]
-,Para [Str "blank`:myrole:"]]
+[ Para [ Str "`no" ] , Para [ Str "blank`:myrole:" ] ]
 ```
 
 Backslash escape behaves properly in interpreted roles:
@@ -18,8 +17,9 @@
 
 `hi\ there`:code:
 ^D
-[Para [Superscript [Str "hithere"]]
-,Para [Code ("",[],[]) "hi\\ there"]]
+[ Para [ Superscript [ Str "hithere" ] ]
+, Para [ Code ( "" , [] , [] ) "hi\\ there" ]
+]
 ```
 
 Backtick followed by alphanumeric doesn't end the span:
@@ -27,7 +27,12 @@
 % pandoc -f rst -t native
 `hi`there`:myrole:
 ^D
-[Para [Code ("",["interpreted-text"],[("role","myrole")]) "hi`there"]]
+[ Para
+    [ Code
+        ( "" , [ "interpreted-text" ] , [ ( "role" , "myrole" ) ] )
+        "hi`there"
+    ]
+]
 ```
 
 Newline is okay, as long as not blank:
@@ -36,7 +41,12 @@
 `hi
 there`:myrole:
 ^D
-[Para [Code ("",["interpreted-text"],[("role","myrole")]) "hi\nthere"]]
+[ Para
+    [ Code
+        ( "" , [ "interpreted-text" ] , [ ( "role" , "myrole" ) ] )
+        "hi\nthere"
+    ]
+]
 ```
 
 Use span for title-reference:
@@ -44,5 +54,7 @@
 % pandoc -f rst -t native
 `default`
 ^D
-[Para [Span ("",["title-ref"],[]) [Str "default"]]]
+[ Para
+    [ Span ( "" , [ "title-ref" ] , [] ) [ Str "default" ] ]
+]
 ```
diff --git a/test/command/4817.md b/test/command/4817.md
--- a/test/command/4817.md
+++ b/test/command/4817.md
@@ -5,6 +5,17 @@
 - bar: bam
 ...
 ^D
-Pandoc (Meta {unMeta = fromList [("foo",MetaList [MetaMap (fromList [("bar",MetaInlines [Str "bam"])])])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "foo"
+            , MetaList
+                [ MetaMap
+                    (fromList [ ( "bar" , MetaInlines [ Str "bam" ] ) ])
+                ]
+            )
+          ]
+    }
+  []
 ```
diff --git a/test/command/4819.md b/test/command/4819.md
--- a/test/command/4819.md
+++ b/test/command/4819.md
@@ -4,8 +4,11 @@
 foo: 42
 ...
 ^D
-Pandoc (Meta {unMeta = fromList [("foo",MetaInlines [Str "42"])]})
-[]
+Pandoc
+  Meta
+    { unMeta = fromList [ ( "foo" , MetaInlines [ Str "42" ] ) ]
+    }
+  []
 ```
 
 ```
@@ -14,8 +17,8 @@
 foo: true
 ...
 ^D
-Pandoc (Meta {unMeta = fromList [("foo",MetaBool True)]})
-[]
+Pandoc
+  Meta { unMeta = fromList [ ( "foo" , MetaBool True ) ] } []
 ```
 
 ```
@@ -24,8 +27,8 @@
 foo: True
 ...
 ^D
-Pandoc (Meta {unMeta = fromList [("foo",MetaBool True)]})
-[]
+Pandoc
+  Meta { unMeta = fromList [ ( "foo" , MetaBool True ) ] } []
 ```
 
 ```
@@ -34,8 +37,9 @@
 foo: FALSE
 ...
 ^D
-Pandoc (Meta {unMeta = fromList [("foo",MetaBool False)]})
-[]
+Pandoc
+  Meta { unMeta = fromList [ ( "foo" , MetaBool False ) ] }
+  []
 ```
 
 ```
@@ -44,7 +48,10 @@
 foo: no
 ...
 ^D
-Pandoc (Meta {unMeta = fromList [("foo",MetaInlines [Str "no"])]})
-[]
+Pandoc
+  Meta
+    { unMeta = fromList [ ( "foo" , MetaInlines [ Str "no" ] ) ]
+    }
+  []
 ```
 
diff --git a/test/command/4832.md b/test/command/4832.md
--- a/test/command/4832.md
+++ b/test/command/4832.md
@@ -2,20 +2,38 @@
 % pandoc -f latex -t native
 \url{http://example.com/foo%20bar.htm}
 ^D
-[Para [Link ("",[],[]) [Str "http://example.com/foo%20bar.htm"] ("http://example.com/foo%20bar.htm","")]]
+[ Para
+    [ Link
+        ( "" , [] , [] )
+        [ Str "http://example.com/foo%20bar.htm" ]
+        ( "http://example.com/foo%20bar.htm" , "" )
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \url{http://example.com/foo{bar}.htm}
 ^D
-[Para [Link ("",[],[]) [Str "http://example.com/foo{bar}.htm"] ("http://example.com/foo{bar}.htm","")]]
+[ Para
+    [ Link
+        ( "" , [] , [] )
+        [ Str "http://example.com/foo{bar}.htm" ]
+        ( "http://example.com/foo{bar}.htm" , "" )
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \href{http://example.com/foo%20bar}{Foobar}
 ^D
-[Para [Link ("",[],[]) [Str "Foobar"] ("http://example.com/foo%20bar","")]]
+[ Para
+    [ Link
+        ( "" , [] , [] )
+        [ Str "Foobar" ]
+        ( "http://example.com/foo%20bar" , "" )
+    ]
+]
 ```
 
diff --git a/test/command/4833.md b/test/command/4833.md
--- a/test/command/4833.md
+++ b/test/command/4833.md
@@ -1,5 +1,5 @@
 ```
-pandoc -f native -t rst
+% pandoc -f native -t rst
 [Div ("",["warning"],[])
  [Div ("",["title"],[])
   [Para [Str "Warning"]]
@@ -10,7 +10,7 @@
    Hi
 ```
 ```
-pandoc -f native -t rst
+% pandoc -f native -t rst
 [Div ("",["unknown"],[])
  [Para [Str "Hi"]]]
 ^D
diff --git a/test/command/4842.md b/test/command/4842.md
--- a/test/command/4842.md
+++ b/test/command/4842.md
@@ -1,6 +1,6 @@
 ```
-pandoc -f latex -t native
+% pandoc -f latex -t native
 \l
 ^D
-[Para [Str "\322"]]
+[ Para [ Str "\322" ] ]
 ```
diff --git a/test/command/4845.md b/test/command/4845.md
--- a/test/command/4845.md
+++ b/test/command/4845.md
@@ -2,5 +2,20 @@
 % pandoc -f html -t native
 x<a href="/foo"> leading trailing space </a>x
 ^D
-[Plain [Str "x",Space,Link ("",[],[]) [Str "leading",Space,Str "trailing",Space,Str "space"] ("/foo",""),Space,Str "x"]]
+[ Plain
+    [ Str "x"
+    , Space
+    , Link
+        ( "" , [] , [] )
+        [ Str "leading"
+        , Space
+        , Str "trailing"
+        , Space
+        , Str "space"
+        ]
+        ( "/foo" , "" )
+    , Space
+    , Str "x"
+    ]
+]
 ```
diff --git a/test/command/4848.md b/test/command/4848.md
--- a/test/command/4848.md
+++ b/test/command/4848.md
@@ -2,21 +2,31 @@
 % pandoc -f latex -t native
 \enquote*{hi}
 ^D
-[Para [Quoted SingleQuote [Str "hi"]]]
+[ Para [ Quoted SingleQuote [ Str "hi" ] ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 \foreignquote{italian}{hi}
 ^D
-[Para [Quoted DoubleQuote [Span ("",[],[("lang","it")]) [Str "hi"]]]]
+[ Para
+    [ Quoted
+        DoubleQuote
+        [ Span ( "" , [] , [ ( "lang" , "it" ) ] ) [ Str "hi" ] ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \hyphenquote*{italian}{hi}
 ^D
-[Para [Quoted SingleQuote [Span ("",[],[("lang","it")]) [Str "hi"]]]]
+[ Para
+    [ Quoted
+        SingleQuote
+        [ Span ( "" , [] , [ ( "lang" , "it" ) ] ) [ Str "hi" ] ]
+    ]
+]
 ```
 
 ```
@@ -25,10 +35,13 @@
 \blockquote{dolor sit amet}
 consectetuer.
 ^D
-[Para [Str "Lorem",Space,Str "ipsum"]
-,BlockQuote
- [Para [Str "dolor",Space,Str "sit",Space,Str "amet"]]
-,Para [Str "consectetuer."]]
+[ Para [ Str "Lorem" , Space , Str "ipsum" ]
+, BlockQuote
+    [ Para
+        [ Str "dolor" , Space , Str "sit" , Space , Str "amet" ]
+    ]
+, Para [ Str "consectetuer." ]
+]
 ```
 
 ```
@@ -37,11 +50,26 @@
 \blockcquote[198]{Knu86}{dolor sit amet}
 consectetuer.
 ^D
-[Para [Str "Lorem",Space,Str "ipsum"]
-,BlockQuote
- [Para [Str "dolor",Space,Str "sit",Space,Str "amet"]
- ,Para [Cite [Citation {citationId = "Knu86", citationPrefix = [], citationSuffix = [Str "198"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] []]]
-,Para [Str "consectetuer."]]
+[ Para [ Str "Lorem" , Space , Str "ipsum" ]
+, BlockQuote
+    [ Para
+        [ Str "dolor" , Space , Str "sit" , Space , Str "amet" ]
+    , Para
+        [ Cite
+            [ Citation
+                { citationId = "Knu86"
+                , citationPrefix = []
+                , citationSuffix = [ Str "198" ]
+                , citationMode = NormalCitation
+                , citationNoteNum = 0
+                , citationHash = 0
+                }
+            ]
+            []
+        ]
+    ]
+, Para [ Str "consectetuer." ]
+]
 ```
 
 ```
@@ -50,10 +78,15 @@
 \foreignblockquote{italian}{dolor sit amet}
 consectetuer.
 ^D
-[Para [Str "Lorem",Space,Str "ipsum"]
-,BlockQuote
- [Div ("",[],[("lang","it")])
-  [Para [Str "dolor",Space,Str "sit",Space,Str "amet"]]]
-,Para [Str "consectetuer."]]
+[ Para [ Str "Lorem" , Space , Str "ipsum" ]
+, BlockQuote
+    [ Div
+        ( "" , [] , [ ( "lang" , "it" ) ] )
+        [ Para
+            [ Str "dolor" , Space , Str "sit" , Space , Str "amet" ]
+        ]
+    ]
+, Para [ Str "consectetuer." ]
+]
 ```
 
diff --git a/test/command/4860.md b/test/command/4860.md
--- a/test/command/4860.md
+++ b/test/command/4860.md
@@ -5,5 +5,16 @@
 .. ***** REFERENCES FOLLOW *****
 .. _broken: http://google.com
 ^D
-[Para [Str "This",Space,Str "is",Space,Link ("",[],[]) [Str "broken"] ("http://google.com",""),Str "."]]
+[ Para
+    [ Str "This"
+    , Space
+    , Str "is"
+    , Space
+    , Link
+        ( "" , [] , [] )
+        [ Str "broken" ]
+        ( "http://google.com" , "" )
+    , Str "."
+    ]
+]
 ```
diff --git a/test/command/4877.md b/test/command/4877.md
--- a/test/command/4877.md
+++ b/test/command/4877.md
@@ -2,12 +2,14 @@
 % pandoc -f html -t native
 My <script type="math/tex">\mathcal{D}</script>
 ^D
-[Plain [Str "My",Space,Math InlineMath "\\mathcal{D}"]]
+[ Plain
+    [ Str "My" , Space , Math InlineMath "\\mathcal{D}" ]
+]
 ```
 
 ```
 % pandoc -f html -t native
 <script type="math/tex; mode=display">\mathcal{D}</script>
 ^D
-[Plain [Math DisplayMath "\\mathcal{D}"]]
+[ Plain [ Math DisplayMath "\\mathcal{D}" ] ]
 ```
diff --git a/test/command/4919.md b/test/command/4919.md
--- a/test/command/4919.md
+++ b/test/command/4919.md
@@ -7,8 +7,11 @@
 
      V = \frac{K}{r^2}
 ^D
-[Div ("tgtmath",[],[])
- [BlockQuote
-  [Para [Math DisplayMath "V = \\frac{K}{r^2}"]]]]
+[ Div
+    ( "tgtmath" , [] , [] )
+    [ BlockQuote
+        [ Para [ Math DisplayMath "V = \\frac{K}{r^2}" ] ]
+    ]
+]
 ```
 
diff --git a/test/command/4928.md b/test/command/4928.md
--- a/test/command/4928.md
+++ b/test/command/4928.md
@@ -2,47 +2,220 @@
 % pandoc -f latex -t native
 \cites(Multiprenote)(multipostnote)[23][42]{Knu86}[65]{Nie72}
 ^D
-[Para [Cite [Citation {citationId = "Knu86", citationPrefix = [Str "Multiprenote",Space,Str "23"], citationSuffix = [Str "42"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "Nie72", citationPrefix = [], citationSuffix = [Str "65",Str ",",Space,Str "multipostnote"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cites(Multiprenote)(multipostnote)[23][42]{Knu86}[65]{Nie72}"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "Knu86"
+            , citationPrefix = [ Str "Multiprenote" , Space , Str "23" ]
+            , citationSuffix = [ Str "42" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        , Citation
+            { citationId = "Nie72"
+            , citationPrefix = []
+            , citationSuffix =
+                [ Str "65" , Str "," , Space , Str "multipostnote" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        ]
+        [ RawInline
+            (Format "latex")
+            "\\cites(Multiprenote)(multipostnote)[23][42]{Knu86}[65]{Nie72}"
+        ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \cites(Multiprenote)()[23][42]{Knu86}[65]{Nie72}
 ^D
-[Para [Cite [Citation {citationId = "Knu86", citationPrefix = [Str "Multiprenote",Space,Str "23"], citationSuffix = [Str "42"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "Nie72", citationPrefix = [], citationSuffix = [Str "65"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cites(Multiprenote)()[23][42]{Knu86}[65]{Nie72}"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "Knu86"
+            , citationPrefix = [ Str "Multiprenote" , Space , Str "23" ]
+            , citationSuffix = [ Str "42" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        , Citation
+            { citationId = "Nie72"
+            , citationPrefix = []
+            , citationSuffix = [ Str "65" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        ]
+        [ RawInline
+            (Format "latex")
+            "\\cites(Multiprenote)()[23][42]{Knu86}[65]{Nie72}"
+        ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \cites()(multipostnote)[23][42]{Knu86}[65]{Nie72}
 ^D
-[Para [Cite [Citation {citationId = "Knu86", citationPrefix = [Str "23"], citationSuffix = [Str "42"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "Nie72", citationPrefix = [], citationSuffix = [Str "65",Str ",",Space,Str "multipostnote"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cites()(multipostnote)[23][42]{Knu86}[65]{Nie72}"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "Knu86"
+            , citationPrefix = [ Str "23" ]
+            , citationSuffix = [ Str "42" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        , Citation
+            { citationId = "Nie72"
+            , citationPrefix = []
+            , citationSuffix =
+                [ Str "65" , Str "," , Space , Str "multipostnote" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        ]
+        [ RawInline
+            (Format "latex")
+            "\\cites()(multipostnote)[23][42]{Knu86}[65]{Nie72}"
+        ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \cites()()[23][42]{Knu86}[65]{Nie72}
 ^D
-[Para [Cite [Citation {citationId = "Knu86", citationPrefix = [Str "23"], citationSuffix = [Str "42"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "Nie72", citationPrefix = [], citationSuffix = [Str "65"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cites()()[23][42]{Knu86}[65]{Nie72}"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "Knu86"
+            , citationPrefix = [ Str "23" ]
+            , citationSuffix = [ Str "42" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        , Citation
+            { citationId = "Nie72"
+            , citationPrefix = []
+            , citationSuffix = [ Str "65" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        ]
+        [ RawInline
+            (Format "latex") "\\cites()()[23][42]{Knu86}[65]{Nie72}"
+        ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \cites(multipostnote)[23][42]{Knu86}[65]{Nie72}
 ^D
-[Para [Cite [Citation {citationId = "Knu86", citationPrefix = [Str "23"], citationSuffix = [Str "42"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "Nie72", citationPrefix = [], citationSuffix = [Str "65",Str ",",Space,Str "multipostnote"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cites(multipostnote)[23][42]{Knu86}[65]{Nie72}"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "Knu86"
+            , citationPrefix = [ Str "23" ]
+            , citationSuffix = [ Str "42" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        , Citation
+            { citationId = "Nie72"
+            , citationPrefix = []
+            , citationSuffix =
+                [ Str "65" , Str "," , Space , Str "multipostnote" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        ]
+        [ RawInline
+            (Format "latex")
+            "\\cites(multipostnote)[23][42]{Knu86}[65]{Nie72}"
+        ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \cites(Multiprenote)(multipostnote){Knu86}
 ^D
-[Para [Cite [Citation {citationId = "Knu86", citationPrefix = [Str "Multiprenote"], citationSuffix = [Str ",",Space,Str "multipostnote"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cites(Multiprenote)(multipostnote){Knu86}"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "Knu86"
+            , citationPrefix = [ Str "Multiprenote" ]
+            , citationSuffix = [ Str "," , Space , Str "multipostnote" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        ]
+        [ RawInline
+            (Format "latex")
+            "\\cites(Multiprenote)(multipostnote){Knu86}"
+        ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \footcites(Multiprenote)(multipostnote)[23][42]{Knu86}[65]{Nie72}
 ^D
-[Para [Note [Para [Cite [Citation {citationId = "Knu86", citationPrefix = [Str "Multiprenote",Space,Str "23"], citationSuffix = [Str "42"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "Nie72", citationPrefix = [], citationSuffix = [Str "65",Str ",",Space,Str "multipostnote"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\footcites(Multiprenote)(multipostnote)[23][42]{Knu86}[65]{Nie72}"],Str "."]]]]
+[ Para
+    [ Note
+        [ Para
+            [ Cite
+                [ Citation
+                    { citationId = "Knu86"
+                    , citationPrefix =
+                        [ Str "Multiprenote" , Space , Str "23" ]
+                    , citationSuffix = [ Str "42" ]
+                    , citationMode = NormalCitation
+                    , citationNoteNum = 0
+                    , citationHash = 0
+                    }
+                , Citation
+                    { citationId = "Nie72"
+                    , citationPrefix = []
+                    , citationSuffix =
+                        [ Str "65"
+                        , Str ","
+                        , Space
+                        , Str "multipostnote"
+                        ]
+                    , citationMode = NormalCitation
+                    , citationNoteNum = 0
+                    , citationHash = 0
+                    }
+                ]
+                [ RawInline
+                    (Format "latex")
+                    "\\footcites(Multiprenote)(multipostnote)[23][42]{Knu86}[65]{Nie72}"
+                ]
+            , Str "."
+            ]
+        ]
+    ]
+]
 ```
diff --git a/test/command/4933.md b/test/command/4933.md
--- a/test/command/4933.md
+++ b/test/command/4933.md
@@ -2,5 +2,9 @@
 % pandoc -f latex -t native
 \includegraphics{lalune}
 ^D
-[Para [Image ("",[],[]) [Str "image"] ("lalune.jpg","")]]
+[ Para
+    [ Image
+        ( "" , [] , [] ) [ Str "image" ] ( "lalune.jpg" , "" )
+    ]
+]
 ```
diff --git a/test/command/5014.md b/test/command/5014.md
--- a/test/command/5014.md
+++ b/test/command/5014.md
@@ -13,18 +13,37 @@
     </tbody>
 </table>
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Name"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Accounts"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault ) ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Name" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Accounts" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/5050.md b/test/command/5050.md
--- a/test/command/5050.md
+++ b/test/command/5050.md
@@ -1,5 +1,5 @@
 ```
-pandoc -t rst
+% pandoc -t rst
 <unknown>
 x
 ^D
diff --git a/test/command/5079.md b/test/command/5079.md
--- a/test/command/5079.md
+++ b/test/command/5079.md
@@ -10,16 +10,26 @@
 </tbody>
 </table>
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault ) ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/5080.md b/test/command/5080.md
--- a/test/command/5080.md
+++ b/test/command/5080.md
@@ -1,12 +1,12 @@
 ```
-pandoc -t asciidoc
+% pandoc -t asciidoc
 [foo *bar*]{.small .red key=val}
 ^D
 [.small .red]#foo _bar_#
 ```
 
 ```
-pandoc -f html -t asciidoc
+% pandoc -f html -t asciidoc
 <small>SMALL</small>
 ^D
 [.small]#SMALL#
diff --git a/test/command/5099.md b/test/command/5099.md
--- a/test/command/5099.md
+++ b/test/command/5099.md
@@ -2,12 +2,28 @@
 % pandoc -t native
 (@citation
 ^D
-[Para [Str "(",Cite [Citation {citationId = "citation", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 1, citationHash = 0}] [Str "@citation"]]]
+[ Para
+    [ Str "("
+    , Cite
+        [ Citation
+            { citationId = "citation"
+            , citationPrefix = []
+            , citationSuffix = []
+            , citationMode = AuthorInText
+            , citationNoteNum = 1
+            , citationHash = 0
+            }
+        ]
+        [ Str "@citation" ]
+    ]
+]
 ```
 
 ```
 % pandoc -t native
 ('asd')
 ^D
-[Para [Str "(",Quoted SingleQuote [Str "asd"],Str ")"]]
+[ Para
+    [ Str "(" , Quoted SingleQuote [ Str "asd" ] , Str ")" ]
+]
 ```
diff --git a/test/command/5128.md b/test/command/5128.md
--- a/test/command/5128.md
+++ b/test/command/5128.md
@@ -1,5 +1,5 @@
 ```
-pandoc -f org -t rst --columns=78
+% pandoc -f org -t rst --columns=78
 | Option | Meaning                                                                                                                                                                                                    |
 |--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
 | =<=    | Left alignment, additional characters are added to the right (default for string).                                                                                                                         |
diff --git a/test/command/5178.md b/test/command/5178.md
--- a/test/command/5178.md
+++ b/test/command/5178.md
@@ -7,8 +7,8 @@
    unsafePerformIO main
 ^D
 #+begin_src haskell -n 42
-  main = putStrLn "Hello World!"
-  unsafePerformIO main
+main = putStrLn "Hello World!"
+unsafePerformIO main
 #+end_src
 ```
 
@@ -22,8 +22,19 @@
   (+ 2 2)
 #+end_src
 ^D
-[CodeBlock ("",["commonlisp","numberLines"],[("org-language","lisp"),("startFrom","20")]) "(+ 1 1)\n"
-,CodeBlock ("",["commonlisp","numberLines","continuedSourceBlock"],[("org-language","lisp"),("startFrom","10")]) "(+ 2 2)\n"]
+[ CodeBlock
+    ( ""
+    , [ "commonlisp" , "numberLines" ]
+    , [ ( "org-language" , "lisp" ) , ( "startFrom" , "20" ) ]
+    )
+    "(+ 1 1)\n"
+, CodeBlock
+    ( ""
+    , [ "commonlisp" , "numberLines" , "continuedSourceBlock" ]
+    , [ ( "org-language" , "lisp" ) , ( "startFrom" , "10" ) ]
+    )
+    "(+ 2 2)\n"
+]
 ```
 
 ```
@@ -32,10 +43,10 @@
 ,CodeBlock ("",["commonlisp","numberLines","continuedSourceBlock"],[("org-language","lisp"),("startFrom","10")]) "(+ 2 2)\n"]
 ^D
 #+begin_src lisp -n 20
-  (+ 1 1)
+(+ 1 1)
 #+end_src
 
 #+begin_src lisp +n 10
-  (+ 2 2)
+(+ 2 2)
 #+end_src
 ```
diff --git a/test/command/5182.md b/test/command/5182.md
--- a/test/command/5182.md
+++ b/test/command/5182.md
@@ -1,6 +1,9 @@
 ```
-pandoc -f rst -t native
+% pandoc -f rst -t native
 .. include:: command/5182.txt
 ^D
-[CodeBlock ("",["python","numberLines"],[]) "def func(x):\n  return y"]
+[ CodeBlock
+    ( "" , [ "python" , "numberLines" ] , [] )
+    "def func(x):\n  return y"
+]
 ```
diff --git a/test/command/5271.md b/test/command/5271.md
--- a/test/command/5271.md
+++ b/test/command/5271.md
@@ -7,6 +7,35 @@
   It consists of two paragraphs.
 ...
 ^D
-Pandoc (Meta {unMeta = fromList [("abstract",MetaBlocks [Para [Str "This",Space,Str "is",Space,Str "the",Space,Str "abstract."],Para [Str "It",Space,Str "consists",Space,Str "of",Space,Str "two",Space,Str "paragraphs."]])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "abstract"
+            , MetaBlocks
+                [ Para
+                    [ Str "This"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "abstract."
+                    ]
+                , Para
+                    [ Str "It"
+                    , Space
+                    , Str "consists"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "two"
+                    , Space
+                    , Str "paragraphs."
+                    ]
+                ]
+            )
+          ]
+    }
+  []
 ```
diff --git a/test/command/5285.md b/test/command/5285.md
--- a/test/command/5285.md
+++ b/test/command/5285.md
@@ -7,11 +7,12 @@
 
 - b
 ^D
-[BulletList
- [[Para [Str "a"]
-  ,Para [Str "b"]]
- ,[Para [Str "a"]]
- ,[Para [Str "b"]]]]
+[ BulletList
+    [ [ Para [ Str "a" ] , Para [ Str "b" ] ]
+    , [ Para [ Str "a" ] ]
+    , [ Para [ Str "b" ] ]
+    ]
+]
 ```
 
 ```
@@ -23,10 +24,9 @@
 
   > foo
 ^D
-[BulletList
- [[Para [Str "foo"]
-  ,Para [Str "foo"]]
- ,[Para [Str "foo"]
-  ,BlockQuote
-   [Para [Str "foo"]]]]]
+[ BulletList
+    [ [ Para [ Str "foo" ] , Para [ Str "foo" ] ]
+    , [ Para [ Str "foo" ] , BlockQuote [ Para [ Str "foo" ] ] ]
+    ]
+]
 ```
diff --git a/test/command/5321.md b/test/command/5321.md
--- a/test/command/5321.md
+++ b/test/command/5321.md
@@ -7,7 +7,11 @@
   <graphic xlink:href="foo.png" xlink:alt-text="baz" />
 </fig>
 ^D
-[Para [Image ("fig-1",[],[]) [Str "bar"] ("foo.png","fig:")]]
+[ Para
+    [ Image
+        ( "fig-1" , [] , [] ) [ Str "bar" ] ( "foo.png" , "fig:" )
+    ]
+]
 ```
 
 ```
@@ -20,5 +24,11 @@
   <graphic xlink:href="foo.png" xlink:alt-text="baz" />
 </fig>
 ^D
-[Para [Image ("fig-1",[],[]) [Str "foo",LineBreak,Str "bar"] ("foo.png","fig:")]]
+[ Para
+    [ Image
+        ( "fig-1" , [] , [] )
+        [ Str "foo" , LineBreak , Str "bar" ]
+        ( "foo.png" , "fig:" )
+    ]
+]
 ```
diff --git a/test/command/5360.md b/test/command/5360.md
--- a/test/command/5360.md
+++ b/test/command/5360.md
@@ -8,12 +8,15 @@
 </table>
 :::
 ^D
-[Div ("",["foo"],[])
- [RawBlock (Format "html") "<table>"
- ,RawBlock (Format "html") "<tr>"
- ,RawBlock (Format "html") "<td>"
- ,Plain [Str "hi"]
- ,RawBlock (Format "html") "</td>"
- ,RawBlock (Format "html") "</tr>"
- ,RawBlock (Format "html") "</table>"]]
+[ Div
+    ( "" , [ "foo" ] , [] )
+    [ RawBlock (Format "html") "<table>"
+    , RawBlock (Format "html") "<tr>"
+    , RawBlock (Format "html") "<td>"
+    , Plain [ Str "hi" ]
+    , RawBlock (Format "html") "</td>"
+    , RawBlock (Format "html") "</tr>"
+    , RawBlock (Format "html") "</table>"
+    ]
+]
 ```
diff --git a/test/command/5368.md b/test/command/5368.md
--- a/test/command/5368.md
+++ b/test/command/5368.md
@@ -12,12 +12,27 @@
 
 Quux.
 ^D
-[OrderedList (1,Decimal,Period)
- [[Para [Str "foo"]
-  ,Para [Image ("",[],[]) [Str "bar"] ("bar.png","fig:")]]
- ,[Para [Str "foo2"]
-  ,Para [Image ("",[],[]) [Str "bar2"] ("bar2.png","fig:")]]
- ,[Para [Str "foo3"]
-  ,Para [Image ("",[],[]) [Str "foo3"] ("foo3.png","fig:")]]]
-,Para [Str "Quux."]]
+[ OrderedList
+    ( 1 , Decimal , Period )
+    [ [ Para [ Str "foo" ]
+      , Para
+          [ Image
+              ( "" , [] , [] ) [ Str "bar" ] ( "bar.png" , "fig:" )
+          ]
+      ]
+    , [ Para [ Str "foo2" ]
+      , Para
+          [ Image
+              ( "" , [] , [] ) [ Str "bar2" ] ( "bar2.png" , "fig:" )
+          ]
+      ]
+    , [ Para [ Str "foo3" ]
+      , Para
+          [ Image
+              ( "" , [] , [] ) [ Str "foo3" ] ( "foo3.png" , "fig:" )
+          ]
+      ]
+    ]
+, Para [ Str "Quux." ]
+]
 ```
diff --git a/test/command/5410.md b/test/command/5410.md
--- a/test/command/5410.md
+++ b/test/command/5410.md
@@ -3,5 +3,5 @@
 .ie n \{\
 'br\}
 ^D
-[Para [LineBreak]]
+[ Para [ LineBreak ] ]
 ```
diff --git a/test/command/5416.md b/test/command/5416.md
--- a/test/command/5416.md
+++ b/test/command/5416.md
@@ -2,12 +2,12 @@
 % pandoc -f dokuwiki -t native
 {
 ^D
-[Para [Str "{"]]
+[ Para [ Str "{" ] ]
 ```
 
 ```
 % pandoc -f dokuwiki -t native
 {{
 ^D
-[Para [Str "{{"]]
+[ Para [ Str "{{" ] ]
 ```
diff --git a/test/command/5540.md b/test/command/5540.md
--- a/test/command/5540.md
+++ b/test/command/5540.md
@@ -4,5 +4,11 @@
 Stay pure!
 \end{lstlisting}
 ^D
-[CodeBlock ("",["myfunnylanguage"],[("language","myfunnylanguage")]) "Stay pure!"]
+[ CodeBlock
+    ( ""
+    , [ "myfunnylanguage" ]
+    , [ ( "language" , "myfunnylanguage" ) ]
+    )
+    "Stay pure!"
+]
 ```
diff --git a/test/command/5549.md b/test/command/5549.md
--- a/test/command/5549.md
+++ b/test/command/5549.md
@@ -4,6 +4,5 @@
 
 []
 ^D
-[Header 2 ("section",[],[]) []
-,Para [Str "[]"]]
+[ Header 2 ( "section" , [] , [] ) [] , Para [ Str "[]" ] ]
 ```
diff --git a/test/command/5619.md b/test/command/5619.md
--- a/test/command/5619.md
+++ b/test/command/5619.md
@@ -6,5 +6,32 @@
 
   The caption. Here's what piggybacking on caption would look like {#fig:1}
 ^D
-[Para [Image ("test",[],[("width","1in")]) [Str "The",Space,Str "caption.",Space,Str "Here's",Space,Str "what",Space,Str "piggybacking",Space,Str "on",Space,Str "caption",Space,Str "would",Space,Str "look",Space,Str "like",Space,Str "{#fig:1}"] ("img1.jpg","fig:")]]
+[ Para
+    [ Image
+        ( "test" , [] , [ ( "width" , "1in" ) ] )
+        [ Str "The"
+        , Space
+        , Str "caption."
+        , Space
+        , Str "Here's"
+        , Space
+        , Str "what"
+        , Space
+        , Str "piggybacking"
+        , Space
+        , Str "on"
+        , Space
+        , Str "caption"
+        , Space
+        , Str "would"
+        , Space
+        , Str "look"
+        , Space
+        , Str "like"
+        , Space
+        , Str "{#fig:1}"
+        ]
+        ( "img1.jpg" , "fig:" )
+    ]
+]
 ```
diff --git a/test/command/5682.md b/test/command/5682.md
--- a/test/command/5682.md
+++ b/test/command/5682.md
@@ -3,6 +3,6 @@
 \newcommand{\ittakestwo}[2][defaultone]{#2}
 \ittakestwo[to]{tango}
 ^D
-[Para [Str "tango"]]
+[ Para [ Str "tango" ] ]
 ```
 
diff --git a/test/command/5686.md b/test/command/5686.md
--- a/test/command/5686.md
+++ b/test/command/5686.md
@@ -4,6 +4,28 @@
 
 This part does not make it to the html output.
 ^D
-[Para [Str "FOO",RawInline (Format "tex") "\\t0",Str "BAR"]
-,Para [Str "This",Space,Str "part",Space,Str "does",Space,Str "not",Space,Str "make",Space,Str "it",Space,Str "to",Space,Str "the",Space,Str "html",Space,Str "output."]]
+[ Para
+    [ Str "FOO" , RawInline (Format "tex") "\\t0" , Str "BAR" ]
+, Para
+    [ Str "This"
+    , Space
+    , Str "part"
+    , Space
+    , Str "does"
+    , Space
+    , Str "not"
+    , Space
+    , Str "make"
+    , Space
+    , Str "it"
+    , Space
+    , Str "to"
+    , Space
+    , Str "the"
+    , Space
+    , Str "html"
+    , Space
+    , Str "output."
+    ]
+]
 ```
diff --git a/test/command/5700.md b/test/command/5700.md
--- a/test/command/5700.md
+++ b/test/command/5700.md
@@ -1,6 +1,39 @@
 ```
 % pandoc -t native -s --metadata-file command/5700-metadata-file-1.yml --metadata-file command/5700-metadata-file-2.yml
 ^D
-Pandoc (Meta {unMeta = fromList [("desc",MetaInlines [Str "Both",Space,Str "of",Space,Str "these",Space,Str "files",Space,Str "should",Space,Str "be",Space,Str "loaded."]),("title",MetaInlines [Str "Multiple",Space,Str "metadata",Space,Str "files",Space,Str "test"])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "desc"
+            , MetaInlines
+                [ Str "Both"
+                , Space
+                , Str "of"
+                , Space
+                , Str "these"
+                , Space
+                , Str "files"
+                , Space
+                , Str "should"
+                , Space
+                , Str "be"
+                , Space
+                , Str "loaded."
+                ]
+            )
+          , ( "title"
+            , MetaInlines
+                [ Str "Multiple"
+                , Space
+                , Str "metadata"
+                , Space
+                , Str "files"
+                , Space
+                , Str "test"
+                ]
+            )
+          ]
+    }
+  []
 ```
diff --git a/test/command/5708.md b/test/command/5708.md
--- a/test/command/5708.md
+++ b/test/command/5708.md
@@ -4,19 +4,34 @@
 | 123456 | :math:`a + b`  |
 +--------+----------------+
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.125)
- ,(AlignDefault,ColWidth 0.2361111111111111)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123456"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Math InlineMath "a + b"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidth 0.125 )
+    , ( AlignDefault , ColWidth 0.2361111111111111 )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123456" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Math InlineMath "a + b" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/5711.md b/test/command/5711.md
--- a/test/command/5711.md
+++ b/test/command/5711.md
@@ -7,16 +7,26 @@
 \end{tabular}
 \end{document}
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "d",LineBreak,Str "e"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignCenter , ColWidthDefault ) ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "d" , LineBreak , Str "e" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/5714.md b/test/command/5714.md
--- a/test/command/5714.md
+++ b/test/command/5714.md
@@ -6,8 +6,11 @@
 # hi _c
 c
 ^D
-[Header 1 ("hi-_a",[],[]) [Str "hi",Space,Str "_a"]
-,Para [Str "b_"]
-,Header 1 ("hi-_c",[],[]) [Str "hi",Space,Str "_c"]
-,Para [Str "c"]]
+[ Header
+    1 ( "hi-_a" , [] , [] ) [ Str "hi" , Space , Str "_a" ]
+, Para [ Str "b_" ]
+, Header
+    1 ( "hi-_c" , [] , [] ) [ Str "hi" , Space , Str "_c" ]
+, Para [ Str "c" ]
+]
 ```
diff --git a/test/command/5753.md b/test/command/5753.md
--- a/test/command/5753.md
+++ b/test/command/5753.md
@@ -10,6 +10,10 @@
 
 end
 ^D
-[Para [Math DisplayMath "q_3\n+ 4",Math DisplayMath "- 5 +\nq_5"]
-,Para [Str "end"]]
+[ Para
+    [ Math DisplayMath "q_3\n+ 4"
+    , Math DisplayMath "- 5 +\nq_5"
+    ]
+, Para [ Str "end" ]
+]
 ```
diff --git a/test/command/5795.md b/test/command/5795.md
--- a/test/command/5795.md
+++ b/test/command/5795.md
@@ -9,7 +9,12 @@
 % pandoc -f html -t native
 <dfn class="dfn" id="foo" title="bax"><span>foo</span></dfn>
 ^D
-[Plain [Span ("foo",["dfn","dfn"],[("title","bax")]) [Span ("",[],[]) [Str "foo"]]]]
+[ Plain
+    [ Span
+        ( "foo" , [ "dfn" , "dfn" ] , [ ( "title" , "bax" ) ] )
+        [ Span ( "" , [] , [] ) [ Str "foo" ] ]
+    ]
+]
 ```
 
 ```
diff --git a/test/command/5797.md b/test/command/5797.md
--- a/test/command/5797.md
+++ b/test/command/5797.md
@@ -9,7 +9,7 @@
 % pandoc -f html -t native
 <mark>Ctrl-C</mark>
 ^D
-[Plain [Span ("",["mark"],[]) [Str "Ctrl-C"]]]
+[ Plain [ Span ( "" , [ "mark" ] , [] ) [ Str "Ctrl-C" ] ] ]
 ```
 
 ```
diff --git a/test/command/5805.md b/test/command/5805.md
--- a/test/command/5805.md
+++ b/test/command/5805.md
@@ -9,7 +9,7 @@
 % pandoc -f html -t native
 <kbd>Ctrl-C</kbd>
 ^D
-[Plain [Span ("",["kbd"],[]) [Str "Ctrl-C"]]]
+[ Plain [ Span ( "" , [ "kbd" ] , [] ) [ Str "Ctrl-C" ] ] ]
 ```
 
 ```
diff --git a/test/command/5845.md b/test/command/5845.md
--- a/test/command/5845.md
+++ b/test/command/5845.md
@@ -2,7 +2,7 @@
 % pandoc -t native
 \parbox{1em}{#1}
 ^D
-[Para [Str "\\parbox{1em}{#1}"]]
+[ Para [ Str "\\parbox{1em}{#1}" ] ]
 ```
 
 ```
@@ -11,6 +11,15 @@
 
 Hello World
 ^D
-[Para [Str "\\newcommand{",RawInline (Format "tex") "\\highlight",Str "}[1]{\\colorbox{yellow}{\\parbox{",RawInline (Format "tex") "\\dimexpr",RawInline (Format "tex") "\\linewidth-2",RawInline (Format "tex") "\\fboxsep",Str "}{#1}}"]
-,Para [Str "Hello",Space,Str "World"]]
+[ Para
+    [ Str "\\newcommand{"
+    , RawInline (Format "tex") "\\highlight"
+    , Str "}[1]{\\colorbox{yellow}{\\parbox{"
+    , RawInline (Format "tex") "\\dimexpr"
+    , RawInline (Format "tex") "\\linewidth-2"
+    , RawInline (Format "tex") "\\fboxsep"
+    , Str "}{#1}}"
+    ]
+, Para [ Str "Hello" , Space , Str "World" ]
+]
 ```
diff --git a/test/command/5878.md b/test/command/5878.md
--- a/test/command/5878.md
+++ b/test/command/5878.md
@@ -3,5 +3,13 @@
 Zozime^[],
 Synésius^[]
 ^D
-[Para [Str "Zozime",Note [Para []],Str ",",SoftBreak,Str "Syn\233sius",Note [Para []]]]
+[ Para
+    [ Str "Zozime"
+    , Note [ Para [] ]
+    , Str ","
+    , SoftBreak
+    , Str "Syn\233sius"
+    , Note [ Para [] ]
+    ]
+]
 ```
diff --git a/test/command/6009.md b/test/command/6009.md
--- a/test/command/6009.md
+++ b/test/command/6009.md
@@ -9,10 +9,11 @@
 
     y
 ^D
-[RawBlock (Format "html") "<tr>"
-,RawBlock (Format "html") "<td>"
-,RawBlock (Format "html") "</td>"
-,RawBlock (Format "html") "</tr>"
-,Para [Str "x"]
-,CodeBlock ("",[],[]) "y"]
+[ RawBlock (Format "html") "<tr>"
+, RawBlock (Format "html") "<td>"
+, RawBlock (Format "html") "</td>"
+, RawBlock (Format "html") "</tr>"
+, Para [ Str "x" ]
+, CodeBlock ( "" , [] , [] ) "y"
+]
 ```
diff --git a/test/command/6026.md b/test/command/6026.md
--- a/test/command/6026.md
+++ b/test/command/6026.md
@@ -4,8 +4,34 @@
 
 @https://openreview.net/forum?id=HkwoSDPgg
 ^D
-[Para [Cite [Citation {citationId = "https://openreview.net/forum?id=HkwoSDPgg", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 1, citationHash = 0}] [Str "@https://openreview.net/forum?id=HkwoSDPgg"]]
-,Para [Cite [Citation {citationId = "https://openreview.net/forum?id", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 2, citationHash = 0}] [Str "@https://openreview.net/forum?id"],Str "=HkwoSDPgg"]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "https://openreview.net/forum?id=HkwoSDPgg"
+            , citationPrefix = []
+            , citationSuffix = []
+            , citationMode = AuthorInText
+            , citationNoteNum = 1
+            , citationHash = 0
+            }
+        ]
+        [ Str "@https://openreview.net/forum?id=HkwoSDPgg" ]
+    ]
+, Para
+    [ Cite
+        [ Citation
+            { citationId = "https://openreview.net/forum?id"
+            , citationPrefix = []
+            , citationSuffix = []
+            , citationMode = AuthorInText
+            , citationNoteNum = 2
+            , citationHash = 0
+            }
+        ]
+        [ Str "@https://openreview.net/forum?id" ]
+    , Str "=HkwoSDPgg"
+    ]
+]
 ```
 ```
 % pandoc -t markdown
diff --git a/test/command/6034.md b/test/command/6034.md
--- a/test/command/6034.md
+++ b/test/command/6034.md
@@ -7,5 +7,8 @@
   \end{overpic}
 \end{figure*}
 ^D
-[RawBlock (Format "latex") "\\begin{figure*}\n  \\centering\n  \\begin{overpic}{test_pic}\n    \\put (70,80) {Caption}\n  \\end{overpic}\n\\end{figure*}"]
+[ RawBlock
+    (Format "latex")
+    "\\begin{figure*}\n  \\centering\n  \\begin{overpic}{test_pic}\n    \\put (70,80) {Caption}\n  \\end{overpic}\n\\end{figure*}"
+]
 ```
diff --git a/test/command/6114.md b/test/command/6114.md
--- a/test/command/6114.md
+++ b/test/command/6114.md
@@ -3,5 +3,11 @@
 \includegraphics[width=.85\textwidth]%
  {pic_M87star.pdf}
 ^D
-[Para [Image ("",[],[("width",".85\\textwidth")]) [Str "image"] ("pic_M87star.pdf","")]]
+[ Para
+    [ Image
+        ( "" , [] , [ ( "width" , ".85\\textwidth" ) ] )
+        [ Str "image" ]
+        ( "pic_M87star.pdf" , "" )
+    ]
+]
 ```
diff --git a/test/command/6137.md b/test/command/6137.md
--- a/test/command/6137.md
+++ b/test/command/6137.md
@@ -15,33 +15,143 @@
         \caption{A numbered caption, if I use pandoc-crossref.}\label{fig:label}
 \end{figure}
 ^D
-[Para [Str "This",Space,Str "reference",Space,Str "to",Space,Str "Table",Space,Link ("",[],[("reference-type","ref"),("reference","tbl:label")]) [Str "1"] ("#tbl:label",""),Space,Str "doesn\8217t",Space,Str "work."]
-,Div ("tbl:label",[],[])
- [Table ("",[],[]) (Caption Nothing
-  [Plain [Str "This",Space,Str "caption",Space,Str "has",Space,Str "no",Space,Str "number."]])
-  [(AlignLeft,ColWidthDefault)
-  ,(AlignCenter,ColWidthDefault)
-  ,(AlignRight,ColWidthDefault)]
-  (TableHead ("",[],[])
-  [])
-  [(TableBody ("",[],[]) (RowHeadColumns 0)
-   []
-   [Row ("",[],[])
-    [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "\8212\8212\8211"]]
-    ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "\8212\8212\8211"]]
-    ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "\8212\8212\8211"]]]
-   ,Row ("",[],[])
-    [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "\8212\8212\8211"]]
-    ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "\8212\8212\8211"]]
-    ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "\8212\8212\8211"]]]])]
-  (TableFoot ("",[],[])
-  [])]
-,Para [Str "This",Space,Str "reference",Space,Str "to",Space,Str "Figure",Space,Link ("",[],[("reference-type","ref"),("reference","fig:label")]) [Str "1"] ("#fig:label",""),Space,Str "works",Space,Str "fine."]
-,Para [Image ("fig:label",[],[("width","\\textwidth")]) [Str "A",Space,Str "numbered",Space,Str "caption,",Space,Str "if",Space,Str "I",Space,Str "use",Space,Str "pandoc-crossref."] ("example.png","fig:")]]
+[ Para
+    [ Str "This"
+    , Space
+    , Str "reference"
+    , Space
+    , Str "to"
+    , Space
+    , Str "Table"
+    , Space
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "ref" )
+          , ( "reference" , "tbl:label" )
+          ]
+        )
+        [ Str "1" ]
+        ( "#tbl:label" , "" )
+    , Space
+    , Str "doesn\8217t"
+    , Space
+    , Str "work."
+    ]
+, Div
+    ( "tbl:label" , [] , [] )
+    [ Table
+        ( "" , [] , [] )
+        (Caption
+           Nothing
+           [ Plain
+               [ Str "This"
+               , Space
+               , Str "caption"
+               , Space
+               , Str "has"
+               , Space
+               , Str "no"
+               , Space
+               , Str "number."
+               ]
+           ])
+        [ ( AlignLeft , ColWidthDefault )
+        , ( AlignCenter , ColWidthDefault )
+        , ( AlignRight , ColWidthDefault )
+        ]
+        (TableHead ( "" , [] , [] ) [])
+        [ TableBody
+            ( "" , [] , [] )
+            (RowHeadColumns 0)
+            []
+            [ Row
+                ( "" , [] , [] )
+                [ Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "\8212\8212\8211" ] ]
+                , Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "\8212\8212\8211" ] ]
+                , Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "\8212\8212\8211" ] ]
+                ]
+            , Row
+                ( "" , [] , [] )
+                [ Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "\8212\8212\8211" ] ]
+                , Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "\8212\8212\8211" ] ]
+                , Cell
+                    ( "" , [] , [] )
+                    AlignDefault
+                    (RowSpan 1)
+                    (ColSpan 1)
+                    [ Plain [ Str "\8212\8212\8211" ] ]
+                ]
+            ]
+        ]
+        (TableFoot ( "" , [] , [] ) [])
+    ]
+, Para
+    [ Str "This"
+    , Space
+    , Str "reference"
+    , Space
+    , Str "to"
+    , Space
+    , Str "Figure"
+    , Space
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "ref" )
+          , ( "reference" , "fig:label" )
+          ]
+        )
+        [ Str "1" ]
+        ( "#fig:label" , "" )
+    , Space
+    , Str "works"
+    , Space
+    , Str "fine."
+    ]
+, Para
+    [ Image
+        ( "fig:label" , [] , [ ( "width" , "\\textwidth" ) ] )
+        [ Str "A"
+        , Space
+        , Str "numbered"
+        , Space
+        , Str "caption,"
+        , Space
+        , Str "if"
+        , Space
+        , Str "I"
+        , Space
+        , Str "use"
+        , Space
+        , Str "pandoc-crossref."
+        ]
+        ( "example.png" , "fig:" )
+    ]
+]
 ```
diff --git a/test/command/6288.md b/test/command/6288.md
--- a/test/command/6288.md
+++ b/test/command/6288.md
@@ -4,5 +4,7 @@
 <label>I</label><title>Introduction</title>
 </sec>
 ^D
-[Header 1 ("",[],[]) [Str "I.",Space,Str "Introduction"]]
+[ Header
+    1 ( "" , [] , [] ) [ Str "I." , Space , Str "Introduction" ]
+]
 ```
diff --git a/test/command/6324.md b/test/command/6324.md
--- a/test/command/6324.md
+++ b/test/command/6324.md
@@ -12,6 +12,15 @@
 \maketitle
 \end{document}
 ^D
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "Me"]]),("title",MetaInlines [Str "Document",Space,Str "title"])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author" , MetaList [ MetaInlines [ Str "Me" ] ] )
+          , ( "title"
+            , MetaInlines [ Str "Document" , Space , Str "title" ]
+            )
+          ]
+    }
+  []
 ```
diff --git a/test/command/6658.md b/test/command/6658.md
--- a/test/command/6658.md
+++ b/test/command/6658.md
@@ -1,5 +1,5 @@
 ```
-pandoc -f latex -t html
+% pandoc -f latex -t html
 \num{12345,67890}
 
 \num{1+-2i}
diff --git a/test/command/6699.md b/test/command/6699.md
--- a/test/command/6699.md
+++ b/test/command/6699.md
@@ -7,7 +7,9 @@
 
 text
 ^D
-[Header 1 ("title",["allowframebreaks"],[]) [Str "title"]
-,Para [Str "text"]]
+[ Header
+    1 ( "title" , [ "allowframebreaks" ] , [] ) [ Str "title" ]
+, Para [ Str "text" ]
+]
 ```
 
diff --git a/test/command/6709.md b/test/command/6709.md
--- a/test/command/6709.md
+++ b/test/command/6709.md
@@ -7,5 +7,7 @@
 fi
 ```
 ^D
-[CodeBlock ("",[],[]) "if true; then\n  echo \"yup\"\nfi"]
+[ CodeBlock
+    ( "" , [] , [] ) "if true; then\n  echo \"yup\"\nfi"
+]
 ````
diff --git a/test/command/6719.md b/test/command/6719.md
--- a/test/command/6719.md
+++ b/test/command/6719.md
@@ -4,7 +4,7 @@
 <emphasis>emphasized </emphasis>text
 </para>
 ^D
-[Para [Emph [Str "emphasized"],Space,Str "text"]]
+[ Para [ Emph [ Str "emphasized" ] , Space , Str "text" ] ]
 ```
 
 ```
@@ -13,6 +13,6 @@
 <italic> hi  </italic>there
 </p>
 ^D
-[Para [Emph [Str "hi"],Space,Str "there"]]
+[ Para [ Emph [ Str "hi" ] , Space , Str "there" ] ]
 ```
 
diff --git a/test/command/6791.md b/test/command/6791.md
--- a/test/command/6791.md
+++ b/test/command/6791.md
@@ -14,19 +14,34 @@
 </tgroup>
 </informaltable>
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.25)
- ,(AlignDefault,ColWidth 0.25)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidth 0.25 )
+    , ( AlignDefault , ColWidth 0.25 )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/6802.md b/test/command/6802.md
--- a/test/command/6802.md
+++ b/test/command/6802.md
@@ -2,8 +2,7 @@
 % pandoc -f latex -t native
 \blockquote[test][]{quote}
 ^D
-[BlockQuote
- [Para [Str "quote"]
- ,Para [Str "test"]]]
+[ BlockQuote [ Para [ Str "quote" ] , Para [ Str "test" ] ]
+]
 
 ```
diff --git a/test/command/6836.md b/test/command/6836.md
--- a/test/command/6836.md
+++ b/test/command/6836.md
@@ -1,5 +1,5 @@
 ```
-pandoc -t native
+% pandoc -t native
 [@buchanan]
 
 (@foo)
@@ -8,10 +8,34 @@
 
 [@buchanan]
 ^D
-[Para [Cite [Citation {citationId = "buchanan", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 1, citationHash = 0}] [Str "[@buchanan]"]]
-,OrderedList (1,Example,TwoParens)
- [[]]
-,Para [Str "See",Space,Str "1."]
-,Para [Cite [Citation {citationId = "buchanan", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 2, citationHash = 0}] [Str "[@buchanan]"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "buchanan"
+            , citationPrefix = []
+            , citationSuffix = []
+            , citationMode = NormalCitation
+            , citationNoteNum = 1
+            , citationHash = 0
+            }
+        ]
+        [ Str "[@buchanan]" ]
+    ]
+, OrderedList ( 1 , Example , TwoParens ) [ [] ]
+, Para [ Str "See" , Space , Str "1." ]
+, Para
+    [ Cite
+        [ Citation
+            { citationId = "buchanan"
+            , citationPrefix = []
+            , citationSuffix = []
+            , citationMode = NormalCitation
+            , citationNoteNum = 2
+            , citationHash = 0
+            }
+        ]
+        [ Str "[@buchanan]" ]
+    ]
+]
 ```
 
diff --git a/test/command/6844.md b/test/command/6844.md
--- a/test/command/6844.md
+++ b/test/command/6844.md
@@ -5,7 +5,7 @@
 \SI{123}{\celsius}
 
 ^D
-[Para [Str "123\160\176C"]]
+[ Para [ Str "123\160\176C" ] ]
 ```
 
 ```
@@ -13,7 +13,7 @@
 \SI{-123}{\celsius}
 
 ^D
-[Para [Str "\8722\&123\160\176C"]]
+[ Para [ Str "\8722\&123\160\176C" ] ]
 ```
 
 ```
@@ -21,7 +21,7 @@
 \SI{+123}{\celsius}
 
 ^D
-[Para [Str "123\160\176C"]]
+[ Para [ Str "123\160\176C" ] ]
 ```
 
 
diff --git a/test/command/6869.md b/test/command/6869.md
--- a/test/command/6869.md
+++ b/test/command/6869.md
@@ -2,5 +2,18 @@
 % pandoc -f latex -t native
 \cite[„Aber“]{key}
 ^D
-[Para [Cite [Citation {citationId = "key", citationPrefix = [], citationSuffix = [Str "\8222Aber\8220"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cite[\8222Aber\8220]{key}"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "key"
+            , citationPrefix = []
+            , citationSuffix = [ Str "\8222Aber\8220" ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        ]
+        [ RawInline (Format "latex") "\\cite[\8222Aber\8220]{key}" ]
+    ]
+]
 ```
diff --git a/test/command/6873.md b/test/command/6873.md
--- a/test/command/6873.md
+++ b/test/command/6873.md
@@ -3,5 +3,33 @@
 \cite[„Etwas […{]} auslassen“]{key}
 ^D
 [WARNING] Citeproc: citation key not found
-[Para [Cite [Citation {citationId = "key", citationPrefix = [], citationSuffix = [Str "\8222Etwas",Space,Str "[\8230",Span ("",[],[]) [Str "]"],Space,Str "auslassen\8220"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "(",Strong [Str "key?"],Str "\8222Etwas",Space,Str "[\8230",Span ("",[],[]) [Str "]"],Space,Str "auslassen\8220)"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "key"
+            , citationPrefix = []
+            , citationSuffix =
+                [ Str "\8222Etwas"
+                , Space
+                , Str "[\8230"
+                , Span ( "" , [] , [] ) [ Str "]" ]
+                , Space
+                , Str "auslassen\8220"
+                ]
+            , citationMode = NormalCitation
+            , citationNoteNum = 0
+            , citationHash = 0
+            }
+        ]
+        [ Str "("
+        , Strong [ Str "key?" ]
+        , Str "\8222Etwas"
+        , Space
+        , Str "[\8230"
+        , Span ( "" , [] , [] ) [ Str "]" ]
+        , Space
+        , Str "auslassen\8220)"
+        ]
+    ]
+]
 ```
diff --git a/test/command/6890.md b/test/command/6890.md
--- a/test/command/6890.md
+++ b/test/command/6890.md
@@ -27,10 +27,116 @@
 
 [^1]: @fruchtel-sozialer-2013a
 ^D
-[Para [Cite [Citation {citationId = "fruchtel-sozialer-2013a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 1, citationHash = 0}] [Str "Fr\252chtel,",Space,Str "Budde,",Space,Str "and",Space,Str "Cyprian",Space,Str "(2013)"]]
-,Para [Str "Some",Space,Str "text.",Note [Para [Cite [Citation {citationId = "fruchtel-sozialer-2013a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 2, citationHash = 0}] [Str "Fr\252chtel,",Space,Str "Budde,",Space,Str "and",Space,Str "Cyprian",Space,Str "(2013)"]]]]
-,Div ("refs",["references","csl-bib-body","hanging-indent"],[])
- [Div ("ref-fruchtel-sozialer-2013a",["csl-entry"],[])
-  [Para [Str "Fr\252chtel,",Space,Str "Frank,",Space,Str "Wolfgang",Space,Str "Budde,",Space,Str "and",Space,Str "Gudrun",Space,Str "Cyprian.",Space,Str "2013.",Space,Emph [Str "Sozialer",Space,Str "Raum",Space,Str "und",Space,Str "Soziale",Space,Str "Arbeit",Space,Str "Fieldbook:",Space,Str "Methoden",Space,Str "und",Space,Str "Techniken"],Str ".",Space,Str "3rd",Space,Str "ed.",Space,Str "Wiesbaden,",Space,Str "Germany:",Space,Str "Springer",Space,Str "VS."]]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "fruchtel-sozialer-2013a"
+            , citationPrefix = []
+            , citationSuffix = []
+            , citationMode = AuthorInText
+            , citationNoteNum = 1
+            , citationHash = 0
+            }
+        ]
+        [ Str "Fr\252chtel,"
+        , Space
+        , Str "Budde,"
+        , Space
+        , Str "and"
+        , Space
+        , Str "Cyprian"
+        , Space
+        , Str "(2013)"
+        ]
+    ]
+, Para
+    [ Str "Some"
+    , Space
+    , Str "text."
+    , Note
+        [ Para
+            [ Cite
+                [ Citation
+                    { citationId = "fruchtel-sozialer-2013a"
+                    , citationPrefix = []
+                    , citationSuffix = []
+                    , citationMode = AuthorInText
+                    , citationNoteNum = 2
+                    , citationHash = 0
+                    }
+                ]
+                [ Str "Fr\252chtel,"
+                , Space
+                , Str "Budde,"
+                , Space
+                , Str "and"
+                , Space
+                , Str "Cyprian"
+                , Space
+                , Str "(2013)"
+                ]
+            ]
+        ]
+    ]
+, Div
+    ( "refs"
+    , [ "references" , "csl-bib-body" , "hanging-indent" ]
+    , []
+    )
+    [ Div
+        ( "ref-fruchtel-sozialer-2013a" , [ "csl-entry" ] , [] )
+        [ Para
+            [ Str "Fr\252chtel,"
+            , Space
+            , Str "Frank,"
+            , Space
+            , Str "Wolfgang"
+            , Space
+            , Str "Budde,"
+            , Space
+            , Str "and"
+            , Space
+            , Str "Gudrun"
+            , Space
+            , Str "Cyprian."
+            , Space
+            , Str "2013."
+            , Space
+            , Emph
+                [ Str "Sozialer"
+                , Space
+                , Str "Raum"
+                , Space
+                , Str "und"
+                , Space
+                , Str "Soziale"
+                , Space
+                , Str "Arbeit"
+                , Space
+                , Str "Fieldbook:"
+                , Space
+                , Str "Methoden"
+                , Space
+                , Str "und"
+                , Space
+                , Str "Techniken"
+                ]
+            , Str "."
+            , Space
+            , Str "3rd"
+            , Space
+            , Str "ed."
+            , Space
+            , Str "Wiesbaden,"
+            , Space
+            , Str "Germany:"
+            , Space
+            , Str "Springer"
+            , Space
+            , Str "VS."
+            ]
+        ]
+    ]
+]
 ```
 
diff --git a/test/command/6993.md b/test/command/6993.md
--- a/test/command/6993.md
+++ b/test/command/6993.md
@@ -2,20 +2,32 @@
 % pandoc -f mediawiki -t native
 '''Should be bold '''
 ^D
-[Para [Strong [Str "Should",Space,Str "be",Space,Str "bold"]]]
+[ Para
+    [ Strong
+        [ Str "Should" , Space , Str "be" , Space , Str "bold" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f mediawiki -t native
 ''' Should be bold'''
 ^D
-[Para [Strong [Str "Should",Space,Str "be",Space,Str "bold"]]]
+[ Para
+    [ Strong
+        [ Str "Should" , Space , Str "be" , Space , Str "bold" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f mediawiki -t native
 '' Should be emph ''
 ^D
-[Para [Emph [Str "Should",Space,Str "be",Space,Str "emph"]]]
+[ Para
+    [ Emph
+        [ Str "Should" , Space , Str "be" , Space , Str "emph" ]
+    ]
+]
 ```
 
diff --git a/test/command/7003.md b/test/command/7003.md
--- a/test/command/7003.md
+++ b/test/command/7003.md
@@ -30,8 +30,29 @@
 \lstinputlisting{example.tex}
 \end{document}
 ^D
-[Header 1 ("with-lstlisting-environment",[],[]) [Str "With",Space,Str "lstlisting",Space,Str "environment"]
-,CodeBlock ("",[],[]) "\\documentclass{article}\n\\begin{document}\n\\section{Foo}\nThis a Foo section\n\\end{document}"
-,Header 1 ("with-lstinputlisting-command",[],[]) [Str "With",Space,Str "lstinputlisting",Space,Str "command"]
-,CodeBlock ("",["latex"],[]) "\\documentclass{article}\n\\begin{document}\n\\section{Bar}\nThis a Bar section\n\\end{document}"]
+[ Header
+    1
+    ( "with-lstlisting-environment" , [] , [] )
+    [ Str "With"
+    , Space
+    , Str "lstlisting"
+    , Space
+    , Str "environment"
+    ]
+, CodeBlock
+    ( "" , [] , [] )
+    "\\documentclass{article}\n\\begin{document}\n\\section{Foo}\nThis a Foo section\n\\end{document}"
+, Header
+    1
+    ( "with-lstinputlisting-command" , [] , [] )
+    [ Str "With"
+    , Space
+    , Str "lstinputlisting"
+    , Space
+    , Str "command"
+    ]
+, CodeBlock
+    ( "" , [ "latex" ] , [] )
+    "\\documentclass{article}\n\\begin{document}\n\\section{Bar}\nThis a Bar section\n\\end{document}"
+]
 ```
diff --git a/test/command/7006.md b/test/command/7006.md
--- a/test/command/7006.md
+++ b/test/command/7006.md
@@ -7,7 +7,7 @@
     ![Caption.](/image.jpg)
 ^D
 <p>Test.<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></p>
-<section class="footnotes" role="doc-endnotes">
+<section class="footnotes footnotes-end-of-document" role="doc-endnotes">
 <hr />
 <ol>
 <li id="fn1" role="doc-endnote"><p>Foo:</p>
diff --git a/test/command/7080.md b/test/command/7080.md
--- a/test/command/7080.md
+++ b/test/command/7080.md
@@ -4,5 +4,14 @@
 
 [image]: image.png width=100px height=150px
 ^D
-[Para [Image ("",[],[("width","100px"),("height","150px")]) [] ("image.png","")]]
+[ Para
+    [ Image
+        ( ""
+        , []
+        , [ ( "width" , "100px" ) , ( "height" , "150px" ) ]
+        )
+        []
+        ( "image.png" , "" )
+    ]
+]
 ```
diff --git a/test/command/7092.md b/test/command/7092.md
--- a/test/command/7092.md
+++ b/test/command/7092.md
@@ -4,5 +4,7 @@
 
 \em{\parseMe{foo}}
 ^D
-[Para [Emph [RawInline (Format "latex") "\\parseMe{foo}"]]]
+[ Para
+    [ Emph [ RawInline (Format "latex") "\\parseMe{foo}" ] ]
+]
 ```
diff --git a/test/command/7129.md b/test/command/7129.md
--- a/test/command/7129.md
+++ b/test/command/7129.md
@@ -5,23 +5,51 @@
   foo & \verb|b&r|  \\ \hline
 \end{tabular}
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "FOO"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "BAR"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "foo"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Code ("",[],[]) "b&r"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignLeft , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "FOO" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "BAR" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "foo" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Code ( "" , [] , [] ) "b&r" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/7134.md b/test/command/7134.md
--- a/test/command/7134.md
+++ b/test/command/7134.md
@@ -8,9 +8,44 @@
 
     This should be a second block quote.
 ^D
-[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "paragraph."]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote."]]
-,BlockQuote
- [Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "second",Space,Str "block",Space,Str "quote."]]]
+[ Para
+    [ Str "This"
+    , Space
+    , Str "is"
+    , Space
+    , Str "a"
+    , Space
+    , Str "paragraph."
+    ]
+, BlockQuote
+    [ Para
+        [ Str "This"
+        , Space
+        , Str "is"
+        , Space
+        , Str "a"
+        , Space
+        , Str "block"
+        , Space
+        , Str "quote."
+        ]
+    ]
+, BlockQuote
+    [ Para
+        [ Str "This"
+        , Space
+        , Str "should"
+        , Space
+        , Str "be"
+        , Space
+        , Str "a"
+        , Space
+        , Str "second"
+        , Space
+        , Str "block"
+        , Space
+        , Str "quote."
+        ]
+    ]
+]
 ```
diff --git a/test/command/7145.md b/test/command/7145.md
--- a/test/command/7145.md
+++ b/test/command/7145.md
@@ -8,5 +8,65 @@
 
 linebreaks</ref>  Nulla ut massa eget ex venenatis lobortis id in eros.
 ^D
-[Para [Str "Maecenas",Space,Str "at",Space,Str "sapien",Space,Str "tempor,",Space,Str "pretium",Space,Str "turpis",Space,Str "ut,",Space,Str "imperdiet",Space,Str "augue.",Note [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "multiline"],Para [Str "reference",SoftBreak,RawInline (Format "html") "<i>",Str "with",RawInline (Format "html") "</i>",SoftBreak,Str "empty"],Para [Str "linebreaks"]],Space,Str "Nulla",Space,Str "ut",Space,Str "massa",Space,Str "eget",Space,Str "ex",Space,Str "venenatis",Space,Str "lobortis",Space,Str "id",Space,Str "in",Space,Str "eros."]]
+[ Para
+    [ Str "Maecenas"
+    , Space
+    , Str "at"
+    , Space
+    , Str "sapien"
+    , Space
+    , Str "tempor,"
+    , Space
+    , Str "pretium"
+    , Space
+    , Str "turpis"
+    , Space
+    , Str "ut,"
+    , Space
+    , Str "imperdiet"
+    , Space
+    , Str "augue."
+    , Note
+        [ Para
+            [ Str "This"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "multiline"
+            ]
+        , Para
+            [ Str "reference"
+            , SoftBreak
+            , RawInline (Format "html") "<i>"
+            , Str "with"
+            , RawInline (Format "html") "</i>"
+            , SoftBreak
+            , Str "empty"
+            ]
+        , Para [ Str "linebreaks" ]
+        ]
+    , Space
+    , Str "Nulla"
+    , Space
+    , Str "ut"
+    , Space
+    , Str "massa"
+    , Space
+    , Str "eget"
+    , Space
+    , Str "ex"
+    , Space
+    , Str "venenatis"
+    , Space
+    , Str "lobortis"
+    , Space
+    , Str "id"
+    , Space
+    , Str "in"
+    , Space
+    , Str "eros."
+    ]
+]
 ```
diff --git a/test/command/7155.md b/test/command/7155.md
--- a/test/command/7155.md
+++ b/test/command/7155.md
@@ -3,7 +3,16 @@
 \(x\) \[x\]
 \\(x\\) \\[x\\]
 ^D
-[Para [Math InlineMath "x",Space,Math DisplayMath "x",SoftBreak,Str "\\(x\\)",Space,Str "\\[x\\]"]]
+[ Para
+    [ Math InlineMath "x"
+    , Space
+    , Math DisplayMath "x"
+    , SoftBreak
+    , Str "\\(x\\)"
+    , Space
+    , Str "\\[x\\]"
+    ]
+]
 ```
 
 ```
@@ -11,5 +20,14 @@
 \(x\) \[x\]
 \\(x\\) \\[x\\]
 ^D
-[Para [Str "(x)",Space,Str "[x]",SoftBreak,Math InlineMath "x",Space,Math DisplayMath "x"]]
+[ Para
+    [ Str "(x)"
+    , Space
+    , Str "[x]"
+    , SoftBreak
+    , Math InlineMath "x"
+    , Space
+    , Math DisplayMath "x"
+    ]
+]
 ```
diff --git a/test/command/7216.md b/test/command/7216.md
--- a/test/command/7216.md
+++ b/test/command/7216.md
@@ -1,5 +1,5 @@
 ```
-pandoc -t latex
+% pandoc -t latex
 "This is some text in quotes. Another paragraph by the same speaker follows. The first paragraph should have no close quote.
 
 "The second paragraph should have open and close quotes."
diff --git a/test/command/7339.md b/test/command/7339.md
--- a/test/command/7339.md
+++ b/test/command/7339.md
@@ -6,6 +6,10 @@
 
 Hi
 ^D
-Pandoc (Meta {unMeta = fromList [("title",MetaInlines [Str "Test"])]})
-[Para [Str "Hi"]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList [ ( "title" , MetaInlines [ Str "Test" ] ) ]
+    }
+  [ Para [ Str "Hi" ] ]
 ```
diff --git a/test/command/7340.md b/test/command/7340.md
--- a/test/command/7340.md
+++ b/test/command/7340.md
@@ -2,5 +2,5 @@
 % pandoc -f latex -t native
 \(*\)
 ^D
-[Para [Math InlineMath "*"]]
+[ Para [ Math InlineMath "*" ] ]
 ```
diff --git a/test/command/7400.md b/test/command/7400.md
--- a/test/command/7400.md
+++ b/test/command/7400.md
@@ -4,6 +4,5 @@
 # Comment only
 ...
 ^D
-Pandoc (Meta {unMeta = fromList []})
-[]
+Pandoc Meta { unMeta = fromList [] } []
 ```
diff --git a/test/command/7434.md b/test/command/7434.md
--- a/test/command/7434.md
+++ b/test/command/7434.md
@@ -9,7 +9,15 @@
 
 [\*\a](x)
 ^D
-[RawBlock (Format "tex") "\\begin{proof}\n\\newcommand{\\x}{\\left.\\right.}\n\\left.\\right.\n\\end{proof}"
-,Para [Str "1234567890abcdefghi"]
-,Para [Link ("",[],[]) [Str "*",RawInline (Format "tex") "\\a"] ("x","")]]
+[ RawBlock
+    (Format "tex")
+    "\\begin{proof}\n\\newcommand{\\x}{\\left.\\right.}\n\\left.\\right.\n\\end{proof}"
+, Para [ Str "1234567890abcdefghi" ]
+, Para
+    [ Link
+        ( "" , [] , [] )
+        [ Str "*" , RawInline (Format "tex") "\\a" ]
+        ( "x" , "" )
+    ]
+]
 ```
diff --git a/test/command/7436.md b/test/command/7436.md
--- a/test/command/7436.md
+++ b/test/command/7436.md
@@ -8,7 +8,24 @@
 
 .. include:: command/three.txt
 ^D
-[CodeBlock ("",[""],[("code","")]) "1st line.\n2nd line.\n3rd line.\n"
-,CodeBlock ("",[""],[("literal","")]) "1st line.\n2nd line.\n3rd line.\n"
-,Para [Str "1st",Space,Str "line.",SoftBreak,Str "2nd",Space,Str "line.",SoftBreak,Str "3rd",Space,Str "line."]]
+[ CodeBlock
+    ( "" , [ "" ] , [ ( "code" , "" ) ] )
+    "1st line.\n2nd line.\n3rd line.\n"
+, CodeBlock
+    ( "" , [ "" ] , [ ( "literal" , "" ) ] )
+    "1st line.\n2nd line.\n3rd line.\n"
+, Para
+    [ Str "1st"
+    , Space
+    , Str "line."
+    , SoftBreak
+    , Str "2nd"
+    , Space
+    , Str "line."
+    , SoftBreak
+    , Str "3rd"
+    , Space
+    , Str "line."
+    ]
+]
 ```
diff --git a/test/command/7520.md b/test/command/7520.md
new file mode 100644
--- /dev/null
+++ b/test/command/7520.md
@@ -0,0 +1,22 @@
+```
+% pandoc -f org -t native -s
+:PROPERTIES:
+:ID:       d5b18943-98a3-4b2a-a545-41d17bf50f3e
+:END:
+#+title: Common Ground
+^D
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "id"
+            , MetaString "d5b18943-98a3-4b2a-a545-41d17bf50f3e"
+            )
+          , ( "title"
+            , MetaInlines [ Str "Common" , Space , Str "Ground" ]
+            )
+          ]
+    }
+  []
+
+```
diff --git a/test/command/7521.md b/test/command/7521.md
new file mode 100644
--- /dev/null
+++ b/test/command/7521.md
@@ -0,0 +1,11 @@
+```
+% pandoc --strip-comments
+- one
+  <!-- with comm -->
+- two
+^D
+<ul>
+<li>one </li>
+<li>two</li>
+</ul>
+```
diff --git a/test/command/7529.md b/test/command/7529.md
new file mode 100644
--- /dev/null
+++ b/test/command/7529.md
@@ -0,0 +1,7 @@
+```
+% pandoc -f html -t asciidoc
+<a href="https://example.com/show.cgi?id=hi--there--everyone">https://example.com/show.cgi?id=hi--there--everyone</a>
+^D
+link:++https://example.com/show.cgi?id=hi--there--everyone++[]
+```
+
diff --git a/test/command/7557.md b/test/command/7557.md
new file mode 100644
--- /dev/null
+++ b/test/command/7557.md
@@ -0,0 +1,20 @@
+```
+% pandoc -f org -t native
+- 11. and 12. 09. meeting
+^D
+[ BulletList
+    [ [ Plain
+          [ Str "11."
+          , Space
+          , Str "and"
+          , Space
+          , Str "12."
+          , Space
+          , Str "09."
+          , Space
+          , Str "meeting"
+          ]
+      ]
+    ]
+]
+```
diff --git a/test/command/7568.md b/test/command/7568.md
new file mode 100644
--- /dev/null
+++ b/test/command/7568.md
@@ -0,0 +1,11 @@
+```
+% pandoc -f rst
+While `Labyrinth Lord: Revised Edition`_ (LLRE; PDF and POD) has been
+criticized for not being a completely faithful retro-clone of the
+Moldvay/Cook/Marsh Basic/Expert D&D rules (B/X), I think it still
+holds a useful spot.
+
+.. _Labyrinth Lord\: Revised Edition: https://www.drivethrurpg.com/product/64332/Labyrinth-Lord-Revised-Edition
+^D
+<p>While <a href="https://www.drivethrurpg.com/product/64332/Labyrinth-Lord-Revised-Edition">Labyrinth Lord: Revised Edition</a> (LLRE; PDF and POD) has been criticized for not being a completely faithful retro-clone of the Moldvay/Cook/Marsh Basic/Expert D&amp;D rules (B/X), I think it still holds a useful spot.</p>
+```
diff --git a/test/command/7573.md b/test/command/7573.md
new file mode 100644
--- /dev/null
+++ b/test/command/7573.md
@@ -0,0 +1,11 @@
+```
+% pandoc --preserve-tabs
+<ol>
+	<li>one
+</ol>
+^D
+<ol>
+<li>
+one
+</ol>
+```
diff --git a/test/command/7589.md b/test/command/7589.md
new file mode 100644
--- /dev/null
+++ b/test/command/7589.md
@@ -0,0 +1,72 @@
+```
+% pandoc -f html -t native
+<table>
+ <thead>
+  <tr>
+   <th>experience</th>
+   <th>expertise</th>
+   <th>paradigms</th>
+   <th>haskell</th>
+   <th>name</th>
+   <th>image</th>
+  </tr>
+ </thead>
+ <tbody></tbody>
+</table>
+^D
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "experience" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "expertise" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "paradigms" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "haskell" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "name" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "image" ] ]
+           ]
+       ])
+    [ TableBody ( "" , [] , [] ) (RowHeadColumns 0) [] [] ]
+    (TableFoot ( "" , [] , [] ) [])
+]
+```
diff --git a/test/command/7615.md b/test/command/7615.md
new file mode 100644
--- /dev/null
+++ b/test/command/7615.md
@@ -0,0 +1,6 @@
+```
+% pandoc -f latex -t native
+\texttt{\^}
+^D
+[ Para [ Code ( "" , [] , [] ) "^" ] ]
+```
diff --git a/test/command/7623.md b/test/command/7623.md
new file mode 100644
--- /dev/null
+++ b/test/command/7623.md
@@ -0,0 +1,12 @@
+```
+% pandoc -t native
+[link $(0,1]$](url)
+^D
+[ Para
+    [ Link
+        ( "" , [] , [] )
+        [ Str "link" , Space , Math InlineMath "(0,1]" ]
+        ( "url" , "" )
+    ]
+]
+```
diff --git a/test/command/7632.md b/test/command/7632.md
new file mode 100644
--- /dev/null
+++ b/test/command/7632.md
@@ -0,0 +1,66 @@
+```
+% pandoc -t native
+(@a) First case
+
+[link to (@a)](url)
+^D
+[ OrderedList
+    ( 1 , Example , TwoParens )
+    [ [ Plain [ Str "First" , Space , Str "case" ] ] ]
+, Para
+    [ Link
+        ( "" , [] , [] )
+        [ Str "link" , Space , Str "to" , Space , Str "(1)" ]
+        ( "url" , "" )
+    ]
+]
+```
+
+```
+% pandoc -t native
+[@a]{.class}
+^D
+[ Para
+    [ Span
+        ( "" , [ "class" ] , [] )
+        [ Cite
+            [ Citation
+                { citationId = "a"
+                , citationPrefix = []
+                , citationSuffix = []
+                , citationMode = AuthorInText
+                , citationNoteNum = 1
+                , citationHash = 0
+                }
+            ]
+            [ Str "@a" ]
+        ]
+    ]
+]
+
+```
+
+```
+% pandoc -t native
+[@a](url)
+^D
+[ Para
+    [ Link
+        ( "" , [] , [] )
+        [ Cite
+            [ Citation
+                { citationId = "a"
+                , citationPrefix = []
+                , citationSuffix = []
+                , citationMode = AuthorInText
+                , citationNoteNum = 1
+                , citationHash = 0
+                }
+            ]
+            [ Str "@a" ]
+        ]
+        ( "url" , "" )
+    ]
+]
+
+```
diff --git a/test/command/934.md b/test/command/934.md
--- a/test/command/934.md
+++ b/test/command/934.md
@@ -7,6 +7,38 @@
 }
 \ddb{This should be italic and in quotes}{And this is the attribution}
 ^D
-[Para [Emph [Quoted DoubleQuote [Str "This",Space,Str "should",Space,Str "be",Space,Str "italic",Space,Str "and",Space,Str "in",Space,Str "quotes"]]]
-,Para [Strong [Str "And",Space,Str "this",Space,Str "is",Space,Str "the",Space,Str "attribution"]]]
+[ Para
+    [ Emph
+        [ Quoted
+            DoubleQuote
+            [ Str "This"
+            , Space
+            , Str "should"
+            , Space
+            , Str "be"
+            , Space
+            , Str "italic"
+            , Space
+            , Str "and"
+            , Space
+            , Str "in"
+            , Space
+            , Str "quotes"
+            ]
+        ]
+    ]
+, Para
+    [ Strong
+        [ Str "And"
+        , Space
+        , Str "this"
+        , Space
+        , Str "is"
+        , Space
+        , Str "the"
+        , Space
+        , Str "attribution"
+        ]
+    ]
+]
 ```
diff --git a/test/command/982.md b/test/command/982.md
--- a/test/command/982.md
+++ b/test/command/982.md
@@ -7,5 +7,5 @@
 y=x^2
 \EEQ
 ^D
-[Para [Math DisplayMath "y=x^2"]]
+[ Para [ Math DisplayMath "y=x^2" ] ]
 ```
diff --git a/test/command/987.md b/test/command/987.md
--- a/test/command/987.md
+++ b/test/command/987.md
@@ -1,5 +1,5 @@
 ```
-pandoc -f latex -t markdown
+% pandoc -f latex -t markdown
 \documentclass{article}
 \newenvironment{flubble}{FOO}{BAR}
 \begin{document}
diff --git a/test/command/adjacent_latex_blocks.md b/test/command/adjacent_latex_blocks.md
--- a/test/command/adjacent_latex_blocks.md
+++ b/test/command/adjacent_latex_blocks.md
@@ -4,6 +4,7 @@
 
 \listoftables
 ^D
-[RawBlock (Format "tex") "\\listoffigures"
-,RawBlock (Format "tex") "\\listoftables"]
+[ RawBlock (Format "tex") "\\listoffigures"
+, RawBlock (Format "tex") "\\listoftables"
+]
 ```
diff --git a/test/command/ascii.md b/test/command/ascii.md
--- a/test/command/ascii.md
+++ b/test/command/ascii.md
@@ -1,19 +1,19 @@
 ```
-pandoc -t html --ascii
+% pandoc -t html --ascii
 äéıå
 ^D
 <p>&#xE4;&#xE9;&#x131;&#xE5;</p>
 ```
 
 ```
-pandoc -t latex --ascii
+% pandoc -t latex --ascii
 äéıå
 ^D
 \"{a}\'{e}\i\r{a}
 ```
 
 ```
-pandoc -t man --ascii
+% pandoc -t man --ascii
 äéıå
 ^D
 .PP
@@ -21,7 +21,7 @@
 ```
 
 ```
-pandoc -t ms --ascii
+% pandoc -t ms --ascii
 äéıå
 ^D
 .LP
@@ -29,7 +29,7 @@
 ```
 
 ```
-pandoc -t docbook --ascii
+% pandoc -t docbook --ascii
 äéıå
 ^D
 <para>
@@ -38,14 +38,14 @@
 ```
 
 ```
-pandoc -t jats --ascii
+% pandoc -t jats --ascii
 äéıå
 ^D
 <p>&#xE4;&#xE9;&#x131;&#xE5;</p>
 ```
 
 ```
-pandoc -t markdown-smart --ascii
+% pandoc -t markdown-smart --ascii
 "äéıå"
 ^D
 &ldquo;&auml;&eacute;&imath;&aring;&rdquo;
diff --git a/test/command/bar-endinput.tex b/test/command/bar-endinput.tex
new file mode 100644
--- /dev/null
+++ b/test/command/bar-endinput.tex
@@ -0,0 +1,3 @@
+\emph{hi there}
+\endinput
+\emph{invisible}
diff --git a/test/command/biblatex-article.md b/test/command/biblatex-article.md
--- a/test/command/biblatex-article.md
+++ b/test/command/biblatex-article.md
@@ -97,7 +97,7 @@
   - family: Author
     given: Ann A.
     suffix: Jr.
-  collection-title: new series
+  collection-title: New series
   container-title: "The Journaltitle: The Journalsubtitle"
   doi: 10.1086/520976
   editor:
diff --git a/test/command/biblatex-gillies.md b/test/command/biblatex-gillies.md
--- a/test/command/biblatex-gillies.md
+++ b/test/command/biblatex-gillies.md
@@ -54,7 +54,7 @@
   author:
   - family: Gillies
     given: Alexander
-  collection-title: new series
+  collection-title: New series
   container-title: Publications of the English Goethe Society
   id: gillies
   issued: 1933
diff --git a/test/command/biblatex-shore.md b/test/command/biblatex-shore.md
--- a/test/command/biblatex-shore.md
+++ b/test/command/biblatex-shore.md
@@ -49,7 +49,7 @@
   author:
   - family: Shore
     given: Bradd
-  collection-title: new series
+  collection-title: New series
   container-title: American Anthropologist
   id: shore
   issue: 1
diff --git a/test/command/cite-in-inline-note.md b/test/command/cite-in-inline-note.md
--- a/test/command/cite-in-inline-note.md
+++ b/test/command/cite-in-inline-note.md
@@ -2,5 +2,25 @@
 % pandoc -t native
 foo^[bar [@doe]]
 ^D
-[Para [Str "foo",Note [Para [Str "bar",Space,Cite [Citation {citationId = "doe", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 1, citationHash = 0}] [Str "[@doe]"]]]]]
+[ Para
+    [ Str "foo"
+    , Note
+        [ Para
+            [ Str "bar"
+            , Space
+            , Cite
+                [ Citation
+                    { citationId = "doe"
+                    , citationPrefix = []
+                    , citationSuffix = []
+                    , citationMode = NormalCitation
+                    , citationNoteNum = 1
+                    , citationHash = 0
+                    }
+                ]
+                [ Str "[@doe]" ]
+            ]
+        ]
+    ]
+]
 ```
diff --git a/test/command/citeproc-author-in-text-suffix.md b/test/command/citeproc-author-in-text-suffix.md
--- a/test/command/citeproc-author-in-text-suffix.md
+++ b/test/command/citeproc-author-in-text-suffix.md
@@ -2,5 +2,33 @@
 % pandoc -t native
 @a [p. 33; @b]
 ^D
-[Para [Cite [Citation {citationId = "a", citationPrefix = [], citationSuffix = [Str "p.\160\&33"], citationMode = AuthorInText, citationNoteNum = 1, citationHash = 0},Citation {citationId = "b", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 1, citationHash = 0}] [Str "@a",Space,Str "[p.",Space,Str "33;",Space,Str "@b]"]]]
+[ Para
+    [ Cite
+        [ Citation
+            { citationId = "a"
+            , citationPrefix = []
+            , citationSuffix = [ Str "p.\160\&33" ]
+            , citationMode = AuthorInText
+            , citationNoteNum = 1
+            , citationHash = 0
+            }
+        , Citation
+            { citationId = "b"
+            , citationPrefix = []
+            , citationSuffix = []
+            , citationMode = NormalCitation
+            , citationNoteNum = 1
+            , citationHash = 0
+            }
+        ]
+        [ Str "@a"
+        , Space
+        , Str "[p."
+        , Space
+        , Str "33;"
+        , Space
+        , Str "@b]"
+        ]
+    ]
+]
 ```
diff --git a/test/command/csv.md b/test/command/csv.md
--- a/test/command/csv.md
+++ b/test/command/csv.md
@@ -5,42 +5,98 @@
 """Navel"" Orange","35 cents",22
 ,,45
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Fruit"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Price"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Quantity"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Apple"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "25",Space,Str "cents"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "33"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "\"Navel\"",Space,Str "Orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "35",Space,Str "cents"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "22"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "45"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Fruit" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Price" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Quantity" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Apple" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "25" , Space , Str "cents" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "33" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "\"Navel\"" , Space , Str "Orange" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "35" , Space , Str "cents" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "22" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+            , Cell
+                ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "45" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/docbook-bibliography.md b/test/command/docbook-bibliography.md
--- a/test/command/docbook-bibliography.md
+++ b/test/command/docbook-bibliography.md
@@ -13,8 +13,33 @@
 </bibliomixed>
 </bibliodiv>
 ^D
-[Header 1 ("",[],[]) [Str "Document",Space,Str "References"]
-,Para [Span ("refTheFirst",[],[]) [],Str "[1]",Space,Str "First",Space,Str "reference"]
-,Para [Span ("refTheSecond",[],[]) [],Str "[2]",Space,Str "Second",Space,Str "reference"]
-,Para [Span ("refTheThird",[],[]) [],Str "[3]",Space,Str "Third",Space,Str "reference"]]
+[ Header
+    1
+    ( "" , [] , [] )
+    [ Str "Document" , Space , Str "References" ]
+, Para
+    [ Span ( "refTheFirst" , [] , [] ) []
+    , Str "[1]"
+    , Space
+    , Str "First"
+    , Space
+    , Str "reference"
+    ]
+, Para
+    [ Span ( "refTheSecond" , [] , [] ) []
+    , Str "[2]"
+    , Space
+    , Str "Second"
+    , Space
+    , Str "reference"
+    ]
+, Para
+    [ Span ( "refTheThird" , [] , [] ) []
+    , Str "[3]"
+    , Space
+    , Str "Third"
+    , Space
+    , Str "reference"
+    ]
+]
 ```
diff --git a/test/command/dots.md b/test/command/dots.md
--- a/test/command/dots.md
+++ b/test/command/dots.md
@@ -6,7 +6,8 @@
 
 \vdots
 ^D
-[Para [Str "\8230"]
-,Para [Str "\8230"]
-,Para [Str "\8942"]]
+[ Para [ Str "\8230" ]
+, Para [ Str "\8230" ]
+, Para [ Str "\8942" ]
+]
 ```
diff --git a/test/command/empty_paragraphs.md b/test/command/empty_paragraphs.md
--- a/test/command/empty_paragraphs.md
+++ b/test/command/empty_paragraphs.md
@@ -2,34 +2,32 @@
 % pandoc -f native -t docx -o - | pandoc -f docx -t native
 [Para [Str "hi"], Para [], Para [], Para [Str "lo"]]
 ^D
-[Para [Str "hi"]
-,Para [Str "lo"]]
+[ Para [ Str "hi" ] , Para [ Str "lo" ] ]
 ```
 
 ```
 % pandoc -f native -t docx+empty_paragraphs -o - | pandoc -f docx -t native
 [Para [Str "hi"], Para [], Para [], Para [Str "lo"]]
 ^D
-[Para [Str "hi"]
-,Para [Str "lo"]]
+[ Para [ Str "hi" ] , Para [ Str "lo" ] ]
 ```
 
 ```
 % pandoc -f native -t docx -o - | pandoc -f docx+empty_paragraphs -t native
 [Para [Str "hi"], Para [], Para [], Para [Str "lo"]]
 ^D
-[Para [Str "hi"]
-,Para [Str "lo"]]
+[ Para [ Str "hi" ] , Para [ Str "lo" ] ]
 ```
 
 ```
 % pandoc -f native -t docx+empty_paragraphs -o - | pandoc -f docx+empty_paragraphs -t native
 [Para [Str "hi"], Para [], Para [], Para [Str "lo"]]
 ^D
-[Para [Str "hi"]
-,Para []
-,Para []
-,Para [Str "lo"]]
+[ Para [ Str "hi" ]
+, Para []
+, Para []
+, Para [ Str "lo" ]
+]
 ```
 
 ```
@@ -57,10 +55,11 @@
 <p></p>
 <p>lo</p>
 ^D
-[Para [Str "hi"]
-,Para []
-,Para []
-,Para [Str "lo"]]
+[ Para [ Str "hi" ]
+, Para []
+, Para []
+, Para [ Str "lo" ]
+]
 ```
 
 ```
@@ -70,8 +69,7 @@
 <p></p>
 <p>lo</p>
 ^D
-[Para [Str "hi"]
-,Para [Str "lo"]]
+[ Para [ Str "hi" ] , Para [ Str "lo" ] ]
 ```
 
 ```
diff --git a/test/command/gfm.md b/test/command/gfm.md
--- a/test/command/gfm.md
+++ b/test/command/gfm.md
@@ -7,37 +7,76 @@
 | apple | 0.13  |
 | orange|1.12|
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Fruit"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Price"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "apple"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "0.13"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1.12"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignRight , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Fruit" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Price" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "apple" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "0.13" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "orange" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1.12" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 
 ```
 % pandoc -f gfm -t native
 ~~stricken out~~
 ^D
-[Para [Strikeout [Str "stricken",Space,Str "out"]]]
+[ Para [ Strikeout [ Str "stricken" , Space , Str "out" ] ]
+]
 ```
 
 ```
@@ -46,30 +85,42 @@
 ## Header
 # -foo-bar_baz
 ^D
-[Header 1 ("header",[],[]) [Str "Header"]
-,Header 2 ("header-1",[],[]) [Str "Header"]
-,Header 1 ("-foo-bar_baz",[],[]) [Str "-foo-bar_baz"]]
+[ Header 1 ( "header" , [] , [] ) [ Str "Header" ]
+, Header 2 ( "header-1" , [] , [] ) [ Str "Header" ]
+, Header
+    1 ( "-foo-bar_baz" , [] , [] ) [ Str "-foo-bar_baz" ]
+]
 ```
 
 ```
 % pandoc -f gfm -t native
 My:thumbsup:emoji:heart:
 ^D
-[Para [Str "My",Span ("",["emoji"],[("data-emoji","thumbsup")]) [Str "\128077"],Str "emoji",Span ("",["emoji"],[("data-emoji","heart")]) [Str "\10084\65039"]]]
+[ Para
+    [ Str "My"
+    , Span
+        ( "" , [ "emoji" ] , [ ( "data-emoji" , "thumbsup" ) ] )
+        [ Str "\128077" ]
+    , Str "emoji"
+    , Span
+        ( "" , [ "emoji" ] , [ ( "data-emoji" , "heart" ) ] )
+        [ Str "\10084\65039" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f gfm -t native
 "hi"
 ^D
-[Para [Str "\"hi\""]]
+[ Para [ Str "\"hi\"" ] ]
 ```
 
 ```
 % pandoc -f gfm+smart -t native
 "hi"
 ^D
-[Para [Quoted DoubleQuote [Str "hi"]]]
+[ Para [ Quoted DoubleQuote [ Str "hi" ] ] ]
 ```
 
 ```
@@ -133,7 +184,7 @@
 hi
 hi
 ^D
-[Para [Str "hi",LineBreak,Str "hi"]]
+[ Para [ Str "hi" , LineBreak , Str "hi" ] ]
 ```
 
 ```
@@ -141,9 +192,11 @@
 - [ ] foo
 - [x] bar
 ^D
-[BulletList
- [[Plain [Str "\9744",Space,Str "foo"]]
- ,[Plain [Str "\9746",Space,Str "bar"]]]]
+[ BulletList
+    [ [ Plain [ Str "\9744" , Space , Str "foo" ] ]
+    , [ Plain [ Str "\9746" , Space , Str "bar" ] ]
+    ]
+]
 ```
 
 ```
@@ -151,9 +204,12 @@
 - [ ] foo
 - [x] bar
 ^D
-[BulletList
- [[Plain [Str "[",Space,Str "]",Space,Str "foo"]]
- ,[Plain [Str "[x]",Space,Str "bar"]]]]
+[ BulletList
+    [ [ Plain [ Str "[" , Space , Str "]" , Space , Str "foo" ]
+      ]
+    , [ Plain [ Str "[x]" , Space , Str "bar" ] ]
+    ]
+]
 ```
 
 ```
diff --git a/test/command/hspace.md b/test/command/hspace.md
--- a/test/command/hspace.md
+++ b/test/command/hspace.md
@@ -8,7 +8,10 @@
 \caption{lalune \hspace{2em} \vspace{1em} bloo}
 \end{figure}
 ^D
-[RawBlock (Format "tex") "\\begin{figure}\n\\includegraphics{lalune.jpg}\n\\caption{lalune \\hspace{2em} \\vspace{1em} bloo}\n\\end{figure}"]
+[ RawBlock
+    (Format "tex")
+    "\\begin{figure}\n\\includegraphics{lalune.jpg}\n\\caption{lalune \\hspace{2em} \\vspace{1em} bloo}\n\\end{figure}"
+]
 ```
 
 Here block:
@@ -32,14 +35,22 @@
 F & F &\\
 \end{tabular}
 ^D
-[RawBlock (Format "tex") "\\begin{tabular}[t]{cc|c}\n\\(P\\) & \\(Q\\) & \\(P\\wedge Q\\)\\\\\n\\hline\nT & T &\\\\\nT & F &\\\\\nF & T &\\\\\nF & F &\\\\\n\\end{tabular}\n\\hspace{1em}\n\\begin{tabular}[t]{cc|c}\n\\(P\\) & \\(Q\\) & \\(P\\vee Q\\)\\\\\n\\hline\nT & T &\\\\\nT & F &\\\\\nF & T &\\\\\nF & F &\\\\\n\\end{tabular}"]
+[ RawBlock
+    (Format "tex")
+    "\\begin{tabular}[t]{cc|c}\n\\(P\\) & \\(Q\\) & \\(P\\wedge Q\\)\\\\\n\\hline\nT & T &\\\\\nT & F &\\\\\nF & T &\\\\\nF & F &\\\\\n\\end{tabular}\n\\hspace{1em}\n\\begin{tabular}[t]{cc|c}\n\\(P\\) & \\(Q\\) & \\(P\\vee Q\\)\\\\\n\\hline\nT & T &\\\\\nT & F &\\\\\nF & T &\\\\\nF & F &\\\\\n\\end{tabular}"
+]
 ```
 
 ```
 % pandoc -f markdown+raw_tex -t native
 hi\hspace{1em}there
 ^D
-[Para [Str "hi",RawInline (Format "tex") "\\hspace{1em}",Str "there"]]
+[ Para
+    [ Str "hi"
+    , RawInline (Format "tex") "\\hspace{1em}"
+    , Str "there"
+    ]
+]
 ```
 
 ```
@@ -50,7 +61,8 @@
 
 there
 ^D
-[Para [Str "hi"]
-,RawBlock (Format "tex") "\\hspace{1em}"
-,Para [Str "there"]]
+[ Para [ Str "hi" ]
+, RawBlock (Format "tex") "\\hspace{1em}"
+, Para [ Str "there" ]
+]
 ```
diff --git a/test/command/html-read-figure.md b/test/command/html-read-figure.md
--- a/test/command/html-read-figure.md
+++ b/test/command/html-read-figure.md
@@ -5,7 +5,11 @@
   <figcaption>bar</figcaption>
 </figure>
 ^D
-[Para [Image ("",[],[]) [Str "bar"] ("foo.png","fig:voyage")]]
+[ Para
+    [ Image
+        ( "" , [] , [] ) [ Str "bar" ] ( "foo.png" , "fig:voyage" )
+    ]
+]
 ```
 
 ```
@@ -15,7 +19,11 @@
   <img src="foo.png" title="voyage">
 </figure>
 ^D
-[Para [Image ("",[],[]) [Str "bar"] ("foo.png","fig:voyage")]]
+[ Para
+    [ Image
+        ( "" , [] , [] ) [ Str "bar" ] ( "foo.png" , "fig:voyage" )
+    ]
+]
 ```
 
 ```
@@ -24,7 +32,9 @@
   <img src="foo.png" title="voyage">
 </figure>
 ^D
-[Para [Image ("",[],[]) [] ("foo.png","fig:voyage")]]
+[ Para
+    [ Image ( "" , [] , [] ) [] ( "foo.png" , "fig:voyage" ) ]
+]
 ```
 
 ```
@@ -34,12 +44,22 @@
   <figcaption>bar</figcaption>
 </figure>
 ^D
-[Para [Image ("",[],[]) [Str "bar"] ("foo.png","fig:voyage")]]
+[ Para
+    [ Image
+        ( "" , [] , [] ) [ Str "bar" ] ( "foo.png" , "fig:voyage" )
+    ]
+]
 ```
 
 ```
 % pandoc -f html -t native
 <figure><img src="foo.png" title="voyage" alt="this is ignored"><figcaption>bar <strong>baz</strong></figcaption></figure>
 ^D
-[Para [Image ("",[],[]) [Str "bar",Space,Strong [Str "baz"]] ("foo.png","fig:voyage")]]
+[ Para
+    [ Image
+        ( "" , [] , [] )
+        [ Str "bar" , Space , Strong [ Str "baz" ] ]
+        ( "foo.png" , "fig:voyage" )
+    ]
+]
 ```
diff --git a/test/command/html-trim-definition-list-terms.md b/test/command/html-trim-definition-list-terms.md
--- a/test/command/html-trim-definition-list-terms.md
+++ b/test/command/html-trim-definition-list-terms.md
@@ -11,7 +11,15 @@
     <dd>test</dd>
 </dl>
 ^D
-[DefinitionList
- [([Str "foo",SoftBreak,Str "bar",LineBreak,Str "baz"],
-   [[Plain [Str "test"]]])]]
+[ DefinitionList
+    [ ( [ Str "foo"
+        , SoftBreak
+        , Str "bar"
+        , LineBreak
+        , Str "baz"
+        ]
+      , [ [ Plain [ Str "test" ] ] ]
+      )
+    ]
+]
 ```
diff --git a/test/command/hyphenat.md b/test/command/hyphenat.md
--- a/test/command/hyphenat.md
+++ b/test/command/hyphenat.md
@@ -2,48 +2,60 @@
 % pandoc -f latex -t native
 electromagnetic\hyp{}endioscopy
 ^D
-[Para [Str "electromagnetic-endioscopy"]]
+[ Para [ Str "electromagnetic-endioscopy" ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 C\colonhyp\bshyp{}Windows\bshyp
 ^D
-[Para [Str "C:\173\\\173Windows\\\173"]]
+[ Para [ Str "C:\173\\\173Windows\\\173" ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 \fshyp{}usr\fshyp{}share\fshyp
 ^D
-[Para [Str "/\173usr/\173share/\173"]]
+[ Para [ Str "/\173usr/\173share/\173" ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 \fshyp{}home\fshyp{}schrieveslaach\fshyp\dothyp{}m2
 ^D
-[Para [Str "/\173home/\173schrieveslaach/\173.\173m2"]]
+[ Para [ Str "/\173home/\173schrieveslaach/\173.\173m2" ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 \nohyphens{Pneumonoultramicroscopicsilicovolcanoconiosis}
 ^D
-[Para [Str "Pneumonoultramicroscopicsilicovolcanoconiosis"]]
+[ Para
+    [ Str "Pneumonoultramicroscopicsilicovolcanoconiosis" ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \textnhtt{Pneumonoultramicroscopicsilicovolcanoconiosis}
 ^D
-[Para [Code ("",[],[]) "Pneumonoultramicroscopicsilicovolcanoconiosis"]]
+[ Para
+    [ Code
+        ( "" , [] , [] )
+        "Pneumonoultramicroscopicsilicovolcanoconiosis"
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \nhttfamily{Pneumonoultramicroscopicsilicovolcanoconiosis}
 ^D
-[Para [Code ("",[],[]) "Pneumonoultramicroscopicsilicovolcanoconiosis"]]
+[ Para
+    [ Code
+        ( "" , [] , [] )
+        "Pneumonoultramicroscopicsilicovolcanoconiosis"
+    ]
+]
 ```
 
diff --git a/test/command/ifstrequal.md b/test/command/ifstrequal.md
--- a/test/command/ifstrequal.md
+++ b/test/command/ifstrequal.md
@@ -5,5 +5,12 @@
 \h{a}
 \h{b}
 ^D
-[Para [Emph [Str "no"],SoftBreak,Str "\225",SoftBreak,Str "b"]]
+[ Para
+    [ Emph [ Str "no" ]
+    , SoftBreak
+    , Str "\225"
+    , SoftBreak
+    , Str "b"
+    ]
+]
 ```
diff --git a/test/command/indented-fences.md b/test/command/indented-fences.md
--- a/test/command/indented-fences.md
+++ b/test/command/indented-fences.md
@@ -5,7 +5,7 @@
 in y
    ```
 ^D
-[CodeBlock ("",["haskell"],[]) "let x = y\nin y"]
+[ CodeBlock ( "" , [ "haskell" ] , [] ) "let x = y\nin y" ]
 `````
 `````
 % pandoc -t native
@@ -16,5 +16,7 @@
  y
 ~~~
 ^D
-[CodeBlock ("",["haskell"],[]) " let x = y\nin y +\ny +\ny"]
+[ CodeBlock
+    ( "" , [ "haskell" ] , [] ) " let x = y\nin y +\ny +\ny"
+]
 `````
diff --git a/test/command/input-with-endinput.md b/test/command/input-with-endinput.md
new file mode 100644
--- /dev/null
+++ b/test/command/input-with-endinput.md
@@ -0,0 +1,15 @@
+```
+% pandoc --from=latex -t native
+\begin{document}
+Visible
+
+\include{command/bar-endinput}
+
+Visible
+\end{document}
+^D
+[ Para [ Str "Visible" ]
+, Para [ Emph [ Str "hi" , Space , Str "there" ] ]
+, Para [ Str "Visible" ]
+]
+```
diff --git a/test/command/latex-center.md b/test/command/latex-center.md
--- a/test/command/latex-center.md
+++ b/test/command/latex-center.md
@@ -7,7 +7,6 @@
 \end{center}
 
 ^D
-[Div ("",["center"],[])
- [Para [Str "Hello"]]]
+[ Div ( "" , [ "center" ] , [] ) [ Para [ Str "Hello" ] ] ]
 ```
 
diff --git a/test/command/latex-color.md b/test/command/latex-color.md
--- a/test/command/latex-color.md
+++ b/test/command/latex-color.md
@@ -4,21 +4,40 @@
 % pandoc -f latex -t native
 Hello \textcolor{red}{World}
 ^D
-[Para [Str "Hello",Space,Span ("",[],[("style","color: red")]) [Str "World"]]]
+[ Para
+    [ Str "Hello"
+    , Space
+    , Span
+        ( "" , [] , [ ( "style" , "color: red" ) ] ) [ Str "World" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \textcolor{red}{Hello} World
 ^D
-[Para [Span ("",[],[("style","color: red")]) [Str "Hello"],Space,Str "World"]]
+[ Para
+    [ Span
+        ( "" , [] , [ ( "style" , "color: red" ) ] ) [ Str "Hello" ]
+    , Space
+    , Str "World"
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 Hello \textcolor{blue}{\textbf{World}}
 ^D
-[Para [Str "Hello",Space,Span ("",[],[("style","color: blue")]) [Strong [Str "World"]]]]
+[ Para
+    [ Str "Hello"
+    , Space
+    , Span
+        ( "" , [] , [ ( "style" , "color: blue" ) ] )
+        [ Strong [ Str "World" ] ]
+    ]
+]
 ```
 
 
@@ -26,7 +45,15 @@
 % pandoc -f latex -t native
 Hello \textcolor{blue}{\textbf{World}}.
 ^D
-[Para [Str "Hello",Space,Span ("",[],[("style","color: blue")]) [Strong [Str "World"]],Str "."]]
+[ Para
+    [ Str "Hello"
+    , Space
+    , Span
+        ( "" , [] , [ ( "style" , "color: blue" ) ] )
+        [ Strong [ Str "World" ] ]
+    , Str "."
+    ]
+]
 ```
 
 ```
@@ -38,10 +65,14 @@
 \end{itemize}
 }
 ^D
-[Div ("",[],[("style","color: orange")])
- [BulletList
-  [[Para [Str "Item",Space,Str "1"]]
-  ,[Para [Str "Item",Space,Str "2"]]]]]
+[ Div
+    ( "" , [] , [ ( "style" , "color: orange" ) ] )
+    [ BulletList
+        [ [ Para [ Str "Item" , Space , Str "1" ] ]
+        , [ Para [ Str "Item" , Space , Str "2" ] ]
+        ]
+    ]
+]
 ```
 
 ```
@@ -53,11 +84,16 @@
 \end{itemize}
 } some more text
 ^D
-[Div ("",[],[("style","color: blue")])
- [BulletList
-  [[Para [Str "Item",Space,Str "1"]]
-  ,[Para [Str "Item",Space,Str "2"]]]]
-,Para [Str "some",Space,Str "more",Space,Str "text"]]
+[ Div
+    ( "" , [] , [ ( "style" , "color: blue" ) ] )
+    [ BulletList
+        [ [ Para [ Str "Item" , Space , Str "1" ] ]
+        , [ Para [ Str "Item" , Space , Str "2" ] ]
+        ]
+    ]
+, Para
+    [ Str "some" , Space , Str "more" , Space , Str "text" ]
+]
 ```
 
 # `\colorbox{}{}`
@@ -67,28 +103,57 @@
 % pandoc -f latex -t native
 Hello \colorbox{red}{World}
 ^D
-[Para [Str "Hello",Space,Span ("",[],[("style","background-color: red")]) [Str "World"]]]
+[ Para
+    [ Str "Hello"
+    , Space
+    , Span
+        ( "" , [] , [ ( "style" , "background-color: red" ) ] )
+        [ Str "World" ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 \colorbox{red}{Hello} World
 ^D
-[Para [Span ("",[],[("style","background-color: red")]) [Str "Hello"],Space,Str "World"]]
+[ Para
+    [ Span
+        ( "" , [] , [ ( "style" , "background-color: red" ) ] )
+        [ Str "Hello" ]
+    , Space
+    , Str "World"
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 Hello \colorbox{blue}{\textbf{World}}
 ^D
-[Para [Str "Hello",Space,Span ("",[],[("style","background-color: blue")]) [Strong [Str "World"]]]]
+[ Para
+    [ Str "Hello"
+    , Space
+    , Span
+        ( "" , [] , [ ( "style" , "background-color: blue" ) ] )
+        [ Strong [ Str "World" ] ]
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 Hello \colorbox{blue}{\textbf{World}}.
 ^D
-[Para [Str "Hello",Space,Span ("",[],[("style","background-color: blue")]) [Strong [Str "World"]],Str "."]]
+[ Para
+    [ Str "Hello"
+    , Space
+    , Span
+        ( "" , [] , [ ( "style" , "background-color: blue" ) ] )
+        [ Strong [ Str "World" ] ]
+    , Str "."
+    ]
+]
 ```
 
 ```
@@ -102,10 +167,14 @@
 \end{minipage}
 }
 ^D
-[Div ("",[],[("style","background-color: orange")])
- [BulletList
-  [[Para [Str "Item",Space,Str "1"]]
-  ,[Para [Str "Item",Space,Str "2"]]]]]
+[ Div
+    ( "" , [] , [ ( "style" , "background-color: orange" ) ] )
+    [ BulletList
+        [ [ Para [ Str "Item" , Space , Str "1" ] ]
+        , [ Para [ Str "Item" , Space , Str "2" ] ]
+        ]
+    ]
+]
 ```
 
 ```
@@ -119,9 +188,14 @@
 \end{minipage}
 } some more text
 ^D
-[Div ("",[],[("style","background-color: blue")])
- [BulletList
-  [[Para [Str "Item",Space,Str "1"]]
-  ,[Para [Str "Item",Space,Str "2"]]]]
-,Para [Str "some",Space,Str "more",Space,Str "text"]]
+[ Div
+    ( "" , [] , [ ( "style" , "background-color: blue" ) ] )
+    [ BulletList
+        [ [ Para [ Str "Item" , Space , Str "1" ] ]
+        , [ Para [ Str "Item" , Space , Str "2" ] ]
+        ]
+    ]
+, Para
+    [ Str "some" , Space , Str "more" , Space , Str "text" ]
+]
 ```
diff --git a/test/command/latex-command-comment.md b/test/command/latex-command-comment.md
--- a/test/command/latex-command-comment.md
+++ b/test/command/latex-command-comment.md
@@ -1,7 +1,7 @@
 ```
-pandoc -f latex -t native
+% pandoc -f latex -t native
 \emph%
 {hi}
 ^D
-[Para [Emph [Str "hi"]]]
+[ Para [ Emph [ Str "hi" ] ] ]
 ```
diff --git a/test/command/latex-fontawesome.md b/test/command/latex-fontawesome.md
--- a/test/command/latex-fontawesome.md
+++ b/test/command/latex-fontawesome.md
@@ -2,12 +2,12 @@
 % pandoc -f latex -t native
 Check: \faCheck
 ^D
-[Para [Str "Check:",Space,Str "\10003"]]
+[ Para [ Str "Check:" , Space , Str "\10003" ] ]
 ```
 
 ```
 % pandoc -f latex -t native
 Close: \faClose
 ^D
-[Para [Str "Close:",Space,Str "\10007"]]
+[ Para [ Str "Close:" , Space , Str "\10007" ] ]
 ```
diff --git a/test/command/latex-tabular-column-specs.md b/test/command/latex-tabular-column-specs.md
--- a/test/command/latex-tabular-column-specs.md
+++ b/test/command/latex-tabular-column-specs.md
@@ -11,35 +11,85 @@
 \bottomrule
 \end{tabular}
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Math InlineMath ""]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Math InlineMath "f1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Math InlineMath "f2"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Math InlineMath "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Math InlineMath "0.5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Math InlineMath "4"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Math InlineMath "f"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Math InlineMath "0.5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Math InlineMath "5,5"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignLeft , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Math InlineMath "" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Math InlineMath "f1" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Math InlineMath "f2" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Math InlineMath "e" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Math InlineMath "0.5" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Math InlineMath "4" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Math InlineMath "f" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Math InlineMath "0.5" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Math InlineMath "5,5" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/lettrine.md b/test/command/lettrine.md
--- a/test/command/lettrine.md
+++ b/test/command/lettrine.md
@@ -4,6 +4,17 @@
 
 \lettrine[lhang=0.17]{A}{category} is
 ^D
-[Para [Span ("",["lettrine"],[]) [Str "A"],SmallCaps [Str "category"],Space,Str "is"]
-,Para [Span ("",["lettrine"],[]) [Str "A"],SmallCaps [Str "category"],Space,Str "is"]]
+[ Para
+    [ Span ( "" , [ "lettrine" ] , [] ) [ Str "A" ]
+    , SmallCaps [ Str "category" ]
+    , Space
+    , Str "is"
+    ]
+, Para
+    [ Span ( "" , [ "lettrine" ] , [] ) [ Str "A" ]
+    , SmallCaps [ Str "category" ]
+    , Space
+    , Str "is"
+    ]
+]
 ```
diff --git a/test/command/lstlisting.md b/test/command/lstlisting.md
--- a/test/command/lstlisting.md
+++ b/test/command/lstlisting.md
@@ -8,7 +8,16 @@
 }
 \end{lstlisting}
 ^D
-[CodeBlock ("lst:Hello-World",["java"],[("language","Java"),("caption","Java Example"),("label","lst:Hello-World")]) "public class World {\n    public static void main(String[] args) {\n        System.out.println(\"Hello World\");\n    }\n}"]
+[ CodeBlock
+    ( "lst:Hello-World"
+    , [ "java" ]
+    , [ ( "language" , "Java" )
+      , ( "caption" , "Java Example" )
+      , ( "label" , "lst:Hello-World" )
+      ]
+    )
+    "public class World {\n    public static void main(String[] args) {\n        System.out.println(\"Hello World\");\n    }\n}"
+]
 ```
 
 ```
@@ -21,5 +30,15 @@
 }
 \end{lstlisting}
 ^D
-[CodeBlock ("lst:Hello-World",["java"],[("language","Java"),("escapechar","|"),("caption","Java Example"),("label","lst:Hello-World")]) "public class World {\n    public static void main(String[] args) {\n        System.out.println(\"Hello World\");\n    }\n}"]
+[ CodeBlock
+    ( "lst:Hello-World"
+    , [ "java" ]
+    , [ ( "language" , "Java" )
+      , ( "escapechar" , "|" )
+      , ( "caption" , "Java Example" )
+      , ( "label" , "lst:Hello-World" )
+      ]
+    )
+    "public class World {\n    public static void main(String[] args) {\n        System.out.println(\"Hello World\");\n    }\n}"
+]
 ```
diff --git a/test/command/macro-defs-in-preamble.md b/test/command/macro-defs-in-preamble.md
--- a/test/command/macro-defs-in-preamble.md
+++ b/test/command/macro-defs-in-preamble.md
@@ -9,8 +9,10 @@
 $\vara \varb$
 \end{document}
 ^D
-Pandoc (Meta {unMeta = fromList []})
-[RawBlock (Format "latex") "\\newcommand{\\vara}{\\alpha}"
-,RawBlock (Format "latex") "\\newcommand{\\varb}{b}"
-,Para [Math InlineMath "\\vara \\varb"]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ RawBlock (Format "latex") "\\newcommand{\\vara}{\\alpha}"
+  , RawBlock (Format "latex") "\\newcommand{\\varb}{b}"
+  , Para [ Math InlineMath "\\vara \\varb" ]
+  ]
 ```
diff --git a/test/command/md-abbrevs.md b/test/command/md-abbrevs.md
--- a/test/command/md-abbrevs.md
+++ b/test/command/md-abbrevs.md
@@ -6,7 +6,7 @@
 % pandoc -t native
 Mr. Bob
 ^D
-[Para [Str "Mr.\160Bob"]]
+[ Para [ Str "Mr.\160Bob" ] ]
 ```
 
 If you don't want this to happen you can escape the period:
@@ -15,6 +15,7 @@
 % pandoc -t native
 Hi Mr\. Bob
 ^D
-[Para [Str "Hi",Space,Str "Mr.",Space,Str "Bob"]]
+[ Para [ Str "Hi" , Space , Str "Mr." , Space , Str "Bob" ]
+]
 ```
 
diff --git a/test/command/multiple-metadata-blocks.md b/test/command/multiple-metadata-blocks.md
--- a/test/command/multiple-metadata-blocks.md
+++ b/test/command/multiple-metadata-blocks.md
@@ -10,6 +10,10 @@
 foo: bim
 ...
 ^D
-Pandoc (Meta {unMeta = fromList [("foo",MetaInlines [Str "bim"])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList [ ( "foo" , MetaInlines [ Str "bim" ] ) ]
+    }
+  []
 ```
diff --git a/test/command/refs.md b/test/command/refs.md
--- a/test/command/refs.md
+++ b/test/command/refs.md
@@ -2,21 +2,60 @@
 % pandoc -f latex -t native
 Figure \ref{fig:1}
 ^D
-[Para [Str "Figure",Space,Link ("",[],[("reference-type","ref"),("reference","fig:1")]) [Str "[fig:1]"] ("#fig:1","")]]
+[ Para
+    [ Str "Figure"
+    , Space
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "ref" )
+          , ( "reference" , "fig:1" )
+          ]
+        )
+        [ Str "[fig:1]" ]
+        ( "#fig:1" , "" )
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 Figure \cref{fig:1}
 ^D
-[Para [Str "Figure",Space,Link ("",[],[("reference-type","ref"),("reference","fig:1")]) [Str "[fig:1]"] ("#fig:1","")]]
+[ Para
+    [ Str "Figure"
+    , Space
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "ref" )
+          , ( "reference" , "fig:1" )
+          ]
+        )
+        [ Str "[fig:1]" ]
+        ( "#fig:1" , "" )
+    ]
+]
 ```
 
 ```
 % pandoc -f latex -t native
 Figure \vref{fig:1}
 ^D
-[Para [Str "Figure",Space,Link ("",[],[("reference-type","ref+page"),("reference","fig:1")]) [Str "[fig:1]"] ("#fig:1","")]]
+[ Para
+    [ Str "Figure"
+    , Space
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "ref+page" )
+          , ( "reference" , "fig:1" )
+          ]
+        )
+        [ Str "[fig:1]" ]
+        ( "#fig:1" , "" )
+    ]
+]
 ```
 
 ```
@@ -28,8 +67,42 @@
   Accuracy = \frac{t_p + t_n}{t_p + f_p + f_n + t_n}
 \end{equation}
 ^D
-[Para [Str "Accuracy\160",Link ("",[],[("reference-type","eqref"),("reference","eq:Accuracy")]) [Str "[eq:Accuracy]"] ("#eq:Accuracy",""),Space,Str "is",Space,Str "the",Space,Str "proportion,",Space,Str "measuring",Space,Str "true",Space,Str "results",Space,Str "among",Space,Str "all",Space,Str "results."]
-,Para [Math DisplayMath "\\label{eq:Accuracy}\n  Accuracy = \\frac{t_p + t_n}{t_p + f_p + f_n + t_n}"]]
+[ Para
+    [ Str "Accuracy\160"
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "eqref" )
+          , ( "reference" , "eq:Accuracy" )
+          ]
+        )
+        [ Str "[eq:Accuracy]" ]
+        ( "#eq:Accuracy" , "" )
+    , Space
+    , Str "is"
+    , Space
+    , Str "the"
+    , Space
+    , Str "proportion,"
+    , Space
+    , Str "measuring"
+    , Space
+    , Str "true"
+    , Space
+    , Str "results"
+    , Space
+    , Str "among"
+    , Space
+    , Str "all"
+    , Space
+    , Str "results."
+    ]
+, Para
+    [ Math
+        DisplayMath
+        "\\label{eq:Accuracy}\n  Accuracy = \\frac{t_p + t_n}{t_p + f_p + f_n + t_n}"
+    ]
+]
 ```
 
 ```
@@ -42,8 +115,34 @@
 
 Figure \ref{fig:Logo} illustrated the SVG logo
 ^D
-[Para [Image ("fig:Logo",[],[]) [Str "Logo"] ("command/SVG_logo.svg","fig:")]
-,Para [Str "Figure",Space,Link ("",[],[("reference-type","ref"),("reference","fig:Logo")]) [Str "1"] ("#fig:Logo",""),Space,Str "illustrated",Space,Str "the",Space,Str "SVG",Space,Str "logo"]]
+[ Para
+    [ Image
+        ( "fig:Logo" , [] , [] )
+        [ Str "Logo" ]
+        ( "command/SVG_logo.svg" , "fig:" )
+    ]
+, Para
+    [ Str "Figure"
+    , Space
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "ref" )
+          , ( "reference" , "fig:Logo" )
+          ]
+        )
+        [ Str "1" ]
+        ( "#fig:Logo" , "" )
+    , Space
+    , Str "illustrated"
+    , Space
+    , Str "the"
+    , Space
+    , Str "SVG"
+    , Space
+    , Str "logo"
+    ]
+]
 ```
 
 ```
@@ -77,15 +176,91 @@
 
 Figure \ref{fig:Logo3} illustrated the SVG logo
 ^D
-[Header 1 ("one",[],[]) [Str "One"]
-,Para [Image ("fig:Logo",[],[]) [Str "Logo"] ("command/SVG_logo.svg","fig:")]
-,Para [Image ("fig:Logo2",[],[]) [Str "Logo2"] ("command/SVG_logo2.svg","fig:")]
-,Header 1 ("two",[],[]) [Str "Two"]
-,Header 2 ("subone",[],[]) [Str "Subone"]
-,Para [Image ("fig:Logo3",[],[]) [Str "Logo3"] ("command/SVG_logo3.svg","fig:")]
-,Para [Str "Figure",Space,Link ("",[],[("reference-type","ref"),("reference","fig:Logo")]) [Str "1.1"] ("#fig:Logo",""),Space,Str "illustrated",Space,Str "the",Space,Str "SVG",Space,Str "logo"]
-,Para [Str "Figure",Space,Link ("",[],[("reference-type","ref"),("reference","fig:Logo2")]) [Str "1.2"] ("#fig:Logo2",""),Space,Str "illustrated",Space,Str "the",Space,Str "SVG",Space,Str "logo"]
-,Para [Str "Figure",Space,Link ("",[],[("reference-type","ref"),("reference","fig:Logo3")]) [Str "2.1"] ("#fig:Logo3",""),Space,Str "illustrated",Space,Str "the",Space,Str "SVG",Space,Str "logo"]]
+[ Header 1 ( "one" , [] , [] ) [ Str "One" ]
+, Para
+    [ Image
+        ( "fig:Logo" , [] , [] )
+        [ Str "Logo" ]
+        ( "command/SVG_logo.svg" , "fig:" )
+    ]
+, Para
+    [ Image
+        ( "fig:Logo2" , [] , [] )
+        [ Str "Logo2" ]
+        ( "command/SVG_logo2.svg" , "fig:" )
+    ]
+, Header 1 ( "two" , [] , [] ) [ Str "Two" ]
+, Header 2 ( "subone" , [] , [] ) [ Str "Subone" ]
+, Para
+    [ Image
+        ( "fig:Logo3" , [] , [] )
+        [ Str "Logo3" ]
+        ( "command/SVG_logo3.svg" , "fig:" )
+    ]
+, Para
+    [ Str "Figure"
+    , Space
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "ref" )
+          , ( "reference" , "fig:Logo" )
+          ]
+        )
+        [ Str "1.1" ]
+        ( "#fig:Logo" , "" )
+    , Space
+    , Str "illustrated"
+    , Space
+    , Str "the"
+    , Space
+    , Str "SVG"
+    , Space
+    , Str "logo"
+    ]
+, Para
+    [ Str "Figure"
+    , Space
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "ref" )
+          , ( "reference" , "fig:Logo2" )
+          ]
+        )
+        [ Str "1.2" ]
+        ( "#fig:Logo2" , "" )
+    , Space
+    , Str "illustrated"
+    , Space
+    , Str "the"
+    , Space
+    , Str "SVG"
+    , Space
+    , Str "logo"
+    ]
+, Para
+    [ Str "Figure"
+    , Space
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "ref" )
+          , ( "reference" , "fig:Logo3" )
+          ]
+        )
+        [ Str "2.1" ]
+        ( "#fig:Logo3" , "" )
+    , Space
+    , Str "illustrated"
+    , Space
+    , Str "the"
+    , Space
+    , Str "SVG"
+    , Space
+    , Str "logo"
+    ]
+]
 ```
 
 
@@ -93,5 +268,22 @@
 % pandoc -f latex -t native
 \label{section} Section \ref{section}
 ^D
-[Para [Span ("section",[],[("label","section")]) [Str "[section]"],Space,Str "Section",Space,Link ("",[],[("reference-type","ref"),("reference","section")]) [Str "[section]"] ("#section","")]]
+[ Para
+    [ Span
+        ( "section" , [] , [ ( "label" , "section" ) ] )
+        [ Str "[section]" ]
+    , Space
+    , Str "Section"
+    , Space
+    , Link
+        ( ""
+        , []
+        , [ ( "reference-type" , "ref" )
+          , ( "reference" , "section" )
+          ]
+        )
+        [ Str "[section]" ]
+        ( "#section" , "" )
+    ]
+]
 ```
diff --git a/test/command/setext-fenced-div.md b/test/command/setext-fenced-div.md
--- a/test/command/setext-fenced-div.md
+++ b/test/command/setext-fenced-div.md
@@ -4,6 +4,5 @@
 ---
 :::
 ^D
-[Div ("",["cell"],[])
- [HorizontalRule]]
+[ Div ( "" , [ "cell" ] , [] ) [ HorizontalRule ] ]
 ```
diff --git a/test/command/shift-heading-level-by.md b/test/command/shift-heading-level-by.md
--- a/test/command/shift-heading-level-by.md
+++ b/test/command/shift-heading-level-by.md
@@ -8,9 +8,21 @@
 
 ## Second
 ^D
-Pandoc (Meta {unMeta = fromList [("title",MetaInlines [Str "My",Space,Str "title"])]})
-[Header 2 ("first-heading",[],[]) [Str "First",Space,Str "heading"]
-,Header 3 ("second",[],[]) [Str "Second"]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "title"
+            , MetaInlines [ Str "My" , Space , Str "title" ]
+            )
+          ]
+    }
+  [ Header
+      2
+      ( "first-heading" , [] , [] )
+      [ Str "First" , Space , Str "heading" ]
+  , Header 3 ( "second" , [] , [] ) [ Str "Second" ]
+  ]
 ```
 
 ```
@@ -25,8 +37,23 @@
 
 # Another top-level heading
 ^D
-Pandoc (Meta {unMeta = fromList [("title",MetaInlines [Str "First",Space,Str "heading"])]})
-[Header 1 ("second",[],[]) [Str "Second"]
-,Para [Str "Another",Space,Str "top-level",Space,Str "heading"]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "title"
+            , MetaInlines [ Str "First" , Space , Str "heading" ]
+            )
+          ]
+    }
+  [ Header 1 ( "second" , [] , [] ) [ Str "Second" ]
+  , Para
+      [ Str "Another"
+      , Space
+      , Str "top-level"
+      , Space
+      , Str "heading"
+      ]
+  ]
 ```
 
diff --git a/test/command/sloppypar.md b/test/command/sloppypar.md
--- a/test/command/sloppypar.md
+++ b/test/command/sloppypar.md
@@ -6,8 +6,111 @@
 Qui et temporibus explicabo. Esse ab ut quidem. Vel qui perspiciatis quae odio consectetur alias non sed. Quo consectetur libero omnis quos eius ad vel.
 \end{sloppypar}
 ^D
-[Para [Str "Sequi",Space,Str "id",Space,Str "qui",Space,Str "facere",Space,Str "et",Space,Str "incidunt",Space,Str "ut.",Space,Str "Et",Space,Str "fuga",Space,Str "ut",Space,Str "voluptate",Space,Str "enim",Space,Str "qui.",Space,Str "Odit",Space,Str "unde",Space,Str "magni",Space,Str "ipsam",Space,Str "dicta",Space,Str "modi.",Space,Str "Modi",Space,Str "soluta",Space,Str "velit",Space,Str "est",Space,Str "aut",Space,Str "aut",Space,Str "possimus."]
-,Para [Str "Qui",Space,Str "et",Space,Str "temporibus",Space,Str "explicabo.",Space,Str "Esse",Space,Str "ab",Space,Str "ut",Space,Str "quidem.",Space,Str "Vel",Space,Str "qui",Space,Str "perspiciatis",Space,Str "quae",Space,Str "odio",Space,Str "consectetur",Space,Str "alias",Space,Str "non",Space,Str "sed.",Space,Str "Quo",Space,Str "consectetur",Space,Str "libero",Space,Str "omnis",Space,Str "quos",Space,Str "eius",Space,Str "ad",Space,Str "vel."]]
+[ Para
+    [ Str "Sequi"
+    , Space
+    , Str "id"
+    , Space
+    , Str "qui"
+    , Space
+    , Str "facere"
+    , Space
+    , Str "et"
+    , Space
+    , Str "incidunt"
+    , Space
+    , Str "ut."
+    , Space
+    , Str "Et"
+    , Space
+    , Str "fuga"
+    , Space
+    , Str "ut"
+    , Space
+    , Str "voluptate"
+    , Space
+    , Str "enim"
+    , Space
+    , Str "qui."
+    , Space
+    , Str "Odit"
+    , Space
+    , Str "unde"
+    , Space
+    , Str "magni"
+    , Space
+    , Str "ipsam"
+    , Space
+    , Str "dicta"
+    , Space
+    , Str "modi."
+    , Space
+    , Str "Modi"
+    , Space
+    , Str "soluta"
+    , Space
+    , Str "velit"
+    , Space
+    , Str "est"
+    , Space
+    , Str "aut"
+    , Space
+    , Str "aut"
+    , Space
+    , Str "possimus."
+    ]
+, Para
+    [ Str "Qui"
+    , Space
+    , Str "et"
+    , Space
+    , Str "temporibus"
+    , Space
+    , Str "explicabo."
+    , Space
+    , Str "Esse"
+    , Space
+    , Str "ab"
+    , Space
+    , Str "ut"
+    , Space
+    , Str "quidem."
+    , Space
+    , Str "Vel"
+    , Space
+    , Str "qui"
+    , Space
+    , Str "perspiciatis"
+    , Space
+    , Str "quae"
+    , Space
+    , Str "odio"
+    , Space
+    , Str "consectetur"
+    , Space
+    , Str "alias"
+    , Space
+    , Str "non"
+    , Space
+    , Str "sed."
+    , Space
+    , Str "Quo"
+    , Space
+    , Str "consectetur"
+    , Space
+    , Str "libero"
+    , Space
+    , Str "omnis"
+    , Space
+    , Str "quos"
+    , Space
+    , Str "eius"
+    , Space
+    , Str "ad"
+    , Space
+    , Str "vel."
+    ]
+]
 ```
 
 ```
@@ -18,6 +121,109 @@
 Qui et temporibus explicabo. Esse ab ut quidem. Vel qui perspiciatis quae odio consectetur alias non sed. Quo consectetur libero omnis quos eius ad vel.
 \end{sloppypar}
 ^D
-[Para [Str "Sequi",Space,Str "id",Space,Str "qui",Space,Str "facere",Space,Str "et",Space,Str "incidunt",Space,Str "ut.",Space,Str "Et",Space,Str "fuga",Space,Str "ut",Space,Str "voluptate",Space,Str "enim",Space,Str "qui.",Space,Str "Odit",Space,Str "unde",Space,Str "magni",Space,Str "ipsam",Space,Str "dicta",Space,Str "modi.",Space,Str "Modi",Space,Str "soluta",Space,Str "velit",Space,Str "est",Space,Str "aut",Space,Str "aut",Space,Str "possimus."]
-,Para [Str "Qui",Space,Str "et",Space,Str "temporibus",Space,Str "explicabo.",Space,Str "Esse",Space,Str "ab",Space,Str "ut",Space,Str "quidem.",Space,Str "Vel",Space,Str "qui",Space,Str "perspiciatis",Space,Str "quae",Space,Str "odio",Space,Str "consectetur",Space,Str "alias",Space,Str "non",Space,Str "sed.",Space,Str "Quo",Space,Str "consectetur",Space,Str "libero",Space,Str "omnis",Space,Str "quos",Space,Str "eius",Space,Str "ad",Space,Str "vel."]]
+[ Para
+    [ Str "Sequi"
+    , Space
+    , Str "id"
+    , Space
+    , Str "qui"
+    , Space
+    , Str "facere"
+    , Space
+    , Str "et"
+    , Space
+    , Str "incidunt"
+    , Space
+    , Str "ut."
+    , Space
+    , Str "Et"
+    , Space
+    , Str "fuga"
+    , Space
+    , Str "ut"
+    , Space
+    , Str "voluptate"
+    , Space
+    , Str "enim"
+    , Space
+    , Str "qui."
+    , Space
+    , Str "Odit"
+    , Space
+    , Str "unde"
+    , Space
+    , Str "magni"
+    , Space
+    , Str "ipsam"
+    , Space
+    , Str "dicta"
+    , Space
+    , Str "modi."
+    , Space
+    , Str "Modi"
+    , Space
+    , Str "soluta"
+    , Space
+    , Str "velit"
+    , Space
+    , Str "est"
+    , Space
+    , Str "aut"
+    , Space
+    , Str "aut"
+    , Space
+    , Str "possimus."
+    ]
+, Para
+    [ Str "Qui"
+    , Space
+    , Str "et"
+    , Space
+    , Str "temporibus"
+    , Space
+    , Str "explicabo."
+    , Space
+    , Str "Esse"
+    , Space
+    , Str "ab"
+    , Space
+    , Str "ut"
+    , Space
+    , Str "quidem."
+    , Space
+    , Str "Vel"
+    , Space
+    , Str "qui"
+    , Space
+    , Str "perspiciatis"
+    , Space
+    , Str "quae"
+    , Space
+    , Str "odio"
+    , Space
+    , Str "consectetur"
+    , Space
+    , Str "alias"
+    , Space
+    , Str "non"
+    , Space
+    , Str "sed."
+    , Space
+    , Str "Quo"
+    , Space
+    , Str "consectetur"
+    , Space
+    , Str "libero"
+    , Space
+    , Str "omnis"
+    , Space
+    , Str "quos"
+    , Space
+    , Str "eius"
+    , Space
+    , Str "ad"
+    , Space
+    , Str "vel."
+    ]
+]
 ```
diff --git a/test/command/table-with-cell-align.md b/test/command/table-with-cell-align.md
--- a/test/command/table-with-cell-align.md
+++ b/test/command/table-with-cell-align.md
@@ -13,27 +13,50 @@
 </tgroup>
 </informaltable>
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignLeft (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignRight (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignLeft
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignRight
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "3" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "4" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 ```
 % pandoc -f native -t opendocument --quiet
diff --git a/test/command/table-with-column-span.md b/test/command/table-with-column-span.md
--- a/test/command/table-with-column-span.md
+++ b/test/command/table-with-column-span.md
@@ -49,73 +49,182 @@
 </tgroup>
 </informaltable>
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)
- ,(AlignDefault,ColWidth 6.25e-2)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 8)
-    [Para [Strong [Str "Octet",Space,Str "no.",Space,Str "1"]]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 8)
-    [Para [Strong [Str "Octet",Space,Str "no.",Space,Str "2"]]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "16"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "15"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "14"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "13"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "12"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "11"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "10"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "9"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "8"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "7"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 8)
-    [Para [Str "Code",Space,Str "A"]]
-   ,Cell ("",[],[]) AlignCenter (RowSpan 1) (ColSpan 8)
-    [Para [Str "Code",Space,Str "B"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    , ( AlignDefault , ColWidth 6.25e-2 )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 8)
+                [ Para
+                    [ Strong
+                        [ Str "Octet"
+                        , Space
+                        , Str "no."
+                        , Space
+                        , Str "1"
+                        ]
+                    ]
+                ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 8)
+                [ Para
+                    [ Strong
+                        [ Str "Octet"
+                        , Space
+                        , Str "no."
+                        , Space
+                        , Str "2"
+                        ]
+                    ]
+                ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "16" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "15" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "14" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "13" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "11" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "10" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "9" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "8" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "7" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "6" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "5" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "4" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "3" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Para [ Str "1" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 8)
+                [ Para [ Str "Code" , Space , Str "A" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignCenter
+                (RowSpan 1)
+                (ColSpan 8)
+                [ Para [ Str "Code" , Space , Str "B" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 ```
 % pandoc -f native -t opendocument --quiet
diff --git a/test/command/tabularx.md b/test/command/tabularx.md
--- a/test/command/tabularx.md
+++ b/test/command/tabularx.md
@@ -20,44 +20,129 @@
 \hline
 \end{tabularx}
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Column",Space,Str "Heading",Space,Str "1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Column",Space,Str "Heading",Space,Str "2"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Column",Space,Str "Heading",Space,Str "3"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1.1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1.2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1.3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2.1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2.2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2.3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3.1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3.2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3.3"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignCenter , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain
+                   [ Str "Column"
+                   , Space
+                   , Str "Heading"
+                   , Space
+                   , Str "1"
+                   ]
+               ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain
+                   [ Str "Column"
+                   , Space
+                   , Str "Heading"
+                   , Space
+                   , Str "2"
+                   ]
+               ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain
+                   [ Str "Column"
+                   , Space
+                   , Str "Heading"
+                   , Space
+                   , Str "3"
+                   ]
+               ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "1.1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "1.2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "1.3" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "2.1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "2.2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "2.3" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "3.1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "3.2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "3.3" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 
 ```
@@ -82,44 +167,129 @@
 \hline
 \end{tabularx}
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignLeft,ColWidth 0.25)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Column",Space,Str "Heading",Space,Str "1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Column",Space,Str "Heading",Space,Str "2"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Column",Space,Str "Heading",Space,Str "3"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1.1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1.2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1.3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2.1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2.2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2.3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3.1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3.2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3.3"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignLeft , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    , ( AlignLeft , ColWidth 0.25 )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain
+                   [ Str "Column"
+                   , Space
+                   , Str "Heading"
+                   , Space
+                   , Str "1"
+                   ]
+               ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain
+                   [ Str "Column"
+                   , Space
+                   , Str "Heading"
+                   , Space
+                   , Str "2"
+                   ]
+               ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain
+                   [ Str "Column"
+                   , Space
+                   , Str "Heading"
+                   , Space
+                   , Str "3"
+                   ]
+               ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "1.1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "1.2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "1.3" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "2.1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "2.2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "2.3" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "3.1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "3.2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "3.3" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
 
 ```
@@ -144,42 +314,127 @@
 \hline
 \end{tabularx}
 ^D
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidth 0.25)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignLeft,ColWidth 0.25)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Column",Space,Str "Heading",Space,Str "1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Column",Space,Str "Heading",Space,Str "2"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Column",Space,Str "Heading",Space,Str "3"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1.1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1.2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1.3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2.1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2.2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2.3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3.1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3.2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3.3"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignLeft , ColWidth 0.25 )
+    , ( AlignCenter , ColWidthDefault )
+    , ( AlignLeft , ColWidth 0.25 )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain
+                   [ Str "Column"
+                   , Space
+                   , Str "Heading"
+                   , Space
+                   , Str "1"
+                   ]
+               ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain
+                   [ Str "Column"
+                   , Space
+                   , Str "Heading"
+                   , Space
+                   , Str "2"
+                   ]
+               ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain
+                   [ Str "Column"
+                   , Space
+                   , Str "Heading"
+                   , Space
+                   , Str "3"
+                   ]
+               ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "1.1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "1.2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "1.3" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "2.1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "2.2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "2.3" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "3.1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "3.2" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Cell" , Space , Str "3.3" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
 ```
diff --git a/test/command/translations.md b/test/command/translations.md
--- a/test/command/translations.md
+++ b/test/command/translations.md
@@ -2,14 +2,14 @@
 % pandoc -f latex -t native -M lang=en
 \figurename\ 2
 ^D
-[Para [Str "Figure\160\&2"]]
+[ Para [ Str "Figure\160\&2" ] ]
 ```
 
 ```
 % pandoc -f latex -t native -M lang=de-DE
 \figurename\ 2
 ^D
-[Para [Str "Abbildung\160\&2"]]
+[ Para [ Str "Abbildung\160\&2" ] ]
 ```
 
 ```
@@ -17,7 +17,7 @@
 \setmainlanguage{german}
 \figurename 2
 ^D
-[Para [Str "Abbildung2"]]
+[ Para [ Str "Abbildung2" ] ]
 ```
 
 ```
@@ -25,5 +25,5 @@
 \figurename~2
 \figurename.
 ^D
-[Para [Str "Slika\160\&2",SoftBreak,Str "Slika."]]
+[ Para [ Str "Slika\160\&2" , SoftBreak , Str "Slika." ] ]
 ```
diff --git a/test/command/write18.md b/test/command/write18.md
--- a/test/command/write18.md
+++ b/test/command/write18.md
@@ -3,12 +3,12 @@
 % pandoc -t native
 \write18{git --version}
 ^D
-[RawBlock (Format "tex") "\\write18{git --version}"]
+[ RawBlock (Format "tex") "\\write18{git --version}" ]
 ```
 
 ```
 % pandoc -f latex+raw_tex -t native
 \write18{git --version}
 ^D
-[RawBlock (Format "latex") "\\write18{git --version}"]
+[ RawBlock (Format "latex") "\\write18{git --version}" ]
 ```
diff --git a/test/command/yaml-metadata-blocks.md b/test/command/yaml-metadata-blocks.md
--- a/test/command/yaml-metadata-blocks.md
+++ b/test/command/yaml-metadata-blocks.md
@@ -6,8 +6,10 @@
   bar_: as should this
 ---
 ^D
-Pandoc (Meta {unMeta = fromList [("foo",MetaMap (fromList []))]})
-[]
+Pandoc
+  Meta
+    { unMeta = fromList [ ( "foo" , MetaMap (fromList []) ) ] }
+  []
 ```
 ```
 % pandoc -s -t native
@@ -32,8 +34,32 @@
   scientific: 3.7e-5
 ---
 ^D
-Pandoc (Meta {unMeta = fromList [("bool",MetaBool True),("empty",MetaList []),("float",MetaInlines [Str "1.5"]),("int",MetaInlines [Str "7"]),("more",MetaBool False),("nested",MetaMap (fromList [("bool",MetaBool True),("empty",MetaList []),("float",MetaInlines [Str "2.5"]),("int",MetaInlines [Str "8"]),("more",MetaBool False),("nothing",MetaInlines [Str "null"]),("scientific",MetaInlines [Str "3.7e-5"])])),("nothing",MetaInlines [Str "null"]),("scientific",MetaInlines [Str "3.7e-5"])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "bool" , MetaBool True )
+          , ( "empty" , MetaList [] )
+          , ( "float" , MetaInlines [ Str "1.5" ] )
+          , ( "int" , MetaInlines [ Str "7" ] )
+          , ( "more" , MetaBool False )
+          , ( "nested"
+            , MetaMap
+                (fromList
+                   [ ( "bool" , MetaBool True )
+                   , ( "empty" , MetaList [] )
+                   , ( "float" , MetaInlines [ Str "2.5" ] )
+                   , ( "int" , MetaInlines [ Str "8" ] )
+                   , ( "more" , MetaBool False )
+                   , ( "nothing" , MetaInlines [ Str "null" ] )
+                   , ( "scientific" , MetaInlines [ Str "3.7e-5" ] )
+                   ])
+            )
+          , ( "nothing" , MetaInlines [ Str "null" ] )
+          , ( "scientific" , MetaInlines [ Str "3.7e-5" ] )
+          ]
+    }
+  []
 ```
 ```
 % pandoc -s -t native
@@ -43,8 +69,20 @@
   - bool: True
 ---
 ^D
-Pandoc (Meta {unMeta = fromList [("array",MetaList [MetaMap (fromList [("foo",MetaInlines [Str "bar"])]),MetaMap (fromList [("bool",MetaBool True)])])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "array"
+            , MetaList
+                [ MetaMap
+                    (fromList [ ( "foo" , MetaInlines [ Str "bar" ] ) ])
+                , MetaMap (fromList [ ( "bool" , MetaBool True ) ])
+                ]
+            )
+          ]
+    }
+  []
 ```
 ```
 % pandoc -s -t native --metadata-file command/yaml-metadata.yaml
@@ -52,12 +90,32 @@
 title: document
 ---
 ^D
-Pandoc (Meta {unMeta = fromList [("other",MetaInlines [Emph [Str "markdown"],Space,Str "value"]),("title",MetaInlines [Str "document"])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "other"
+            , MetaInlines
+                [ Emph [ Str "markdown" ] , Space , Str "value" ]
+            )
+          , ( "title" , MetaInlines [ Str "document" ] )
+          ]
+    }
+  []
 ```
 ```
 % pandoc -s -t native --metadata-file command/yaml-metadata.yaml -M title=cmdline
 ^D
-Pandoc (Meta {unMeta = fromList [("other",MetaInlines [Emph [Str "markdown"],Space,Str "value"]),("title",MetaString "cmdline")]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "other"
+            , MetaInlines
+                [ Emph [ Str "markdown" ] , Space , Str "value" ]
+            )
+          , ( "title" , MetaString "cmdline" )
+          ]
+    }
+  []
 ```
diff --git a/test/command/yaml-with-chomp.md b/test/command/yaml-with-chomp.md
--- a/test/command/yaml-with-chomp.md
+++ b/test/command/yaml-with-chomp.md
@@ -7,6 +7,14 @@
     BLOCK
 ...
 ^D
-Pandoc (Meta {unMeta = fromList [("ml",MetaBlocks [Para [Str "TEST"],Plain [Str "BLOCK"]])]})
-[]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "ml"
+            , MetaBlocks [ Para [ Str "TEST" ] , Plain [ Str "BLOCK" ] ]
+            )
+          ]
+    }
+  []
 ```
diff --git a/test/creole-reader.native b/test/creole-reader.native
--- a/test/creole-reader.native
+++ b/test/creole-reader.native
@@ -1,132 +1,970 @@
-Pandoc (Meta {unMeta = fromList []})
-[Header 1 ("",[],[]) [Str "Top-level heading (1)"]
-,Header 2 ("",[],[]) [Str "This a test for creole 0.1 (2)"]
-,Header 3 ("",[],[]) [Str "This is a Subheading (3)"]
-,Header 4 ("",[],[]) [Str "Subsub (4)"]
-,Header 5 ("",[],[]) [Str "Subsubsub (5)"]
-,Para [Str "The",Space,Str "ending",Space,Str "equal",Space,Str "signs",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "displayed:"]
-,Header 1 ("",[],[]) [Str "Top-level heading (1)"]
-,Header 2 ("",[],[]) [Str "This a test for creole 0.1 (2)"]
-,Header 3 ("",[],[]) [Str "This is a Subheading (3)"]
-,Header 4 ("",[],[]) [Str "Subsub (4)"]
-,Header 5 ("",[],[]) [Str "Subsubsub (5)"]
-,Para [Str "You",Space,Str "can",Space,Str "make",Space,Str "things",Space,Strong [Str "bold"],Space,Str "or",Space,Emph [Str "italic"],Space,Str "or",Space,Strong [Emph [Str "both"]],Space,Str "or",Space,Emph [Strong [Str "both"]],Str "."]
-,Para [Str "Character",Space,Str "formatting",Space,Str "extends",Space,Str "across",Space,Str "line",Space,Str "breaks:",Space,Strong [Str "bold,",Space,Str "this",Space,Str "is",Space,Str "still",Space,Str "bold.",Space,Str "This",Space,Str "line",Space,Str "deliberately",Space,Str "does",Space,Str "not",Space,Str "end",Space,Str "in",Space,Str "star-star."]]
-,Para [Str "Not",Space,Str "bold.",Space,Str "Character",Space,Str "formatting",Space,Str "does",Space,Str "not",Space,Str "cross",Space,Str "paragraph",Space,Str "boundaries."]
-,Para [Str "You",Space,Str "can",Space,Str "use",Space,Link ("",[],[]) [Str "internal links"] ("internal links",""),Space,Str "or",Space,Link ("",[],[]) [Str "external links"] ("http://www.wikicreole.org",""),Str ",",Space,Str "give",Space,Str "the",Space,Str "link",Space,Str "a",Space,Link ("",[],[]) [Str "different"] ("internal links",""),Space,Str "name."]
-,Para [Str "Here's",Space,Str "another",Space,Str "sentence:",Space,Str "This",Space,Str "wisdom",Space,Str "is",Space,Str "taken",Space,Str "from",Space,Link ("",[],[]) [Str "Ward Cunningham's"] ("Ward Cunningham's",""),Space,Link ("",[],[]) [Str "Presentation at the Wikisym 06"] ("http://www.c2.com/doc/wikisym/WikiSym2006.pdf",""),Str "."]
-,Para [Str "Here's",Space,Str "a",Space,Str "external",Space,Str "link",Space,Str "without",Space,Str "a",Space,Str "description:",Space,Link ("",[],[]) [Str "http://www.wikicreole.org"] ("http://www.wikicreole.org","")]
-,Para [Str "Be",Space,Str "careful",Space,Str "that",Space,Str "italic",Space,Str "links",Space,Str "are",Space,Str "rendered",Space,Str "properly:",Space,Emph [Link ("",[],[]) [Str "My Book Title"] ("http://my.book.example/","")]]
-,Para [Str "Free",Space,Str "links",Space,Str "without",Space,Str "braces",Space,Str "should",Space,Str "be",Space,Str "rendered",Space,Str "as",Space,Str "well,",Space,Str "like",Space,Link ("",[],[]) [Str "http://www.wikicreole.org/"] ("http://www.wikicreole.org/",""),Space,Str "and",Space,Link ("",[],[]) [Str "http://www.wikicreole.org/users/~example"] ("http://www.wikicreole.org/users/~example",""),Str "."]
-,Para [Str "Creole1.0",Space,Str "specifies",Space,Str "that",Space,Link ("",[],[]) [Str "http://bar"] ("http://bar",""),Space,Str "and",Space,Link ("",[],[]) [Str "ftp://bar"] ("ftp://bar",""),Space,Str "should",Space,Str "not",Space,Str "render",Space,Str "italic,",Space,Str "something",Space,Str "like",Space,Str "foo:",Emph [Str "bar",Space,Str "should",Space,Str "render",Space,Str "as",Space,Str "italic."]]
-,Para [Str "You",Space,Str "can",Space,Str "use",Space,Str "this",Space,Str "to",Space,Str "draw",Space,Str "a",Space,Str "line",Space,Str "to",Space,Str "separate",Space,Str "the",Space,Str "page:"]
-,HorizontalRule
-,Para [Str "You",Space,Str "can",Space,Str "use",Space,Str "lists,",Space,Str "start",Space,Str "it",Space,Str "at",Space,Str "the",Space,Str "first",Space,Str "column",Space,Str "for",Space,Str "now,",Space,Str "please..."]
-,Para [Str "unnumbered",Space,Str "lists",Space,Str "are",Space,Str "like"]
-,BulletList
- [[Plain [Str "item",Space,Str "a"]]
- ,[Plain [Str "item",Space,Str "b"]]
- ,[Plain [Strong [Str "bold",Space,Str "item",Space,Str "c"]]]]
-,Para [Str "blank",Space,Str "space",Space,Str "is",Space,Str "also",Space,Str "permitted",Space,Str "before",Space,Str "lists",Space,Str "like:"]
-,BulletList
- [[Plain [Str "item",Space,Str "a"]]
- ,[Plain [Str "item",Space,Str "b"]]
- ,[Plain [Str "item",Space,Str "c"]
-  ,BulletList
-   [[Plain [Str "item",Space,Str "c.a"]]]]]
-,Para [Str "or",Space,Str "you",Space,Str "can",Space,Str "number",Space,Str "them"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Link ("",[],[]) [Str "item 1"] ("item 1","")]]
- ,[Plain [Str "item",Space,Str "2"]]
- ,[Plain [Emph [Space,Str "italic",Space,Str "item",Space,Str "3",Space]]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "item",Space,Str "3.1"]]
-   ,[Plain [Str "item",Space,Str "3.2"]]]]]
-,Para [Str "up",Space,Str "to",Space,Str "five",Space,Str "levels"]
-,BulletList
- [[Plain [Str "1"]
-  ,BulletList
-   [[Plain [Str "2"]
-    ,BulletList
-     [[Plain [Str "3"]
-      ,BulletList
-       [[Plain [Str "4"]
-        ,BulletList
-         [[Plain [Str "5"]]]]]]]]]]]
-,BulletList
- [[Plain [Str "You",Space,Str "can",Space,Str "have",Space,Str "multiline",Space,Str "list",Space,Str "items"]]
- ,[Plain [Str "this",Space,Str "is",Space,Str "a",Space,Str "second",Space,Str "multiline",Space,Str "list",Space,Str "item"]]]
-,Para [Str "You",Space,Str "can",Space,Str "use",Space,Str "nowiki",Space,Str "syntax",Space,Str "if",Space,Str "you",Space,Str "would",Space,Str "like",Space,Str "do",Space,Str "stuff",Space,Str "like",Space,Str "this:"]
-,CodeBlock ("",[],[]) "Guitar Chord C:\n\n||---|---|---|\n||-0-|---|---|\n||---|---|---|\n||---|-0-|---|\n||---|---|-0-|\n||---|---|---|"
-,Para [Str "You",Space,Str "can",Space,Str "also",Space,Str "use",Space,Str "it",Space,Str "inline",Space,Str "nowiki",Space,Code ("",[],[]) " in a sentence ",Space,Str "like",Space,Str "this."]
-,Header 1 ("",[],[]) [Str "Escapes"]
-,Para [Str "Normal",Space,Str "Link:",Space,Link ("",[],[]) [Str "http://wikicreole.org/"] ("http://wikicreole.org/",""),Space,Str "-",Space,Str "now",Space,Str "same",Space,Str "link,",Space,Str "but",Space,Str "escaped:",Space,Str "http://wikicreole.org/"]
-,Para [Str "Normal",Space,Str "asterisks:",Space,Str "**not",Space,Str "bold**"]
-,Para [Str "a",Space,Str "tilde",Space,Str "alone:",Space,Str "~"]
-,Para [Str "a",Space,Str "tilde",Space,Str "escapes",Space,Str "itself:",Space,Str "~xxx"]
-,Header 3 ("",[],[]) [Str "Creole 0.2"]
-,Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "flower",Space,Str "with",Space,Str "the",Space,Str "ALT",Space,Str "text",Space,Str "\"this",Space,Str "is",Space,Str "a",Space,Str "flower\"",Space,Str "if",Space,Str "your",Space,Str "wiki",Space,Str "supports",Space,Str "ALT",Space,Str "text",Space,Str "on",Space,Str "images:"]
-,Para [Image ("",[],[]) [Str "here is a red flower"] ("Red-Flower.jpg","")]
-,Header 3 ("",[],[]) [Str "Creole 0.4"]
-,Para [Str "Tables",Space,Str "are",Space,Str "done",Space,Str "like",Space,Str "this:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "header",Space,Str "col1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "header",Space,Str "col2"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "col1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "col2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "you"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "can"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "also"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "align",LineBreak,Str "it."]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "You",Space,Str "can",Space,Str "format",Space,Str "an",Space,Str "address",Space,Str "by",Space,Str "simply",Space,Str "forcing",Space,Str "linebreaks:"]
-,Para [Str "My",Space,Str "contact",Space,Str "dates:",LineBreak,Str "Pone:",Space,Str "xyz",LineBreak,Str "Fax:",Space,Str "+45",LineBreak,Str "Mobile:",Space,Str "abc"]
-,Header 3 ("",[],[]) [Str "Creole 0.5"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Header",Space,Str "title"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Another",Space,Str "header",Space,Str "title"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Code ("",[],[]) " //not italic text// "]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Code ("",[],[]) " **not bold text** "]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Emph [Str "italic",Space,Str "text"]]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Strong [Space,Str "bold",Space,Str "text",Space]]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 3 ("",[],[]) [Str "Creole 1.0"]
-,Para [Str "If",Space,Str "interwiki",Space,Str "links",Space,Str "are",Space,Str "setup",Space,Str "in",Space,Str "your",Space,Str "wiki,",Space,Str "this",Space,Str "links",Space,Str "to",Space,Str "the",Space,Str "WikiCreole",Space,Str "page",Space,Str "about",Space,Str "Creole",Space,Str "1.0",Space,Str "test",Space,Str "cases:",Space,Link ("",[],[]) [Str "WikiCreole:Creole1.0TestCases"] ("WikiCreole:Creole1.0TestCases",""),Str "."]
-,HorizontalRule
-,Para [Str "The",Space,Str "above",Space,Str "test",Space,Str "document",Space,Str "was",Space,Str "found",Space,Str "on",Space,Link ("",[],[]) [Str "http://www.wikicreole.org/wiki/Creole1.0TestCases"] ("http://www.wikicreole.org/wiki/Creole1.0TestCases",""),Space,Str "and",Space,Str "downloaded",Space,Str "from",Space,Link ("",[],[]) [Str "http://www.wikicreole.org/attach/Creole1.0TestCases/creole1.0test.txt"] ("http://www.wikicreole.org/attach/Creole1.0TestCases/creole1.0test.txt",""),Str "."]
-,Para [Str "The",Space,Str "Creole",Space,Str "Wiki",Space,Str "is",Space,Str "licensed:",Space,Str "Copyright",Space,Str "(C)",Space,Str "by",Space,Str "the",Space,Str "contributors.",Space,Str "Some",Space,Str "rights",Space,Str "reserved,",Space,Str "license",Space,Link ("",[],[]) [Str "https://creativecommons.org/licenses/by-sa/1.0/"] ("BY-SA",""),Str "."]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Header 1 ( "" , [] , [] ) [ Str "Top-level heading (1)" ]
+  , Header
+      2 ( "" , [] , [] ) [ Str "This a test for creole 0.1 (2)" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "This is a Subheading (3)" ]
+  , Header 4 ( "" , [] , [] ) [ Str "Subsub (4)" ]
+  , Header 5 ( "" , [] , [] ) [ Str "Subsubsub (5)" ]
+  , Para
+      [ Str "The"
+      , Space
+      , Str "ending"
+      , Space
+      , Str "equal"
+      , Space
+      , Str "signs"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "displayed:"
+      ]
+  , Header 1 ( "" , [] , [] ) [ Str "Top-level heading (1)" ]
+  , Header
+      2 ( "" , [] , [] ) [ Str "This a test for creole 0.1 (2)" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "This is a Subheading (3)" ]
+  , Header 4 ( "" , [] , [] ) [ Str "Subsub (4)" ]
+  , Header 5 ( "" , [] , [] ) [ Str "Subsubsub (5)" ]
+  , Para
+      [ Str "You"
+      , Space
+      , Str "can"
+      , Space
+      , Str "make"
+      , Space
+      , Str "things"
+      , Space
+      , Strong [ Str "bold" ]
+      , Space
+      , Str "or"
+      , Space
+      , Emph [ Str "italic" ]
+      , Space
+      , Str "or"
+      , Space
+      , Strong [ Emph [ Str "both" ] ]
+      , Space
+      , Str "or"
+      , Space
+      , Emph [ Strong [ Str "both" ] ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Character"
+      , Space
+      , Str "formatting"
+      , Space
+      , Str "extends"
+      , Space
+      , Str "across"
+      , Space
+      , Str "line"
+      , Space
+      , Str "breaks:"
+      , Space
+      , Strong
+          [ Str "bold,"
+          , Space
+          , Str "this"
+          , Space
+          , Str "is"
+          , Space
+          , Str "still"
+          , Space
+          , Str "bold."
+          , Space
+          , Str "This"
+          , Space
+          , Str "line"
+          , Space
+          , Str "deliberately"
+          , Space
+          , Str "does"
+          , Space
+          , Str "not"
+          , Space
+          , Str "end"
+          , Space
+          , Str "in"
+          , Space
+          , Str "star-star."
+          ]
+      ]
+  , Para
+      [ Str "Not"
+      , Space
+      , Str "bold."
+      , Space
+      , Str "Character"
+      , Space
+      , Str "formatting"
+      , Space
+      , Str "does"
+      , Space
+      , Str "not"
+      , Space
+      , Str "cross"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "boundaries."
+      ]
+  , Para
+      [ Str "You"
+      , Space
+      , Str "can"
+      , Space
+      , Str "use"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "internal links" ]
+          ( "internal links" , "" )
+      , Space
+      , Str "or"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "external links" ]
+          ( "http://www.wikicreole.org" , "" )
+      , Str ","
+      , Space
+      , Str "give"
+      , Space
+      , Str "the"
+      , Space
+      , Str "link"
+      , Space
+      , Str "a"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "different" ]
+          ( "internal links" , "" )
+      , Space
+      , Str "name."
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "another"
+      , Space
+      , Str "sentence:"
+      , Space
+      , Str "This"
+      , Space
+      , Str "wisdom"
+      , Space
+      , Str "is"
+      , Space
+      , Str "taken"
+      , Space
+      , Str "from"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "Ward Cunningham's" ]
+          ( "Ward Cunningham's" , "" )
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "Presentation at the Wikisym 06" ]
+          ( "http://www.c2.com/doc/wikisym/WikiSym2006.pdf" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Str "external"
+      , Space
+      , Str "link"
+      , Space
+      , Str "without"
+      , Space
+      , Str "a"
+      , Space
+      , Str "description:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.wikicreole.org" ]
+          ( "http://www.wikicreole.org" , "" )
+      ]
+  , Para
+      [ Str "Be"
+      , Space
+      , Str "careful"
+      , Space
+      , Str "that"
+      , Space
+      , Str "italic"
+      , Space
+      , Str "links"
+      , Space
+      , Str "are"
+      , Space
+      , Str "rendered"
+      , Space
+      , Str "properly:"
+      , Space
+      , Emph
+          [ Link
+              ( "" , [] , [] )
+              [ Str "My Book Title" ]
+              ( "http://my.book.example/" , "" )
+          ]
+      ]
+  , Para
+      [ Str "Free"
+      , Space
+      , Str "links"
+      , Space
+      , Str "without"
+      , Space
+      , Str "braces"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "rendered"
+      , Space
+      , Str "as"
+      , Space
+      , Str "well,"
+      , Space
+      , Str "like"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.wikicreole.org/" ]
+          ( "http://www.wikicreole.org/" , "" )
+      , Space
+      , Str "and"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.wikicreole.org/users/~example" ]
+          ( "http://www.wikicreole.org/users/~example" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Creole1.0"
+      , Space
+      , Str "specifies"
+      , Space
+      , Str "that"
+      , Space
+      , Link
+          ( "" , [] , [] ) [ Str "http://bar" ] ( "http://bar" , "" )
+      , Space
+      , Str "and"
+      , Space
+      , Link
+          ( "" , [] , [] ) [ Str "ftp://bar" ] ( "ftp://bar" , "" )
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "render"
+      , Space
+      , Str "italic,"
+      , Space
+      , Str "something"
+      , Space
+      , Str "like"
+      , Space
+      , Str "foo:"
+      , Emph
+          [ Str "bar"
+          , Space
+          , Str "should"
+          , Space
+          , Str "render"
+          , Space
+          , Str "as"
+          , Space
+          , Str "italic."
+          ]
+      ]
+  , Para
+      [ Str "You"
+      , Space
+      , Str "can"
+      , Space
+      , Str "use"
+      , Space
+      , Str "this"
+      , Space
+      , Str "to"
+      , Space
+      , Str "draw"
+      , Space
+      , Str "a"
+      , Space
+      , Str "line"
+      , Space
+      , Str "to"
+      , Space
+      , Str "separate"
+      , Space
+      , Str "the"
+      , Space
+      , Str "page:"
+      ]
+  , HorizontalRule
+  , Para
+      [ Str "You"
+      , Space
+      , Str "can"
+      , Space
+      , Str "use"
+      , Space
+      , Str "lists,"
+      , Space
+      , Str "start"
+      , Space
+      , Str "it"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "first"
+      , Space
+      , Str "column"
+      , Space
+      , Str "for"
+      , Space
+      , Str "now,"
+      , Space
+      , Str "please..."
+      ]
+  , Para
+      [ Str "unnumbered"
+      , Space
+      , Str "lists"
+      , Space
+      , Str "are"
+      , Space
+      , Str "like"
+      ]
+  , BulletList
+      [ [ Plain [ Str "item" , Space , Str "a" ] ]
+      , [ Plain [ Str "item" , Space , Str "b" ] ]
+      , [ Plain
+            [ Strong
+                [ Str "bold" , Space , Str "item" , Space , Str "c" ]
+            ]
+        ]
+      ]
+  , Para
+      [ Str "blank"
+      , Space
+      , Str "space"
+      , Space
+      , Str "is"
+      , Space
+      , Str "also"
+      , Space
+      , Str "permitted"
+      , Space
+      , Str "before"
+      , Space
+      , Str "lists"
+      , Space
+      , Str "like:"
+      ]
+  , BulletList
+      [ [ Plain [ Str "item" , Space , Str "a" ] ]
+      , [ Plain [ Str "item" , Space , Str "b" ] ]
+      , [ Plain [ Str "item" , Space , Str "c" ]
+        , BulletList
+            [ [ Plain [ Str "item" , Space , Str "c.a" ] ] ]
+        ]
+      ]
+  , Para
+      [ Str "or"
+      , Space
+      , Str "you"
+      , Space
+      , Str "can"
+      , Space
+      , Str "number"
+      , Space
+      , Str "them"
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Link ( "" , [] , [] ) [ Str "item 1" ] ( "item 1" , "" ) ]
+        ]
+      , [ Plain [ Str "item" , Space , Str "2" ] ]
+      , [ Plain
+            [ Emph
+                [ Space
+                , Str "italic"
+                , Space
+                , Str "item"
+                , Space
+                , Str "3"
+                , Space
+                ]
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain [ Str "item" , Space , Str "3.1" ] ]
+            , [ Plain [ Str "item" , Space , Str "3.2" ] ]
+            ]
+        ]
+      ]
+  , Para
+      [ Str "up"
+      , Space
+      , Str "to"
+      , Space
+      , Str "five"
+      , Space
+      , Str "levels"
+      ]
+  , BulletList
+      [ [ Plain [ Str "1" ]
+        , BulletList
+            [ [ Plain [ Str "2" ]
+              , BulletList
+                  [ [ Plain [ Str "3" ]
+                    , BulletList
+                        [ [ Plain [ Str "4" ]
+                          , BulletList [ [ Plain [ Str "5" ] ] ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "You"
+            , Space
+            , Str "can"
+            , Space
+            , Str "have"
+            , Space
+            , Str "multiline"
+            , Space
+            , Str "list"
+            , Space
+            , Str "items"
+            ]
+        ]
+      , [ Plain
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "second"
+            , Space
+            , Str "multiline"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            ]
+        ]
+      ]
+  , Para
+      [ Str "You"
+      , Space
+      , Str "can"
+      , Space
+      , Str "use"
+      , Space
+      , Str "nowiki"
+      , Space
+      , Str "syntax"
+      , Space
+      , Str "if"
+      , Space
+      , Str "you"
+      , Space
+      , Str "would"
+      , Space
+      , Str "like"
+      , Space
+      , Str "do"
+      , Space
+      , Str "stuff"
+      , Space
+      , Str "like"
+      , Space
+      , Str "this:"
+      ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "Guitar Chord C:\n\n||---|---|---|\n||-0-|---|---|\n||---|---|---|\n||---|-0-|---|\n||---|---|-0-|\n||---|---|---|"
+  , Para
+      [ Str "You"
+      , Space
+      , Str "can"
+      , Space
+      , Str "also"
+      , Space
+      , Str "use"
+      , Space
+      , Str "it"
+      , Space
+      , Str "inline"
+      , Space
+      , Str "nowiki"
+      , Space
+      , Code ( "" , [] , [] ) " in a sentence "
+      , Space
+      , Str "like"
+      , Space
+      , Str "this."
+      ]
+  , Header 1 ( "" , [] , [] ) [ Str "Escapes" ]
+  , Para
+      [ Str "Normal"
+      , Space
+      , Str "Link:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://wikicreole.org/" ]
+          ( "http://wikicreole.org/" , "" )
+      , Space
+      , Str "-"
+      , Space
+      , Str "now"
+      , Space
+      , Str "same"
+      , Space
+      , Str "link,"
+      , Space
+      , Str "but"
+      , Space
+      , Str "escaped:"
+      , Space
+      , Str "http://wikicreole.org/"
+      ]
+  , Para
+      [ Str "Normal"
+      , Space
+      , Str "asterisks:"
+      , Space
+      , Str "**not"
+      , Space
+      , Str "bold**"
+      ]
+  , Para
+      [ Str "a"
+      , Space
+      , Str "tilde"
+      , Space
+      , Str "alone:"
+      , Space
+      , Str "~"
+      ]
+  , Para
+      [ Str "a"
+      , Space
+      , Str "tilde"
+      , Space
+      , Str "escapes"
+      , Space
+      , Str "itself:"
+      , Space
+      , Str "~xxx"
+      ]
+  , Header 3 ( "" , [] , [] ) [ Str "Creole 0.2" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "flower"
+      , Space
+      , Str "with"
+      , Space
+      , Str "the"
+      , Space
+      , Str "ALT"
+      , Space
+      , Str "text"
+      , Space
+      , Str "\"this"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "flower\""
+      , Space
+      , Str "if"
+      , Space
+      , Str "your"
+      , Space
+      , Str "wiki"
+      , Space
+      , Str "supports"
+      , Space
+      , Str "ALT"
+      , Space
+      , Str "text"
+      , Space
+      , Str "on"
+      , Space
+      , Str "images:"
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "here is a red flower" ]
+          ( "Red-Flower.jpg" , "" )
+      ]
+  , Header 3 ( "" , [] , [] ) [ Str "Creole 0.4" ]
+  , Para
+      [ Str "Tables"
+      , Space
+      , Str "are"
+      , Space
+      , Str "done"
+      , Space
+      , Str "like"
+      , Space
+      , Str "this:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "header" , Space , Str "col1" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "header" , Space , Str "col2" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "col1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "col2" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "you" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "can" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "also" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "align" , LineBreak , Str "it." ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "You"
+      , Space
+      , Str "can"
+      , Space
+      , Str "format"
+      , Space
+      , Str "an"
+      , Space
+      , Str "address"
+      , Space
+      , Str "by"
+      , Space
+      , Str "simply"
+      , Space
+      , Str "forcing"
+      , Space
+      , Str "linebreaks:"
+      ]
+  , Para
+      [ Str "My"
+      , Space
+      , Str "contact"
+      , Space
+      , Str "dates:"
+      , LineBreak
+      , Str "Pone:"
+      , Space
+      , Str "xyz"
+      , LineBreak
+      , Str "Fax:"
+      , Space
+      , Str "+45"
+      , LineBreak
+      , Str "Mobile:"
+      , Space
+      , Str "abc"
+      ]
+  , Header 3 ( "" , [] , [] ) [ Str "Creole 0.5" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Header" , Space , Str "title" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain
+                     [ Str "Another"
+                     , Space
+                     , Str "header"
+                     , Space
+                     , Str "title"
+                     ]
+                 ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Code ( "" , [] , [] ) " //not italic text// " ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Code ( "" , [] , [] ) " **not bold text** " ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Emph [ Str "italic" , Space , Str "text" ] ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Strong
+                          [ Space
+                          , Str "bold"
+                          , Space
+                          , Str "text"
+                          , Space
+                          ]
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header 3 ( "" , [] , [] ) [ Str "Creole 1.0" ]
+  , Para
+      [ Str "If"
+      , Space
+      , Str "interwiki"
+      , Space
+      , Str "links"
+      , Space
+      , Str "are"
+      , Space
+      , Str "setup"
+      , Space
+      , Str "in"
+      , Space
+      , Str "your"
+      , Space
+      , Str "wiki,"
+      , Space
+      , Str "this"
+      , Space
+      , Str "links"
+      , Space
+      , Str "to"
+      , Space
+      , Str "the"
+      , Space
+      , Str "WikiCreole"
+      , Space
+      , Str "page"
+      , Space
+      , Str "about"
+      , Space
+      , Str "Creole"
+      , Space
+      , Str "1.0"
+      , Space
+      , Str "test"
+      , Space
+      , Str "cases:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "WikiCreole:Creole1.0TestCases" ]
+          ( "WikiCreole:Creole1.0TestCases" , "" )
+      , Str "."
+      ]
+  , HorizontalRule
+  , Para
+      [ Str "The"
+      , Space
+      , Str "above"
+      , Space
+      , Str "test"
+      , Space
+      , Str "document"
+      , Space
+      , Str "was"
+      , Space
+      , Str "found"
+      , Space
+      , Str "on"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.wikicreole.org/wiki/Creole1.0TestCases" ]
+          ( "http://www.wikicreole.org/wiki/Creole1.0TestCases" , "" )
+      , Space
+      , Str "and"
+      , Space
+      , Str "downloaded"
+      , Space
+      , Str "from"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str
+              "http://www.wikicreole.org/attach/Creole1.0TestCases/creole1.0test.txt"
+          ]
+          ( "http://www.wikicreole.org/attach/Creole1.0TestCases/creole1.0test.txt"
+          , ""
+          )
+      , Str "."
+      ]
+  , Para
+      [ Str "The"
+      , Space
+      , Str "Creole"
+      , Space
+      , Str "Wiki"
+      , Space
+      , Str "is"
+      , Space
+      , Str "licensed:"
+      , Space
+      , Str "Copyright"
+      , Space
+      , Str "(C)"
+      , Space
+      , Str "by"
+      , Space
+      , Str "the"
+      , Space
+      , Str "contributors."
+      , Space
+      , Str "Some"
+      , Space
+      , Str "rights"
+      , Space
+      , Str "reserved,"
+      , Space
+      , Str "license"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "https://creativecommons.org/licenses/by-sa/1.0/" ]
+          ( "BY-SA" , "" )
+      , Str "."
+      ]
+  ]
diff --git a/test/docbook-chapter.native b/test/docbook-chapter.native
--- a/test/docbook-chapter.native
+++ b/test/docbook-chapter.native
@@ -1,17 +1,173 @@
-Pandoc (Meta {unMeta = fromList []})
-[Header 1 ("",[],[]) [Str "Test",Space,Str "Chapter"]
-,Para [Str "This",Space,Str "chapter",Space,Str "uses",Space,Str "recursive",Space,Str "sections."]
-,Header 2 ("",[],[]) [Str "Like",Space,Str "a",Space,Str "Sect1"]
-,Para [Str "This",Space,Str "section",Space,Str "is",Space,Str "like",Space,Str "a",Space,Str "Sect1."]
-,Header 3 ("",[],[]) [Str "Like",Space,Str "a",Space,Str "Sect2"]
-,Para [Str "This",Space,Str "section",Space,Str "is",Space,Str "like",Space,Str "a",Space,Str "Sect2."]
-,Header 4 ("",[],[]) [Str "Like",Space,Str "a",Space,Str "Sect3"]
-,Para [Str "This",Space,Str "section",Space,Str "is",Space,Str "like",Space,Str "a",Space,Str "Sect3."]
-,Header 5 ("",[],[]) [Str "Like",Space,Str "a",Space,Str "Sect4"]
-,Para [Str "This",Space,Str "section",Space,Str "is",Space,Str "like",Space,Str "a",Space,Str "Sect4."]
-,Header 6 ("",[],[]) [Str "Like",Space,Str "a",Space,Str "Sect5"]
-,Para [Str "This",Space,Str "section",Space,Str "is",Space,Str "like",Space,Str "a",Space,Str "Sect5."]
-,Header 7 ("",[],[]) [Str "Would",Space,Str "be",Space,Str "like",Space,Str "a",Space,Str "Sect6"]
-,Para [Str "This",Space,Str "section",Space,Str "would",Space,Str "be",Space,Str "like",Space,Str "a",Space,Str "Sect6,",Space,Str "if",Space,Str "there",Space,Str "was",Space,Str "one."]
-,Header 8 ("",[],[]) [Str "Would",Space,Str "be",Space,Str "like",Space,Str "a",Space,Str "Sect7"]
-,Para [Str "This",Space,Str "section",Space,Str "would",Space,Str "be",Space,Str "like",Space,Str "a",Space,Str "Sect7,",Space,Str "if",Space,Str "there",Space,Str "was",Space,Str "one."]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Header
+      1 ( "" , [] , [] ) [ Str "Test" , Space , Str "Chapter" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "chapter"
+      , Space
+      , Str "uses"
+      , Space
+      , Str "recursive"
+      , Space
+      , Str "sections."
+      ]
+  , Header
+      2
+      ( "" , [] , [] )
+      [ Str "Like" , Space , Str "a" , Space , Str "Sect1" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "section"
+      , Space
+      , Str "is"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "Sect1."
+      ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Like" , Space , Str "a" , Space , Str "Sect2" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "section"
+      , Space
+      , Str "is"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "Sect2."
+      ]
+  , Header
+      4
+      ( "" , [] , [] )
+      [ Str "Like" , Space , Str "a" , Space , Str "Sect3" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "section"
+      , Space
+      , Str "is"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "Sect3."
+      ]
+  , Header
+      5
+      ( "" , [] , [] )
+      [ Str "Like" , Space , Str "a" , Space , Str "Sect4" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "section"
+      , Space
+      , Str "is"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "Sect4."
+      ]
+  , Header
+      6
+      ( "" , [] , [] )
+      [ Str "Like" , Space , Str "a" , Space , Str "Sect5" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "section"
+      , Space
+      , Str "is"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "Sect5."
+      ]
+  , Header
+      7
+      ( "" , [] , [] )
+      [ Str "Would"
+      , Space
+      , Str "be"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "Sect6"
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "section"
+      , Space
+      , Str "would"
+      , Space
+      , Str "be"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "Sect6,"
+      , Space
+      , Str "if"
+      , Space
+      , Str "there"
+      , Space
+      , Str "was"
+      , Space
+      , Str "one."
+      ]
+  , Header
+      8
+      ( "" , [] , [] )
+      [ Str "Would"
+      , Space
+      , Str "be"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "Sect7"
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "section"
+      , Space
+      , Str "would"
+      , Space
+      , Str "be"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "Sect7,"
+      , Space
+      , Str "if"
+      , Space
+      , Str "there"
+      , Space
+      , Str "was"
+      , Space
+      , Str "one."
+      ]
+  ]
diff --git a/test/docbook-reader.docbook b/test/docbook-reader.docbook
--- a/test/docbook-reader.docbook
+++ b/test/docbook-reader.docbook
@@ -102,6 +102,11 @@
     print &quot;working&quot;;
 }
 </programlisting>
+    <programlisting linenumbering="numbered">
+sub status {
+    print &quot;working with line numbers&quot;;
+}
+</programlisting>
     <screen>
 % <command>ls</command>
 </screen>
diff --git a/test/docbook-reader.native b/test/docbook-reader.native
--- a/test/docbook-reader.native
+++ b/test/docbook-reader.native
@@ -1,584 +1,2933 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",SoftBreak,Str "MacFarlane"],MetaInlines [Str "Anonymous"]]),("date",MetaInlines [Str "July",Space,Str "17,",Space,Str "2006"]),("title",MetaInlines [Str "Pandoc",Space,Str "Test",Space,Str "Suite"])]})
-[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",SoftBreak,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
-,Header 1 ("headers",[],[]) [Str "Headers"]
-,Header 2 ("level-2-with-an-embedded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link ("",[],[]) [Str "embedded",Space,Str "link"] ("/url","")]
-,Header 3 ("level-3-with-emphasis",[],[]) [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 4 ("level-4",[],[]) [Str "Level",Space,Str "4"]
-,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
-,Para [Str "Hi."]
-,Header 1 ("level-1",[],[]) [Str "Level",Space,Str "1"]
-,Header 2 ("level-2-with-emphasis",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 3 ("level-3",[],[]) [Str "Level",Space,Str "3"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,Header 4 ("",["unnumbered"],[]) [Str "Level",Space,Str "4"]
-,Para [Str "An",Space,Str "unnumbered",Space,Str "section."]
-,Header 2 ("level-2",[],[]) [Str "Level",Space,Str "2"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
-,Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",SoftBreak,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",SoftBreak,Str "a",Space,Str "list",Space,Str "item."]
-,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
-,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
-,Para [Str "E-mail",Space,Str "style:"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
-,BlockQuote
- [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- ,CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"
- ,CodeBlock ("",[],[]) "% ls"
- ,Para [Str "A",Space,Str "list:"]
- ,OrderedList (1,Decimal,DefaultDelim)
-  [[Para [Str "item",Space,Str "one"]]
-  ,[Para [Str "item",Space,Str "two"]]]
- ,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
- ,BlockQuote
-  [Para [Str "nested"]]
- ,BlockQuote
-  [Para [Str "nested"]]]
-,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",Space,Str ">",Space,Str "1."]
-,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
-,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
-,Para [Str "And:"]
-,CodeBlock ("",[],[]) "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
-,Header 1 ("lists",[],[]) [Str "Lists"]
-,Header 2 ("unordered",[],[]) [Str "Unordered"]
-,Para [Str "Asterisks",Space,Str "loose:"]
-,BulletList
- [[Para [Str "asterisk",Space,Str "1"]]
- ,[Para [Str "asterisk",Space,Str "2"]]
- ,[Para [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Plus",Space,Str "1"]]
- ,[Para [Str "Plus",Space,Str "2"]]
- ,[Para [Str "Plus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Minus",Space,Str "1"]]
- ,[Para [Str "Minus",Space,Str "2"]]
- ,[Para [Str "Minus",Space,Str "3"]]]
-,Header 2 ("ordered",[],[]) [Str "Ordered"]
-,OrderedList (1,Decimal,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second"]]
- ,[Para [Str "Third"]]]
-,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
-,OrderedList (1,Decimal,DefaultDelim)
- [[Para [Str "One"]]
- ,[Para [Str "Two"]]
- ,[Para [Str "Three"]]]
-,Para [Str "Multiple",Space,Str "paragraphs:"]
-,OrderedList (1,Decimal,DefaultDelim)
- [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
-  ,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",SoftBreak,Str "back."]]
- ,[Para [Str "Item",Space,Str "2."]]
- ,[Para [Str "Item",Space,Str "3."]]]
-,Header 2 ("nested",[],[]) [Str "Nested"]
-,BulletList
- [[Para [Str "Tab"]
-  ,BulletList
-   [[Para [Str "Tab"]
-    ,BulletList
-     [[Para [Str "Tab"]]]]]]]
-,Para [Str "Here\8217s",Space,Str "another:"]
-,OrderedList (1,Decimal,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Para [Str "Fee"]]
-   ,[Para [Str "Fie"]]
-   ,[Para [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
-,OrderedList (1,Decimal,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Para [Str "Fee"]]
-   ,[Para [Str "Fie"]]
-   ,[Para [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Header 2 ("tabs-and-spaces",[],[]) [Str "Tabs",Space,Str "and",Space,Str "spaces"]
-,BulletList
- [[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"]]
- ,[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]
-  ,BulletList
-   [[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"]]
-   ,[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]]]]]
-,Header 2 ("fancy-list-markers",[],[]) [Str "Fancy",Space,Str "list",Space,Str "markers"]
-,OrderedList (2,Decimal,DefaultDelim)
- [[Para [Str "begins",Space,Str "with",Space,Str "2"]]
- ,[Para [Str "and",Space,Str "now",Space,Str "3"]
-  ,Para [Str "with",Space,Str "a",Space,Str "continuation"]
-  ,OrderedList (4,LowerRoman,DefaultDelim)
-   [[Para [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",Space,Str "starting",Space,Str "with",Space,Str "4"]]
-   ,[Para [Str "more",Space,Str "items"]
-    ,OrderedList (1,UpperAlpha,DefaultDelim)
-     [[Para [Str "a",Space,Str "subsublist"]]
-     ,[Para [Str "a",Space,Str "subsublist"]]]]]]]
-,Para [Str "Nesting:"]
-,OrderedList (1,UpperAlpha,DefaultDelim)
- [[Para [Str "Upper",Space,Str "Alpha"]
-  ,OrderedList (1,UpperRoman,DefaultDelim)
-   [[Para [Str "Upper",Space,Str "Roman."]
-    ,OrderedList (6,Decimal,DefaultDelim)
-     [[Para [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
-      ,OrderedList (3,LowerAlpha,DefaultDelim)
-       [[Para [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
-,Para [Str "Autonumbering:"]
-,OrderedList (1,Decimal,DefaultDelim)
- [[Para [Str "Autonumber."]]
- ,[Para [Str "More."]
-  ,OrderedList (1,Decimal,DefaultDelim)
-   [[Para [Str "Nested."]]]]]
-,Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item:"]
-,Para [Str "M.A.\160\&2007"]
-,Para [Str "B.",Space,Str "Williams"]
-,Header 2 ("callout",[],[]) [Str "Callout"]
-,Para [Str "Simple."]
-,BulletList
- [[Para [Str "A",Space,Code ("",[],[]) "__letrec",Space,Str "is",Space,Str "equivalent",Space,Str "to",Space,Str "a",Space,Str "normal",SoftBreak,Str "Haskell",Space,Str "LET."]]
- ,[Para [Str "GHC",Space,Str "compiled",Space,Str "the",Space,Str "body",Space,Str "of",Space,Str "our",Space,Str "list",Space,Str "comprehension",Space,Str "into",SoftBreak,Str "a",Space,Str "loop",Space,Str "named",Space,Code ("",[],[]) "go_s1YC",Str "."]]
- ,[Para [Str "If",Space,Str "our",Space,Str "CASE",Space,Str "expression",Space,Str "matches",Space,Str "the",Space,Str "empty",Space,Str "list,",Space,Str "we",SoftBreak,Str "return",Space,Str "the",Space,Str "empty",Space,Str "list.",Space,Str "This",Space,Str "is",Space,Str "reassuringly",SoftBreak,Str "familiar."]]]
-,Header 1 ("definition-lists",[],[]) [Str "Definition",Space,Str "Lists"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]]])
- ,([Str "banana"],
-   [[Para [Str "yellow",Space,Str "fruit"]]])]
-,Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics:"]
-,DefinitionList
- [([Emph [Str "apple"]],
-   [[Para [Str "red",Space,Str "fruit"]
-    ,Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"]]])
- ,([Emph [Str "orange"]],
-   [[Para [Str "orange",Space,Str "fruit"]
-    ,CodeBlock ("",[],[]) "{ orange code block }"
-    ,BlockQuote
-     [Para [Str "orange",Space,Str "block",Space,Str "quote"]]]])]
-,Para [Str "Multiple",Space,Str "definitions,",Space,Str "loose:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]
-   ,[Para [Str "computer"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]]
-   ,[Para [Str "bank"]]])]
-,Para [Str "Blank",Space,Str "line",Space,Str "after",Space,Str "term,",Space,Str "indented",Space,Str "marker,",Space,Str "alternate",Space,Str "markers:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]
-   ,[Para [Str "computer"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]
-    ,OrderedList (1,Decimal,DefaultDelim)
-     [[Para [Str "sublist"]]
-     ,[Para [Str "sublist"]]]]])]
-,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",SoftBreak,Str "this"],Str "."]
-,Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",SoftBreak,Strong [Str "is",Space,Str "this"],Str "."]
-,Para [Str "An",Space,Emph [Link ("",[],[]) [Str "emphasized",Space,Str "link"] ("/url","")],Str "."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",SoftBreak,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",SoftBreak,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",SoftBreak,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",SoftBreak,Code ("",[],[]) "<html>",Str "."]
-,Para [Str "More",Space,Str "code:",Space,Code ("",[],[]) "Class",Space,Str "and",Space,Code ("",[],[]) "Type"]
-,Para [Str "Referencing",Space,Str "a",Space,Str "man",Space,Str "page:",Space,Code ("",["citerefentry"],[]) "nix.conf(5)"]
-,Para [Strikeout [Str "This",Space,Str "is",SoftBreak,Emph [Str "strikeout"],Str "."]]
-,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",SoftBreak,Str "a",Superscript [Emph [Str "hello"]],SoftBreak,Str "a",Superscript [Str "hello\160there"],Str "."]
-,Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",SoftBreak,Str "H",Subscript [Str "many\160of\160them"],Str "O."]
-,Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts,",Space,Str "because",Space,Str "of",Space,Str "the",Space,Str "unescaped",SoftBreak,Str "spaces:",Space,Str "a^b",Space,Str "c^d,",Space,Str "a~b",Space,Str "c~d."]
-,Header 1 ("smart-quotes-ellipses-dashes",[],[]) [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
-,Para [Quoted DoubleQuote [Str "Hello,"],Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Quoted DoubleQuote [Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",SoftBreak,Str "name."]]
-,Para [Quoted DoubleQuote [Str "A"],Str ",",Space,Quoted DoubleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted DoubleQuote [Str "C"],Space,Str "are",Space,Str "letters."]
-,Para [Quoted DoubleQuote [Str "He",Space,Str "said,",Space,Quoted SingleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",SoftBreak,Str "70\8217s?"]
-,Para [Str "Some",Space,Str "dashes:",Space,Str "one\8212two",Space,Str "\8212",Space,Str "three\8212four",Space,Str "\8212",Space,Str "five."]
-,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5\8211\&7,",Space,Str "255\8211\&66,",Space,Str "1987\8211\&1999."]
-,Para [Str "Ellipses\8230and\8230and\8230."]
-,Header 1 ("math",[],[]) []
-,Para [Math DisplayMath "e = mc^{2}",Math DisplayMath "1",SoftBreak,Math InlineMath "e = mc^{2}",SoftBreak,Math DisplayMath "e = mc^{2}"]
-,Header 1 ("special-characters",[],[]) [Str "Special",Space,Str "Characters"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
-,BulletList
- [[Para [Str "I",Space,Str "hat:",Space,Str "\206"]]
- ,[Para [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
- ,[Para [Str "section:",Space,Str "\167"]]
- ,[Para [Str "set",Space,Str "membership:",Space,Str "\8712"]]
- ,[Para [Str "copyright:",Space,Str "\169"]]]
-,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
-,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
-,Para [Str "This",Space,Str "&",Space,Str "that."]
-,Para [Str "4",Space,Str "<",Space,Str "5."]
-,Para [Str "6",Space,Str ">",Space,Str "5."]
-,Para [Str "Backslash:",Space,Str "\\"]
-,Para [Str "Backtick:",Space,Str "`"]
-,Para [Str "Asterisk:",Space,Str "*"]
-,Para [Str "Underscore:",Space,Str "_"]
-,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
-,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
-,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
-,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
-,Para [Str "Left",Space,Str "paren:",Space,Str "("]
-,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
-,Para [Str "Greater-than:",Space,Str ">"]
-,Para [Str "Hash:",Space,Str "#"]
-,Para [Str "Period:",Space,Str "."]
-,Para [Str "Bang:",Space,Str "!"]
-,Para [Str "Plus:",Space,Str "+"]
-,Para [Str "Minus:",Space,Str "-"]
-,Header 1 ("links",[],[]) [Str "Links"]
-,Header 2 ("explicit",[],[]) [Str "Explicit"]
-,Para [Str "Just",Space,Str "a",Space,Link ("",[],[]) [Str "URL"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","")]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","")]
-,Para [Link ("",[],[]) [Str "with_underscore"] ("/url/with_underscore","")]
-,Para [Link ("",[],[]) [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
-,Para [Link ("",[],[]) [Str "Empty"] ("",""),Str "."]
-,Header 2 ("reference",[],[]) [Str "Reference"]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "With",Space,Link ("",[],[]) [Str "embedded",Space,Str "[brackets]"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "once"] ("/url",""),Str "."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "twice"] ("/url",""),Str "."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "thrice"] ("/url",""),Str "."]
-,Para [Str "This",Space,Str "should",Space,Str "[not][]",Space,Str "be",Space,Str "a",Space,Str "link."]
-,CodeBlock ("",[],[]) "[not]: /url"
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "biz"] ("/url/",""),Str "."]
-,Header 2 ("with-ampersands",[],[]) [Str "With",Space,Str "ampersands"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Link ("",[],[]) [Str "link",Space,Str "with",Space,Str "an",SoftBreak,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",SoftBreak,Link ("",[],[]) [Str "AT&T"] ("http://att.com/",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "an",Space,Link ("",[],[]) [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "an",Space,Link ("",[],[]) [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",SoftBreak,Str "braces"] ("/script?foo=1&bar=2",""),Str "."]
-,Header 2 ("autolinks",[],[]) [Str "Autolinks"]
-,Para [Str "With",Space,Str "an",Space,Str "ampersand:",SoftBreak,Link ("",[],[]) [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
-,BulletList
- [[Para [Str "In",Space,Str "a",Space,Str "list?"]]
- ,[Para [Link ("",[],[]) [Str "http://example.com/"] ("http://example.com/","")]]
- ,[Para [Str "It",Space,Str "should."]]]
-,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Link ("",[],[]) [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
-,BlockQuote
- [Para [Str "Blockquoted:",SoftBreak,Link ("",[],[]) [Str "http://example.com/"] ("http://example.com/","")]]
-,Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",SoftBreak,Code ("",[],[]) "<http://example.com/>"]
-,CodeBlock ("",[],[]) "or here: <http://example.com/>"
-,Header 1 ("images",[],[]) [Str "Images"]
-,Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
-,Para [Image ("",[],[]) [Str "lalune",Space,Str "fig",Space,Str "caption"] ("lalune.jpg","fig:")]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image ("",[],[]) [] ("movie.jpg",""),Space,Str "icon.",SoftBreak,Str "And",Space,Str "here",Space,Str "a",Space,Str "second",Space,Str "movie",Space,Image ("",[],[]) [Str "alt",Space,Str "text"] ("movie.jpg",""),Space,Str "icon.",SoftBreak,Str "And",Space,Str "here",Space,Str "a",Space,Str "third",Space,Str "movie",Space,Image ("",[],[]) [Str "alt",Space,Str "text"] ("movie.jpg",""),Space,Str "icon."]
-,Para [Image ("",[],[]) [Str "lalune",Space,Str "no",Space,Str "figure",Space,Str "alt",Space,Str "text"] ("lalune.jpg","")]
-,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference.",SoftBreak,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],Space,Str "and",Space,Str "another.",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",SoftBreak,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock ("",[],[]) "  { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",SoftBreak,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",SoftBreak,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space.[^my",Space,Str "note]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note.",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",SoftBreak,Link ("",[],[]) [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",SoftBreak,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
-,BlockQuote
- [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]]]
-,OrderedList (1,Decimal,DefaultDelim)
- [[Para [Str "And",Space,Str "in",Space,Str "list",Space,Str "items.",Note [Para [Str "In",Space,Str "list."]]]]]
-,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented."]
-,Header 1 ("tables",[],[]) [Str "Tables"]
-,Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces:"]
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Here's",Space,Str "the",Space,Str "caption.",Space,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."]])
- [(AlignCenter,ColWidth 0.2)
- ,(AlignLeft,ColWidth 0.2)
- ,(AlignRight,ColWidth 0.3)
- ,(AlignLeft,ColWidth 0.3)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Centered",Space,Str "Header"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left",Space,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right",Space,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default",Space,Str "aligned"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "First"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Second"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidth 0.1)
- ,(AlignLeft,ColWidth 0.2)
- ,(AlignRight,ColWidth 0.3)
- ,(AlignLeft,ColWidth 0.4)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Centered",Space,Str "Header"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left",Space,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right",Space,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default",Space,Str "aligned"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "First"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Second"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidth 0.25)
- ,(AlignLeft,ColWidth 0.25)
- ,(AlignRight,ColWidth 0.25)
- ,(AlignLeft,ColWidth 0.25)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "First"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Second"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]])]
- (TableFoot ("",[],[])
- [])
-,BulletList
- [[Para [Str "A",Space,Str "Step"]]
- ,[Para [Str "Another",Space,Str "Step"]
-  ,Para [Str "Substeps",Space,Str "can",Space,Str "be",Space,Str "nested",Space,Str "indefinitely",Space,Str "deep."]]
- ,[Para [Str "A",Space,Str "Final",Space,Str "Step"]]]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author"
+            , MetaList
+                [ MetaInlines
+                    [ Str "John" , SoftBreak , Str "MacFarlane" ]
+                , MetaInlines [ Str "Anonymous" ]
+                ]
+            )
+          , ( "date"
+            , MetaInlines
+                [ Str "July" , Space , Str "17," , Space , Str "2006" ]
+            )
+          , ( "title"
+            , MetaInlines
+                [ Str "Pandoc"
+                , Space
+                , Str "Test"
+                , Space
+                , Str "Suite"
+                ]
+            )
+          ]
+    }
+  [ Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "set"
+      , Space
+      , Str "of"
+      , Space
+      , Str "tests"
+      , Space
+      , Str "for"
+      , Space
+      , Str "pandoc."
+      , Space
+      , Str "Most"
+      , Space
+      , Str "of"
+      , Space
+      , Str "them"
+      , Space
+      , Str "are"
+      , Space
+      , Str "adapted"
+      , Space
+      , Str "from"
+      , Space
+      , Str "John"
+      , SoftBreak
+      , Str "Gruber\8217s"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "test"
+      , Space
+      , Str "suite."
+      ]
+  , Header 1 ( "headers" , [] , [] ) [ Str "Headers" ]
+  , Header
+      2
+      ( "level-2-with-an-embedded-link" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "link" ]
+          ( "/url" , "" )
+      ]
+  , Header
+      3
+      ( "level-3-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "3"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      4 ( "level-4" , [] , [] ) [ Str "Level" , Space , Str "4" ]
+  , Header
+      5 ( "level-5" , [] , [] ) [ Str "Level" , Space , Str "5" ]
+  , Para [ Str "Hi." ]
+  , Header
+      1 ( "level-1" , [] , [] ) [ Str "Level" , Space , Str "1" ]
+  , Header
+      2
+      ( "level-2-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      3 ( "level-3" , [] , [] ) [ Str "Level" , Space , Str "3" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , Header
+      4
+      ( "" , [ "unnumbered" ] , [] )
+      [ Str "Level" , Space , Str "4" ]
+  , Para
+      [ Str "An"
+      , Space
+      , Str "unnumbered"
+      , Space
+      , Str "section."
+      ]
+  , Header
+      2 ( "level-2" , [] , [] ) [ Str "Level" , Space , Str "2" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , Header 1 ( "paragraphs" , [] , [] ) [ Str "Paragraphs" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "regular"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "In"
+      , Space
+      , Str "Markdown"
+      , Space
+      , Str "1.0.0"
+      , Space
+      , Str "and"
+      , Space
+      , Str "earlier."
+      , Space
+      , Str "Version"
+      , Space
+      , Str "8."
+      , Space
+      , Str "This"
+      , Space
+      , Str "line"
+      , Space
+      , Str "turns"
+      , Space
+      , Str "into"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , SoftBreak
+      , Str "item."
+      , Space
+      , Str "Because"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard-wrapped"
+      , Space
+      , Str "line"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "middle"
+      , Space
+      , Str "of"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "looked"
+      , Space
+      , Str "like"
+      , SoftBreak
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "one"
+      , Space
+      , Str "with"
+      , Space
+      , Str "a"
+      , Space
+      , Str "bullet."
+      , Space
+      , Str "*"
+      , Space
+      , Str "criminey."
+      ]
+  , Header
+      1
+      ( "block-quotes" , [] , [] )
+      [ Str "Block" , Space , Str "Quotes" ]
+  , Para [ Str "E-mail" , Space , Str "style:" ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          , Space
+          , Str "It"
+          , Space
+          , Str "is"
+          , Space
+          , Str "pretty"
+          , Space
+          , Str "short."
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Code"
+          , Space
+          , Str "in"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote:"
+          ]
+      , CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      , CodeBlock
+          ( "" , [ "numberLines" ] , [] )
+          "sub status {\n    print \"working with line numbers\";\n}"
+      , CodeBlock ( "" , [] , [] ) "% ls"
+      , Para [ Str "A" , Space , Str "list:" ]
+      , OrderedList
+          ( 1 , Decimal , DefaultDelim )
+          [ [ Para [ Str "item" , Space , Str "one" ] ]
+          , [ Para [ Str "item" , Space , Str "two" ] ]
+          ]
+      , Para
+          [ Str "Nested"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quotes:"
+          ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "block"
+      , Space
+      , Str "quote:"
+      , Space
+      , Str "2"
+      , Space
+      , Str ">"
+      , Space
+      , Str "1."
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "a"
+      , Space
+      , Str "following"
+      , Space
+      , Str "paragraph."
+      ]
+  , Header
+      1
+      ( "code-blocks" , [] , [] )
+      [ Str "Code" , Space , Str "Blocks" ]
+  , Para [ Str "Code:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
+  , Header 1 ( "lists" , [] , [] ) [ Str "Lists" ]
+  , Header 2 ( "unordered" , [] , [] ) [ Str "Unordered" ]
+  , Para [ Str "Asterisks" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Plus" , Space , Str "1" ] ]
+      , [ Para [ Str "Plus" , Space , Str "2" ] ]
+      , [ Para [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Minus" , Space , Str "1" ] ]
+      , [ Para [ Str "Minus" , Space , Str "2" ] ]
+      , [ Para [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Header 2 ( "ordered" , [] , [] ) [ Str "Ordered" ]
+  , OrderedList
+      ( 1 , Decimal , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second" ] ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "and" , Space , Str "using" , Space , Str "spaces:" ]
+  , OrderedList
+      ( 1 , Decimal , DefaultDelim )
+      [ [ Para [ Str "One" ] ]
+      , [ Para [ Str "Two" ] ]
+      , [ Para [ Str "Three" ] ]
+      ]
+  , Para [ Str "Multiple" , Space , Str "paragraphs:" ]
+  , OrderedList
+      ( 1 , Decimal , DefaultDelim )
+      [ [ Para
+            [ Str "Item"
+            , Space
+            , Str "1,"
+            , Space
+            , Str "graf"
+            , Space
+            , Str "one."
+            ]
+        , Para
+            [ Str "Item"
+            , Space
+            , Str "1."
+            , Space
+            , Str "graf"
+            , Space
+            , Str "two."
+            , Space
+            , Str "The"
+            , Space
+            , Str "quick"
+            , Space
+            , Str "brown"
+            , Space
+            , Str "fox"
+            , Space
+            , Str "jumped"
+            , Space
+            , Str "over"
+            , Space
+            , Str "the"
+            , Space
+            , Str "lazy"
+            , Space
+            , Str "dog\8217s"
+            , SoftBreak
+            , Str "back."
+            ]
+        ]
+      , [ Para [ Str "Item" , Space , Str "2." ] ]
+      , [ Para [ Str "Item" , Space , Str "3." ] ]
+      ]
+  , Header 2 ( "nested" , [] , [] ) [ Str "Nested" ]
+  , BulletList
+      [ [ Para [ Str "Tab" ]
+        , BulletList
+            [ [ Para [ Str "Tab" ]
+              , BulletList [ [ Para [ Str "Tab" ] ] ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Here\8217s" , Space , Str "another:" ]
+  , OrderedList
+      ( 1 , Decimal , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Para [ Str "Fee" ] ]
+            , [ Para [ Str "Fie" ] ]
+            , [ Para [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "Same"
+      , Space
+      , Str "thing"
+      , Space
+      , Str "but"
+      , Space
+      , Str "with"
+      , Space
+      , Str "paragraphs:"
+      ]
+  , OrderedList
+      ( 1 , Decimal , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Para [ Str "Fee" ] ]
+            , [ Para [ Str "Fie" ] ]
+            , [ Para [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Header
+      2
+      ( "tabs-and-spaces" , [] , [] )
+      [ Str "Tabs" , Space , Str "and" , Space , Str "spaces" ]
+  , BulletList
+      [ [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "tabs"
+            ]
+        ]
+      , [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "spaces"
+            ]
+        , BulletList
+            [ [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "tabs"
+                  ]
+              ]
+            , [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "spaces"
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "fancy-list-markers" , [] , [] )
+      [ Str "Fancy" , Space , Str "list" , Space , Str "markers" ]
+  , OrderedList
+      ( 2 , Decimal , DefaultDelim )
+      [ [ Para
+            [ Str "begins" , Space , Str "with" , Space , Str "2" ]
+        ]
+      , [ Para [ Str "and" , Space , Str "now" , Space , Str "3" ]
+        , Para
+            [ Str "with"
+            , Space
+            , Str "a"
+            , Space
+            , Str "continuation"
+            ]
+        , OrderedList
+            ( 4 , LowerRoman , DefaultDelim )
+            [ [ Para
+                  [ Str "sublist"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "roman"
+                  , Space
+                  , Str "numerals,"
+                  , Space
+                  , Str "starting"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "4"
+                  ]
+              ]
+            , [ Para [ Str "more" , Space , Str "items" ]
+              , OrderedList
+                  ( 1 , UpperAlpha , DefaultDelim )
+                  [ [ Para [ Str "a" , Space , Str "subsublist" ] ]
+                  , [ Para [ Str "a" , Space , Str "subsublist" ] ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Nesting:" ]
+  , OrderedList
+      ( 1 , UpperAlpha , DefaultDelim )
+      [ [ Para [ Str "Upper" , Space , Str "Alpha" ]
+        , OrderedList
+            ( 1 , UpperRoman , DefaultDelim )
+            [ [ Para [ Str "Upper" , Space , Str "Roman." ]
+              , OrderedList
+                  ( 6 , Decimal , DefaultDelim )
+                  [ [ Para
+                        [ Str "Decimal"
+                        , Space
+                        , Str "start"
+                        , Space
+                        , Str "with"
+                        , Space
+                        , Str "6"
+                        ]
+                    , OrderedList
+                        ( 3 , LowerAlpha , DefaultDelim )
+                        [ [ Para
+                              [ Str "Lower"
+                              , Space
+                              , Str "alpha"
+                              , Space
+                              , Str "with"
+                              , Space
+                              , Str "paren"
+                              ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Autonumbering:" ]
+  , OrderedList
+      ( 1 , Decimal , DefaultDelim )
+      [ [ Para [ Str "Autonumber." ] ]
+      , [ Para [ Str "More." ]
+        , OrderedList
+            ( 1 , Decimal , DefaultDelim )
+            [ [ Para [ Str "Nested." ] ] ]
+        ]
+      ]
+  , Para
+      [ Str "Should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item:"
+      ]
+  , Para [ Str "M.A.\160\&2007" ]
+  , Para [ Str "B." , Space , Str "Williams" ]
+  , Header 2 ( "callout" , [] , [] ) [ Str "Callout" ]
+  , Para [ Str "Simple." ]
+  , BulletList
+      [ [ Para
+            [ Str "A"
+            , Space
+            , Code ( "" , [] , [] ) "__letrec"
+            , Space
+            , Str "is"
+            , Space
+            , Str "equivalent"
+            , Space
+            , Str "to"
+            , Space
+            , Str "a"
+            , Space
+            , Str "normal"
+            , SoftBreak
+            , Str "Haskell"
+            , Space
+            , Str "LET."
+            ]
+        ]
+      , [ Para
+            [ Str "GHC"
+            , Space
+            , Str "compiled"
+            , Space
+            , Str "the"
+            , Space
+            , Str "body"
+            , Space
+            , Str "of"
+            , Space
+            , Str "our"
+            , Space
+            , Str "list"
+            , Space
+            , Str "comprehension"
+            , Space
+            , Str "into"
+            , SoftBreak
+            , Str "a"
+            , Space
+            , Str "loop"
+            , Space
+            , Str "named"
+            , Space
+            , Code ( "" , [] , [] ) "go_s1YC"
+            , Str "."
+            ]
+        ]
+      , [ Para
+            [ Str "If"
+            , Space
+            , Str "our"
+            , Space
+            , Str "CASE"
+            , Space
+            , Str "expression"
+            , Space
+            , Str "matches"
+            , Space
+            , Str "the"
+            , Space
+            , Str "empty"
+            , Space
+            , Str "list,"
+            , Space
+            , Str "we"
+            , SoftBreak
+            , Str "return"
+            , Space
+            , Str "the"
+            , Space
+            , Str "empty"
+            , Space
+            , Str "list."
+            , Space
+            , Str "This"
+            , Space
+            , Str "is"
+            , Space
+            , Str "reassuringly"
+            , SoftBreak
+            , Str "familiar."
+            ]
+        ]
+      ]
+  , Header
+      1
+      ( "definition-lists" , [] , [] )
+      [ Str "Definition" , Space , Str "Lists" ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "banana" ]
+        , [ [ Para [ Str "yellow" , Space , Str "fruit" ] ] ]
+        )
+      ]
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "blocks"
+      , Space
+      , Str "with"
+      , Space
+      , Str "italics:"
+      ]
+  , DefinitionList
+      [ ( [ Emph [ Str "apple" ] ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ]
+            , Para
+                [ Str "contains"
+                , Space
+                , Str "seeds,"
+                , Space
+                , Str "crisp,"
+                , Space
+                , Str "pleasant"
+                , Space
+                , Str "to"
+                , Space
+                , Str "taste"
+                ]
+            ]
+          ]
+        )
+      , ( [ Emph [ Str "orange" ] ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ]
+            , CodeBlock ( "" , [] , [] ) "{ orange code block }"
+            , BlockQuote
+                [ Para
+                    [ Str "orange"
+                    , Space
+                    , Str "block"
+                    , Space
+                    , Str "quote"
+                    ]
+                ]
+            ]
+          ]
+        )
+      ]
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "definitions,"
+      , Space
+      , Str "loose:"
+      ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ]
+          , [ Para [ Str "computer" ] ]
+          ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ] ]
+          , [ Para [ Str "bank" ] ]
+          ]
+        )
+      ]
+  , Para
+      [ Str "Blank"
+      , Space
+      , Str "line"
+      , Space
+      , Str "after"
+      , Space
+      , Str "term,"
+      , Space
+      , Str "indented"
+      , Space
+      , Str "marker,"
+      , Space
+      , Str "alternate"
+      , Space
+      , Str "markers:"
+      ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ]
+          , [ Para [ Str "computer" ] ]
+          ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ]
+            , OrderedList
+                ( 1 , Decimal , DefaultDelim )
+                [ [ Para [ Str "sublist" ] ]
+                , [ Para [ Str "sublist" ] ]
+                ]
+            ]
+          ]
+        )
+      ]
+  , Header
+      1
+      ( "inline-markup" , [] , [] )
+      [ Str "Inline" , Space , Str "Markup" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Emph [ Str "is" , SoftBreak , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , SoftBreak
+      , Strong [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Emph
+          [ Link
+              ( "" , [] , [] )
+              [ Str "emphasized" , Space , Str "link" ]
+              ( "/url" , "" )
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , SoftBreak
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , SoftBreak
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "code:"
+      , Space
+      , Code ( "" , [] , [] ) ">"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "$"
+      , Str ","
+      , SoftBreak
+      , Code ( "" , [] , [] ) "\\"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\$"
+      , Str ","
+      , SoftBreak
+      , Code ( "" , [] , [] ) "<html>"
+      , Str "."
+      ]
+  , Para
+      [ Str "More"
+      , Space
+      , Str "code:"
+      , Space
+      , Code ( "" , [] , [] ) "Class"
+      , Space
+      , Str "and"
+      , Space
+      , Code ( "" , [] , [] ) "Type"
+      ]
+  , Para
+      [ Str "Referencing"
+      , Space
+      , Str "a"
+      , Space
+      , Str "man"
+      , Space
+      , Str "page:"
+      , Space
+      , Code ( "" , [ "citerefentry" ] , [] ) "nix.conf(5)"
+      ]
+  , Para
+      [ Strikeout
+          [ Str "This"
+          , Space
+          , Str "is"
+          , SoftBreak
+          , Emph [ Str "strikeout" ]
+          , Str "."
+          ]
+      ]
+  , Para
+      [ Str "Superscripts:"
+      , Space
+      , Str "a"
+      , Superscript [ Str "bc" ]
+      , Str "d"
+      , SoftBreak
+      , Str "a"
+      , Superscript [ Emph [ Str "hello" ] ]
+      , SoftBreak
+      , Str "a"
+      , Superscript [ Str "hello\160there" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Subscripts:"
+      , Space
+      , Str "H"
+      , Subscript [ Str "2" ]
+      , Str "O,"
+      , Space
+      , Str "H"
+      , Subscript [ Str "23" ]
+      , Str "O,"
+      , SoftBreak
+      , Str "H"
+      , Subscript [ Str "many\160of\160them" ]
+      , Str "O."
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "superscripts"
+      , Space
+      , Str "or"
+      , Space
+      , Str "subscripts,"
+      , Space
+      , Str "because"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "unescaped"
+      , SoftBreak
+      , Str "spaces:"
+      , Space
+      , Str "a^b"
+      , Space
+      , Str "c^d,"
+      , Space
+      , Str "a~b"
+      , Space
+      , Str "c~d."
+      ]
+  , Header
+      1
+      ( "smart-quotes-ellipses-dashes" , [] , [] )
+      [ Str "Smart"
+      , Space
+      , Str "quotes,"
+      , Space
+      , Str "ellipses,"
+      , Space
+      , Str "dashes"
+      ]
+  , Para
+      [ Quoted DoubleQuote [ Str "Hello," ]
+      , Space
+      , Str "said"
+      , Space
+      , Str "the"
+      , Space
+      , Str "spider."
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Quoted SingleQuote [ Str "Shelob" ]
+          , Space
+          , Str "is"
+          , Space
+          , Str "my"
+          , SoftBreak
+          , Str "name."
+          ]
+      ]
+  , Para
+      [ Quoted DoubleQuote [ Str "A" ]
+      , Str ","
+      , Space
+      , Quoted DoubleQuote [ Str "B" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Quoted DoubleQuote [ Str "C" ]
+      , Space
+      , Str "are"
+      , Space
+      , Str "letters."
+      ]
+  , Para
+      [ Quoted
+          DoubleQuote
+          [ Str "He"
+          , Space
+          , Str "said,"
+          , Space
+          , Quoted
+              SingleQuote
+              [ Str "I"
+              , Space
+              , Str "want"
+              , Space
+              , Str "to"
+              , Space
+              , Str "go."
+              ]
+          ]
+      , Space
+      , Str "Were"
+      , Space
+      , Str "you"
+      , Space
+      , Str "alive"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "70\8217s?"
+      ]
+  , Para
+      [ Str "Some"
+      , Space
+      , Str "dashes:"
+      , Space
+      , Str "one\8212two"
+      , Space
+      , Str "\8212"
+      , Space
+      , Str "three\8212four"
+      , Space
+      , Str "\8212"
+      , Space
+      , Str "five."
+      ]
+  , Para
+      [ Str "Dashes"
+      , Space
+      , Str "between"
+      , Space
+      , Str "numbers:"
+      , Space
+      , Str "5\8211\&7,"
+      , Space
+      , Str "255\8211\&66,"
+      , Space
+      , Str "1987\8211\&1999."
+      ]
+  , Para [ Str "Ellipses\8230and\8230and\8230." ]
+  , Header 1 ( "math" , [] , [] ) []
+  , Para
+      [ Math DisplayMath "e = mc^{2}"
+      , Math DisplayMath "1"
+      , SoftBreak
+      , Math InlineMath "e = mc^{2}"
+      , SoftBreak
+      , Math DisplayMath "e = mc^{2}"
+      ]
+  , Header
+      1
+      ( "special-characters" , [] , [] )
+      [ Str "Special" , Space , Str "Characters" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "unicode:"
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "I" , Space , Str "hat:" , Space , Str "\206" ]
+        ]
+      , [ Para
+            [ Str "o" , Space , Str "umlaut:" , Space , Str "\246" ]
+        ]
+      , [ Para [ Str "section:" , Space , Str "\167" ] ]
+      , [ Para
+            [ Str "set"
+            , Space
+            , Str "membership:"
+            , Space
+            , Str "\8712"
+            ]
+        ]
+      , [ Para [ Str "copyright:" , Space , Str "\169" ] ]
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "has"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "their"
+      , Space
+      , Str "name."
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "is"
+      , Space
+      , Str "another"
+      , Space
+      , Str "way"
+      , Space
+      , Str "to"
+      , Space
+      , Str "write"
+      , Space
+      , Str "it."
+      ]
+  , Para
+      [ Str "This" , Space , Str "&" , Space , Str "that." ]
+  , Para [ Str "4" , Space , Str "<" , Space , Str "5." ]
+  , Para [ Str "6" , Space , Str ">" , Space , Str "5." ]
+  , Para [ Str "Backslash:" , Space , Str "\\" ]
+  , Para [ Str "Backtick:" , Space , Str "`" ]
+  , Para [ Str "Asterisk:" , Space , Str "*" ]
+  , Para [ Str "Underscore:" , Space , Str "_" ]
+  , Para
+      [ Str "Left" , Space , Str "brace:" , Space , Str "{" ]
+  , Para
+      [ Str "Right" , Space , Str "brace:" , Space , Str "}" ]
+  , Para
+      [ Str "Left" , Space , Str "bracket:" , Space , Str "[" ]
+  , Para
+      [ Str "Right" , Space , Str "bracket:" , Space , Str "]" ]
+  , Para
+      [ Str "Left" , Space , Str "paren:" , Space , Str "(" ]
+  , Para
+      [ Str "Right" , Space , Str "paren:" , Space , Str ")" ]
+  , Para [ Str "Greater-than:" , Space , Str ">" ]
+  , Para [ Str "Hash:" , Space , Str "#" ]
+  , Para [ Str "Period:" , Space , Str "." ]
+  , Para [ Str "Bang:" , Space , Str "!" ]
+  , Para [ Str "Plus:" , Space , Str "+" ]
+  , Para [ Str "Minus:" , Space , Str "-" ]
+  , Header 1 ( "links" , [] , [] ) [ Str "Links" ]
+  , Header 2 ( "explicit" , [] , [] ) [ Str "Explicit" ]
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "a"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "URL" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "with_underscore" ]
+          ( "/url/with_underscore" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "nobody@nowhere.net" ]
+          ( "mailto:nobody@nowhere.net" , "" )
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "Empty" ] ( "" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "reference" , [] , [] ) [ Str "Reference" ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "With"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "[brackets]" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "b" ] ( "/url/" , "" )
+      , Space
+      , Str "by"
+      , Space
+      , Str "itself"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "once" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "twice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "thrice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "[not][]"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , CodeBlock ( "" , [] , [] ) "[not]: /url"
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "biz" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Header
+      2
+      ( "with-ampersands" , [] , [] )
+      [ Str "With" , Space , Str "ampersands" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "link"
+          , Space
+          , Str "with"
+          , Space
+          , Str "an"
+          , SoftBreak
+          , Str "ampersand"
+          , Space
+          , Str "in"
+          , Space
+          , Str "the"
+          , Space
+          , Str "URL"
+          ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Str "amersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "link"
+      , Space
+      , Str "text:"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "AT&T" ] ( "http://att.com/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline" , Space , Str "link" ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline"
+          , Space
+          , Str "link"
+          , Space
+          , Str "in"
+          , Space
+          , Str "pointy"
+          , SoftBreak
+          , Str "braces"
+          ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "autolinks" , [] , [] ) [ Str "Autolinks" ]
+  , Para
+      [ Str "With"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand:"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://example.com/?foo=1&bar=2" ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "In" , Space , Str "a" , Space , Str "list?" ]
+        ]
+      , [ Para
+            [ Link
+                ( "" , [] , [] )
+                [ Str "http://example.com/" ]
+                ( "http://example.com/" , "" )
+            ]
+        ]
+      , [ Para [ Str "It" , Space , Str "should." ] ]
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Str "e-mail"
+      , Space
+      , Str "address:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "nobody@nowhere.net" ]
+          ( "mailto:nobody@nowhere.net" , "" )
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Blockquoted:"
+          , SoftBreak
+          , Link
+              ( "" , [] , [] )
+              [ Str "http://example.com/" ]
+              ( "http://example.com/" , "" )
+          ]
+      ]
+  , Para
+      [ Str "Auto-links"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "occur"
+      , Space
+      , Str "here:"
+      , SoftBreak
+      , Code ( "" , [] , [] ) "<http://example.com/>"
+      ]
+  , CodeBlock
+      ( "" , [] , [] ) "or here: <http://example.com/>"
+  , Header 1 ( "images" , [] , [] ) [ Str "Images" ]
+  , Para
+      [ Str "From"
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Str "Voyage"
+          , Space
+          , Str "dans"
+          , Space
+          , Str "la"
+          , Space
+          , Str "Lune"
+          ]
+      , Space
+      , Str "by"
+      , Space
+      , Str "Georges"
+      , Space
+      , Str "Melies"
+      , Space
+      , Str "(1902):"
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "lalune" , Space , Str "fig" , Space , Str "caption" ]
+          ( "lalune.jpg" , "fig:" )
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "movie"
+      , Space
+      , Image ( "" , [] , [] ) [] ( "movie.jpg" , "" )
+      , Space
+      , Str "icon."
+      , SoftBreak
+      , Str "And"
+      , Space
+      , Str "here"
+      , Space
+      , Str "a"
+      , Space
+      , Str "second"
+      , Space
+      , Str "movie"
+      , Space
+      , Image
+          ( "" , [] , [] )
+          [ Str "alt" , Space , Str "text" ]
+          ( "movie.jpg" , "" )
+      , Space
+      , Str "icon."
+      , SoftBreak
+      , Str "And"
+      , Space
+      , Str "here"
+      , Space
+      , Str "a"
+      , Space
+      , Str "third"
+      , Space
+      , Str "movie"
+      , Space
+      , Image
+          ( "" , [] , [] )
+          [ Str "alt" , Space , Str "text" ]
+          ( "movie.jpg" , "" )
+      , Space
+      , Str "icon."
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "lalune"
+          , Space
+          , Str "no"
+          , Space
+          , Str "figure"
+          , Space
+          , Str "alt"
+          , Space
+          , Str "text"
+          ]
+          ( "lalune.jpg" , "" )
+      ]
+  , Header 1 ( "footnotes" , [] , [] ) [ Str "Footnotes" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference,"
+      , Note
+          [ Para
+              [ Str "Here"
+              , Space
+              , Str "is"
+              , Space
+              , Str "the"
+              , Space
+              , Str "footnote."
+              , Space
+              , Str "It"
+              , Space
+              , Str "can"
+              , Space
+              , Str "go"
+              , Space
+              , Str "anywhere"
+              , Space
+              , Str "after"
+              , Space
+              , Str "the"
+              , Space
+              , Str "footnote"
+              , Space
+              , Str "reference."
+              , SoftBreak
+              , Str "It"
+              , Space
+              , Str "need"
+              , Space
+              , Str "not"
+              , Space
+              , Str "be"
+              , Space
+              , Str "placed"
+              , Space
+              , Str "at"
+              , Space
+              , Str "the"
+              , Space
+              , Str "end"
+              , Space
+              , Str "of"
+              , Space
+              , Str "the"
+              , Space
+              , Str "document."
+              ]
+          ]
+      , Space
+      , Str "and"
+      , Space
+      , Str "another."
+      , Note
+          [ Para
+              [ Str "Here\8217s"
+              , Space
+              , Str "the"
+              , Space
+              , Str "long"
+              , Space
+              , Str "note."
+              , Space
+              , Str "This"
+              , Space
+              , Str "one"
+              , Space
+              , Str "contains"
+              , Space
+              , Str "multiple"
+              , Space
+              , Str "blocks."
+              ]
+          , Para
+              [ Str "Subsequent"
+              , Space
+              , Str "blocks"
+              , Space
+              , Str "are"
+              , Space
+              , Str "indented"
+              , Space
+              , Str "to"
+              , Space
+              , Str "show"
+              , Space
+              , Str "that"
+              , Space
+              , Str "they"
+              , Space
+              , Str "belong"
+              , Space
+              , Str "to"
+              , Space
+              , Str "the"
+              , SoftBreak
+              , Str "footnote"
+              , Space
+              , Str "(as"
+              , Space
+              , Str "with"
+              , Space
+              , Str "list"
+              , Space
+              , Str "items)."
+              ]
+          , CodeBlock ( "" , [] , [] ) "  { <code> }"
+          , Para
+              [ Str "If"
+              , Space
+              , Str "you"
+              , Space
+              , Str "want,"
+              , Space
+              , Str "you"
+              , Space
+              , Str "can"
+              , Space
+              , Str "indent"
+              , Space
+              , Str "every"
+              , Space
+              , Str "line,"
+              , Space
+              , Str "but"
+              , Space
+              , Str "you"
+              , Space
+              , Str "can"
+              , Space
+              , Str "also"
+              , Space
+              , Str "be"
+              , Space
+              , Str "lazy"
+              , Space
+              , Str "and"
+              , SoftBreak
+              , Str "just"
+              , Space
+              , Str "indent"
+              , Space
+              , Str "the"
+              , Space
+              , Str "first"
+              , Space
+              , Str "line"
+              , Space
+              , Str "of"
+              , Space
+              , Str "each"
+              , Space
+              , Str "block."
+              ]
+          ]
+      , Space
+      , Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Emph [ Str "not" ]
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference,"
+      , SoftBreak
+      , Str "because"
+      , Space
+      , Str "it"
+      , Space
+      , Str "contains"
+      , Space
+      , Str "a"
+      , Space
+      , Str "space.[^my"
+      , Space
+      , Str "note]"
+      , Space
+      , Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "an"
+      , Space
+      , Str "inline"
+      , Space
+      , Str "note."
+      , Note
+          [ Para
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Emph [ Str "easier" ]
+              , Space
+              , Str "to"
+              , Space
+              , Str "type."
+              , Space
+              , Str "Inline"
+              , Space
+              , Str "notes"
+              , Space
+              , Str "may"
+              , Space
+              , Str "contain"
+              , SoftBreak
+              , Link
+                  ( "" , [] , [] )
+                  [ Str "links" ]
+                  ( "http://google.com" , "" )
+              , Space
+              , Str "and"
+              , Space
+              , Code ( "" , [] , [] ) "]"
+              , SoftBreak
+              , Str "verbatim"
+              , Space
+              , Str "characters,"
+              , Space
+              , Str "as"
+              , Space
+              , Str "well"
+              , Space
+              , Str "as"
+              , Space
+              , Str "[bracketed"
+              , Space
+              , Str "text]."
+              ]
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Notes"
+          , Space
+          , Str "can"
+          , Space
+          , Str "go"
+          , Space
+          , Str "in"
+          , Space
+          , Str "quotes."
+          , Note [ Para [ Str "In" , Space , Str "quote." ] ]
+          ]
+      ]
+  , OrderedList
+      ( 1 , Decimal , DefaultDelim )
+      [ [ Para
+            [ Str "And"
+            , Space
+            , Str "in"
+            , Space
+            , Str "list"
+            , Space
+            , Str "items."
+            , Note [ Para [ Str "In" , Space , Str "list." ] ]
+            ]
+        ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "part"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "note,"
+      , Space
+      , Str "as"
+      , Space
+      , Str "it"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "indented."
+      ]
+  , Header 1 ( "tables" , [] , [] ) [ Str "Tables" ]
+  , Para
+      [ Str "Simple"
+      , Space
+      , Str "table"
+      , Space
+      , Str "with"
+      , Space
+      , Str "caption:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption
+         Nothing
+         [ Plain
+             [ Str "Demonstration"
+             , Space
+             , Str "of"
+             , Space
+             , Str "simple"
+             , Space
+             , Str "table"
+             , Space
+             , Str "syntax."
+             ]
+         ])
+      [ ( AlignRight , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Right" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Left" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Center" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Default" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Simple"
+      , Space
+      , Str "table"
+      , Space
+      , Str "without"
+      , Space
+      , Str "caption:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignRight , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Right" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Left" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Center" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Default" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Simple"
+      , Space
+      , Str "table"
+      , Space
+      , Str "indented"
+      , Space
+      , Str "two"
+      , Space
+      , Str "spaces:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption
+         Nothing
+         [ Plain
+             [ Str "Demonstration"
+             , Space
+             , Str "of"
+             , Space
+             , Str "simple"
+             , Space
+             , Str "table"
+             , Space
+             , Str "syntax."
+             ]
+         ])
+      [ ( AlignRight , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Right" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Left" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Center" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Default" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Multiline"
+      , Space
+      , Str "table"
+      , Space
+      , Str "with"
+      , Space
+      , Str "caption:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption
+         Nothing
+         [ Plain
+             [ Str "Here's"
+             , Space
+             , Str "the"
+             , Space
+             , Str "caption."
+             , Space
+             , Str "It"
+             , Space
+             , Str "may"
+             , Space
+             , Str "span"
+             , Space
+             , Str "multiple"
+             , Space
+             , Str "lines."
+             ]
+         ])
+      [ ( AlignCenter , ColWidth 0.2 )
+      , ( AlignLeft , ColWidth 0.2 )
+      , ( AlignRight , ColWidth 0.3 )
+      , ( AlignLeft , ColWidth 0.3 )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Centered" , Space , Str "Header" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Left" , Space , Str "Aligned" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Right" , Space , Str "Aligned" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Default" , Space , Str "aligned" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "First" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "row" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12.0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Example"
+                      , Space
+                      , Str "of"
+                      , Space
+                      , Str "a"
+                      , Space
+                      , Str "row"
+                      , Space
+                      , Str "that"
+                      , Space
+                      , Str "spans"
+                      , Space
+                      , Str "multiple"
+                      , Space
+                      , Str "lines."
+                      ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Second" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "row" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5.0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Here's"
+                      , Space
+                      , Str "another"
+                      , Space
+                      , Str "one."
+                      , Space
+                      , Str "Note"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "blank"
+                      , Space
+                      , Str "line"
+                      , Space
+                      , Str "between"
+                      , Space
+                      , Str "rows."
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Multiline"
+      , Space
+      , Str "table"
+      , Space
+      , Str "without"
+      , Space
+      , Str "caption:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidth 0.1 )
+      , ( AlignLeft , ColWidth 0.2 )
+      , ( AlignRight , ColWidth 0.3 )
+      , ( AlignLeft , ColWidth 0.4 )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Centered" , Space , Str "Header" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Left" , Space , Str "Aligned" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Right" , Space , Str "Aligned" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Default" , Space , Str "aligned" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "First" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "row" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12.0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Example"
+                      , Space
+                      , Str "of"
+                      , Space
+                      , Str "a"
+                      , Space
+                      , Str "row"
+                      , Space
+                      , Str "that"
+                      , Space
+                      , Str "spans"
+                      , Space
+                      , Str "multiple"
+                      , Space
+                      , Str "lines."
+                      ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Second" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "row" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5.0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Here's"
+                      , Space
+                      , Str "another"
+                      , Space
+                      , Str "one."
+                      , Space
+                      , Str "Note"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "blank"
+                      , Space
+                      , Str "line"
+                      , Space
+                      , Str "between"
+                      , Space
+                      , Str "rows."
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Table"
+      , Space
+      , Str "without"
+      , Space
+      , Str "column"
+      , Space
+      , Str "headers:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignRight , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignRight , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Multiline"
+      , Space
+      , Str "table"
+      , Space
+      , Str "without"
+      , Space
+      , Str "column"
+      , Space
+      , Str "headers:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidth 0.25 )
+      , ( AlignLeft , ColWidth 0.25 )
+      , ( AlignRight , ColWidth 0.25 )
+      , ( AlignLeft , ColWidth 0.25 )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "First" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "row" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12.0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Example"
+                      , Space
+                      , Str "of"
+                      , Space
+                      , Str "a"
+                      , Space
+                      , Str "row"
+                      , Space
+                      , Str "that"
+                      , Space
+                      , Str "spans"
+                      , Space
+                      , Str "multiple"
+                      , Space
+                      , Str "lines."
+                      ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Second" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "row" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5.0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Here's"
+                      , Space
+                      , Str "another"
+                      , Space
+                      , Str "one."
+                      , Space
+                      , Str "Note"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "blank"
+                      , Space
+                      , Str "line"
+                      , Space
+                      , Str "between"
+                      , Space
+                      , Str "rows."
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , BulletList
+      [ [ Para [ Str "A" , Space , Str "Step" ] ]
+      , [ Para [ Str "Another" , Space , Str "Step" ]
+        , Para
+            [ Str "Substeps"
+            , Space
+            , Str "can"
+            , Space
+            , Str "be"
+            , Space
+            , Str "nested"
+            , Space
+            , Str "indefinitely"
+            , Space
+            , Str "deep."
+            ]
+        ]
+      , [ Para
+            [ Str "A" , Space , Str "Final" , Space , Str "Step" ]
+        ]
+      ]
+  ]
diff --git a/test/docbook-xref.native b/test/docbook-xref.native
--- a/test/docbook-xref.native
+++ b/test/docbook-xref.native
@@ -1,29 +1,177 @@
-Pandoc (Meta {unMeta = fromList [("title",MetaInlines [Str "An",Space,Str "Example",Space,Str "Book"])]})
-[Header 1 ("ch01",[],[]) [Str "XRef",Space,Str "Samples"]
-,Para [Str "This",Space,Str "paragraph",Space,Str "demonstrates",Space,Str "several",Space,Str "features",Space,Str "of",SoftBreak,Str "XRef."]
-,BulletList
- [[Para [Str "A",Space,Str "straight",Space,Str "link",Space,Str "generates",Space,Str "the",SoftBreak,Str "cross-reference",Space,Str "text:",Space,Link ("",[],[]) [Str "The",Space,Str "Second",Space,Str "Chapter"] ("#ch02",""),Str "."]]
- ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",Space,Str "element",Space,Str "with",Space,Str "an",SoftBreak,Str "XRefLabel:",SoftBreak,Link ("",[],[]) [Str "Chapter",Space,Str "the",Space,Str "Third"] ("#ch03",""),Str "."]]
- ,[Para [Str "A",Space,Str "link",Space,Str "with",Space,Str "an",SoftBreak,Str "EndTerm:",SoftBreak,Link ("",[],[]) [Str "Chapter",Space,Str "4"] ("#ch04",""),Str "."]]
- ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",SoftBreak,Str "cmdsynopsis",Space,Str "element:",Space,Link ("",[],[]) [Str "chgrp"] ("#cmd01",""),Str "."]]
- ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",SoftBreak,Str "funcsynopsis",Space,Str "element:",Space,Link ("",[],[]) [Str "max"] ("#func01",""),Str "."]]]
-,Header 1 ("ch02",[],[]) [Str "The",Space,Str "Second",Space,Str "Chapter"]
-,Para [Str "Some",Space,Str "content",Space,Str "here"]
-,Header 1 ("ch03",[],[]) [Str "The",Space,Str "Third",Space,Str "Chapter"]
-,Para [Str "Some",Space,Str "content",Space,Str "here"]
-,Header 1 ("ch04",[],[]) [Str "The",Space,Str "Fourth",Space,Str "Chapter"]
-,Para [Str "Some",Space,Str "content",Space,Str "here"]
-,Plain [Str "chgrp"]
-,Plain [Str "-R"]
-,Plain [Str "-H"]
-,Plain [Str "-L"]
-,Plain [Str "-P"]
-,Plain [Str "-f"]
-,Plain [Str "group"]
-,Plain [Str "file"]
-,Plain [Str "int"]
-,Plain [Str "max"]
-,Plain [Str "int"]
-,Plain [Str "int1"]
-,Plain [Str "int"]
-,Plain [Str "int2"]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "title"
+            , MetaInlines
+                [ Str "An"
+                , Space
+                , Str "Example"
+                , Space
+                , Str "Book"
+                ]
+            )
+          ]
+    }
+  [ Header
+      1
+      ( "ch01" , [] , [] )
+      [ Str "XRef" , Space , Str "Samples" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "demonstrates"
+      , Space
+      , Str "several"
+      , Space
+      , Str "features"
+      , Space
+      , Str "of"
+      , SoftBreak
+      , Str "XRef."
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "A"
+            , Space
+            , Str "straight"
+            , Space
+            , Str "link"
+            , Space
+            , Str "generates"
+            , Space
+            , Str "the"
+            , SoftBreak
+            , Str "cross-reference"
+            , Space
+            , Str "text:"
+            , Space
+            , Link
+                ( "" , [] , [] )
+                [ Str "The"
+                , Space
+                , Str "Second"
+                , Space
+                , Str "Chapter"
+                ]
+                ( "#ch02" , "" )
+            , Str "."
+            ]
+        ]
+      , [ Para
+            [ Str "A"
+            , Space
+            , Str "link"
+            , Space
+            , Str "to"
+            , Space
+            , Str "an"
+            , Space
+            , Str "element"
+            , Space
+            , Str "with"
+            , Space
+            , Str "an"
+            , SoftBreak
+            , Str "XRefLabel:"
+            , SoftBreak
+            , Link
+                ( "" , [] , [] )
+                [ Str "Chapter"
+                , Space
+                , Str "the"
+                , Space
+                , Str "Third"
+                ]
+                ( "#ch03" , "" )
+            , Str "."
+            ]
+        ]
+      , [ Para
+            [ Str "A"
+            , Space
+            , Str "link"
+            , Space
+            , Str "with"
+            , Space
+            , Str "an"
+            , SoftBreak
+            , Str "EndTerm:"
+            , SoftBreak
+            , Link
+                ( "" , [] , [] )
+                [ Str "Chapter" , Space , Str "4" ]
+                ( "#ch04" , "" )
+            , Str "."
+            ]
+        ]
+      , [ Para
+            [ Str "A"
+            , Space
+            , Str "link"
+            , Space
+            , Str "to"
+            , Space
+            , Str "an"
+            , SoftBreak
+            , Str "cmdsynopsis"
+            , Space
+            , Str "element:"
+            , Space
+            , Link ( "" , [] , [] ) [ Str "chgrp" ] ( "#cmd01" , "" )
+            , Str "."
+            ]
+        ]
+      , [ Para
+            [ Str "A"
+            , Space
+            , Str "link"
+            , Space
+            , Str "to"
+            , Space
+            , Str "an"
+            , SoftBreak
+            , Str "funcsynopsis"
+            , Space
+            , Str "element:"
+            , Space
+            , Link ( "" , [] , [] ) [ Str "max" ] ( "#func01" , "" )
+            , Str "."
+            ]
+        ]
+      ]
+  , Header
+      1
+      ( "ch02" , [] , [] )
+      [ Str "The" , Space , Str "Second" , Space , Str "Chapter" ]
+  , Para
+      [ Str "Some" , Space , Str "content" , Space , Str "here" ]
+  , Header
+      1
+      ( "ch03" , [] , [] )
+      [ Str "The" , Space , Str "Third" , Space , Str "Chapter" ]
+  , Para
+      [ Str "Some" , Space , Str "content" , Space , Str "here" ]
+  , Header
+      1
+      ( "ch04" , [] , [] )
+      [ Str "The" , Space , Str "Fourth" , Space , Str "Chapter" ]
+  , Para
+      [ Str "Some" , Space , Str "content" , Space , Str "here" ]
+  , Plain [ Str "chgrp" ]
+  , Plain [ Str "-R" ]
+  , Plain [ Str "-H" ]
+  , Plain [ Str "-L" ]
+  , Plain [ Str "-P" ]
+  , Plain [ Str "-f" ]
+  , Plain [ Str "group" ]
+  , Plain [ Str "file" ]
+  , Plain [ Str "int" ]
+  , Plain [ Str "max" ]
+  , Plain [ Str "int" ]
+  , Plain [ Str "int1" ]
+  , Plain [ Str "int" ]
+  , Plain [ Str "int2" ]
+  ]
diff --git a/test/docx/0_level_headers.native b/test/docx/0_level_headers.native
--- a/test/docx/0_level_headers.native
+++ b/test/docx/0_level_headers.native
@@ -39,9 +39,9 @@
  [])
 ,Para [Str "CONTENTS"]
 ,Para [Strong [Str "Section",Space,Str "Page"]]
-,Para [Str "FIGURES",Space,Str "iv"]
-,Para [Str "TABLES",Space,Str "v"]
-,Para [Str "SECTION",Space,Str "1",Space,Str "Introduction",Space,Str "2"]
+,Para [Str "FIGURES",Space,Link ("",[],[]) [Str "iv"] ("#figures","")]
+,Para [Str "TABLES",Space,Link ("",[],[]) [Str "v"] ("#tables","")]
+,Para [Str "SECTION",Space,Str "1",Space,Str "Introduction",Space,Link ("",[],[]) [Str "2"] ("#introduction","")]
 ,Header 1 ("figures",["Heading-0"],[]) [Str "FIGURES"]
 ,Para [Strong [Str "Figure",Space,Str "Page"]]
 ,Para [Strong [Str "No",Space,Str "table",Space,Str "of",Space,Str "figures",Space,Str "entries",Space,Str "found."]]
diff --git a/test/docx/diagram.docx b/test/docx/diagram.docx
new file mode 100644
Binary files /dev/null and b/test/docx/diagram.docx differ
diff --git a/test/docx/diagram.native b/test/docx/diagram.native
new file mode 100644
--- /dev/null
+++ b/test/docx/diagram.native
@@ -0,0 +1,2 @@
+[Header 1 ("diagram-after",[],[]) [Str "Diagram",Space,Str "after:"]
+,Para [Span ("",["diagram"],[]) [Str "[DIAGRAM]"]]]
diff --git a/test/docx/empty_field.docx b/test/docx/empty_field.docx
new file mode 100644
Binary files /dev/null and b/test/docx/empty_field.docx differ
diff --git a/test/docx/empty_field.native b/test/docx/empty_field.native
new file mode 100644
--- /dev/null
+++ b/test/docx/empty_field.native
@@ -0,0 +1,7 @@
+[Para
+    [Str "\24076\26395\28145\20837\20102\35299\30340\35835\32773\21487\20197\21435\30475David",Space,Str "French",Space,Str "Belding\21644Kevin",Space,Str "J.",Space,Str "Mitchell\30340"
+    ,Link ("",[],[]) [Str "Foundations",Space,Str "of",Space,Str "Analysis,",Space,Str "2nd",Space,Str "Edition"] ("https://books.google.com/books?id=sp_Zcb9ot90C&lpg=PR4&hl=zh-CN&pg=PA19#v=onepage&q&f=true",""),Str ",\21487\20174\&19\39029\30475\36215\65292\25110D.C.",Space,Str "Goldrei\30340",Space
+    ,Link ("",[],[]) [Str "Classic",Space,Str "Set",Space,Str "Theory:",Space,Str "For",Space,Str "Guided",Space,Str "Independent",Space,Str "Study"] ("https://books.google.ae/books?id=dlc0DwAAQBAJ&lpg=PT29&hl=zh-CN&pg=PT26#v=onepage&q&f=true","")
+    ,Str "\65292\20174\31532\20108\31456\30475\36215\65292\38405\35835\26102\35201\27880\24847\26412\25991\19982\36825\20123\20070\25152\19981\21516\30340\26159\24182\27809\26377\25226\23454\25968\30475\20316\26159\26377\29702\25968\38598\30340\20998\21106\12290"]
+,Para [Str "Index:"]
+,Para [Str "French,",Space,Str "1"]]
diff --git a/test/docx/golden/image.docx b/test/docx/golden/image.docx
Binary files a/test/docx/golden/image.docx and b/test/docx/golden/image.docx differ
diff --git a/test/docx/golden/inline_images.docx b/test/docx/golden/inline_images.docx
Binary files a/test/docx/golden/inline_images.docx and b/test/docx/golden/inline_images.docx differ
diff --git a/test/docx/golden/nested_anchors_in_header.docx b/test/docx/golden/nested_anchors_in_header.docx
Binary files a/test/docx/golden/nested_anchors_in_header.docx and b/test/docx/golden/nested_anchors_in_header.docx differ
diff --git a/test/docx/image_vml.native b/test/docx/image_vml.native
--- a/test/docx/image_vml.native
+++ b/test/docx/image_vml.native
@@ -1,4 +1,3 @@
 [Header 1 ("vml-image",[],[]) [Strong [Str "VML",Space,Str "Image"]]
-,BlockQuote
- [Para [Str "It",Space,Str "should",Space,Str "follow",Space,Str "below:"]
- ,Para [Image ("",[],[]) [] ("media/image4.jpeg","")]]]
+,Para [Str "It",Space,Str "should",Space,Str "follow",Space,Str "below:"]
+,Para [Image ("",[],[]) [] ("media/image4.jpeg","")]]
diff --git a/test/docx/nested_anchors_in_header.native b/test/docx/nested_anchors_in_header.native
--- a/test/docx/nested_anchors_in_header.native
+++ b/test/docx/nested_anchors_in_header.native
@@ -1,8 +1,8 @@
 [Header 1 ("\1086\1075\1083\1072\1074\1083\1077\1085\1080\1077",["TOC-Heading"],[]) [Str "\1054\1075\1083\1072\1074\1083\1077\1085\1080\1077"]
-,Para [Link ("",[],[]) [Str "Short",Space,Str "instructions",Space,Str "1"] ("#short-instructions","")]
-,Para [Link ("",[],[]) [Str "Some",Space,Str "instructions",Space,Str "1"] ("#some-instructions","")]
-,Para [Link ("",[],[]) [Str "Remote",Space,Str "folder",Space,Str "or",Space,Str "longlonglonglonglong",Space,Str "file",Space,Str "with",Space,Str "manymanymanymany",Space,Str "letters",Space,Str "inside",Space,Str "opening",Space,Str "2"] ("#remote-folder-or-longlonglonglonglong-file-with-manymanymanymany-letters-inside-opening","")]
-,Para [Link ("",[],[]) [Str "Remote",Space,Str "folder",Space,Str "or",Space,Str "longlonglonglonglong",Space,Str "file",Space,Str "with",Space,Str "manymanymanymany",Space,Str "letters",Space,Str "inside",Space,Str "closing",Space,Str "2"] ("#remote-folder-or-longlonglonglonglong-file-with-manymanymanymany-letters-inside-closing","")]
+,Para [Link ("",[],[]) [Str "Short",Space,Str "instructions",Space,Link ("",[],[]) [Str "1"] ("#short-instructions","")] ("#short-instructions","")]
+,Para [Link ("",[],[]) [Str "Some",Space,Str "instructions",Space,Link ("",[],[]) [Str "1"] ("#some-instructions","")] ("#some-instructions","")]
+,Para [Link ("",[],[]) [Str "Remote",Space,Str "folder",Space,Str "or",Space,Str "longlonglonglonglong",Space,Str "file",Space,Str "with",Space,Str "manymanymanymany",Space,Str "letters",Space,Str "inside",Space,Str "opening",Space,Link ("",[],[]) [Str "2"] ("#remote-folder-or-longlonglonglonglong-file-with-manymanymanymany-letters-inside-opening","")] ("#remote-folder-or-longlonglonglonglong-file-with-manymanymanymany-letters-inside-opening","")]
+,Para [Link ("",[],[]) [Str "Remote",Space,Str "folder",Space,Str "or",Space,Str "longlonglonglonglong",Space,Str "file",Space,Str "with",Space,Str "manymanymanymany",Space,Str "letters",Space,Str "inside",Space,Str "closing",Space,Link ("",[],[]) [Str "2"] ("#remote-folder-or-longlonglonglonglong-file-with-manymanymanymany-letters-inside-closing","")] ("#remote-folder-or-longlonglonglonglong-file-with-manymanymanymany-letters-inside-closing","")]
 ,Header 1 ("short-instructions",[],[]) [Str "Short",Space,Str "instructions"]
 ,Para [Link ("",[],[]) [Str "Open",Space,Str "remote",Space,Str "folder"] ("#remote-folder-or-longlonglonglonglong-file-with-manymanymanymany-letters-inside-opening","")]
 ,Para [Str "Do",Space,Str "staff"]
diff --git a/test/docx/nested_instrText.docx b/test/docx/nested_instrText.docx
new file mode 100644
Binary files /dev/null and b/test/docx/nested_instrText.docx differ
diff --git a/test/docx/nested_instrText.native b/test/docx/nested_instrText.native
new file mode 100644
--- /dev/null
+++ b/test/docx/nested_instrText.native
@@ -0,0 +1,5 @@
+[Para [Str "\24076\26395\28145\20837\20102\35299\30340\35835\32773\21487\20197\21435\30475David",Space,Str "French",Space,Str "Belding\21644Kevin",Space,Str "J.",Space,Str "Mitchell\30340"
+    ,Link ("",[],[]) [Str "Foundations",Space,Str "of",Space,Str "Analysis,",Space,Str "1/16/18",Space,Str "8:40:00",Space,Str "AM,",Space,Str "2nd",Space,Str "Edition"] ("https://books.google.com/books?id=sp_Zcb9ot90C&lpg=PR4&hl=zh-CN&pg=PA19#v=onepage&q&f=true","")
+    ,Str ",\21487\20174\&19\39029\30475\36215\65292\25110D.C.",Space,Str "Goldrei\30340",Space
+    ,Link ("",[],[]) [Str "Classic",Space,Str "Set",Space,Str "Theory:",Space,Str "For",Space,Str "Guided",Space,Str "Independent",Space,Str "Study"] ("https://books.google.ae/books?id=dlc0DwAAQBAJ&lpg=PT29&hl=zh-CN&pg=PT26#v=onepage&q&f=true","")
+    ,Str "\65292\20174\31532\20108\31456\30475\36215\65292\38405\35835\26102\35201\27880\24847\26412\25991\19982\36825\20123\20070\25152\19981\21516\30340\26159\24182\27809\26377\25226\23454\25968\30475\20316\26159\26377\29702\25968\38598\30340\20998\21106\12290"]]
diff --git a/test/docx/pageref.docx b/test/docx/pageref.docx
new file mode 100644
Binary files /dev/null and b/test/docx/pageref.docx differ
diff --git a/test/docx/pageref.native b/test/docx/pageref.native
new file mode 100644
--- /dev/null
+++ b/test/docx/pageref.native
@@ -0,0 +1,4 @@
+[Para [Str "Title",Space,Link ("",[],[]) [Str "2"] ("#title","")]
+,Para [Str "Title2",Space,Link ("",[],[]) [Str "2"] ("#title2","")]
+,Header 1 ("title", [],[]) [Str "Title"]
+,Header 1 ("title2",[],[]) [Str "Title2"]]
diff --git a/test/docx/relative_indentation_blockquotes.docx b/test/docx/relative_indentation_blockquotes.docx
new file mode 100644
Binary files /dev/null and b/test/docx/relative_indentation_blockquotes.docx differ
diff --git a/test/docx/relative_indentation_blockquotes.native b/test/docx/relative_indentation_blockquotes.native
new file mode 100644
--- /dev/null
+++ b/test/docx/relative_indentation_blockquotes.native
@@ -0,0 +1,4 @@
+[Header 1 ("indentation-blockquotes",[],[]) [Str "Indentation",Space,Str "blockquotes"]
+,Para [Str "Normal",Space,Str "list",Space,Str "paragraph"]
+,Para [Str "List",Space,Str "paragraph",Space,Str "with",Space,Str "less",Space,Str "indent"]
+,BlockQuote [Para [Str "List",Space,Str "paragraph",Space,Str "with",Space,Str "more",Space,Str "indent"]]]
diff --git a/test/epub/features.native b/test/epub/features.native
--- a/test/epub/features.native
+++ b/test/epub/features.native
@@ -1,93 +1,1676 @@
-[Para [Span ("front.xhtml",[],[]) []]
-,Div ("",["section"],[])
- [Header 1 ("",[],[]) [Str "Reflowable",Space,Str "EPUB",Space,Str "3",Space,Str "Conformance",Space,Str "Test",Space,Str "Document:",Space,Str "0100"]
- ,Div ("",["section"],[])
-  [Header 2 ("",[],[]) [Str "Status",Space,Str "of",Space,Str "this",Space,Str "Document"]
-  ,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "currently",Space,Str "considered",Space,Span ("",["status"],[]) [Str "[UNDER",Space,Str "DEVELOPMENT]"],Space,Str "by",Space,Str "the",Space,Str "IDPF."]
-  ,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "part",Space,Str "of",Space,Str "version",Space,Span ("",["version"],[]) [Str "X.X"],Space,Str "of",Space,Str "the",Space,Str "EPUB",Space,Str "3.0",Space,Str "Compliance",Space,Str "Test",Space,Str "Suite",Space,Str "released",SoftBreak,Str "on",Space,RawInline (Format "html") "<time class=\"release\">",Str "TBD",RawInline (Format "html") "</time>",Str "."]
-  ,Para [Str "Before",Space,Str "using",Space,Str "this",Space,Str "publication",Space,Str "to",Space,Str "evaluate",Space,Str "reading",Space,Str "systems,",Space,Str "testers",Space,Str "are",Space,Str "strongly",Space,Str "encouraged",Space,Str "to",SoftBreak,Str "verify",Space,Str "that",Space,Str "they",Space,Str "have",Space,Str "the",Space,Str "latest",Space,Str "release",Space,Str "by",Space,Str "checking",Space,Str "the",Space,Str "current",Space,Str "release",Space,Str "version",Space,Str "and",Space,Str "date",Space,Str "of",SoftBreak,Str "the",Space,Str "test",Space,Str "suite",Space,Str "at",Space,Link ("",[],[]) [Str "TBD"] ("http://idpf.org/","")]
-  ,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "one",Space,Str "of",Space,Str "several",Space,Str "that",Space,Str "currently",Space,Str "comprise",Space,Str "the",Space,Str "EPUB",Space,Str "3",Space,Str "conformance",Space,Str "test",Space,Str "suite",SoftBreak,Str "for",Space,Str "reflowable",Space,Str "content.",Space,Str "The",Space,Str "complete",Space,Str "test",Space,Str "suite",Space,Str "includes",Space,Str "all",Space,Str "of",Space,Str "the",Space,Str "following",Space,Str "publications:"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "."]]]]
- ,Div ("",["section"],[])
-  [Header 2 ("",[],[]) [Str "About",Space,Str "this",Space,Str "Document"]
-  ,Para [Str "This",Space,Str "document",Space,Str "focuses",Space,Str "on",Space,Str "human-evaluated",Space,Str "binary",Space,Str "(pass/fail)",Space,Str "tests",Space,Str "in",Space,Str "a",SoftBreak,Str "reflowable",Space,Str "context.",Space,Str "Tests",Space,Str "for",Space,Str "fixed-layout",Space,Str "content",Space,Str "and",Space,Str "other",Space,Str "individual",Space,Str "tests",Space,Str "that",SoftBreak,Str "require",Space,Str "a",Space,Str "dedicated",Space,Str "epub",Space,Str "file",Space,Str "are",Space,Str "available",Space,Str "in",Space,Str "additional",Space,Str "sibling",Space,Str "documents;",Space,Str "refer",Space,Str "to",SoftBreak,Str "the",Space,Link ("",[],[]) [Str "test",Space,Str "suite",SoftBreak,Str "wiki"] ("https://github.com/mgylling/epub-testsuite/wiki/Overview",""),Space,Str "(",Code ("",[],[]) "https://github.com/mgylling/epub-testsuite/wiki/Overview",Str ")",Space,Str "for",Space,Str "additional",SoftBreak,Str "information."]]
- ,Div ("",["section"],[])
-  [Header 2 ("",[],[]) [Str "Conventions"]
-  ,Para [Str "The",Space,Str "following",Space,Str "conventions",Space,Str "are",Space,Str "used",Space,Str "throughout",Space,Str "the",Space,Str "document:"]
-  ,DefinitionList
-   [([Str "1.",Space,Str "Locating",Space,Str "a",Space,Str "test"],
-     [[Div ("",["ctest"],[])
-       [Para [Str "Tests",Space,Str "for",Space,Emph [Str "required"],Space,Str "Reading",Space,Str "System",Space,Str "functionality",Space,Str "are",SoftBreak,Str "preceded",Space,Str "by",Space,Str "the",Space,Str "label:",Space,Span ("",["nature"],[("style","display: inline; font-size: 100%")]) [Str "[REQUIRED]"]]]
-      ,Div ("",["otest"],[])
-       [Para [Str "Tests",Space,Str "for",Space,Emph [Str "optional"],Space,Str "Reading",Space,Str "System",Space,Str "functionality",Space,Str "are",SoftBreak,Str "preceded",Space,Str "by",Space,Str "the",Space,Str "label:",Space,Span ("",["nature"],[("style","display: inline; font-size: 100%")]) [Str "[OPTIONAL]"]]]]])
-   ,([Str "2.",Space,Str "Performing",Space,Str "the",Space,Str "test"],
-     [[Plain [Str "Each",Space,Str "test",Space,Str "includes",Space,Str "a",Space,Str "description",Space,Str "of",Space,Str "its",Space,Str "purpose",Space,Str "followed",Space,Str "by",Space,Str "the",Space,Str "actual",Space,Strong [Str "test",Space,Str "statement,",SoftBreak,Str "which",Space,Str "can",Space,Str "always",Space,Str "be",Space,Str "evaluated",Space,Str "to",Space,Str "true",Space,Str "or",Space,Str "false"],Str ".",Space,Str "These",Space,Str "statements",Space,Str "typically",Space,Str "have",Space,Str "the",Space,Str "form:",SoftBreak,Str "\"If",Space,Str "[some",Space,Str "condition],",Space,Str "the",Space,Str "test",Space,Str "passes\"."]]])
-   ,([Str "3.",Space,Str "Scoring",Space,Str "in",Space,Str "the",Space,Str "results",Space,Str "form"],
-     [[Plain [Str "@@@TODO",Space,Str "provide",Space,Str "info",Space,Str "on",Space,Str "where",Space,Str "to",Space,Str "get",Space,Str "the",Space,Str "results",Space,Str "form"]]])]]]
-,Para [Span ("content-mathml-001.xhtml",[],[]) []]
-,Div ("",["section"],[])
- [Header 2 ("content-mathml-001.xhtml#mathml",[],[]) [Str "MathML"]
- ,Div ("content-mathml-001.xhtml#mathml-010",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-010"],Space,Str "Rendering"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "MathML",Space,Str "equation",Space,Str "rendering",Space,Str "is",Space,Str "supported."]
-  ,Plain [Math DisplayMath "\\int_{- \\infty}^{\\infty}e^{- x^{2}}\\, dx = \\sqrt{\\pi}",SoftBreak,Math DisplayMath "\\sum\\limits_{n = 1}^{\\infty}\\frac{1}{n^{2}} = \\frac{\\pi^{2}}{6}",SoftBreak,Math DisplayMath "x = \\frac{- b \\pm \\sqrt{b^{2} - 4ac}}{2a}"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "equations",Space,Str "are",Space,Str "not",Space,Str "presented",Space,Str "as",Space,Str "linear",Space,Str "text",Space,Str "(e.g.,",Space,Str "x=-b\177b2-4ac2a),",SoftBreak,Str "the",Space,Str "test",Space,Str "passes."]]
- ,Div ("content-mathml-001.xhtml#mathml-020",["section","otest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[OPTIONAL]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-020"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "math",Space,Str "element"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "basic",Space,Str "CSS",Space,Str "styling",Space,Str "of",Space,Str "MathML",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "the",Space,Code ("",[],[]) "math",Space,Str "element."]
-  ,Plain [Math InlineMath "{2x}{+ y - z}"]
-  ,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "equation",Space,Str "has",Space,Str "a",Space,Str "yellow",Space,Str "background",Space,Str "and",Space,Str "a",Space,Str "dashed",Space,Str "border."]
-  ,Para [Str "If",Space,Str "the",Space,Str "reading",Space,Str "system",Space,Str "does",Space,Str "not",Space,Str "have",Space,Str "a",Space,Str "viewport,",Space,Str "or",Space,Str "does",Space,Str "not",Space,Str "support",SoftBreak,Str "CSS",Space,Str "styles,",Space,Str "this",Space,Str "test",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]]
- ,Div ("content-mathml-001.xhtml#mathml-021",["section","otest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[OPTIONAL]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-021"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "mo",Space,Str "element"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "basic",Space,Str "CSS",Space,Str "styling",Space,Str "of",Space,Str "MathML",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "the",Space,Code ("",[],[]) "mo",Space,Str "element."]
-  ,Plain [Math InlineMath "{2x}{+ y - z}"]
-  ,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "operators",Space,Str "are",Space,Str "enlarged",Space,Str "relative",Space,Str "to",Space,Str "the",Space,Str "other",Space,Str "symbols",Space,Str "and",Space,Str "numbers."]
-  ,Para [Str "If",Space,Str "the",Space,Str "reading",Space,Str "system",Space,Str "does",Space,Str "not",Space,Str "have",Space,Str "a",Space,Str "viewport,",Space,Str "or",Space,Str "does",Space,Str "not",Space,Str "support",SoftBreak,Str "CSS",Space,Str "styles,",Space,Str "this",Space,Str "test",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]]
- ,Div ("content-mathml-001.xhtml#mathml-022",["section","otest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[OPTIONAL]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-022"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "mi",Space,Str "element"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "basic",Space,Str "CSS",Space,Str "styling",Space,Str "of",Space,Str "MathML",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "the",Space,Code ("",[],[]) "mi",Space,Str "element."]
-  ,Plain [Math InlineMath "{2x}{+ y - z}"]
-  ,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "identifiers",Space,Str "are",Space,Str "bolded",Space,Str "and",Space,Str "blue."]
-  ,Para [Str "If",Space,Str "the",Space,Str "reading",Space,Str "system",Space,Str "does",Space,Str "not",Space,Str "have",Space,Str "a",Space,Str "viewport,",Space,Str "or",Space,Str "does",Space,Str "not",Space,Str "support",SoftBreak,Str "CSS",Space,Str "styles,",Space,Str "this",Space,Str "test",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]]
- ,Div ("content-mathml-001.xhtml#mathml-023",["section","otest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[OPTIONAL]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-023"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "mn",Space,Str "element"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "basic",Space,Str "CSS",Space,Str "styling",Space,Str "of",Space,Str "MathML",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "the",Space,Code ("",[],[]) "mn",Space,Str "element."]
-  ,Plain [Math InlineMath "{2x}{+ y - z}"]
-  ,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "number",Space,Str "2",Space,Str "is",Space,Str "italicized",Space,Str "and",Space,Str "blue."]
-  ,Para [Str "If",Space,Str "the",Space,Str "reading",Space,Str "system",Space,Str "does",Space,Str "not",Space,Str "have",Space,Str "a",Space,Str "viewport,",Space,Str "or",Space,Str "does",Space,Str "not",Space,Str "support",SoftBreak,Str "CSS",Space,Str "styles,",Space,Str "this",Space,Str "test",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]]
- ,Div ("content-mathml-001.xhtml#mathml-024",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-024"],Str "Horizontal",Space,Str "stretch,",Space,Code ("",[],[]) "mover",Str ",",Space,Code ("",[],[]) "munder",Str ",",Space,Str "and",Space,Code ("",[],[]) "mspace",Space,Str "elements"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "horizontal",Space,Str "stretch,",Space,Code ("",[],[]) "mover",Str ",",Space,Code ("",[],[]) "munder",Str ",",Space,Code ("",[],[]) "mspace",Space,Str "elements",Space,Str "are",Space,Str "supported."]
-  ,Plain [Math DisplayMath "c = \\overset{\\text{complex\\ number}}{\\overbrace{\\underset{\\text{real}}{\\underbrace{\\mspace{20mu} a\\mspace{20mu}}} + \\underset{\\text{imaginary}}{\\underbrace{\\quad b{\\mathbb{i}}\\quad}}}}"]
-  ,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Str "."]]
- ,Div ("content-mathml-001.xhtml#mathml-025",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-025"],Str "Testing",Space,Code ("",[],[]) "mtable",Space,Str "with",Space,Code ("",[],[]) "colspan",Space,Str "and",Space,Code ("",[],[]) "rowspan",Space,Str "attributes,",Space,Str "Hebrew",Space,Str "and",Space,Str "Script",Space,Str "fonts"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Code ("",[],[]) "mtable",Space,Str "with",Space,Code ("",[],[]) "colspan",Space,Str "and",Space,Code ("",[],[]) "mspace",Space,Str "attributes",Space,Str "(column",Space,Str "and",Space,Str "row",Space,Str "spanning)",Space,Str "are",Space,Str "supported;",Space,Str "uses",Space,Str "Hebrew",Space,Str "and",Space,Str "Script",Space,Str "alphabets."]
-  ,Plain [Math DisplayMath "\\begin{matrix}\n & {\\operatorname{cov}(\\mathcal{L})} & \\longrightarrow & {\\operatorname{non}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cof}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cof}(\\mathcal{L})} & \\longrightarrow & 2^{\\aleph_{0}} \\\\\n & \\uparrow & & \\uparrow & & \\uparrow & & \\uparrow & & \\\\\n & {\\mathfrak{b}} & \\longrightarrow & {\\mathfrak{d}} & & & & & & \\\\\n & \\uparrow & & \\uparrow & & & & & & \\\\\n\\aleph_{1} & \\longrightarrow & {\\operatorname{add}(\\mathcal{L})} & \\longrightarrow & {\\operatorname{add}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cov}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{non}(\\mathcal{L})} & \\\\\n\\end{matrix}"]
-  ,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Link ("",[],[]) [Str "Cicho\324's",Space,Str "Diagram"] ("http://en.wikipedia.org/wiki/Cicho%C5%84's_diagram",""),Str ":",Space,Str "."]]
- ,Div ("content-mathml-001.xhtml#mathml-026",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-026"],Str "BiDi,",Space,Str "RTL",Space,Str "and",Space,Str "Arabic",Space,Str "alphabets"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "right-to-left",Space,Str "and",Space,Str "Arabic",Space,Str "alphabets",Space,Str "are",Space,Str "supported."]
-  ,Plain [Math DisplayMath "{\1583(\1587)} = \\left\\{ \\begin{matrix}\n{\\sum\\limits_{\1646 = 1}^{\1589}\1587^{\1646}} & {\\text{\1573\1584\1575\1603\1575\1606}\1587 > 0} \\\\\n{\\int_{1}^{\1589}{\1587^{\1646}\1569\1587}} & {\\text{\1573\1584\1575\1603\1575\1606}\1587 \\in \1605} \\\\\n{{\1591\1575}\\pi} & {\\text{\1594\1610\1585\1584\1604\1603}\\left( \\text{\1605\1593}\\pi \\simeq 3,141 \\right)} \\\\\n\\end{matrix} \\right."]
-  ,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Str "the",Space,Str "following",Space,Str "image:"]]
- ,Div ("content-mathml-001.xhtml#mathml-027",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],SoftBreak,Span ("",["test-id"],[]) [Str "mathml-027"],Str "Elementary",Space,Str "math:",Space,Str "long",Space,Str "division",Space,Str "notation"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Code ("",[],[]) "mlongdiv",Space,Str "elements",Space,Str "(from",Space,Str "elementary",Space,Str "math)",Space,Str "are",Space,Str "supported."]
-  ,Plain [Span ("",["math"],[("xmlns","http://www.w3.org/1998/Math/MathML")]) [SoftBreak,Str "3",SoftBreak,Str "435.3",SoftBreak,Str "1306",SoftBreak,Str "12",SoftBreak,Str "10",SoftBreak,Str "9",SoftBreak,Str "16",SoftBreak,Str "15",SoftBreak,Str "1.0",SoftBreak,Str "9",SoftBreak,Str "1",SoftBreak]]
-  ,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Str "the",Space,Str "following",Space,Str "image:",Space,Str "."]]]
-,Para [Span ("content-switch-001.xhtml",[],[]) []]
-,Div ("content-switch-001.xhtml#epub-switch",["section"],[])
- [Header 3 ("",[],[]) [Code ("",[],[]) "epub:switch"]
- ,Div ("content-switch-001.xhtml#switch-010",["section","ctest"],[])
-  [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "switch-010"],Space,Str "Support"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "epub:switch",Space,Str "element",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "PASS"]
-  ,Para [Str "If",Space,Str "only",Space,Str "the",Space,Str "word",Space,Str "\"PASS\"",Space,Str "is",Space,Str "rendered",Space,Str "before",Space,Str "this",Space,Str "paragraph,",Space,Str "the",Space,Str "test",Space,Str "passes.",Space,Str "If",Space,Str "both",Space,Str "\"PASS\"",Space,Str "and",Space,Str "\"FAIL\"",Space,Str "are",Space,Str "rendered,",Space,Str "or",Space,Str "neither",SoftBreak,Str "\"PASS\"",Space,Str "nor",Space,Str "\"FAIL\"",Space,Str "is",Space,Str "rendered,",Space,Str "the",Space,Str "test",Space,Str "fails."]]
- ,Div ("content-switch-001.xhtml#switch-020",["section","otest"],[])
-  [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[OPTIONAL]"],SoftBreak,Span ("",["test-id"],[]) [Str "switch-020"],SoftBreak,Str "MathML",Space,Str "Embedding"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Str "MathML",Space,Str "namespace",Space,Str "is",Space,Str "recognized",Space,Str "when",Space,Str "used",Space,Str "in",Space,Str "an",Space,Code ("",[],[]) "epub:case",Space,Str "element."]
-  ,Para [Math InlineMath "{2x}{+ y - z}"]
-  ,Para [Str "If",Space,Str "a",Space,Str "MathML",Space,Str "equation",Space,Str "is",Space,Str "rendered",Space,Str "before",Space,Str "this",Space,Str "paragraph,",Space,Str "the",Space,Str "test",Space,Str "passes."]
-  ,Para [Str "If",Space,Str "test",Space,Code ("",[],[]) "switch-010",Space,Str "did",Space,Str "not",Space,Str "pass,",Space,Str "this",Space,Str "test",Space,Str "should",Space,Str "be",Space,Str "marked",Space,Code ("",[],[]) "Not Supported",Str "."]]]]
+[ Para [ Span ( "front.xhtml" , [] , [] ) [] ]
+, Div
+    ( "" , [ "section" ] , [] )
+    [ Header
+        1
+        ( "" , [] , [] )
+        [ Str "Reflowable"
+        , Space
+        , Str "EPUB"
+        , Space
+        , Str "3"
+        , Space
+        , Str "Conformance"
+        , Space
+        , Str "Test"
+        , Space
+        , Str "Document:"
+        , Space
+        , Str "0100"
+        ]
+    , Div
+        ( "" , [ "section" ] , [] )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Str "Status"
+            , Space
+            , Str "of"
+            , Space
+            , Str "this"
+            , Space
+            , Str "Document"
+            ]
+        , Para
+            [ Str "This"
+            , Space
+            , Str "publication"
+            , Space
+            , Str "is"
+            , Space
+            , Str "currently"
+            , Space
+            , Str "considered"
+            , Space
+            , Span
+                ( "" , [ "status" ] , [] )
+                [ Str "[UNDER" , Space , Str "DEVELOPMENT]" ]
+            , Space
+            , Str "by"
+            , Space
+            , Str "the"
+            , Space
+            , Str "IDPF."
+            ]
+        , Para
+            [ Str "This"
+            , Space
+            , Str "publication"
+            , Space
+            , Str "is"
+            , Space
+            , Str "part"
+            , Space
+            , Str "of"
+            , Space
+            , Str "version"
+            , Space
+            , Span ( "" , [ "version" ] , [] ) [ Str "X.X" ]
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "EPUB"
+            , Space
+            , Str "3.0"
+            , Space
+            , Str "Compliance"
+            , Space
+            , Str "Test"
+            , Space
+            , Str "Suite"
+            , Space
+            , Str "released"
+            , SoftBreak
+            , Str "on"
+            , Space
+            , RawInline (Format "html") "<time class=\"release\">"
+            , Str "TBD"
+            , RawInline (Format "html") "</time>"
+            , Str "."
+            ]
+        , Para
+            [ Str "Before"
+            , Space
+            , Str "using"
+            , Space
+            , Str "this"
+            , Space
+            , Str "publication"
+            , Space
+            , Str "to"
+            , Space
+            , Str "evaluate"
+            , Space
+            , Str "reading"
+            , Space
+            , Str "systems,"
+            , Space
+            , Str "testers"
+            , Space
+            , Str "are"
+            , Space
+            , Str "strongly"
+            , Space
+            , Str "encouraged"
+            , Space
+            , Str "to"
+            , SoftBreak
+            , Str "verify"
+            , Space
+            , Str "that"
+            , Space
+            , Str "they"
+            , Space
+            , Str "have"
+            , Space
+            , Str "the"
+            , Space
+            , Str "latest"
+            , Space
+            , Str "release"
+            , Space
+            , Str "by"
+            , Space
+            , Str "checking"
+            , Space
+            , Str "the"
+            , Space
+            , Str "current"
+            , Space
+            , Str "release"
+            , Space
+            , Str "version"
+            , Space
+            , Str "and"
+            , Space
+            , Str "date"
+            , Space
+            , Str "of"
+            , SoftBreak
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "suite"
+            , Space
+            , Str "at"
+            , Space
+            , Link
+                ( "" , [] , [] )
+                [ Str "TBD" ]
+                ( "http://idpf.org/" , "" )
+            ]
+        , Para
+            [ Str "This"
+            , Space
+            , Str "publication"
+            , Space
+            , Str "is"
+            , Space
+            , Str "one"
+            , Space
+            , Str "of"
+            , Space
+            , Str "several"
+            , Space
+            , Str "that"
+            , Space
+            , Str "currently"
+            , Space
+            , Str "comprise"
+            , Space
+            , Str "the"
+            , Space
+            , Str "EPUB"
+            , Space
+            , Str "3"
+            , Space
+            , Str "conformance"
+            , Space
+            , Str "test"
+            , Space
+            , Str "suite"
+            , SoftBreak
+            , Str "for"
+            , Space
+            , Str "reflowable"
+            , Space
+            , Str "content."
+            , Space
+            , Str "The"
+            , Space
+            , Str "complete"
+            , Space
+            , Str "test"
+            , Space
+            , Str "suite"
+            , Space
+            , Str "includes"
+            , Space
+            , Str "all"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "following"
+            , Space
+            , Str "publications:"
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain [ Str "." ] ] ]
+        ]
+    , Div
+        ( "" , [ "section" ] , [] )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Str "About"
+            , Space
+            , Str "this"
+            , Space
+            , Str "Document"
+            ]
+        , Para
+            [ Str "This"
+            , Space
+            , Str "document"
+            , Space
+            , Str "focuses"
+            , Space
+            , Str "on"
+            , Space
+            , Str "human-evaluated"
+            , Space
+            , Str "binary"
+            , Space
+            , Str "(pass/fail)"
+            , Space
+            , Str "tests"
+            , Space
+            , Str "in"
+            , Space
+            , Str "a"
+            , SoftBreak
+            , Str "reflowable"
+            , Space
+            , Str "context."
+            , Space
+            , Str "Tests"
+            , Space
+            , Str "for"
+            , Space
+            , Str "fixed-layout"
+            , Space
+            , Str "content"
+            , Space
+            , Str "and"
+            , Space
+            , Str "other"
+            , Space
+            , Str "individual"
+            , Space
+            , Str "tests"
+            , Space
+            , Str "that"
+            , SoftBreak
+            , Str "require"
+            , Space
+            , Str "a"
+            , Space
+            , Str "dedicated"
+            , Space
+            , Str "epub"
+            , Space
+            , Str "file"
+            , Space
+            , Str "are"
+            , Space
+            , Str "available"
+            , Space
+            , Str "in"
+            , Space
+            , Str "additional"
+            , Space
+            , Str "sibling"
+            , Space
+            , Str "documents;"
+            , Space
+            , Str "refer"
+            , Space
+            , Str "to"
+            , SoftBreak
+            , Str "the"
+            , Space
+            , Link
+                ( "" , [] , [] )
+                [ Str "test"
+                , Space
+                , Str "suite"
+                , SoftBreak
+                , Str "wiki"
+                ]
+                ( "https://github.com/mgylling/epub-testsuite/wiki/Overview"
+                , ""
+                )
+            , Space
+            , Str "("
+            , Code
+                ( "" , [] , [] )
+                "https://github.com/mgylling/epub-testsuite/wiki/Overview"
+            , Str ")"
+            , Space
+            , Str "for"
+            , Space
+            , Str "additional"
+            , SoftBreak
+            , Str "information."
+            ]
+        ]
+    , Div
+        ( "" , [ "section" ] , [] )
+        [ Header 2 ( "" , [] , [] ) [ Str "Conventions" ]
+        , Para
+            [ Str "The"
+            , Space
+            , Str "following"
+            , Space
+            , Str "conventions"
+            , Space
+            , Str "are"
+            , Space
+            , Str "used"
+            , Space
+            , Str "throughout"
+            , Space
+            , Str "the"
+            , Space
+            , Str "document:"
+            ]
+        , DefinitionList
+            [ ( [ Str "1."
+                , Space
+                , Str "Locating"
+                , Space
+                , Str "a"
+                , Space
+                , Str "test"
+                ]
+              , [ [ Div
+                      ( "" , [ "ctest" ] , [] )
+                      [ Para
+                          [ Str "Tests"
+                          , Space
+                          , Str "for"
+                          , Space
+                          , Emph [ Str "required" ]
+                          , Space
+                          , Str "Reading"
+                          , Space
+                          , Str "System"
+                          , Space
+                          , Str "functionality"
+                          , Space
+                          , Str "are"
+                          , SoftBreak
+                          , Str "preceded"
+                          , Space
+                          , Str "by"
+                          , Space
+                          , Str "the"
+                          , Space
+                          , Str "label:"
+                          , Space
+                          , Span
+                              ( ""
+                              , [ "nature" ]
+                              , [ ( "style"
+                                  , "display: inline; font-size: 100%"
+                                  )
+                                ]
+                              )
+                              [ Str "[REQUIRED]" ]
+                          ]
+                      ]
+                  , Div
+                      ( "" , [ "otest" ] , [] )
+                      [ Para
+                          [ Str "Tests"
+                          , Space
+                          , Str "for"
+                          , Space
+                          , Emph [ Str "optional" ]
+                          , Space
+                          , Str "Reading"
+                          , Space
+                          , Str "System"
+                          , Space
+                          , Str "functionality"
+                          , Space
+                          , Str "are"
+                          , SoftBreak
+                          , Str "preceded"
+                          , Space
+                          , Str "by"
+                          , Space
+                          , Str "the"
+                          , Space
+                          , Str "label:"
+                          , Space
+                          , Span
+                              ( ""
+                              , [ "nature" ]
+                              , [ ( "style"
+                                  , "display: inline; font-size: 100%"
+                                  )
+                                ]
+                              )
+                              [ Str "[OPTIONAL]" ]
+                          ]
+                      ]
+                  ]
+                ]
+              )
+            , ( [ Str "2."
+                , Space
+                , Str "Performing"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                ]
+              , [ [ Plain
+                      [ Str "Each"
+                      , Space
+                      , Str "test"
+                      , Space
+                      , Str "includes"
+                      , Space
+                      , Str "a"
+                      , Space
+                      , Str "description"
+                      , Space
+                      , Str "of"
+                      , Space
+                      , Str "its"
+                      , Space
+                      , Str "purpose"
+                      , Space
+                      , Str "followed"
+                      , Space
+                      , Str "by"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "actual"
+                      , Space
+                      , Strong
+                          [ Str "test"
+                          , Space
+                          , Str "statement,"
+                          , SoftBreak
+                          , Str "which"
+                          , Space
+                          , Str "can"
+                          , Space
+                          , Str "always"
+                          , Space
+                          , Str "be"
+                          , Space
+                          , Str "evaluated"
+                          , Space
+                          , Str "to"
+                          , Space
+                          , Str "true"
+                          , Space
+                          , Str "or"
+                          , Space
+                          , Str "false"
+                          ]
+                      , Str "."
+                      , Space
+                      , Str "These"
+                      , Space
+                      , Str "statements"
+                      , Space
+                      , Str "typically"
+                      , Space
+                      , Str "have"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "form:"
+                      , SoftBreak
+                      , Str "\"If"
+                      , Space
+                      , Str "[some"
+                      , Space
+                      , Str "condition],"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "test"
+                      , Space
+                      , Str "passes\"."
+                      ]
+                  ]
+                ]
+              )
+            , ( [ Str "3."
+                , Space
+                , Str "Scoring"
+                , Space
+                , Str "in"
+                , Space
+                , Str "the"
+                , Space
+                , Str "results"
+                , Space
+                , Str "form"
+                ]
+              , [ [ Plain
+                      [ Str "@@@TODO"
+                      , Space
+                      , Str "provide"
+                      , Space
+                      , Str "info"
+                      , Space
+                      , Str "on"
+                      , Space
+                      , Str "where"
+                      , Space
+                      , Str "to"
+                      , Space
+                      , Str "get"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "results"
+                      , Space
+                      , Str "form"
+                      ]
+                  ]
+                ]
+              )
+            ]
+        ]
+    ]
+, Para [ Span ( "content-mathml-001.xhtml" , [] , [] ) [] ]
+, Div
+    ( "" , [ "section" ] , [] )
+    [ Header
+        2
+        ( "content-mathml-001.xhtml#mathml" , [] , [] )
+        [ Str "MathML" ]
+    , Div
+        ( "content-mathml-001.xhtml#mathml-010"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , SoftBreak
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "mathml-010" ]
+            , Space
+            , Str "Rendering"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "MathML"
+            , Space
+            , Str "equation"
+            , Space
+            , Str "rendering"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Plain
+            [ Math
+                DisplayMath
+                "\\int_{- \\infty}^{\\infty}e^{- x^{2}}\\, dx = \\sqrt{\\pi}"
+            , SoftBreak
+            , Math
+                DisplayMath
+                "\\sum\\limits_{n = 1}^{\\infty}\\frac{1}{n^{2}} = \\frac{\\pi^{2}}{6}"
+            , SoftBreak
+            , Math
+                DisplayMath
+                "x = \\frac{- b \\pm \\sqrt{b^{2} - 4ac}}{2a}"
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "equations"
+            , Space
+            , Str "are"
+            , Space
+            , Str "not"
+            , Space
+            , Str "presented"
+            , Space
+            , Str "as"
+            , Space
+            , Str "linear"
+            , Space
+            , Str "text"
+            , Space
+            , Str "(e.g.,"
+            , Space
+            , Str "x=-b\177b2-4ac2a),"
+            , SoftBreak
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes."
+            ]
+        ]
+    , Div
+        ( "content-mathml-001.xhtml#mathml-020"
+        , [ "section" , "otest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[OPTIONAL]" ]
+            , SoftBreak
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "mathml-020" ]
+            , Space
+            , Str "CSS"
+            , Space
+            , Str "Styling"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "math"
+            , Space
+            , Str "element"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "basic"
+            , Space
+            , Str "CSS"
+            , Space
+            , Str "styling"
+            , Space
+            , Str "of"
+            , Space
+            , Str "MathML"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported"
+            , Space
+            , Str "on"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "math"
+            , Space
+            , Str "element."
+            ]
+        , Plain [ Math InlineMath "{2x}{+ y - z}" ]
+        , Para
+            [ Str "The"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes"
+            , Space
+            , Str "if"
+            , Space
+            , Str "the"
+            , Space
+            , Str "equation"
+            , Space
+            , Str "has"
+            , Space
+            , Str "a"
+            , Space
+            , Str "yellow"
+            , Space
+            , Str "background"
+            , Space
+            , Str "and"
+            , Space
+            , Str "a"
+            , Space
+            , Str "dashed"
+            , Space
+            , Str "border."
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "reading"
+            , Space
+            , Str "system"
+            , Space
+            , Str "does"
+            , Space
+            , Str "not"
+            , Space
+            , Str "have"
+            , Space
+            , Str "a"
+            , Space
+            , Str "viewport,"
+            , Space
+            , Str "or"
+            , Space
+            , Str "does"
+            , Space
+            , Str "not"
+            , Space
+            , Str "support"
+            , SoftBreak
+            , Str "CSS"
+            , Space
+            , Str "styles,"
+            , Space
+            , Str "this"
+            , Space
+            , Str "test"
+            , Space
+            , Str "should"
+            , Space
+            , Str "be"
+            , Space
+            , Str "marked"
+            , Space
+            , Code ( "" , [] , [] ) "Not Supported"
+            , Str "."
+            ]
+        ]
+    , Div
+        ( "content-mathml-001.xhtml#mathml-021"
+        , [ "section" , "otest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[OPTIONAL]" ]
+            , SoftBreak
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "mathml-021" ]
+            , Space
+            , Str "CSS"
+            , Space
+            , Str "Styling"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "mo"
+            , Space
+            , Str "element"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "basic"
+            , Space
+            , Str "CSS"
+            , Space
+            , Str "styling"
+            , Space
+            , Str "of"
+            , Space
+            , Str "MathML"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported"
+            , Space
+            , Str "on"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "mo"
+            , Space
+            , Str "element."
+            ]
+        , Plain [ Math InlineMath "{2x}{+ y - z}" ]
+        , Para
+            [ Str "The"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes"
+            , Space
+            , Str "if"
+            , Space
+            , Str "the"
+            , Space
+            , Str "operators"
+            , Space
+            , Str "are"
+            , Space
+            , Str "enlarged"
+            , Space
+            , Str "relative"
+            , Space
+            , Str "to"
+            , Space
+            , Str "the"
+            , Space
+            , Str "other"
+            , Space
+            , Str "symbols"
+            , Space
+            , Str "and"
+            , Space
+            , Str "numbers."
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "reading"
+            , Space
+            , Str "system"
+            , Space
+            , Str "does"
+            , Space
+            , Str "not"
+            , Space
+            , Str "have"
+            , Space
+            , Str "a"
+            , Space
+            , Str "viewport,"
+            , Space
+            , Str "or"
+            , Space
+            , Str "does"
+            , Space
+            , Str "not"
+            , Space
+            , Str "support"
+            , SoftBreak
+            , Str "CSS"
+            , Space
+            , Str "styles,"
+            , Space
+            , Str "this"
+            , Space
+            , Str "test"
+            , Space
+            , Str "should"
+            , Space
+            , Str "be"
+            , Space
+            , Str "marked"
+            , Space
+            , Code ( "" , [] , [] ) "Not Supported"
+            , Str "."
+            ]
+        ]
+    , Div
+        ( "content-mathml-001.xhtml#mathml-022"
+        , [ "section" , "otest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[OPTIONAL]" ]
+            , SoftBreak
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "mathml-022" ]
+            , Space
+            , Str "CSS"
+            , Space
+            , Str "Styling"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "mi"
+            , Space
+            , Str "element"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "basic"
+            , Space
+            , Str "CSS"
+            , Space
+            , Str "styling"
+            , Space
+            , Str "of"
+            , Space
+            , Str "MathML"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported"
+            , Space
+            , Str "on"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "mi"
+            , Space
+            , Str "element."
+            ]
+        , Plain [ Math InlineMath "{2x}{+ y - z}" ]
+        , Para
+            [ Str "The"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes"
+            , Space
+            , Str "if"
+            , Space
+            , Str "the"
+            , Space
+            , Str "identifiers"
+            , Space
+            , Str "are"
+            , Space
+            , Str "bolded"
+            , Space
+            , Str "and"
+            , Space
+            , Str "blue."
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "reading"
+            , Space
+            , Str "system"
+            , Space
+            , Str "does"
+            , Space
+            , Str "not"
+            , Space
+            , Str "have"
+            , Space
+            , Str "a"
+            , Space
+            , Str "viewport,"
+            , Space
+            , Str "or"
+            , Space
+            , Str "does"
+            , Space
+            , Str "not"
+            , Space
+            , Str "support"
+            , SoftBreak
+            , Str "CSS"
+            , Space
+            , Str "styles,"
+            , Space
+            , Str "this"
+            , Space
+            , Str "test"
+            , Space
+            , Str "should"
+            , Space
+            , Str "be"
+            , Space
+            , Str "marked"
+            , Space
+            , Code ( "" , [] , [] ) "Not Supported"
+            , Str "."
+            ]
+        ]
+    , Div
+        ( "content-mathml-001.xhtml#mathml-023"
+        , [ "section" , "otest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[OPTIONAL]" ]
+            , SoftBreak
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "mathml-023" ]
+            , Space
+            , Str "CSS"
+            , Space
+            , Str "Styling"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "mn"
+            , Space
+            , Str "element"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "basic"
+            , Space
+            , Str "CSS"
+            , Space
+            , Str "styling"
+            , Space
+            , Str "of"
+            , Space
+            , Str "MathML"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported"
+            , Space
+            , Str "on"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "mn"
+            , Space
+            , Str "element."
+            ]
+        , Plain [ Math InlineMath "{2x}{+ y - z}" ]
+        , Para
+            [ Str "The"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes"
+            , Space
+            , Str "if"
+            , Space
+            , Str "the"
+            , Space
+            , Str "number"
+            , Space
+            , Str "2"
+            , Space
+            , Str "is"
+            , Space
+            , Str "italicized"
+            , Space
+            , Str "and"
+            , Space
+            , Str "blue."
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "reading"
+            , Space
+            , Str "system"
+            , Space
+            , Str "does"
+            , Space
+            , Str "not"
+            , Space
+            , Str "have"
+            , Space
+            , Str "a"
+            , Space
+            , Str "viewport,"
+            , Space
+            , Str "or"
+            , Space
+            , Str "does"
+            , Space
+            , Str "not"
+            , Space
+            , Str "support"
+            , SoftBreak
+            , Str "CSS"
+            , Space
+            , Str "styles,"
+            , Space
+            , Str "this"
+            , Space
+            , Str "test"
+            , Space
+            , Str "should"
+            , Space
+            , Str "be"
+            , Space
+            , Str "marked"
+            , Space
+            , Code ( "" , [] , [] ) "Not Supported"
+            , Str "."
+            ]
+        ]
+    , Div
+        ( "content-mathml-001.xhtml#mathml-024"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , SoftBreak
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "mathml-024" ]
+            , Str "Horizontal"
+            , Space
+            , Str "stretch,"
+            , Space
+            , Code ( "" , [] , [] ) "mover"
+            , Str ","
+            , Space
+            , Code ( "" , [] , [] ) "munder"
+            , Str ","
+            , Space
+            , Str "and"
+            , Space
+            , Code ( "" , [] , [] ) "mspace"
+            , Space
+            , Str "elements"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "horizontal"
+            , Space
+            , Str "stretch,"
+            , Space
+            , Code ( "" , [] , [] ) "mover"
+            , Str ","
+            , Space
+            , Code ( "" , [] , [] ) "munder"
+            , Str ","
+            , Space
+            , Code ( "" , [] , [] ) "mspace"
+            , Space
+            , Str "elements"
+            , Space
+            , Str "are"
+            , Space
+            , Str "supported."
+            ]
+        , Plain
+            [ Math
+                DisplayMath
+                "c = \\overset{\\text{complex\\ number}}{\\overbrace{\\underset{\\text{real}}{\\underbrace{\\mspace{20mu} a\\mspace{20mu}}} + \\underset{\\text{imaginary}}{\\underbrace{\\quad b{\\mathbb{i}}\\quad}}}}"
+            ]
+        , Para
+            [ Str "The"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes"
+            , Space
+            , Str "if"
+            , Space
+            , Str "the"
+            , Space
+            , Str "rendering"
+            , Space
+            , Str "looks"
+            , Space
+            , Str "like"
+            , Space
+            , Str "."
+            ]
+        ]
+    , Div
+        ( "content-mathml-001.xhtml#mathml-025"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , SoftBreak
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "mathml-025" ]
+            , Str "Testing"
+            , Space
+            , Code ( "" , [] , [] ) "mtable"
+            , Space
+            , Str "with"
+            , Space
+            , Code ( "" , [] , [] ) "colspan"
+            , Space
+            , Str "and"
+            , Space
+            , Code ( "" , [] , [] ) "rowspan"
+            , Space
+            , Str "attributes,"
+            , Space
+            , Str "Hebrew"
+            , Space
+            , Str "and"
+            , Space
+            , Str "Script"
+            , Space
+            , Str "fonts"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Code ( "" , [] , [] ) "mtable"
+            , Space
+            , Str "with"
+            , Space
+            , Code ( "" , [] , [] ) "colspan"
+            , Space
+            , Str "and"
+            , Space
+            , Code ( "" , [] , [] ) "mspace"
+            , Space
+            , Str "attributes"
+            , Space
+            , Str "(column"
+            , Space
+            , Str "and"
+            , Space
+            , Str "row"
+            , Space
+            , Str "spanning)"
+            , Space
+            , Str "are"
+            , Space
+            , Str "supported;"
+            , Space
+            , Str "uses"
+            , Space
+            , Str "Hebrew"
+            , Space
+            , Str "and"
+            , Space
+            , Str "Script"
+            , Space
+            , Str "alphabets."
+            ]
+        , Plain
+            [ Math
+                DisplayMath
+                "\\begin{matrix}\n & {\\operatorname{cov}(\\mathcal{L})} & \\longrightarrow & {\\operatorname{non}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cof}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cof}(\\mathcal{L})} & \\longrightarrow & 2^{\\aleph_{0}} \\\\\n & \\uparrow & & \\uparrow & & \\uparrow & & \\uparrow & & \\\\\n & {\\mathfrak{b}} & \\longrightarrow & {\\mathfrak{d}} & & & & & & \\\\\n & \\uparrow & & \\uparrow & & & & & & \\\\\n\\aleph_{1} & \\longrightarrow & {\\operatorname{add}(\\mathcal{L})} & \\longrightarrow & {\\operatorname{add}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cov}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{non}(\\mathcal{L})} & \\\\\n\\end{matrix}"
+            ]
+        , Para
+            [ Str "The"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes"
+            , Space
+            , Str "if"
+            , Space
+            , Str "the"
+            , Space
+            , Str "rendering"
+            , Space
+            , Str "looks"
+            , Space
+            , Str "like"
+            , Space
+            , Link
+                ( "" , [] , [] )
+                [ Str "Cicho\324's" , Space , Str "Diagram" ]
+                ( "http://en.wikipedia.org/wiki/Cicho%C5%84's_diagram"
+                , ""
+                )
+            , Str ":"
+            , Space
+            , Str "."
+            ]
+        ]
+    , Div
+        ( "content-mathml-001.xhtml#mathml-026"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , SoftBreak
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "mathml-026" ]
+            , Str "BiDi,"
+            , Space
+            , Str "RTL"
+            , Space
+            , Str "and"
+            , Space
+            , Str "Arabic"
+            , Space
+            , Str "alphabets"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "right-to-left"
+            , Space
+            , Str "and"
+            , Space
+            , Str "Arabic"
+            , Space
+            , Str "alphabets"
+            , Space
+            , Str "are"
+            , Space
+            , Str "supported."
+            ]
+        , Plain
+            [ Math
+                DisplayMath
+                "{\1583(\1587)} = \\left\\{ \\begin{matrix}\n{\\sum\\limits_{\1646 = 1}^{\1589}\1587^{\1646}} & {\\text{\1573\1584\1575\1603\1575\1606}\1587 > 0} \\\\\n{\\int_{1}^{\1589}{\1587^{\1646}\1569\1587}} & {\\text{\1573\1584\1575\1603\1575\1606}\1587 \\in \1605} \\\\\n{{\1591\1575}\\pi} & {\\text{\1594\1610\1585\1584\1604\1603}\\left( \\text{\1605\1593}\\pi \\simeq 3,141 \\right)} \\\\\n\\end{matrix} \\right."
+            ]
+        , Para
+            [ Str "The"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes"
+            , Space
+            , Str "if"
+            , Space
+            , Str "the"
+            , Space
+            , Str "rendering"
+            , Space
+            , Str "looks"
+            , Space
+            , Str "like"
+            , Space
+            , Str "the"
+            , Space
+            , Str "following"
+            , Space
+            , Str "image:"
+            ]
+        ]
+    , Div
+        ( "content-mathml-001.xhtml#mathml-027"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , SoftBreak
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "mathml-027" ]
+            , Str "Elementary"
+            , Space
+            , Str "math:"
+            , Space
+            , Str "long"
+            , Space
+            , Str "division"
+            , Space
+            , Str "notation"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Code ( "" , [] , [] ) "mlongdiv"
+            , Space
+            , Str "elements"
+            , Space
+            , Str "(from"
+            , Space
+            , Str "elementary"
+            , Space
+            , Str "math)"
+            , Space
+            , Str "are"
+            , Space
+            , Str "supported."
+            ]
+        , Plain
+            [ Span
+                ( ""
+                , [ "math" ]
+                , [ ( "xmlns" , "http://www.w3.org/1998/Math/MathML" ) ]
+                )
+                [ SoftBreak
+                , Str "3"
+                , SoftBreak
+                , Str "435.3"
+                , SoftBreak
+                , Str "1306"
+                , SoftBreak
+                , Str "12"
+                , SoftBreak
+                , Str "10"
+                , SoftBreak
+                , Str "9"
+                , SoftBreak
+                , Str "16"
+                , SoftBreak
+                , Str "15"
+                , SoftBreak
+                , Str "1.0"
+                , SoftBreak
+                , Str "9"
+                , SoftBreak
+                , Str "1"
+                , SoftBreak
+                ]
+            ]
+        , Para
+            [ Str "The"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes"
+            , Space
+            , Str "if"
+            , Space
+            , Str "the"
+            , Space
+            , Str "rendering"
+            , Space
+            , Str "looks"
+            , Space
+            , Str "like"
+            , Space
+            , Str "the"
+            , Space
+            , Str "following"
+            , Space
+            , Str "image:"
+            , Space
+            , Str "."
+            ]
+        ]
+    ]
+, Para [ Span ( "content-switch-001.xhtml" , [] , [] ) [] ]
+, Div
+    ( "content-switch-001.xhtml#epub-switch"
+    , [ "section" ]
+    , []
+    )
+    [ Header
+        3 ( "" , [] , [] ) [ Code ( "" , [] , [] ) "epub:switch" ]
+    , Div
+        ( "content-switch-001.xhtml#switch-010"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            4
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "switch-010" ]
+            , Space
+            , Str "Support"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "epub:switch"
+            , Space
+            , Str "element"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "PASS" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "only"
+            , Space
+            , Str "the"
+            , Space
+            , Str "word"
+            , Space
+            , Str "\"PASS\""
+            , Space
+            , Str "is"
+            , Space
+            , Str "rendered"
+            , Space
+            , Str "before"
+            , Space
+            , Str "this"
+            , Space
+            , Str "paragraph,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes."
+            , Space
+            , Str "If"
+            , Space
+            , Str "both"
+            , Space
+            , Str "\"PASS\""
+            , Space
+            , Str "and"
+            , Space
+            , Str "\"FAIL\""
+            , Space
+            , Str "are"
+            , Space
+            , Str "rendered,"
+            , Space
+            , Str "or"
+            , Space
+            , Str "neither"
+            , SoftBreak
+            , Str "\"PASS\""
+            , Space
+            , Str "nor"
+            , Space
+            , Str "\"FAIL\""
+            , Space
+            , Str "is"
+            , Space
+            , Str "rendered,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    , Div
+        ( "content-switch-001.xhtml#switch-020"
+        , [ "section" , "otest" ]
+        , []
+        )
+        [ Header
+            4
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[OPTIONAL]" ]
+            , SoftBreak
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "switch-020" ]
+            , SoftBreak
+            , Str "MathML"
+            , Space
+            , Str "Embedding"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Str "MathML"
+            , Space
+            , Str "namespace"
+            , Space
+            , Str "is"
+            , Space
+            , Str "recognized"
+            , Space
+            , Str "when"
+            , Space
+            , Str "used"
+            , Space
+            , Str "in"
+            , Space
+            , Str "an"
+            , Space
+            , Code ( "" , [] , [] ) "epub:case"
+            , Space
+            , Str "element."
+            ]
+        , Para [ Math InlineMath "{2x}{+ y - z}" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "a"
+            , Space
+            , Str "MathML"
+            , Space
+            , Str "equation"
+            , Space
+            , Str "is"
+            , Space
+            , Str "rendered"
+            , Space
+            , Str "before"
+            , Space
+            , Str "this"
+            , Space
+            , Str "paragraph,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes."
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "test"
+            , Space
+            , Code ( "" , [] , [] ) "switch-010"
+            , Space
+            , Str "did"
+            , Space
+            , Str "not"
+            , Space
+            , Str "pass,"
+            , Space
+            , Str "this"
+            , Space
+            , Str "test"
+            , Space
+            , Str "should"
+            , Space
+            , Str "be"
+            , Space
+            , Str "marked"
+            , Space
+            , Code ( "" , [] , [] ) "Not Supported"
+            , Str "."
+            ]
+        ]
+    ]
+]
diff --git a/test/epub/formatting.native b/test/epub/formatting.native
--- a/test/epub/formatting.native
+++ b/test/epub/formatting.native
@@ -1,402 +1,5984 @@
-[Para [Span ("front.xhtml",[],[]) []]
-,Div ("",["section"],[])
- [Header 1 ("",[],[]) [Str "EPUB",Space,Str "3",Space,Str "Styling",Space,Str "Test",Space,Str "Document:",Space,Str "0101"]
- ,Div ("",["section"],[])
-  [Header 2 ("",[],[]) [Str "Status",Space,Str "of",Space,Str "this",Space,Str "Document"]
-  ,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "currently",Space,Str "considered",Space,Span ("",["status"],[]) [Str "[UNDER",Space,Str "DEVELOPMENT]"],Space,Str "by",Space,Str "the",Space,Str "IDPF."]
-  ,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "part",Space,Str "of",Space,Str "version",Space,Span ("",["version"],[]) [Str "X.X"],Space,Str "of",Space,Str "the",Space,Str "EPUB",Space,Str "3.0",Space,Str "Compliance",Space,Str "Test",Space,Str "Suite",Space,Str "released",SoftBreak,Str "on",Space,RawInline (Format "html") "<time class=\"release\">",Str "TBD",RawInline (Format "html") "</time>",Str "."]
-  ,Para [Str "Before",Space,Str "using",Space,Str "this",Space,Str "publication",Space,Str "to",Space,Str "evaluate",Space,Str "reading",Space,Str "systems,",Space,Str "testers",Space,Str "are",Space,Str "strongly",Space,Str "encouraged",Space,Str "to",SoftBreak,Str "verify",Space,Str "that",Space,Str "they",Space,Str "have",Space,Str "the",Space,Str "latest",Space,Str "release",Space,Str "by",Space,Str "checking",Space,Str "the",Space,Str "current",Space,Str "release",Space,Str "version",Space,Str "and",Space,Str "date",Space,Str "of",SoftBreak,Str "the",Space,Str "test",Space,Str "suite",Space,Str "at",Space,Link ("",[],[]) [Str "TBD"] ("http://idpf.org/","")]
-  ,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "one",Space,Str "of",Space,Str "several",Space,Str "that",Space,Str "currently",Space,Str "comprise",Space,Str "the",Space,Str "EPUB",Space,Str "3",Space,Str "conformance",Space,Str "test",Space,Str "suite",SoftBreak,Str "for",Space,Str "reflowable",Space,Str "content.",Space,Str "The",Space,Str "complete",Space,Str "test",Space,Str "suite",Space,Str "includes",Space,Str "all",Space,Str "of",Space,Str "the",Space,Str "following",Space,Str "publications:"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "."]]]]
- ,Div ("",["section"],[])
-  [Header 2 ("",[],[]) [Str "About",Space,Str "this",Space,Str "Document"]
-  ,Para [Str "This",Space,Str "document",Space,Str "focuses",Space,Str "on",Space,Str "human-evaluated",Space,Str "binary",Space,Str "(pass/fail)",Space,Str "tests",Space,Str "in",Space,Str "a",SoftBreak,Str "reflowable",Space,Str "context.",Space,Str "Tests",Space,Str "for",Space,Str "fixed-layout",Space,Str "content",Space,Str "and",Space,Str "other",Space,Str "individual",Space,Str "tests",Space,Str "that",SoftBreak,Str "require",Space,Str "a",Space,Str "dedicated",Space,Str "epub",Space,Str "file",Space,Str "are",Space,Str "available",Space,Str "in",Space,Str "additional",Space,Str "sibling",Space,Str "documents;",Space,Str "refer",Space,Str "to",SoftBreak,Str "the",Space,Link ("",[],[]) [Str "test",Space,Str "suite",SoftBreak,Str "wiki"] ("https://github.com/mgylling/epub-testsuite/wiki/Overview",""),Space,Str "(",Code ("",[],[]) "https://github.com/mgylling/epub-testsuite/wiki/Overview",Str ")",Space,Str "for",Space,Str "additional",SoftBreak,Str "information."]]
- ,Div ("",["section"],[])
-  [Header 2 ("",[],[]) [Str "Conventions"]
-  ,Para [Str "The",Space,Str "following",Space,Str "conventions",Space,Str "are",Space,Str "used",Space,Str "throughout",Space,Str "the",Space,Str "document:"]
-  ,DefinitionList
-   [([Str "1.",Space,Str "Locating",Space,Str "a",Space,Str "test"],
-     [[Div ("",["ctest"],[])
-       [Para [Str "Tests",Space,Str "for",Space,Emph [Str "required"],Space,Str "Reading",Space,Str "System",Space,Str "functionality",Space,Str "are",SoftBreak,Str "preceded",Space,Str "by",Space,Str "the",Space,Str "label:",Space,Span ("",["nature"],[("style","display: inline; font-size: 100%")]) [Str "[REQUIRED]"]]]
-      ,Div ("",["otest"],[])
-       [Para [Str "Tests",Space,Str "for",Space,Emph [Str "optional"],Space,Str "Reading",Space,Str "System",Space,Str "functionality",Space,Str "are",SoftBreak,Str "preceded",Space,Str "by",Space,Str "the",Space,Str "label:",Space,Span ("",["nature"],[("style","display: inline; font-size: 100%")]) [Str "[OPTIONAL]"]]]]])
-   ,([Str "2.",Space,Str "Performing",Space,Str "the",Space,Str "test"],
-     [[Plain [Str "Each",Space,Str "test",Space,Str "includes",Space,Str "a",Space,Str "description",Space,Str "of",Space,Str "its",Space,Str "purpose",Space,Str "followed",Space,Str "by",Space,Str "the",Space,Str "actual",Space,Strong [Str "test",Space,Str "statement,",SoftBreak,Str "which",Space,Str "can",Space,Str "always",Space,Str "be",Space,Str "evaluated",Space,Str "to",Space,Str "true",Space,Str "or",Space,Str "false"],Str ".",Space,Str "These",Space,Str "statements",Space,Str "typically",Space,Str "have",Space,Str "the",Space,Str "form:",SoftBreak,Str "\"If",Space,Str "[some",Space,Str "condition],",Space,Str "the",Space,Str "test",Space,Str "passes\"."]]])
-   ,([Str "3.",Space,Str "Scoring",Space,Str "in",Space,Str "the",Space,Str "results",Space,Str "form"],
-     [[Plain [Str "@@@TODO",Space,Str "provide",Space,Str "info",Space,Str "on",Space,Str "where",Space,Str "to",Space,Str "get",Space,Str "the",Space,Str "results",Space,Str "form"]]])]]]
-,Para [Span ("styling-xhtml-001.xhtml",[],[]) []]
-,Div ("styling-xhtml-001.xhtml#epub-css",["section"],[])
- [Header 1 ("",[],[]) [Str "EPUB",Space,Str "Style",Space,Str "Sheets"]
- ,Para [Str "This",Space,Str "section",Space,Str "contains",Space,Str "tests",Space,Str "for",Space,Str "styling",Space,Str "and",Space,Str "layout."]]
-,Para [Span ("styling-xhtml-003.xhtml",[],[]) []]
-,Div ("styling-xhtml-003.xhtml#style-110",["section","ctest"],[])
- [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-110"],Space,Str "Multi-Column",Space,Str "Layouts"]
- ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "CSS Multi-Column Layout",Space,Str "properties",Space,Str "are",Space,Str "supported."]
- ,Div ("",["multicol"],[])
-  [Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]]
- ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "text",Space,Str "is",Space,Str "rendered",Space,Str "in",Space,Str "three",Space,Str "columns,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-,Para [Span ("styling-xhtml-002.xhtml",[],[]) []]
-,Div ("styling-xhtml-002.xhtml#style-lists",["section"],[])
- [Header 2 ("",[],[]) [Str "Lists"]
- ,Div ("styling-xhtml-002.xhtml#style-list-style-type",["section"],[])
-  [Header 3 ("",[],[]) [Str "The",Space,Code ("",[],[]) "list-style-type",Space,Str "property"]
-  ,Div ("styling-xhtml-002.xhtml#style-009",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-009"],Space,Code ("",[],[]) "decimal"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "decimal",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "decimal",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-010",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-010"],Space,Code ("",[],[]) "circle"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "circle",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ul",Space,Str "element."]
-   ,BulletList
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "circle",Space,Str "markers,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-011",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-011"],Space,Code ("",[],[]) "square"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "square",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ul",Space,Str "element."]
-   ,BulletList
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "square",Space,Str "markers,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-012",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-012"],Space,Code ("",[],[]) "disc"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "disc",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ul",Space,Str "element."]
-   ,BulletList
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "disc",Space,Str "markers,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-013",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-013"],Space,Code ("",[],[]) "lower-latin"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "lower-latin",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "lower-latin",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-014",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-014"],Space,Code ("",[],[]) "lower-roman"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "lower-roman",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "lower-roman",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-015",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-015"],Space,Code ("",[],[]) "upper-alpha"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "upper-alpha",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "upper-alpha",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-016",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-016"],Space,Code ("",[],[]) "hiragana"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "hiragana",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "hiragana",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-017",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-017"],Space,Code ("",[],[]) "hiragana-iroha"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "hiragana-iroha",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "hiragana-iroha",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-018",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-018"],Space,Code ("",[],[]) "katakana"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "katakana",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "katakana",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-019",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-019"],Space,Code ("",[],[]) "katakana-iroha"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "katakana-iroha",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "katakana-iroha",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-020",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-020"],Space,Code ("",[],[]) "upper-roman"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "upper-roman",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "upper-roman",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-021",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-021"],Space,Code ("",[],[]) "upper-latin"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "upper-latin",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "upper-latin",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-022",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-022"],Space,Code ("",[],[]) "lower-alpha"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "lower-alpha",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "lower-alpha",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-023",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-023"],Space,Code ("",[],[]) "lower-greek"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "lower-greek",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "lower-greek",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-024",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-024"],Space,Code ("",[],[]) "armenian"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "armenian",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "armenian",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-025",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-025"],Space,Code ("",[],[]) "cjk-ideographic"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "cjk-ideographic",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "cjk-ideographic",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-026",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-026"],Space,Code ("",[],[]) "decimal-leading-zero"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "decimal-leading-zero",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "decimal-leading-zero",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-027",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-027"],Space,Code ("",[],[]) "georgian"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "georgian",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "georgian",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-028",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-028"],Space,Code ("",[],[]) "hebrew"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "hebrew",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "hebrew",Space,Str "markers",Space,Str "in",Space,Str "ascending",Space,Str "order,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-029",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-029"],Space,Code ("",[],[]) "none"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-type",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "none",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element."]
-   ,OrderedList (1,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "no",Space,Str "markers,",Space,Str "the",Space,Str "test",Space,Str "passes."]]]
- ,Div ("styling-xhtml-002.xhtml#style-list-style",["section"],[])
-  [Header 3 ("",[],[]) [Str "The",Space,Code ("",[],[]) "list-style",Space,Str "property"]
-  ,Div ("styling-xhtml-002.xhtml#style-030",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-030"],Space,Str "images"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style",Space,Str "shorthand",Space,Str "property",Space,Str "is",Space,Str "supported",Space,Str "using",Space,Str "a",Space,Str "gif",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ul",Space,Str "element."]
-   ,BulletList
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "the",Space,Str "purple",Space,Str "and",Space,Str "aqua",Space,Str "square",Space,Str "bullet",Space,Str "the",Space,Str "test",Space,Str "passes."]]]
- ,Div ("styling-xhtml-002.xhtml#style-list-style-position",["section"],[])
-  [Header 3 ("",[],[]) [Str "The",Space,Code ("",[],[]) "list-style-position",Space,Str "property"]
-  ,Div ("styling-xhtml-002.xhtml#style-040",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-040"],Space,Str "The",Space,Code ("",[],[]) "list-style-position",Space,Str "property:",Space,Code ("",[],[]) "inside"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-position",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "inside",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ul",Space,Str "element."]
-   ,BulletList
-    [[Plain [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat."]]
-    ,[Plain [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat."]]
-    ,[Plain [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat."]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "markers",Space,Str "inside",Space,Str "the",Space,Str "indentation,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-041",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-041"],Space,Str "The",Space,Code ("",[],[]) "list-style-position",Space,Str "property:",Space,Code ("",[],[]) "outside"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "list-style-position",Space,Str "property",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "outside",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ul",Space,Str "element."]
-   ,BulletList
-    [[Plain [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat."]]
-    ,[Plain [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat."]]
-    ,[Plain [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat."]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "has",Space,Str "the",Space,Str "default",Space,Str "setting",Space,Str "(marker",Space,Str "outside",Space,Str "the",Space,Str "indentation),",Space,Str "the",Space,Str "test",Space,Str "passes."]]]
- ,Div ("styling-xhtml-002.xhtml#style-list-start",["section"],[])
-  [Header 3 ("",[],[]) [Str "The",Space,Str "HTML",Space,Code ("",[],[]) "start",Space,Str "attribute"]
-  ,Div ("styling-xhtml-002.xhtml#style-050",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-050"],Space,Str "Without",Space,Code ("",[],[]) "list-style-type",Space,Str "set"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "start",Space,Str "attribute",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element",Space,Str "with",Space,Str "no",Space,Code ("",[],[]) "list-style-type",Space,Str "property."]
-   ,OrderedList (25,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "starts",Space,Str "at",Space,Str "25,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
-  ,Div ("styling-xhtml-002.xhtml#style-051",["section","ctest"],[])
-   [Header 4 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-051"],Space,Str "With",Space,Code ("",[],[]) "list-style-type",Space,Str "set"]
-   ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "start",Space,Str "attribute",Space,Str "is",Space,Str "supported",Space,Str "on",Space,Str "a",Space,Code ("",[],[]) "ol",Space,Str "element",Space,Str "with",Space,Str "a",Space,Code ("",[],[]) "list-style-type",Space,Str "property."]
-   ,OrderedList (50,DefaultStyle,DefaultDelim)
-    [[Plain [Str "Lorem"]]
-    ,[Plain [Str "Ipsum"]]
-    ,[Plain [Str "Dolor"]]
-    ,[Plain [Str "Sit"]]
-    ,[Plain [Str "Amet"]]]
-   ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "list",Space,Str "starts",Space,Str "at",Space,Str "'L'",Space,Str "(50),",Space,Str "the",Space,Str "test",Space,Str "passes."]]]]
-,Para [Span ("styling-xhtml-004.xhtml",[],[]) []]
-,Div ("styling-xhtml-004.xhtml#style-media-rules",["section"],[])
- [Header 2 ("",[],[]) [Code ("",[],[]) "@media",Space,Str "Rules"]
- ,Div ("styling-xhtml-004.xhtml#style-210",["section","ctest"],[])
-  [Header 3 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-210"],Space,Code ("",[],[]) "all"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "@media",Space,Str "rule",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "all",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "FAIL"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"FAIL\",",Space,Str "the",Space,Str "test",Space,Str "fails."]]
- ,Div ("styling-xhtml-004.xhtml#style-211",["section","ctest"],[])
-  [Header 3 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-211"],Space,Code ("",[],[]) "screen"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "@media",Space,Str "rule",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "screen",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "FAIL"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"FAIL\",",Space,Str "the",Space,Str "test",Space,Str "fails."]]
- ,Div ("styling-xhtml-004.xhtml#style-212",["section","ctest"],[])
-  [Header 3 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-212"],Space,Code ("",[],[]) "handheld"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "@media",Space,Str "rule",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "handheld",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "FAIL"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"FAIL\",",Space,Str "the",Space,Str "test",Space,Str "fails."]]
- ,Div ("styling-xhtml-004.xhtml#style-213",["section","ctest"],[])
-  [Header 3 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-213"],Space,Code ("",[],[]) "tv"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "@media",Space,Str "rule",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "tv",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "FAIL"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"FAIL\",",Space,Str "the",Space,Str "test",Space,Str "fails."]]
- ,Div ("styling-xhtml-004.xhtml#style-220",["section","ctest"],[])
-  [Header 3 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-220"],Space,Code ("",[],[]) "orientation:landscape"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "@media",Space,Str "rule",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "orientation:landscape",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "FAIL"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"FAIL\"",Space,Str "when",Space,Str "the",Space,Str "device",Space,Str "is",Space,Str "held",Space,Str "in",Space,Str "landscape",Space,Str "mode,",Space,Str "and",Space,Str "the",Space,Str "device",Space,Str "supports",Space,Str "multiple",Space,Str "orientations,",Space,Str "the",Space,Str "test",Space,Str "fails."]]
- ,Div ("styling-xhtml-004.xhtml#style-221",["section","ctest"],[])
-  [Header 3 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-221"],Space,Code ("",[],[]) "orientation:portrait"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "@media",Space,Str "rule",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "orientation:portrait",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "FAIL"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"FAIL\"",Space,Str "when",Space,Str "the",Space,Str "device",Space,Str "is",Space,Str "held",Space,Str "in",Space,Str "portrait",Space,Str "mode,",Space,Str "and",Space,Str "the",Space,Str "device",Space,Str "supports",Space,Str "multiple",Space,Str "orientations,",Space,Str "the",Space,Str "test",Space,Str "fails."]]
- ,Div ("styling-xhtml-004.xhtml#style-230",["section","ctest"],[])
-  [Header 3 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-230"],Space,Code ("",[],[]) "min-width"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "@media",Space,Str "rule",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "min-width:200px",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "FAIL"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"FAIL\",",Space,Str "the",Space,Str "test",Space,Str "fails."]]
- ,Div ("styling-xhtml-004.xhtml#style-231",["section","ctest"],[])
-  [Header 3 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-231"],Space,Code ("",[],[]) "max-width"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "@media",Space,Str "rule",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "max-width:2000px",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "FAIL"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"FAIL\",",Space,Str "the",Space,Str "test",Space,Str "fails."]]
- ,Div ("styling-xhtml-004.xhtml#style-240",["section","ctest"],[])
-  [Header 3 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-240"],Space,Code ("",[],[]) "min-device-width"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "@media",Space,Str "rule",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "min-device-width:200px",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "FAIL"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"FAIL\",",Space,Str "the",Space,Str "test",Space,Str "fails."]]
- ,Div ("styling-xhtml-004.xhtml#style-241",["section","ctest"],[])
-  [Header 3 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-241"],Space,Code ("",[],[]) "max-device-width"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "@media",Space,Str "rule",Space,Str "set",Space,Str "to",Space,Code ("",[],[]) "max-device-width:2000px",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "FAIL"]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "reads",Space,Str "\"FAIL\",",Space,Str "the",Space,Str "test",Space,Str "fails."]]]
-,Para [Span ("styling-xhtml-005.xhtml",[],[]) []]
-,Div ("styling-xhtml-005.xhtml#style-text-xform",["section"],[])
- [Header 2 ("",[],[]) [Str "The",Space,Code ("",[],[]) "text-transform",Space,Str "property"]
- ,Div ("styling-xhtml-005.xhtml#style-310",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-310"],Space,Code ("",[],[]) "uppercase"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "text-transform",Space,Str "property",Space,Str "set",Space,Str "to",Space,Str "uppercase",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "is",Space,Str "in",Space,Str "upper",Space,Str "case,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
- ,Div ("styling-xhtml-005.xhtml#style-311",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-311"],Space,Code ("",[],[]) "capitalize"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "text-transform",Space,Str "property",Space,Str "set",Space,Str "to",Space,Str "capitalize",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "If",Space,Str "each",Space,Str "first",Space,Str "letter",Space,Str "of",Space,Str "each",Space,Str "word",Space,Str "in",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "is",Space,Str "in",Space,Str "upper",Space,Str "case,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
- ,Div ("styling-xhtml-005.xhtml#style-312",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-312"],Space,Code ("",[],[]) "lowercase"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "text-transform",Space,Str "property",Space,Str "set",Space,Str "to",Space,Str "lowercase",Space,Str "is",Space,Str "supported."]
-  ,Para [Str "Lorem",Space,Str "ipsum",Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipisicing",Space,Str "elit,",Space,Str "sed",Space,Str "do",Space,Str "eiusmod",Space,Str "tempor",Space,Str "incididunt",Space,Str "ut",Space,Str "labore",Space,Str "et",Space,Str "dolore",Space,Str "magna",Space,Str "aliqua.",Space,Str "Ut",Space,Str "enim",Space,Str "ad",Space,Str "minim",Space,Str "veniam,",Space,Str "quis",Space,Str "nostrud",Space,Str "exercitation",Space,Str "ullamco",Space,Str "laboris",Space,Str "nisi",Space,Str "ut",Space,Str "aliquip",Space,Str "ex",Space,Str "ea",Space,Str "commodo",Space,Str "consequat.",Space,Str "Duis",Space,Str "aute",Space,Str "irure",Space,Str "dolor",Space,Str "in",Space,Str "reprehenderit",Space,Str "in",Space,Str "voluptate",Space,Str "velit",Space,Str "esse",Space,Str "cillum",Space,Str "dolore",Space,Str "eu",Space,Str "fugiat",Space,Str "nulla",Space,Str "pariatur.",Space,Str "Excepteur",Space,Str "sint",Space,Str "occaecat",Space,Str "cupidatat",Space,Str "non",Space,Str "proident,",Space,Str "sunt",Space,Str "in",Space,Str "culpa",Space,Str "qui",Space,Str "officia",Space,Str "deserunt",Space,Str "mollit",Space,Str "anim",Space,Str "id",Space,Str "est",Space,Str "laborum."]
-  ,Para [Str "If",Space,Str "the",Space,Str "preceding",Space,Str "paragraph",Space,Str "is",Space,Str "in",Space,Str "lower",Space,Str "case,",Space,Str "the",Space,Str "test",Space,Str "passes."]]]
-,Para [Span ("styling-xhtml-006.xhtml",[],[]) []]
-,Div ("styling-xhtml-006.xhtml#style-ruby",["section"],[])
- [Header 2 ("",[],[]) [Str "The",Space,Code ("",[],[]) "epub-ruby-position",Space,Str "property"]
- ,Div ("styling-xhtml-006.xhtml#style-410",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-410"],Space,Code ("",[],[]) "over"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "-epub-ruby-position",Space,Str "property",Space,Str "set",Space,Str "to",Space,Str "over",Space,Str "is",Space,Str "supported."]
-  ,Plain [RawInline (Format "html") "<ruby class=\"ruby-over\">",Strong [Str "Lorem",Space,Str "Ipsum"],Space,RawInline (Format "html") "<rp>",Str "(",RawInline (Format "html") "</rp>",RawInline (Format "html") "<rt>",Str "Lorem",Space,Str "Ipsum",RawInline (Format "html") "</rt>",RawInline (Format "html") "<rp>",Str ")",RawInline (Format "html") "</rp>",RawInline (Format "html") "</ruby>"]
-  ,Para [Str "If",Space,Str "the",Space,Str "Ruby",Space,Str "text",Space,Str "is",Space,Str "positioned",Space,Str "on",Space,Str "the",Space,Link ("",[],[]) [Str "over"] ("http://www.w3.org/TR/css3-writing-modes/#over",""),Space,Str "side",Space,Str "of",Space,Str "the",Space,Str "ruby",Space,Str "base,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
- ,Div ("styling-xhtml-006.xhtml#style-411",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-411"],Space,Code ("",[],[]) "under"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "-epub-ruby-position",Space,Str "property",Space,Str "set",Space,Str "to",Space,Str "under",Space,Str "is",Space,Str "supported."]
-  ,Plain [RawInline (Format "html") "<ruby class=\"ruby-under\">",Strong [Str "Lorem",Space,Str "Ipsum"],Space,RawInline (Format "html") "<rp>",Str "(",RawInline (Format "html") "</rp>",RawInline (Format "html") "<rt>",Str "Lorem",Space,Str "Ipsum",RawInline (Format "html") "</rt>",RawInline (Format "html") "<rp>",Str ")",RawInline (Format "html") "</rp>",RawInline (Format "html") "</ruby>"]
-  ,Para [Str "If",Space,Str "the",Space,Str "Ruby",Space,Str "text",Space,Str "is",Space,Str "positioned",Space,Str "on",Space,Str "the",Space,Link ("",[],[]) [Str "under"] ("http://www.w3.org/TR/css3-writing-modes/#under",""),Space,Str "side",Space,Str "of",Space,Str "the",Space,Str "ruby",Space,Str "base,",Space,Str "the",Space,Str "test",Space,Str "passes."]]
- ,Div ("styling-xhtml-006.xhtml#style-412",["section","ctest"],[])
-  [Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-412"],Space,Code ("",[],[]) "inter-character"]
-  ,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "-epub-ruby-position",Space,Str "property",Space,Str "set",Space,Str "to",Space,Str "inter-caracter",Space,Str "is",Space,Str "supported."]
-  ,Plain [RawInline (Format "html") "<ruby class=\"ruby-inter-character\">",Strong [Str "Lorem",Space,Str "Ipsum"],Space,RawInline (Format "html") "<rp>",Str "(",RawInline (Format "html") "</rp>",RawInline (Format "html") "<rt>",Str "Lorem",Space,Str "Ipsum",RawInline (Format "html") "</rt>",RawInline (Format "html") "<rp>",Str ")",RawInline (Format "html") "</rp>",RawInline (Format "html") "</ruby>"]
-  ,Para [Str "If",Space,Str "the",Space,Str "Ruby",Space,Str "text",Space,Str "is",Space,Str "positioned",Space,Str "on",Space,Str "the",Space,Str "right",Space,Str "side",Space,Str "of",Space,Str "the",Space,Str "base",Space,Str "text,",Space,Str "the",Space,Str "test",Space,Str "passes."]]]]
+[ Para [ Span ( "front.xhtml" , [] , [] ) [] ]
+, Div
+    ( "" , [ "section" ] , [] )
+    [ Header
+        1
+        ( "" , [] , [] )
+        [ Str "EPUB"
+        , Space
+        , Str "3"
+        , Space
+        , Str "Styling"
+        , Space
+        , Str "Test"
+        , Space
+        , Str "Document:"
+        , Space
+        , Str "0101"
+        ]
+    , Div
+        ( "" , [ "section" ] , [] )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Str "Status"
+            , Space
+            , Str "of"
+            , Space
+            , Str "this"
+            , Space
+            , Str "Document"
+            ]
+        , Para
+            [ Str "This"
+            , Space
+            , Str "publication"
+            , Space
+            , Str "is"
+            , Space
+            , Str "currently"
+            , Space
+            , Str "considered"
+            , Space
+            , Span
+                ( "" , [ "status" ] , [] )
+                [ Str "[UNDER" , Space , Str "DEVELOPMENT]" ]
+            , Space
+            , Str "by"
+            , Space
+            , Str "the"
+            , Space
+            , Str "IDPF."
+            ]
+        , Para
+            [ Str "This"
+            , Space
+            , Str "publication"
+            , Space
+            , Str "is"
+            , Space
+            , Str "part"
+            , Space
+            , Str "of"
+            , Space
+            , Str "version"
+            , Space
+            , Span ( "" , [ "version" ] , [] ) [ Str "X.X" ]
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "EPUB"
+            , Space
+            , Str "3.0"
+            , Space
+            , Str "Compliance"
+            , Space
+            , Str "Test"
+            , Space
+            , Str "Suite"
+            , Space
+            , Str "released"
+            , SoftBreak
+            , Str "on"
+            , Space
+            , RawInline (Format "html") "<time class=\"release\">"
+            , Str "TBD"
+            , RawInline (Format "html") "</time>"
+            , Str "."
+            ]
+        , Para
+            [ Str "Before"
+            , Space
+            , Str "using"
+            , Space
+            , Str "this"
+            , Space
+            , Str "publication"
+            , Space
+            , Str "to"
+            , Space
+            , Str "evaluate"
+            , Space
+            , Str "reading"
+            , Space
+            , Str "systems,"
+            , Space
+            , Str "testers"
+            , Space
+            , Str "are"
+            , Space
+            , Str "strongly"
+            , Space
+            , Str "encouraged"
+            , Space
+            , Str "to"
+            , SoftBreak
+            , Str "verify"
+            , Space
+            , Str "that"
+            , Space
+            , Str "they"
+            , Space
+            , Str "have"
+            , Space
+            , Str "the"
+            , Space
+            , Str "latest"
+            , Space
+            , Str "release"
+            , Space
+            , Str "by"
+            , Space
+            , Str "checking"
+            , Space
+            , Str "the"
+            , Space
+            , Str "current"
+            , Space
+            , Str "release"
+            , Space
+            , Str "version"
+            , Space
+            , Str "and"
+            , Space
+            , Str "date"
+            , Space
+            , Str "of"
+            , SoftBreak
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "suite"
+            , Space
+            , Str "at"
+            , Space
+            , Link
+                ( "" , [] , [] )
+                [ Str "TBD" ]
+                ( "http://idpf.org/" , "" )
+            ]
+        , Para
+            [ Str "This"
+            , Space
+            , Str "publication"
+            , Space
+            , Str "is"
+            , Space
+            , Str "one"
+            , Space
+            , Str "of"
+            , Space
+            , Str "several"
+            , Space
+            , Str "that"
+            , Space
+            , Str "currently"
+            , Space
+            , Str "comprise"
+            , Space
+            , Str "the"
+            , Space
+            , Str "EPUB"
+            , Space
+            , Str "3"
+            , Space
+            , Str "conformance"
+            , Space
+            , Str "test"
+            , Space
+            , Str "suite"
+            , SoftBreak
+            , Str "for"
+            , Space
+            , Str "reflowable"
+            , Space
+            , Str "content."
+            , Space
+            , Str "The"
+            , Space
+            , Str "complete"
+            , Space
+            , Str "test"
+            , Space
+            , Str "suite"
+            , Space
+            , Str "includes"
+            , Space
+            , Str "all"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "following"
+            , Space
+            , Str "publications:"
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain [ Str "." ] ] ]
+        ]
+    , Div
+        ( "" , [ "section" ] , [] )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Str "About"
+            , Space
+            , Str "this"
+            , Space
+            , Str "Document"
+            ]
+        , Para
+            [ Str "This"
+            , Space
+            , Str "document"
+            , Space
+            , Str "focuses"
+            , Space
+            , Str "on"
+            , Space
+            , Str "human-evaluated"
+            , Space
+            , Str "binary"
+            , Space
+            , Str "(pass/fail)"
+            , Space
+            , Str "tests"
+            , Space
+            , Str "in"
+            , Space
+            , Str "a"
+            , SoftBreak
+            , Str "reflowable"
+            , Space
+            , Str "context."
+            , Space
+            , Str "Tests"
+            , Space
+            , Str "for"
+            , Space
+            , Str "fixed-layout"
+            , Space
+            , Str "content"
+            , Space
+            , Str "and"
+            , Space
+            , Str "other"
+            , Space
+            , Str "individual"
+            , Space
+            , Str "tests"
+            , Space
+            , Str "that"
+            , SoftBreak
+            , Str "require"
+            , Space
+            , Str "a"
+            , Space
+            , Str "dedicated"
+            , Space
+            , Str "epub"
+            , Space
+            , Str "file"
+            , Space
+            , Str "are"
+            , Space
+            , Str "available"
+            , Space
+            , Str "in"
+            , Space
+            , Str "additional"
+            , Space
+            , Str "sibling"
+            , Space
+            , Str "documents;"
+            , Space
+            , Str "refer"
+            , Space
+            , Str "to"
+            , SoftBreak
+            , Str "the"
+            , Space
+            , Link
+                ( "" , [] , [] )
+                [ Str "test"
+                , Space
+                , Str "suite"
+                , SoftBreak
+                , Str "wiki"
+                ]
+                ( "https://github.com/mgylling/epub-testsuite/wiki/Overview"
+                , ""
+                )
+            , Space
+            , Str "("
+            , Code
+                ( "" , [] , [] )
+                "https://github.com/mgylling/epub-testsuite/wiki/Overview"
+            , Str ")"
+            , Space
+            , Str "for"
+            , Space
+            , Str "additional"
+            , SoftBreak
+            , Str "information."
+            ]
+        ]
+    , Div
+        ( "" , [ "section" ] , [] )
+        [ Header 2 ( "" , [] , [] ) [ Str "Conventions" ]
+        , Para
+            [ Str "The"
+            , Space
+            , Str "following"
+            , Space
+            , Str "conventions"
+            , Space
+            , Str "are"
+            , Space
+            , Str "used"
+            , Space
+            , Str "throughout"
+            , Space
+            , Str "the"
+            , Space
+            , Str "document:"
+            ]
+        , DefinitionList
+            [ ( [ Str "1."
+                , Space
+                , Str "Locating"
+                , Space
+                , Str "a"
+                , Space
+                , Str "test"
+                ]
+              , [ [ Div
+                      ( "" , [ "ctest" ] , [] )
+                      [ Para
+                          [ Str "Tests"
+                          , Space
+                          , Str "for"
+                          , Space
+                          , Emph [ Str "required" ]
+                          , Space
+                          , Str "Reading"
+                          , Space
+                          , Str "System"
+                          , Space
+                          , Str "functionality"
+                          , Space
+                          , Str "are"
+                          , SoftBreak
+                          , Str "preceded"
+                          , Space
+                          , Str "by"
+                          , Space
+                          , Str "the"
+                          , Space
+                          , Str "label:"
+                          , Space
+                          , Span
+                              ( ""
+                              , [ "nature" ]
+                              , [ ( "style"
+                                  , "display: inline; font-size: 100%"
+                                  )
+                                ]
+                              )
+                              [ Str "[REQUIRED]" ]
+                          ]
+                      ]
+                  , Div
+                      ( "" , [ "otest" ] , [] )
+                      [ Para
+                          [ Str "Tests"
+                          , Space
+                          , Str "for"
+                          , Space
+                          , Emph [ Str "optional" ]
+                          , Space
+                          , Str "Reading"
+                          , Space
+                          , Str "System"
+                          , Space
+                          , Str "functionality"
+                          , Space
+                          , Str "are"
+                          , SoftBreak
+                          , Str "preceded"
+                          , Space
+                          , Str "by"
+                          , Space
+                          , Str "the"
+                          , Space
+                          , Str "label:"
+                          , Space
+                          , Span
+                              ( ""
+                              , [ "nature" ]
+                              , [ ( "style"
+                                  , "display: inline; font-size: 100%"
+                                  )
+                                ]
+                              )
+                              [ Str "[OPTIONAL]" ]
+                          ]
+                      ]
+                  ]
+                ]
+              )
+            , ( [ Str "2."
+                , Space
+                , Str "Performing"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                ]
+              , [ [ Plain
+                      [ Str "Each"
+                      , Space
+                      , Str "test"
+                      , Space
+                      , Str "includes"
+                      , Space
+                      , Str "a"
+                      , Space
+                      , Str "description"
+                      , Space
+                      , Str "of"
+                      , Space
+                      , Str "its"
+                      , Space
+                      , Str "purpose"
+                      , Space
+                      , Str "followed"
+                      , Space
+                      , Str "by"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "actual"
+                      , Space
+                      , Strong
+                          [ Str "test"
+                          , Space
+                          , Str "statement,"
+                          , SoftBreak
+                          , Str "which"
+                          , Space
+                          , Str "can"
+                          , Space
+                          , Str "always"
+                          , Space
+                          , Str "be"
+                          , Space
+                          , Str "evaluated"
+                          , Space
+                          , Str "to"
+                          , Space
+                          , Str "true"
+                          , Space
+                          , Str "or"
+                          , Space
+                          , Str "false"
+                          ]
+                      , Str "."
+                      , Space
+                      , Str "These"
+                      , Space
+                      , Str "statements"
+                      , Space
+                      , Str "typically"
+                      , Space
+                      , Str "have"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "form:"
+                      , SoftBreak
+                      , Str "\"If"
+                      , Space
+                      , Str "[some"
+                      , Space
+                      , Str "condition],"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "test"
+                      , Space
+                      , Str "passes\"."
+                      ]
+                  ]
+                ]
+              )
+            , ( [ Str "3."
+                , Space
+                , Str "Scoring"
+                , Space
+                , Str "in"
+                , Space
+                , Str "the"
+                , Space
+                , Str "results"
+                , Space
+                , Str "form"
+                ]
+              , [ [ Plain
+                      [ Str "@@@TODO"
+                      , Space
+                      , Str "provide"
+                      , Space
+                      , Str "info"
+                      , Space
+                      , Str "on"
+                      , Space
+                      , Str "where"
+                      , Space
+                      , Str "to"
+                      , Space
+                      , Str "get"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "results"
+                      , Space
+                      , Str "form"
+                      ]
+                  ]
+                ]
+              )
+            ]
+        ]
+    ]
+, Para [ Span ( "styling-xhtml-001.xhtml" , [] , [] ) [] ]
+, Div
+    ( "styling-xhtml-001.xhtml#epub-css" , [ "section" ] , [] )
+    [ Header
+        1
+        ( "" , [] , [] )
+        [ Str "EPUB" , Space , Str "Style" , Space , Str "Sheets" ]
+    , Para
+        [ Str "This"
+        , Space
+        , Str "section"
+        , Space
+        , Str "contains"
+        , Space
+        , Str "tests"
+        , Space
+        , Str "for"
+        , Space
+        , Str "styling"
+        , Space
+        , Str "and"
+        , Space
+        , Str "layout."
+        ]
+    ]
+, Para [ Span ( "styling-xhtml-003.xhtml" , [] , [] ) [] ]
+, Div
+    ( "styling-xhtml-003.xhtml#style-110"
+    , [ "section" , "ctest" ]
+    , []
+    )
+    [ Header
+        2
+        ( "" , [] , [] )
+        [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+        , Space
+        , Span ( "" , [ "test-id" ] , [] ) [ Str "style-110" ]
+        , Space
+        , Str "Multi-Column"
+        , Space
+        , Str "Layouts"
+        ]
+    , Para
+        [ Str "Tests"
+        , Space
+        , Str "whether"
+        , Space
+        , Str "the"
+        , Space
+        , Code ( "" , [] , [] ) "CSS Multi-Column Layout"
+        , Space
+        , Str "properties"
+        , Space
+        , Str "are"
+        , Space
+        , Str "supported."
+        ]
+    , Div
+        ( "" , [ "multicol" ] , [] )
+        [ Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        ]
+    , Para
+        [ Str "If"
+        , Space
+        , Str "the"
+        , Space
+        , Str "preceding"
+        , Space
+        , Str "text"
+        , Space
+        , Str "is"
+        , Space
+        , Str "rendered"
+        , Space
+        , Str "in"
+        , Space
+        , Str "three"
+        , Space
+        , Str "columns,"
+        , Space
+        , Str "the"
+        , Space
+        , Str "test"
+        , Space
+        , Str "passes."
+        ]
+    ]
+, Para [ Span ( "styling-xhtml-002.xhtml" , [] , [] ) [] ]
+, Div
+    ( "styling-xhtml-002.xhtml#style-lists"
+    , [ "section" ]
+    , []
+    )
+    [ Header 2 ( "" , [] , [] ) [ Str "Lists" ]
+    , Div
+        ( "styling-xhtml-002.xhtml#style-list-style-type"
+        , [ "section" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Str "The"
+            , Space
+            , Code ( "" , [] , [] ) "list-style-type"
+            , Space
+            , Str "property"
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-009"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-009" ]
+                , Space
+                , Code ( "" , [] , [] ) "decimal"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "decimal"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "decimal"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-010"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-010" ]
+                , Space
+                , Code ( "" , [] , [] ) "circle"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "circle"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ul"
+                , Space
+                , Str "element."
+                ]
+            , BulletList
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "circle"
+                , Space
+                , Str "markers,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-011"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-011" ]
+                , Space
+                , Code ( "" , [] , [] ) "square"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "square"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ul"
+                , Space
+                , Str "element."
+                ]
+            , BulletList
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "square"
+                , Space
+                , Str "markers,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-012"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-012" ]
+                , Space
+                , Code ( "" , [] , [] ) "disc"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "disc"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ul"
+                , Space
+                , Str "element."
+                ]
+            , BulletList
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "disc"
+                , Space
+                , Str "markers,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-013"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-013" ]
+                , Space
+                , Code ( "" , [] , [] ) "lower-latin"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "lower-latin"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "lower-latin"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-014"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-014" ]
+                , Space
+                , Code ( "" , [] , [] ) "lower-roman"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "lower-roman"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "lower-roman"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-015"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-015" ]
+                , Space
+                , Code ( "" , [] , [] ) "upper-alpha"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "upper-alpha"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "upper-alpha"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-016"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-016" ]
+                , Space
+                , Code ( "" , [] , [] ) "hiragana"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "hiragana"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "hiragana"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-017"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-017" ]
+                , Space
+                , Code ( "" , [] , [] ) "hiragana-iroha"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "hiragana-iroha"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "hiragana-iroha"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-018"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-018" ]
+                , Space
+                , Code ( "" , [] , [] ) "katakana"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "katakana"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "katakana"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-019"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-019" ]
+                , Space
+                , Code ( "" , [] , [] ) "katakana-iroha"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "katakana-iroha"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "katakana-iroha"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-020"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-020" ]
+                , Space
+                , Code ( "" , [] , [] ) "upper-roman"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "upper-roman"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "upper-roman"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-021"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-021" ]
+                , Space
+                , Code ( "" , [] , [] ) "upper-latin"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "upper-latin"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "upper-latin"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-022"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-022" ]
+                , Space
+                , Code ( "" , [] , [] ) "lower-alpha"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "lower-alpha"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "lower-alpha"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-023"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-023" ]
+                , Space
+                , Code ( "" , [] , [] ) "lower-greek"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "lower-greek"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "lower-greek"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-024"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-024" ]
+                , Space
+                , Code ( "" , [] , [] ) "armenian"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "armenian"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "armenian"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-025"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-025" ]
+                , Space
+                , Code ( "" , [] , [] ) "cjk-ideographic"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "cjk-ideographic"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "cjk-ideographic"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-026"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-026" ]
+                , Space
+                , Code ( "" , [] , [] ) "decimal-leading-zero"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "decimal-leading-zero"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "decimal-leading-zero"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-027"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-027" ]
+                , Space
+                , Code ( "" , [] , [] ) "georgian"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "georgian"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "georgian"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-028"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-028" ]
+                , Space
+                , Code ( "" , [] , [] ) "hebrew"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "hebrew"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "hebrew"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "in"
+                , Space
+                , Str "ascending"
+                , Space
+                , Str "order,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-029"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-029" ]
+                , Space
+                , Code ( "" , [] , [] ) "none"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "none"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element."
+                ]
+            , OrderedList
+                ( 1 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "no"
+                , Space
+                , Str "markers,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-002.xhtml#style-list-style"
+        , [ "section" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Str "The"
+            , Space
+            , Code ( "" , [] , [] ) "list-style"
+            , Space
+            , Str "property"
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-030"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-030" ]
+                , Space
+                , Str "images"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style"
+                , Space
+                , Str "shorthand"
+                , Space
+                , Str "property"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "using"
+                , Space
+                , Str "a"
+                , Space
+                , Str "gif"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ul"
+                , Space
+                , Str "element."
+                ]
+            , BulletList
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "the"
+                , Space
+                , Str "purple"
+                , Space
+                , Str "and"
+                , Space
+                , Str "aqua"
+                , Space
+                , Str "square"
+                , Space
+                , Str "bullet"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-002.xhtml#style-list-style-position"
+        , [ "section" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Str "The"
+            , Space
+            , Code ( "" , [] , [] ) "list-style-position"
+            , Space
+            , Str "property"
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-040"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-040" ]
+                , Space
+                , Str "The"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-position"
+                , Space
+                , Str "property:"
+                , Space
+                , Code ( "" , [] , [] ) "inside"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-position"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "inside"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ul"
+                , Space
+                , Str "element."
+                ]
+            , BulletList
+                [ [ Plain
+                      [ Str "Lorem"
+                      , Space
+                      , Str "ipsum"
+                      , Space
+                      , Str "dolor"
+                      , Space
+                      , Str "sit"
+                      , Space
+                      , Str "amet,"
+                      , Space
+                      , Str "consectetur"
+                      , Space
+                      , Str "adipisicing"
+                      , Space
+                      , Str "elit,"
+                      , Space
+                      , Str "sed"
+                      , Space
+                      , Str "do"
+                      , Space
+                      , Str "eiusmod"
+                      , Space
+                      , Str "tempor"
+                      , Space
+                      , Str "incididunt"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "labore"
+                      , Space
+                      , Str "et"
+                      , Space
+                      , Str "dolore"
+                      , Space
+                      , Str "magna"
+                      , Space
+                      , Str "aliqua."
+                      , Space
+                      , Str "Ut"
+                      , Space
+                      , Str "enim"
+                      , Space
+                      , Str "ad"
+                      , Space
+                      , Str "minim"
+                      , Space
+                      , Str "veniam,"
+                      , Space
+                      , Str "quis"
+                      , Space
+                      , Str "nostrud"
+                      , Space
+                      , Str "exercitation"
+                      , Space
+                      , Str "ullamco"
+                      , Space
+                      , Str "laboris"
+                      , Space
+                      , Str "nisi"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "aliquip"
+                      , Space
+                      , Str "ex"
+                      , Space
+                      , Str "ea"
+                      , Space
+                      , Str "commodo"
+                      , Space
+                      , Str "consequat."
+                      ]
+                  ]
+                , [ Plain
+                      [ Str "Lorem"
+                      , Space
+                      , Str "ipsum"
+                      , Space
+                      , Str "dolor"
+                      , Space
+                      , Str "sit"
+                      , Space
+                      , Str "amet,"
+                      , Space
+                      , Str "consectetur"
+                      , Space
+                      , Str "adipisicing"
+                      , Space
+                      , Str "elit,"
+                      , Space
+                      , Str "sed"
+                      , Space
+                      , Str "do"
+                      , Space
+                      , Str "eiusmod"
+                      , Space
+                      , Str "tempor"
+                      , Space
+                      , Str "incididunt"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "labore"
+                      , Space
+                      , Str "et"
+                      , Space
+                      , Str "dolore"
+                      , Space
+                      , Str "magna"
+                      , Space
+                      , Str "aliqua."
+                      , Space
+                      , Str "Ut"
+                      , Space
+                      , Str "enim"
+                      , Space
+                      , Str "ad"
+                      , Space
+                      , Str "minim"
+                      , Space
+                      , Str "veniam,"
+                      , Space
+                      , Str "quis"
+                      , Space
+                      , Str "nostrud"
+                      , Space
+                      , Str "exercitation"
+                      , Space
+                      , Str "ullamco"
+                      , Space
+                      , Str "laboris"
+                      , Space
+                      , Str "nisi"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "aliquip"
+                      , Space
+                      , Str "ex"
+                      , Space
+                      , Str "ea"
+                      , Space
+                      , Str "commodo"
+                      , Space
+                      , Str "consequat."
+                      ]
+                  ]
+                , [ Plain
+                      [ Str "Lorem"
+                      , Space
+                      , Str "ipsum"
+                      , Space
+                      , Str "dolor"
+                      , Space
+                      , Str "sit"
+                      , Space
+                      , Str "amet,"
+                      , Space
+                      , Str "consectetur"
+                      , Space
+                      , Str "adipisicing"
+                      , Space
+                      , Str "elit,"
+                      , Space
+                      , Str "sed"
+                      , Space
+                      , Str "do"
+                      , Space
+                      , Str "eiusmod"
+                      , Space
+                      , Str "tempor"
+                      , Space
+                      , Str "incididunt"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "labore"
+                      , Space
+                      , Str "et"
+                      , Space
+                      , Str "dolore"
+                      , Space
+                      , Str "magna"
+                      , Space
+                      , Str "aliqua."
+                      , Space
+                      , Str "Ut"
+                      , Space
+                      , Str "enim"
+                      , Space
+                      , Str "ad"
+                      , Space
+                      , Str "minim"
+                      , Space
+                      , Str "veniam,"
+                      , Space
+                      , Str "quis"
+                      , Space
+                      , Str "nostrud"
+                      , Space
+                      , Str "exercitation"
+                      , Space
+                      , Str "ullamco"
+                      , Space
+                      , Str "laboris"
+                      , Space
+                      , Str "nisi"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "aliquip"
+                      , Space
+                      , Str "ex"
+                      , Space
+                      , Str "ea"
+                      , Space
+                      , Str "commodo"
+                      , Space
+                      , Str "consequat."
+                      ]
+                  ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "markers"
+                , Space
+                , Str "inside"
+                , Space
+                , Str "the"
+                , Space
+                , Str "indentation,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-041"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-041" ]
+                , Space
+                , Str "The"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-position"
+                , Space
+                , Str "property:"
+                , Space
+                , Code ( "" , [] , [] ) "outside"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-position"
+                , Space
+                , Str "property"
+                , Space
+                , Str "set"
+                , Space
+                , Str "to"
+                , Space
+                , Code ( "" , [] , [] ) "outside"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ul"
+                , Space
+                , Str "element."
+                ]
+            , BulletList
+                [ [ Plain
+                      [ Str "Lorem"
+                      , Space
+                      , Str "ipsum"
+                      , Space
+                      , Str "dolor"
+                      , Space
+                      , Str "sit"
+                      , Space
+                      , Str "amet,"
+                      , Space
+                      , Str "consectetur"
+                      , Space
+                      , Str "adipisicing"
+                      , Space
+                      , Str "elit,"
+                      , Space
+                      , Str "sed"
+                      , Space
+                      , Str "do"
+                      , Space
+                      , Str "eiusmod"
+                      , Space
+                      , Str "tempor"
+                      , Space
+                      , Str "incididunt"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "labore"
+                      , Space
+                      , Str "et"
+                      , Space
+                      , Str "dolore"
+                      , Space
+                      , Str "magna"
+                      , Space
+                      , Str "aliqua."
+                      , Space
+                      , Str "Ut"
+                      , Space
+                      , Str "enim"
+                      , Space
+                      , Str "ad"
+                      , Space
+                      , Str "minim"
+                      , Space
+                      , Str "veniam,"
+                      , Space
+                      , Str "quis"
+                      , Space
+                      , Str "nostrud"
+                      , Space
+                      , Str "exercitation"
+                      , Space
+                      , Str "ullamco"
+                      , Space
+                      , Str "laboris"
+                      , Space
+                      , Str "nisi"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "aliquip"
+                      , Space
+                      , Str "ex"
+                      , Space
+                      , Str "ea"
+                      , Space
+                      , Str "commodo"
+                      , Space
+                      , Str "consequat."
+                      ]
+                  ]
+                , [ Plain
+                      [ Str "Lorem"
+                      , Space
+                      , Str "ipsum"
+                      , Space
+                      , Str "dolor"
+                      , Space
+                      , Str "sit"
+                      , Space
+                      , Str "amet,"
+                      , Space
+                      , Str "consectetur"
+                      , Space
+                      , Str "adipisicing"
+                      , Space
+                      , Str "elit,"
+                      , Space
+                      , Str "sed"
+                      , Space
+                      , Str "do"
+                      , Space
+                      , Str "eiusmod"
+                      , Space
+                      , Str "tempor"
+                      , Space
+                      , Str "incididunt"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "labore"
+                      , Space
+                      , Str "et"
+                      , Space
+                      , Str "dolore"
+                      , Space
+                      , Str "magna"
+                      , Space
+                      , Str "aliqua."
+                      , Space
+                      , Str "Ut"
+                      , Space
+                      , Str "enim"
+                      , Space
+                      , Str "ad"
+                      , Space
+                      , Str "minim"
+                      , Space
+                      , Str "veniam,"
+                      , Space
+                      , Str "quis"
+                      , Space
+                      , Str "nostrud"
+                      , Space
+                      , Str "exercitation"
+                      , Space
+                      , Str "ullamco"
+                      , Space
+                      , Str "laboris"
+                      , Space
+                      , Str "nisi"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "aliquip"
+                      , Space
+                      , Str "ex"
+                      , Space
+                      , Str "ea"
+                      , Space
+                      , Str "commodo"
+                      , Space
+                      , Str "consequat."
+                      ]
+                  ]
+                , [ Plain
+                      [ Str "Lorem"
+                      , Space
+                      , Str "ipsum"
+                      , Space
+                      , Str "dolor"
+                      , Space
+                      , Str "sit"
+                      , Space
+                      , Str "amet,"
+                      , Space
+                      , Str "consectetur"
+                      , Space
+                      , Str "adipisicing"
+                      , Space
+                      , Str "elit,"
+                      , Space
+                      , Str "sed"
+                      , Space
+                      , Str "do"
+                      , Space
+                      , Str "eiusmod"
+                      , Space
+                      , Str "tempor"
+                      , Space
+                      , Str "incididunt"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "labore"
+                      , Space
+                      , Str "et"
+                      , Space
+                      , Str "dolore"
+                      , Space
+                      , Str "magna"
+                      , Space
+                      , Str "aliqua."
+                      , Space
+                      , Str "Ut"
+                      , Space
+                      , Str "enim"
+                      , Space
+                      , Str "ad"
+                      , Space
+                      , Str "minim"
+                      , Space
+                      , Str "veniam,"
+                      , Space
+                      , Str "quis"
+                      , Space
+                      , Str "nostrud"
+                      , Space
+                      , Str "exercitation"
+                      , Space
+                      , Str "ullamco"
+                      , Space
+                      , Str "laboris"
+                      , Space
+                      , Str "nisi"
+                      , Space
+                      , Str "ut"
+                      , Space
+                      , Str "aliquip"
+                      , Space
+                      , Str "ex"
+                      , Space
+                      , Str "ea"
+                      , Space
+                      , Str "commodo"
+                      , Space
+                      , Str "consequat."
+                      ]
+                  ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "has"
+                , Space
+                , Str "the"
+                , Space
+                , Str "default"
+                , Space
+                , Str "setting"
+                , Space
+                , Str "(marker"
+                , Space
+                , Str "outside"
+                , Space
+                , Str "the"
+                , Space
+                , Str "indentation),"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-002.xhtml#style-list-start"
+        , [ "section" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Str "The"
+            , Space
+            , Str "HTML"
+            , Space
+            , Code ( "" , [] , [] ) "start"
+            , Space
+            , Str "attribute"
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-050"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-050" ]
+                , Space
+                , Str "Without"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "set"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "start"
+                , Space
+                , Str "attribute"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element"
+                , Space
+                , Str "with"
+                , Space
+                , Str "no"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property."
+                ]
+            , OrderedList
+                ( 25 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "starts"
+                , Space
+                , Str "at"
+                , Space
+                , Str "25,"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        , Div
+            ( "styling-xhtml-002.xhtml#style-051"
+            , [ "section" , "ctest" ]
+            , []
+            )
+            [ Header
+                4
+                ( "" , [] , [] )
+                [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+                , Space
+                , Span ( "" , [ "test-id" ] , [] ) [ Str "style-051" ]
+                , Space
+                , Str "With"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "set"
+                ]
+            , Para
+                [ Str "Tests"
+                , Space
+                , Str "whether"
+                , Space
+                , Str "the"
+                , Space
+                , Code ( "" , [] , [] ) "start"
+                , Space
+                , Str "attribute"
+                , Space
+                , Str "is"
+                , Space
+                , Str "supported"
+                , Space
+                , Str "on"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "ol"
+                , Space
+                , Str "element"
+                , Space
+                , Str "with"
+                , Space
+                , Str "a"
+                , Space
+                , Code ( "" , [] , [] ) "list-style-type"
+                , Space
+                , Str "property."
+                ]
+            , OrderedList
+                ( 50 , DefaultStyle , DefaultDelim )
+                [ [ Plain [ Str "Lorem" ] ]
+                , [ Plain [ Str "Ipsum" ] ]
+                , [ Plain [ Str "Dolor" ] ]
+                , [ Plain [ Str "Sit" ] ]
+                , [ Plain [ Str "Amet" ] ]
+                ]
+            , Para
+                [ Str "If"
+                , Space
+                , Str "the"
+                , Space
+                , Str "preceding"
+                , Space
+                , Str "list"
+                , Space
+                , Str "starts"
+                , Space
+                , Str "at"
+                , Space
+                , Str "'L'"
+                , Space
+                , Str "(50),"
+                , Space
+                , Str "the"
+                , Space
+                , Str "test"
+                , Space
+                , Str "passes."
+                ]
+            ]
+        ]
+    ]
+, Para [ Span ( "styling-xhtml-004.xhtml" , [] , [] ) [] ]
+, Div
+    ( "styling-xhtml-004.xhtml#style-media-rules"
+    , [ "section" ]
+    , []
+    )
+    [ Header
+        2
+        ( "" , [] , [] )
+        [ Code ( "" , [] , [] ) "@media" , Space , Str "Rules" ]
+    , Div
+        ( "styling-xhtml-004.xhtml#style-210"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-210" ]
+            , Space
+            , Code ( "" , [] , [] ) "all"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "@media"
+            , Space
+            , Str "rule"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Code ( "" , [] , [] ) "all"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "FAIL" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "reads"
+            , Space
+            , Str "\"FAIL\","
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-004.xhtml#style-211"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-211" ]
+            , Space
+            , Code ( "" , [] , [] ) "screen"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "@media"
+            , Space
+            , Str "rule"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Code ( "" , [] , [] ) "screen"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "FAIL" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "reads"
+            , Space
+            , Str "\"FAIL\","
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-004.xhtml#style-212"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-212" ]
+            , Space
+            , Code ( "" , [] , [] ) "handheld"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "@media"
+            , Space
+            , Str "rule"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Code ( "" , [] , [] ) "handheld"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "FAIL" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "reads"
+            , Space
+            , Str "\"FAIL\","
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-004.xhtml#style-213"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-213" ]
+            , Space
+            , Code ( "" , [] , [] ) "tv"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "@media"
+            , Space
+            , Str "rule"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Code ( "" , [] , [] ) "tv"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "FAIL" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "reads"
+            , Space
+            , Str "\"FAIL\","
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-004.xhtml#style-220"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-220" ]
+            , Space
+            , Code ( "" , [] , [] ) "orientation:landscape"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "@media"
+            , Space
+            , Str "rule"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Code ( "" , [] , [] ) "orientation:landscape"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "FAIL" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "reads"
+            , Space
+            , Str "\"FAIL\""
+            , Space
+            , Str "when"
+            , Space
+            , Str "the"
+            , Space
+            , Str "device"
+            , Space
+            , Str "is"
+            , Space
+            , Str "held"
+            , Space
+            , Str "in"
+            , Space
+            , Str "landscape"
+            , Space
+            , Str "mode,"
+            , Space
+            , Str "and"
+            , Space
+            , Str "the"
+            , Space
+            , Str "device"
+            , Space
+            , Str "supports"
+            , Space
+            , Str "multiple"
+            , Space
+            , Str "orientations,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-004.xhtml#style-221"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-221" ]
+            , Space
+            , Code ( "" , [] , [] ) "orientation:portrait"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "@media"
+            , Space
+            , Str "rule"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Code ( "" , [] , [] ) "orientation:portrait"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "FAIL" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "reads"
+            , Space
+            , Str "\"FAIL\""
+            , Space
+            , Str "when"
+            , Space
+            , Str "the"
+            , Space
+            , Str "device"
+            , Space
+            , Str "is"
+            , Space
+            , Str "held"
+            , Space
+            , Str "in"
+            , Space
+            , Str "portrait"
+            , Space
+            , Str "mode,"
+            , Space
+            , Str "and"
+            , Space
+            , Str "the"
+            , Space
+            , Str "device"
+            , Space
+            , Str "supports"
+            , Space
+            , Str "multiple"
+            , Space
+            , Str "orientations,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-004.xhtml#style-230"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-230" ]
+            , Space
+            , Code ( "" , [] , [] ) "min-width"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "@media"
+            , Space
+            , Str "rule"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Code ( "" , [] , [] ) "min-width:200px"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "FAIL" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "reads"
+            , Space
+            , Str "\"FAIL\","
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-004.xhtml#style-231"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-231" ]
+            , Space
+            , Code ( "" , [] , [] ) "max-width"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "@media"
+            , Space
+            , Str "rule"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Code ( "" , [] , [] ) "max-width:2000px"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "FAIL" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "reads"
+            , Space
+            , Str "\"FAIL\","
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-004.xhtml#style-240"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-240" ]
+            , Space
+            , Code ( "" , [] , [] ) "min-device-width"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "@media"
+            , Space
+            , Str "rule"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Code ( "" , [] , [] ) "min-device-width:200px"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "FAIL" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "reads"
+            , Space
+            , Str "\"FAIL\","
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-004.xhtml#style-241"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            3
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-241" ]
+            , Space
+            , Code ( "" , [] , [] ) "max-device-width"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "@media"
+            , Space
+            , Str "rule"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Code ( "" , [] , [] ) "max-device-width:2000px"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para [ Str "FAIL" ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "reads"
+            , Space
+            , Str "\"FAIL\","
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "fails."
+            ]
+        ]
+    ]
+, Para [ Span ( "styling-xhtml-005.xhtml" , [] , [] ) [] ]
+, Div
+    ( "styling-xhtml-005.xhtml#style-text-xform"
+    , [ "section" ]
+    , []
+    )
+    [ Header
+        2
+        ( "" , [] , [] )
+        [ Str "The"
+        , Space
+        , Code ( "" , [] , [] ) "text-transform"
+        , Space
+        , Str "property"
+        ]
+    , Div
+        ( "styling-xhtml-005.xhtml#style-310"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-310" ]
+            , Space
+            , Code ( "" , [] , [] ) "uppercase"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "text-transform"
+            , Space
+            , Str "property"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Str "uppercase"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "is"
+            , Space
+            , Str "in"
+            , Space
+            , Str "upper"
+            , Space
+            , Str "case,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-005.xhtml#style-311"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-311" ]
+            , Space
+            , Code ( "" , [] , [] ) "capitalize"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "text-transform"
+            , Space
+            , Str "property"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Str "capitalize"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "each"
+            , Space
+            , Str "first"
+            , Space
+            , Str "letter"
+            , Space
+            , Str "of"
+            , Space
+            , Str "each"
+            , Space
+            , Str "word"
+            , Space
+            , Str "in"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "is"
+            , Space
+            , Str "in"
+            , Space
+            , Str "upper"
+            , Space
+            , Str "case,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-005.xhtml#style-312"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-312" ]
+            , Space
+            , Code ( "" , [] , [] ) "lowercase"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "text-transform"
+            , Space
+            , Str "property"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Str "lowercase"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Para
+            [ Str "Lorem"
+            , Space
+            , Str "ipsum"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "sit"
+            , Space
+            , Str "amet,"
+            , Space
+            , Str "consectetur"
+            , Space
+            , Str "adipisicing"
+            , Space
+            , Str "elit,"
+            , Space
+            , Str "sed"
+            , Space
+            , Str "do"
+            , Space
+            , Str "eiusmod"
+            , Space
+            , Str "tempor"
+            , Space
+            , Str "incididunt"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "labore"
+            , Space
+            , Str "et"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "magna"
+            , Space
+            , Str "aliqua."
+            , Space
+            , Str "Ut"
+            , Space
+            , Str "enim"
+            , Space
+            , Str "ad"
+            , Space
+            , Str "minim"
+            , Space
+            , Str "veniam,"
+            , Space
+            , Str "quis"
+            , Space
+            , Str "nostrud"
+            , Space
+            , Str "exercitation"
+            , Space
+            , Str "ullamco"
+            , Space
+            , Str "laboris"
+            , Space
+            , Str "nisi"
+            , Space
+            , Str "ut"
+            , Space
+            , Str "aliquip"
+            , Space
+            , Str "ex"
+            , Space
+            , Str "ea"
+            , Space
+            , Str "commodo"
+            , Space
+            , Str "consequat."
+            , Space
+            , Str "Duis"
+            , Space
+            , Str "aute"
+            , Space
+            , Str "irure"
+            , Space
+            , Str "dolor"
+            , Space
+            , Str "in"
+            , Space
+            , Str "reprehenderit"
+            , Space
+            , Str "in"
+            , Space
+            , Str "voluptate"
+            , Space
+            , Str "velit"
+            , Space
+            , Str "esse"
+            , Space
+            , Str "cillum"
+            , Space
+            , Str "dolore"
+            , Space
+            , Str "eu"
+            , Space
+            , Str "fugiat"
+            , Space
+            , Str "nulla"
+            , Space
+            , Str "pariatur."
+            , Space
+            , Str "Excepteur"
+            , Space
+            , Str "sint"
+            , Space
+            , Str "occaecat"
+            , Space
+            , Str "cupidatat"
+            , Space
+            , Str "non"
+            , Space
+            , Str "proident,"
+            , Space
+            , Str "sunt"
+            , Space
+            , Str "in"
+            , Space
+            , Str "culpa"
+            , Space
+            , Str "qui"
+            , Space
+            , Str "officia"
+            , Space
+            , Str "deserunt"
+            , Space
+            , Str "mollit"
+            , Space
+            , Str "anim"
+            , Space
+            , Str "id"
+            , Space
+            , Str "est"
+            , Space
+            , Str "laborum."
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "preceding"
+            , Space
+            , Str "paragraph"
+            , Space
+            , Str "is"
+            , Space
+            , Str "in"
+            , Space
+            , Str "lower"
+            , Space
+            , Str "case,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes."
+            ]
+        ]
+    ]
+, Para [ Span ( "styling-xhtml-006.xhtml" , [] , [] ) [] ]
+, Div
+    ( "styling-xhtml-006.xhtml#style-ruby"
+    , [ "section" ]
+    , []
+    )
+    [ Header
+        2
+        ( "" , [] , [] )
+        [ Str "The"
+        , Space
+        , Code ( "" , [] , [] ) "epub-ruby-position"
+        , Space
+        , Str "property"
+        ]
+    , Div
+        ( "styling-xhtml-006.xhtml#style-410"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-410" ]
+            , Space
+            , Code ( "" , [] , [] ) "over"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "-epub-ruby-position"
+            , Space
+            , Str "property"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Str "over"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Plain
+            [ RawInline (Format "html") "<ruby class=\"ruby-over\">"
+            , Strong [ Str "Lorem" , Space , Str "Ipsum" ]
+            , Space
+            , RawInline (Format "html") "<rp>"
+            , Str "("
+            , RawInline (Format "html") "</rp>"
+            , RawInline (Format "html") "<rt>"
+            , Str "Lorem"
+            , Space
+            , Str "Ipsum"
+            , RawInline (Format "html") "</rt>"
+            , RawInline (Format "html") "<rp>"
+            , Str ")"
+            , RawInline (Format "html") "</rp>"
+            , RawInline (Format "html") "</ruby>"
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "Ruby"
+            , Space
+            , Str "text"
+            , Space
+            , Str "is"
+            , Space
+            , Str "positioned"
+            , Space
+            , Str "on"
+            , Space
+            , Str "the"
+            , Space
+            , Link
+                ( "" , [] , [] )
+                [ Str "over" ]
+                ( "http://www.w3.org/TR/css3-writing-modes/#over" , "" )
+            , Space
+            , Str "side"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "ruby"
+            , Space
+            , Str "base,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-006.xhtml#style-411"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-411" ]
+            , Space
+            , Code ( "" , [] , [] ) "under"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "-epub-ruby-position"
+            , Space
+            , Str "property"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Str "under"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Plain
+            [ RawInline (Format "html") "<ruby class=\"ruby-under\">"
+            , Strong [ Str "Lorem" , Space , Str "Ipsum" ]
+            , Space
+            , RawInline (Format "html") "<rp>"
+            , Str "("
+            , RawInline (Format "html") "</rp>"
+            , RawInline (Format "html") "<rt>"
+            , Str "Lorem"
+            , Space
+            , Str "Ipsum"
+            , RawInline (Format "html") "</rt>"
+            , RawInline (Format "html") "<rp>"
+            , Str ")"
+            , RawInline (Format "html") "</rp>"
+            , RawInline (Format "html") "</ruby>"
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "Ruby"
+            , Space
+            , Str "text"
+            , Space
+            , Str "is"
+            , Space
+            , Str "positioned"
+            , Space
+            , Str "on"
+            , Space
+            , Str "the"
+            , Space
+            , Link
+                ( "" , [] , [] )
+                [ Str "under" ]
+                ( "http://www.w3.org/TR/css3-writing-modes/#under"
+                , ""
+                )
+            , Space
+            , Str "side"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "ruby"
+            , Space
+            , Str "base,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes."
+            ]
+        ]
+    , Div
+        ( "styling-xhtml-006.xhtml#style-412"
+        , [ "section" , "ctest" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Span ( "" , [ "nature" ] , [] ) [ Str "[REQUIRED]" ]
+            , Space
+            , Span ( "" , [ "test-id" ] , [] ) [ Str "style-412" ]
+            , Space
+            , Code ( "" , [] , [] ) "inter-character"
+            ]
+        , Para
+            [ Str "Tests"
+            , Space
+            , Str "whether"
+            , Space
+            , Str "the"
+            , Space
+            , Code ( "" , [] , [] ) "-epub-ruby-position"
+            , Space
+            , Str "property"
+            , Space
+            , Str "set"
+            , Space
+            , Str "to"
+            , Space
+            , Str "inter-caracter"
+            , Space
+            , Str "is"
+            , Space
+            , Str "supported."
+            ]
+        , Plain
+            [ RawInline
+                (Format "html") "<ruby class=\"ruby-inter-character\">"
+            , Strong [ Str "Lorem" , Space , Str "Ipsum" ]
+            , Space
+            , RawInline (Format "html") "<rp>"
+            , Str "("
+            , RawInline (Format "html") "</rp>"
+            , RawInline (Format "html") "<rt>"
+            , Str "Lorem"
+            , Space
+            , Str "Ipsum"
+            , RawInline (Format "html") "</rt>"
+            , RawInline (Format "html") "<rp>"
+            , Str ")"
+            , RawInline (Format "html") "</rp>"
+            , RawInline (Format "html") "</ruby>"
+            ]
+        , Para
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "Ruby"
+            , Space
+            , Str "text"
+            , Space
+            , Str "is"
+            , Space
+            , Str "positioned"
+            , Space
+            , Str "on"
+            , Space
+            , Str "the"
+            , Space
+            , Str "right"
+            , Space
+            , Str "side"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "base"
+            , Space
+            , Str "text,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "test"
+            , Space
+            , Str "passes."
+            ]
+        ]
+    ]
+]
diff --git a/test/epub/wasteland.epub b/test/epub/wasteland.epub
Binary files a/test/epub/wasteland.epub and b/test/epub/wasteland.epub differ
diff --git a/test/epub/wasteland.native b/test/epub/wasteland.native
--- a/test/epub/wasteland.native
+++ b/test/epub/wasteland.native
@@ -1,938 +1,4551 @@
-[Para [Image ("",[],[]) [] ("wasteland-cover.jpg","")]
-,Para [Span ("wasteland-content.xhtml",[],[]) []]
-,Div ("wasteland-content.xhtml#frontmatter",["section","frontmatter"],[])
- []
-,Div ("wasteland-content.xhtml#bodymatter",["section","bodymatter"],[])
- [Div ("wasteland-content.xhtml#ch1",["section"],[])
-  [Header 2 ("",[],[]) [Str "I.",Space,Str "THE",Space,Str "BURIAL",Space,Str "OF",Space,Str "THE",Space,Str "DEAD"]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "April",Space,Str "is",Space,Str "the",Space,Str "cruellest",Space,Str "month,",Space,Str "breeding"]]
-   ,Div ("",[],[])
-    [Plain [Str "Lilacs",Space,Str "out",Space,Str "of",Space,Str "the",Space,Str "dead",Space,Str "land,",Space,Str "mixing"]]
-   ,Div ("",[],[])
-    [Plain [Str "Memory",Space,Str "and",Space,Str "desire,",Space,Str "stirring"]]
-   ,Div ("",[],[])
-    [Plain [Str "Dull",Space,Str "roots",Space,Str "with",Space,Str "spring",Space,Str "rain."]]
-   ,Div ("",[],[])
-    [Plain [Str "Winter",Space,Str "kept",Space,Str "us",Space,Str "warm,",Space,Str "covering"]]
-   ,Div ("",[],[])
-    [Plain [Str "Earth",Space,Str "in",Space,Str "forgetful",Space,Str "snow,",Space,Str "feeding"]]
-   ,Div ("",[],[])
-    [Plain [Str "A",Space,Str "little",Space,Str "life",Space,Str "with",Space,Str "dried",Space,Str "tubers."]]
-   ,Div ("",[],[])
-    [Plain [Str "Summer",Space,Str "surprised",Space,Str "us,",Space,Str "coming",Space,Str "over",Space,Str "the",Space,Str "Starnbergersee"]]
-   ,Div ("",[],[])
-    [Plain [Str "With",Space,Str "a",Space,Str "shower",Space,Str "of",Space,Str "rain;",Space,Str "we",Space,Str "stopped",Space,Str "in",Space,Str "the",Space,Str "colonnade,"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "went",Space,Str "on",Space,Str "in",Space,Str "sunlight,",Space,Str "into",Space,Str "the",Space,Str "Hofgarten,",Span ("",["lnum"],[]) [Str "10"]]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "drank",Space,Str "coffee,",Space,Str "and",Space,Str "talked",Space,Str "for",Space,Str "an",Space,Str "hour."]]
-   ,Div ("",[],[("lang","de")])
-    [Plain [Str "Bin",Space,Str "gar",Space,Str "keine",Space,Str "Russin,",Space,Str "stamm'",Space,Str "aus",Space,Str "Litauen,",Space,Str "echt",SoftBreak,Str "deutsch."]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "when",Space,Str "we",Space,Str "were",Space,Str "children,",Space,Str "staying",Space,Str "at",Space,Str "the",Space,Str "archduke's,"]]
-   ,Div ("",[],[])
-    [Plain [Str "My",Space,Str "cousin's,",Space,Str "he",Space,Str "took",Space,Str "me",Space,Str "out",Space,Str "on",Space,Str "a",Space,Str "sled,"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "I",Space,Str "was",Space,Str "frightened.",Space,Str "He",Space,Str "said,",Space,Str "Marie,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Marie,",Space,Str "hold",Space,Str "on",Space,Str "tight.",Space,Str "And",Space,Str "down",Space,Str "we",Space,Str "went."]]
-   ,Div ("",[],[])
-    [Plain [Str "In",Space,Str "the",Space,Str "mountains,",Space,Str "there",Space,Str "you",Space,Str "feel",Space,Str "free."]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "read,",Space,Str "much",Space,Str "of",Space,Str "the",Space,Str "night,",Space,Str "and",Space,Str "go",Space,Str "south",Space,Str "in",Space,Str "the",Space,Str "winter."]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "What",Space,Str "are",Space,Str "the",Space,Str "roots",Space,Str "that",Space,Str "clutch,",Space,Str "what",Space,Str "branches",Space,Str "grow"]]
-   ,Div ("wasteland-content.xhtml#ln20",[],[])
-    [Plain [Str "Out",Space,Str "of",Space,Str "this",Space,Str "stony",Space,Str "rubbish?",Space,Str "Son",Space,Str "of",Space,Str "man,",Note [Para [Link ("",[],[]) [Str "Line",Space,Str "20."] ("#wasteland-content.xhtml#ln20",""),Space,Str "Cf.",Space,Str "Ezekiel",Space,Str "2:1."]],Span ("",["lnum"],[]) [Str "20"]]]
-   ,Div ("",[],[])
-    [Plain [Str "You",Space,Str "cannot",Space,Str "say,",Space,Str "or",Space,Str "guess,",Space,Str "for",Space,Str "you",Space,Str "know",Space,Str "only"]]
-   ,Div ("",[],[])
-    [Plain [Str "A",Space,Str "heap",Space,Str "of",Space,Str "broken",Space,Str "images,",Space,Str "where",Space,Str "the",Space,Str "sun",Space,Str "beats,"]]
-   ,Div ("wasteland-content.xhtml#ln23",[],[])
-    [Plain [Str "And",Space,Str "the",Space,Str "dead",Space,Str "tree",Space,Str "gives",Space,Str "no",Space,Str "shelter,",Space,Str "the",Space,Str "cricket",Space,Str "no",Space,Str "relief,",Note [Para [Link ("",[],[]) [Str "23."] ("#wasteland-content.xhtml#ln23",""),Space,Str "Cf.",Space,Str "Ecclesiastes",Space,Str "12:5."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "the",Space,Str "dry",Space,Str "stone",Space,Str "no",Space,Str "sound",Space,Str "of",Space,Str "water.",Space,Str "Only"]]
-   ,Div ("",[],[])
-    [Plain [Str "There",Space,Str "is",Space,Str "shadow",Space,Str "under",Space,Str "this",Space,Str "red",Space,Str "rock,"]]
-   ,Div ("",[],[])
-    [Plain [Str "(Come",Space,Str "in",Space,Str "under",Space,Str "the",Space,Str "shadow",Space,Str "of",Space,Str "this",Space,Str "red",Space,Str "rock),"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "I",Space,Str "will",Space,Str "show",Space,Str "you",Space,Str "something",Space,Str "different",Space,Str "from",Space,Str "either"]]
-   ,Div ("",[],[])
-    [Plain [Str "Your",Space,Str "shadow",Space,Str "at",Space,Str "morning",Space,Str "striding",Space,Str "behind",Space,Str "you"]]
-   ,Div ("",[],[])
-    [Plain [Str "Or",Space,Str "your",Space,Str "shadow",Space,Str "at",Space,Str "evening",Space,Str "rising",Space,Str "to",Space,Str "meet",Space,Str "you;"]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "will",Space,Str "show",Space,Str "you",Space,Str "fear",Space,Str "in",Space,Str "a",Space,Str "handful",Space,Str "of",Space,Str "dust.",Span ("",["lnum"],[]) [Str "30"]]]
-   ,BlockQuote
-    [Div ("",[],[])
-     [Div ("wasteland-content.xhtml#ln31",[],[])
-      [Plain [Str "Frisch",Space,Str "weht",Space,Str "der",Space,Str "Wind",Note [Para [Link ("",[],[]) [Str "31."] ("#wasteland-content.xhtml#ln31",""),Space,Str "V.",Space,Str "Tristan",Space,Str "und",Space,Str "Isolde,",Space,Str "i,",Space,Str "verses",Space,Str "5-8."]]]]
-     ,Div ("",[],[])
-      [Plain [Str "Der",Space,Str "Heimat",Space,Str "zu"]]
-     ,Div ("",[],[])
-      [Plain [Str "Mein",Space,Str "Irisch",Space,Str "Kind,"]]
-     ,Div ("",[],[])
-      [Plain [Str "Wo",Space,Str "weilest",Space,Str "du?"]]]]
-   ,Div ("",[],[])
-    [Plain [Str "\"You",Space,Str "gave",Space,Str "me",Space,Str "hyacinths",Space,Str "first",Space,Str "a",Space,Str "year",Space,Str "ago;"]]
-   ,Div ("",[],[])
-    [Plain [Str "\"They",Space,Str "called",Space,Str "me",Space,Str "the",Space,Str "hyacinth",Space,Str "girl.\""]]
-   ,Div ("",[],[])
-    [Plain [Str "\8213Yet",Space,Str "when",Space,Str "we",Space,Str "came",Space,Str "back,",Space,Str "late,",Space,Str "from",Space,Str "the",Space,Str "Hyacinth",SoftBreak,Str "garden,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Your",Space,Str "arms",Space,Str "full,",Space,Str "and",Space,Str "your",Space,Str "hair",Space,Str "wet,",Space,Str "I",Space,Str "could",Space,Str "not"]]
-   ,Div ("",[],[])
-    [Plain [Str "Speak,",Space,Str "and",Space,Str "my",Space,Str "eyes",Space,Str "failed,",Space,Str "I",Space,Str "was",Space,Str "neither"]]
-   ,Div ("",[],[])
-    [Plain [Str "Living",Space,Str "nor",Space,Str "dead,",Space,Str "and",Space,Str "I",Space,Str "knew",Space,Str "nothing,",Span ("",["lnum"],[]) [Str "40"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Looking",Space,Str "into",Space,Str "the",Space,Str "heart",Space,Str "of",Space,Str "light,",Space,Str "the",Space,Str "silence."]]
-   ,Div ("wasteland-content.xhtml#ln42",[],[("lang","de")])
-    [Plain [Emph [Str "Od'",Space,Str "und",Space,Str "leer",Space,Str "das",Space,Str "Meer"],Str ".",Note [Para [Link ("",[],[]) [Str "42."] ("#wasteland-content.xhtml#ln42",""),Space,Str "Id.",Space,Str "iii,",Space,Str "verse",Space,Str "24."]]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "Madame",Space,Str "Sosostris,",Space,Str "famous",Space,Str "clairvoyante,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Had",Space,Str "a",Space,Str "bad",Space,Str "cold,",Space,Str "nevertheless"]]
-   ,Div ("",[],[])
-    [Plain [Str "Is",Space,Str "known",Space,Str "to",Space,Str "be",Space,Str "the",Space,Str "wisest",Space,Str "woman",Space,Str "in",Space,Str "Europe,"]]
-   ,Div ("wasteland-content.xhtml#ln46",[],[])
-    [Plain [Str "With",Space,Str "a",Space,Str "wicked",Space,Str "pack",Space,Str "of",Space,Str "cards.",Space,Str "Here,",Space,Str "said",Space,Str "she,",Note [Para [Link ("",[],[]) [Str "46."] ("#wasteland-content.xhtml#ln46",""),Space,Str "I",Space,Str "am",Space,Str "not",Space,Str "familiar",Space,Str "with",Space,Str "the",Space,Str "exact",Space,Str "constitution",Space,Str "of",Space,Str "the",Space,Str "Tarot",Space,Str "pack",Space,Str "of",SoftBreak,Str "cards,",Space,Str "from",Space,Str "which",Space,Str "I",Space,Str "have",Space,Str "obviously",Space,Str "departed",Space,Str "to",Space,Str "suit",Space,Str "my",Space,Str "own",Space,Str "convenience.",SoftBreak,Str "The",Space,Str "Hanged",Space,Str "Man,",Space,Str "a",Space,Str "member",Space,Str "of",Space,Str "the",Space,Str "traditional",Space,Str "pack,",Space,Str "fits",Space,Str "my",Space,Str "purpose",Space,Str "in",Space,Str "two",SoftBreak,Str "ways:",Space,Str "because",Space,Str "he",Space,Str "is",Space,Str "associated",Space,Str "in",Space,Str "my",Space,Str "mind",Space,Str "with",Space,Str "the",Space,Str "Hanged",Space,Str "God",Space,Str "of",Space,Str "Frazer,",SoftBreak,Str "and",Space,Str "because",Space,Str "I",Space,Str "associate",Space,Str "him",Space,Str "with",Space,Str "the",Space,Str "hooded",Space,Str "figure",Space,Str "in",Space,Str "the",Space,Str "passage",Space,Str "of",Space,Str "the",SoftBreak,Str "disciples",Space,Str "to",Space,Str "Emmaus",Space,Str "in",Space,Str "Part",Space,Str "V.",Space,Str "The",Space,Str "Phoenician",Space,Str "Sailor",Space,Str "and",Space,Str "the",Space,Str "Merchant",SoftBreak,Str "appear",Space,Str "later;",Space,Str "also",Space,Str "the",Space,Str "\"crowds",Space,Str "of",Space,Str "people,\"",Space,Str "and",Space,Str "Death",Space,Str "by",Space,Str "Water",Space,Str "is",SoftBreak,Str "executed",Space,Str "in",Space,Str "Part",Space,Str "IV.",Space,Str "The",Space,Str "Man",Space,Str "with",Space,Str "Three",Space,Str "Staves",Space,Str "(an",Space,Str "authentic",Space,Str "member",Space,Str "of",SoftBreak,Str "the",Space,Str "Tarot",Space,Str "pack)",Space,Str "I",Space,Str "associate,",Space,Str "quite",Space,Str "arbitrarily,",Space,Str "with",Space,Str "the",Space,Str "Fisher",Space,Str "King",SoftBreak,Str "himself."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Is",Space,Str "your",Space,Str "card,",Space,Str "the",Space,Str "drowned",Space,Str "Phoenician",Space,Str "Sailor,"]]
-   ,Div ("",[],[])
-    [Plain [Str "(Those",Space,Str "are",Space,Str "pearls",Space,Str "that",Space,Str "were",Space,Str "his",Space,Str "eyes.",Space,Str "Look!)"]]
-   ,Div ("",[],[])
-    [Plain [Str "Here",Space,Str "is",Space,Str "Belladonna,",Space,Str "the",Space,Str "Lady",Space,Str "of",Space,Str "the",Space,Str "Rocks,"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "lady",Space,Str "of",Space,Str "situations.",Span ("",["lnum"],[]) [Str "50"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Here",Space,Str "is",Space,Str "the",Space,Str "man",Space,Str "with",Space,Str "three",Space,Str "staves,",Space,Str "and",Space,Str "here",Space,Str "the",Space,Str "Wheel,"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "here",Space,Str "is",Space,Str "the",Space,Str "one-eyed",Space,Str "merchant,",Space,Str "and",Space,Str "this",Space,Str "card,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Which",Space,Str "is",Space,Str "blank,",Space,Str "is",Space,Str "something",Space,Str "he",Space,Str "carries",Space,Str "on",Space,Str "his",Space,Str "back,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Which",Space,Str "I",Space,Str "am",Space,Str "forbidden",Space,Str "to",Space,Str "see.",Space,Str "I",Space,Str "do",Space,Str "not",Space,Str "find"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "Hanged",Space,Str "Man.",Space,Str "Fear",Space,Str "death",Space,Str "by",Space,Str "water."]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "see",Space,Str "crowds",Space,Str "of",Space,Str "people,",Space,Str "walking",Space,Str "round",Space,Str "in",Space,Str "a",Space,Str "ring."]]
-   ,Div ("",[],[])
-    [Plain [Str "Thank",Space,Str "you.",Space,Str "If",Space,Str "you",Space,Str "see",Space,Str "dear",Space,Str "Mrs.",Space,Str "Equitone,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Tell",Space,Str "her",Space,Str "I",Space,Str "bring",Space,Str "the",Space,Str "horoscope",Space,Str "myself:"]]
-   ,Div ("",[],[])
-    [Plain [Str "One",Space,Str "must",Space,Str "be",Space,Str "so",Space,Str "careful",Space,Str "these",Space,Str "days."]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("wasteland-content.xhtml#ln60",[],[])
-    [Plain [Str "Unreal",Space,Str "City,",Note [Para [Link ("",[],[]) [Str "60."] ("#wasteland-content.xhtml#ln60",""),Space,Str "Cf.",Space,Str "Baudelaire:"],BlockQuote [Para [Str "\"Fourmillante",Space,Str "cite;,",Space,Str "cite;",Space,Str "pleine",Space,Str "de",Space,Str "reves,",LineBreak,Str "Ou",Space,Str "le",Space,Str "spectre",Space,Str "en",SoftBreak,Str "plein",Space,Str "jour",Space,Str "raccroche",Space,Str "le",Space,Str "passant.\""]]],Span ("",["lnum"],[]) [Str "60"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Under",Space,Str "the",Space,Str "brown",Space,Str "fog",Space,Str "of",Space,Str "a",Space,Str "winter",Space,Str "dawn,"]]
-   ,Div ("",[],[])
-    [Plain [Str "A",Space,Str "crowd",Space,Str "flowed",Space,Str "over",Space,Str "London",Space,Str "Bridge,",Space,Str "so",Space,Str "many,"]]
-   ,Div ("wasteland-content.xhtml#ln63",[],[])
-    [Plain [Str "I",Space,Str "had",Space,Str "not",Space,Str "thought",Space,Str "death",Space,Str "had",Space,Str "undone",Space,Str "so",Space,Str "many.",Note [Para [Link ("",[],[]) [Str "63."] ("#wasteland-content.xhtml#ln63",""),Space,Str "Cf.",Space,Str "Inferno,",Space,Str "iii.",Space,Str "55-7."],BlockQuote [Para [Str "\"si",Space,Str "lunga",Space,Str "tratta",LineBreak,Str "di",Space,Str "gente,",Space,Str "ch'io",Space,Str "non",Space,Str "avrei",Space,Str "mai",Space,Str "creduto",LineBreak,Str "che",SoftBreak,Str "morte",Space,Str "tanta",Space,Str "n'avesse",Space,Str "disfatta.\""]]]]]
-   ,Div ("wasteland-content.xhtml#ln64",[],[])
-    [Plain [Str "Sighs,",Space,Str "short",Space,Str "and",Space,Str "infrequent,",Space,Str "were",Space,Str "exhaled,",Note [Para [Link ("",[],[]) [Str "64."] ("#wasteland-content.xhtml#ln64",""),Space,Str "Cf.",Space,Str "Inferno,",Space,Str "iv.",Space,Str "25-7:"],BlockQuote [Para [Str "\"Quivi,",Space,Str "secondo",Space,Str "che",Space,Str "per",Space,Str "ascoltahre,",LineBreak,Str "\"non",Space,Str "avea",Space,Str "pianto,",Space,Str "ma'",Space,Str "che",Space,Str "di",SoftBreak,Str "sospiri,",LineBreak,Str "\"che",Space,Str "l'aura",Space,Str "eterna",Space,Str "facevan",Space,Str "tremare.\""]]]]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "each",Space,Str "man",Space,Str "fixed",Space,Str "his",Space,Str "eyes",Space,Str "before",Space,Str "his",Space,Str "feet."]]
-   ,Div ("",[],[])
-    [Plain [Str "Flowed",Space,Str "up",Space,Str "the",Space,Str "hill",Space,Str "and",Space,Str "down",Space,Str "King",Space,Str "William",Space,Str "Street,"]]
-   ,Div ("",[],[])
-    [Plain [Str "To",Space,Str "where",Space,Str "Saint",Space,Str "Mary",Space,Str "Woolnoth",Space,Str "kept",Space,Str "the",Space,Str "hours"]]
-   ,Div ("wasteland-content.xhtml#ln68",[],[])
-    [Plain [Str "With",Space,Str "a",Space,Str "dead",Space,Str "sound",Space,Str "on",Space,Str "the",Space,Str "final",Space,Str "stroke",Space,Str "of",Space,Str "nine.",Note [Para [Link ("",[],[]) [Str "68."] ("#wasteland-content.xhtml#ln68",""),Space,Str "A",Space,Str "phenomenon",Space,Str "which",Space,Str "I",Space,Str "have",Space,Str "often",Space,Str "noticed."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "There",Space,Str "I",Space,Str "saw",Space,Str "one",Space,Str "I",Space,Str "knew,",Space,Str "and",Space,Str "stopped",Space,Str "him,",Space,Str "crying",SoftBreak,Str "\"Stetson!"]]
-   ,Div ("",[],[])
-    [Plain [Str "\"You",Space,Str "who",Space,Str "were",Space,Str "with",Space,Str "me",Space,Str "in",Space,Str "the",Space,Str "ships",Space,Str "at",Space,Str "Mylae!",Span ("",["lnum"],[]) [Str "70"]]]
-   ,Div ("",[],[])
-    [Plain [Str "\"That",Space,Str "corpse",Space,Str "you",Space,Str "planted",Space,Str "last",Space,Str "year",Space,Str "in",Space,Str "your",Space,Str "garden,"]]
-   ,Div ("",[],[])
-    [Plain [Str "\"Has",Space,Str "it",Space,Str "begun",Space,Str "to",Space,Str "sprout?",Space,Str "Will",Space,Str "it",Space,Str "bloom",Space,Str "this",Space,Str "year?"]]
-   ,Div ("",[],[])
-    [Plain [Str "\"Or",Space,Str "has",Space,Str "the",Space,Str "sudden",Space,Str "frost",Space,Str "disturbed",Space,Str "its",Space,Str "bed?"]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("wasteland-content.xhtml#ln74",[],[])
-    [Plain [Str "\"Oh",Space,Str "keep",Space,Str "the",Space,Str "Dog",Space,Str "far",Space,Str "hence,",Space,Str "that's",Space,Str "friend",Space,Str "to",Space,Str "men,",Note [Para [Link ("",[],[]) [Str "74."] ("#wasteland-content.xhtml#ln74",""),Space,Str "Cf.",Space,Str "the",Space,Str "Dirge",Space,Str "in",Space,Str "Webster's",Space,Str "White",Space,Str "Devil",Space,Str "."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "\"Or",Space,Str "with",Space,Str "his",Space,Str "nails",Space,Str "he'll",Space,Str "dig",Space,Str "it",Space,Str "up",Space,Str "again!"]]
-   ,Div ("wasteland-content.xhtml#ln76",[],[])
-    [Plain [Str "\"You!",Space,Span ("",[],[("lang","fr")]) [Str "hypocrite",Space,Str "lecteur!",Space,Str "-",Space,Str "mon",Space,Str "semblable,",Space,Str "-",SoftBreak,Str "mon",Space,Str "frere"],Space,Str "!\"",Note [Para [Link ("",[],[]) [Str "76."] ("#wasteland-content.xhtml#ln76",""),Space,Str "V.",Space,Str "Baudelaire,",Space,Str "Preface",Space,Str "to",Space,Str "Fleurs",Space,Str "du",Space,Str "Mal."]]]]]]
- ,Div ("wasteland-content.xhtml#ch2",["section"],[])
-  [Header 2 ("",[],[]) [Str "II.",Space,Str "A",Space,Str "GAME",Space,Str "OF",Space,Str "CHESS"]
-  ,Div ("",["linegroup"],[])
-   [Div ("wasteland-content.xhtml#ln77",[],[])
-    [Plain [Str "The",Space,Str "Chair",Space,Str "she",Space,Str "sat",Space,Str "in,",Space,Str "like",Space,Str "a",Space,Str "burnished",Space,Str "throne,",Note [Para [Link ("",[],[]) [Str "77."] ("#wasteland-content.xhtml#ln77",""),Space,Str "Cf.",Space,Str "Antony",Space,Str "and",Space,Str "Cleopatra,",Space,Str "II.",Space,Str "ii.,",Space,Str "l.",Space,Str "190."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Glowed",Space,Str "on",Space,Str "the",Space,Str "marble,",Space,Str "where",Space,Str "the",Space,Str "glass"]]
-   ,Div ("",[],[])
-    [Plain [Str "Held",Space,Str "up",Space,Str "by",Space,Str "standards",Space,Str "wrought",Space,Str "with",Space,Str "fruited",Space,Str "vines"]]
-   ,Div ("",[],[])
-    [Plain [Str "From",Space,Str "which",Space,Str "a",Space,Str "golden",Space,Str "Cupidon",Space,Str "peeped",Space,Str "out",Span ("",["lnum"],[]) [Str "80"]]]
-   ,Div ("",[],[])
-    [Plain [Str "(Another",Space,Str "hid",Space,Str "his",Space,Str "eyes",Space,Str "behind",Space,Str "his",Space,Str "wing)"]]
-   ,Div ("",[],[])
-    [Plain [Str "Doubled",Space,Str "the",Space,Str "flames",Space,Str "of",Space,Str "sevenbranched",Space,Str "candelabra"]]
-   ,Div ("",[],[])
-    [Plain [Str "Reflecting",Space,Str "light",Space,Str "upon",Space,Str "the",Space,Str "table",Space,Str "as"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "glitter",Space,Str "of",Space,Str "her",Space,Str "jewels",Space,Str "rose",Space,Str "to",Space,Str "meet",Space,Str "it,"]]
-   ,Div ("",[],[])
-    [Plain [Str "From",Space,Str "satin",Space,Str "cases",Space,Str "poured",Space,Str "in",Space,Str "rich",Space,Str "profusion;"]]
-   ,Div ("",[],[])
-    [Plain [Str "In",Space,Str "vials",Space,Str "of",Space,Str "ivory",Space,Str "and",Space,Str "coloured",Space,Str "glass"]]
-   ,Div ("",[],[])
-    [Plain [Str "Unstoppered,",Space,Str "lurked",Space,Str "her",Space,Str "strange",Space,Str "synthetic",Space,Str "perfumes,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Unguent,",Space,Str "powdered,",Space,Str "or",Space,Str "liquid",Space,Str "-",Space,Str "troubled,",Space,Str "confused"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "drowned",Space,Str "the",Space,Str "sense",Space,Str "in",Space,Str "odours;",Space,Str "stirred",Space,Str "by",Space,Str "the",Space,Str "air"]]
-   ,Div ("",[],[])
-    [Plain [Str "That",Space,Str "freshened",Space,Str "from",Space,Str "the",Space,Str "window,",Space,Str "these",Space,Str "ascended",Span ("",["lnum"],[]) [Str "90"]]]
-   ,Div ("",[],[])
-    [Plain [Str "In",Space,Str "fattening",Space,Str "the",Space,Str "prolonged",Space,Str "candle-flames,"]]
-   ,Div ("wasteland-content.xhtml#ln92",[],[])
-    [Plain [Str "Flung",Space,Str "their",Space,Str "smoke",Space,Str "into",Space,Str "the",Space,Str "laquearia,",Note [Para [Link ("",[],[]) [Str "92."] ("#wasteland-content.xhtml#ln92",""),Space,Str "Laquearia.",Space,Str "V.",Space,Str "Aeneid,",Space,Str "I.",Space,Str "726:"],BlockQuote [Para [Str "dependent",Space,Str "lychni",Space,Str "laquearibus",Space,Str "aureis",Space,Str "incensi,",Space,Str "et",Space,Str "noctem",SoftBreak,Str "flammis",LineBreak,Str "funalia",Space,Str "vincunt."]]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Stirring",Space,Str "the",Space,Str "pattern",Space,Str "on",Space,Str "the",Space,Str "coffered",Space,Str "ceiling."]]
-   ,Div ("",[],[])
-    [Plain [Str "Huge",Space,Str "sea-wood",Space,Str "fed",Space,Str "with",Space,Str "copper"]]
-   ,Div ("",[],[])
-    [Plain [Str "Burned",Space,Str "green",Space,Str "and",Space,Str "orange,",Space,Str "framed",Space,Str "by",Space,Str "the",Space,Str "coloured",Space,Str "stone,"]]
-   ,Div ("",[],[])
-    [Plain [Str "In",Space,Str "which",Space,Str "sad",Space,Str "light",Space,Str "a",Space,Str "carved",Space,Str "dolphin",Space,Str "swam."]]
-   ,Div ("",[],[])
-    [Plain [Str "Above",Space,Str "the",Space,Str "antique",Space,Str "mantel",Space,Str "was",Space,Str "displayed"]]
-   ,Div ("wasteland-content.xhtml#ln98",[],[])
-    [Plain [Str "As",Space,Str "though",Space,Str "a",Space,Str "window",Space,Str "gave",Space,Str "upon",Space,Str "the",Space,Str "sylvan",Space,Str "scene",Note [Para [Link ("",[],[]) [Str "98."] ("#wasteland-content.xhtml#ln98",""),Space,Str "Sylvan",Space,Str "scene.",Space,Str "V.",Space,Str "Milton,",Space,Str "Paradise",Space,Str "Lost,",Space,Str "iv.",Space,Str "140."]]]]
-   ,Div ("wasteland-content.xhtml#ln99",[],[])
-    [Plain [Str "The",Space,Str "change",Space,Str "of",Space,Str "Philomel,",Space,Str "by",Space,Str "the",Space,Str "barbarous",Space,Str "king",Note [Para [Link ("",[],[]) [Str "99."] ("#wasteland-content.xhtml#ln99",""),Space,Str "V.",Space,Str "Ovid,",Space,Str "Metamorphoses,",Space,Str "vi,",Space,Str "Philomela."]]]]
-   ,Div ("wasteland-content.xhtml#ln100",[],[])
-    [Plain [Str "So",Space,Str "rudely",Space,Str "forced;",Space,Str "yet",Space,Str "there",Space,Str "the",Space,Str "nightingale",Note [Para [Link ("",[],[]) [Str "100."] ("#wasteland-content.xhtml#ln100",""),Space,Str "Cf.",Space,Str "Part",Space,Str "III,",Space,Str "l.",Space,Str "204."]],SoftBreak,Span ("",["lnum"],[]) [Str "100"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Filled",Space,Str "all",Space,Str "the",Space,Str "desert",Space,Str "with",Space,Str "inviolable",Space,Str "voice"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "still",Space,Str "she",Space,Str "cried,",Space,Str "and",Space,Str "still",Space,Str "the",Space,Str "world",Space,Str "pursues,"]]
-   ,Div ("",[],[])
-    [Plain [Str "\"Jug",Space,Str "Jug\"",Space,Str "to",Space,Str "dirty",Space,Str "ears."]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "other",Space,Str "withered",Space,Str "stumps",Space,Str "of",Space,Str "time"]]
-   ,Div ("",[],[])
-    [Plain [Str "Were",Space,Str "told",Space,Str "upon",Space,Str "the",Space,Str "walls;",Space,Str "staring",Space,Str "forms"]]
-   ,Div ("",[],[])
-    [Plain [Str "Leaned",Space,Str "out,",Space,Str "leaning,",Space,Str "hushing",Space,Str "the",Space,Str "room",Space,Str "enclosed."]]
-   ,Div ("",[],[])
-    [Plain [Str "Footsteps",Space,Str "shuffled",Space,Str "on",Space,Str "the",Space,Str "stair."]]
-   ,Div ("",[],[])
-    [Plain [Str "Under",Space,Str "the",Space,Str "firelight,",Space,Str "under",Space,Str "the",Space,Str "brush,",Space,Str "her",Space,Str "hair"]]
-   ,Div ("",[],[])
-    [Plain [Str "Spread",Space,Str "out",Space,Str "in",Space,Str "fiery",Space,Str "points"]]
-   ,Div ("",[],[])
-    [Plain [Str "Glowed",Space,Str "into",Space,Str "words,",Space,Str "then",Space,Str "would",Space,Str "be",Space,Str "savagely",Space,Str "still.",Span ("",["lnum"],[]) [Str "110"]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",["linegroup"],[])
-    [Div ("",[],[])
-     [Plain [Str "\"My",Space,Str "nerves",Space,Str "are",Space,Str "bad",Space,Str "to-night.",Space,Str "Yes,",Space,Str "bad.",Space,Str "Stay",Space,Str "with",Space,Str "me."]]
-    ,Div ("",[],[])
-     [Plain [Str "\"Speak",Space,Str "to",Space,Str "me.",Space,Str "Why",Space,Str "do",Space,Str "you",Space,Str "never",Space,Str "speak.",Space,Str "Speak."]]
-    ,Div ("",[],[])
-     [Plain [Str "\"What",Space,Str "are",Space,Str "you",Space,Str "thinking",Space,Str "of?",Space,Str "What",Space,Str "thinking?",Space,Str "What?"]]
-    ,Div ("",[],[])
-     [Plain [Str "\"I",Space,Str "never",Space,Str "know",Space,Str "what",Space,Str "you",Space,Str "are",Space,Str "thinking.",Space,Str "Think.\""]]]
-   ,Div ("",["linegroup"],[])
-    [Div ("wasteland-content.xhtml#ln115",[],[])
-     [Plain [Str "I",Space,Str "think",Space,Str "we",Space,Str "are",Space,Str "in",Space,Str "rats'",Space,Str "alley",Note [Para [Link ("",[],[]) [Str "115."] ("#wasteland-content.xhtml#ln115",""),Space,Str "Cf.",Space,Str "Part",Space,Str "III,",Space,Str "l.",Space,Str "195."]]]]
-    ,Div ("",[],[])
-     [Plain [Str "Where",Space,Str "the",Space,Str "dead",Space,Str "men",Space,Str "lost",Space,Str "their",Space,Str "bones."]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "\"What",Space,Str "is",Space,Str "that",Space,Str "noise?\""]]
-   ,Div ("wasteland-content.xhtml#ln118",["indent"],[])
-    [Plain [Str "The",Space,Str "wind",Space,Str "under",Space,Str "the",Space,Str "door.",Note [Para [Link ("",[],[]) [Str "118."] ("#wasteland-content.xhtml#ln118",""),Space,Str "Cf.",Space,Str "Webster:"],BlockQuote [Para [Str "\"Is",Space,Str "the",Space,Str "wind",Space,Str "in",Space,Str "that",Space,Str "door",Space,Str "still?\""]]]]]
-   ,Div ("",[],[])
-    [Plain [Str "\"What",Space,Str "is",Space,Str "that",Space,Str "noise",Space,Str "now?",Space,Str "What",Space,Str "is",Space,Str "the",Space,Str "wind",Space,Str "doing?\""]]
-   ,Div ("",["indent"],[])
-    [Plain [Str "Nothing",Space,Str "again",Space,Str "nothing.",Span ("",["lnum"],[]) [Str "120"]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "\"Do"]]
-   ,Div ("",[],[])
-    [Plain [Str "\"You",Space,Str "know",Space,Str "nothing?",Space,Str "Do",Space,Str "you",Space,Str "see",Space,Str "nothing?",Space,Str "Do",Space,Str "you",Space,Str "remember"]]
-   ,Div ("",[],[])
-    [Plain [Str "\"Nothing?\""]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "I",Space,Str "remember"]]
-   ,Div ("",[],[])
-    [Plain [Str "Those",Space,Str "are",Space,Str "pearls",Space,Str "that",Space,Str "were",Space,Str "his",Space,Str "eyes."]]
-   ,Div ("wasteland-content.xhtml#ln126",[],[])
-    [Plain [Str "\"Are",Space,Str "you",Space,Str "alive,",Space,Str "or",Space,Str "not?",Space,Str "Is",Space,Str "there",Space,Str "nothing",Space,Str "in",Space,Str "your",Space,Str "head?\"",Note [Para [Link ("",[],[]) [Str "126."] ("#wasteland-content.xhtml#ln126",""),Space,Str "Cf.",Space,Str "Part",Space,Str "I,",Space,Str "l.",Space,Str "37,",Space,Str "48."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "But"]]
-   ,Div ("",[],[])
-    [Plain [Str "O",Space,Str "O",Space,Str "O",Space,Str "O",Space,Str "that",Space,Str "Shakespeherian",Space,Str "Rag\8213"]]
-   ,Div ("",[],[])
-    [Plain [Str "It's",Space,Str "so",Space,Str "elegant"]]
-   ,Div ("",[],[])
-    [Plain [Str "So",Space,Str "intelligent",Span ("",["lnum"],[]) [Str "130"]]]
-   ,Div ("",[],[])
-    [Plain [Str "\"What",Space,Str "shall",Space,Str "I",Space,Str "do",Space,Str "now?",Space,Str "What",Space,Str "shall",Space,Str "I",Space,Str "do?\""]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "shall",Space,Str "rush",Space,Str "out",Space,Str "as",Space,Str "I",Space,Str "am,",Space,Str "and",Space,Str "walk",Space,Str "the",Space,Str "street"]]
-   ,Div ("",[],[])
-    [Plain [Str "\"With",Space,Str "my",Space,Str "hair",Space,Str "down,",Space,Str "so.",Space,Str "What",Space,Str "shall",Space,Str "we",Space,Str "do",Space,Str "to-morrow?"]]
-   ,Div ("",[],[])
-    [Plain [Str "\"What",Space,Str "shall",Space,Str "we",Space,Str "ever",Space,Str "do?\""]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "hot",Space,Str "water",Space,Str "at",Space,Str "ten."]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "if",Space,Str "it",Space,Str "rains,",Space,Str "a",Space,Str "closed",Space,Str "car",Space,Str "at",Space,Str "four."]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "we",Space,Str "shall",Space,Str "play",Space,Str "a",Space,Str "game",Space,Str "of",Space,Str "chess,"]]
-   ,Div ("wasteland-content.xhtml#ln138",[],[])
-    [Plain [Str "Pressing",Space,Str "lidless",Space,Str "eyes",Space,Str "and",Space,Str "waiting",Space,Str "for",Space,Str "a",Space,Str "knock",Space,Str "upon",Space,Str "the",Space,Str "door.",Note [Para [Link ("",[],[]) [Str "138."] ("#wasteland-content.xhtml#ln138",""),Space,Str "Cf.",Space,Str "the",Space,Str "game",Space,Str "of",Space,Str "chess",Space,Str "in",Space,Str "Middleton's",Space,Str "Women",Space,Str "beware",Space,Str "Women."]]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "When",Space,Str "Lil's",Space,Str "husband",Space,Str "got",Space,Str "demobbed,",Space,Str "I",Space,Str "said",Space,Str "-"]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "didn't",Space,Str "mince",Space,Str "my",Space,Str "words,",Space,Str "I",Space,Str "said",Space,Str "to",Space,Str "her",Space,Str "myself,",Span ("",["lnum"],[]) [Str "140"]]]
-   ,Div ("",[],[])
-    [Plain [Str "HURRY",Space,Str "UP",Space,Str "PLEASE",Space,Str "ITS",Space,Str "TIME"]]
-   ,Div ("",[],[])
-    [Plain [Str "Now",Space,Str "Albert's",Space,Str "coming",Space,Str "back,",Space,Str "make",Space,Str "yourself",Space,Str "a",Space,Str "bit",Space,Str "smart."]]
-   ,Div ("",[],[])
-    [Plain [Str "He'll",Space,Str "want",Space,Str "to",Space,Str "know",Space,Str "what",Space,Str "you",Space,Str "done",Space,Str "with",Space,Str "that",Space,Str "money",Space,Str "he",Space,Str "gave",SoftBreak,Str "you"]]
-   ,Div ("",[],[])
-    [Plain [Str "To",Space,Str "get",Space,Str "yourself",Space,Str "some",Space,Str "teeth.",Space,Str "He",Space,Str "did,",Space,Str "I",Space,Str "was",Space,Str "there."]]
-   ,Div ("",[],[])
-    [Plain [Str "You",Space,Str "have",Space,Str "them",Space,Str "all",Space,Str "out,",Space,Str "Lil,",Space,Str "and",Space,Str "get",Space,Str "a",Space,Str "nice",Space,Str "set,"]]
-   ,Div ("",[],[])
-    [Plain [Str "He",Space,Str "said,",Space,Str "I",Space,Str "swear,",Space,Str "I",Space,Str "can't",Space,Str "bear",Space,Str "to",Space,Str "look",Space,Str "at",Space,Str "you."]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "no",Space,Str "more",Space,Str "can't",Space,Str "I,",Space,Str "I",Space,Str "said,",Space,Str "and",Space,Str "think",Space,Str "of",Space,Str "poor",Space,Str "Albert,"]]
-   ,Div ("",[],[])
-    [Plain [Str "He's",Space,Str "been",Space,Str "in",Space,Str "the",Space,Str "army",Space,Str "four",Space,Str "years,",Space,Str "he",Space,Str "wants",Space,Str "a",Space,Str "good",Space,Str "time,"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "if",Space,Str "you",Space,Str "don't",Space,Str "give",Space,Str "it",Space,Str "him,",Space,Str "there's",Space,Str "others",Space,Str "will,",Space,Str "I",SoftBreak,Str "said."]]
-   ,Div ("",[],[])
-    [Plain [Str "Oh",Space,Str "is",Space,Str "there,",Space,Str "she",Space,Str "said.",Space,Str "Something",Space,Str "o'",Space,Str "that,",Space,Str "I",Space,Str "said.",Span ("",["lnum"],[]) [Str "150"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Then",Space,Str "I'll",Space,Str "know",Space,Str "who",Space,Str "to",Space,Str "thank,",Space,Str "she",Space,Str "said,",Space,Str "and",Space,Str "give",Space,Str "me",Space,Str "a",Space,Str "straight",SoftBreak,Str "look."]]
-   ,Div ("",[],[])
-    [Plain [Str "HURRY",Space,Str "UP",Space,Str "PLEASE",Space,Str "ITS",Space,Str "TIME"]]
-   ,Div ("",[],[])
-    [Plain [Str "If",Space,Str "you",Space,Str "don't",Space,Str "like",Space,Str "it",Space,Str "you",Space,Str "can",Space,Str "get",Space,Str "on",Space,Str "with",Space,Str "it,",Space,Str "I",Space,Str "said."]]
-   ,Div ("",[],[])
-    [Plain [Str "Others",Space,Str "can",Space,Str "pick",Space,Str "and",Space,Str "choose",Space,Str "if",Space,Str "you",Space,Str "can't."]]
-   ,Div ("",[],[])
-    [Plain [Str "But",Space,Str "if",Space,Str "Albert",Space,Str "makes",Space,Str "off,",Space,Str "it",Space,Str "won't",Space,Str "be",Space,Str "for",Space,Str "lack",Space,Str "of",SoftBreak,Str "telling."]]
-   ,Div ("",[],[])
-    [Plain [Str "You",Space,Str "ought",Space,Str "to",Space,Str "be",Space,Str "ashamed,",Space,Str "I",Space,Str "said,",Space,Str "to",Space,Str "look",Space,Str "so",Space,Str "antique."]]
-   ,Div ("",[],[])
-    [Plain [Str "(And",Space,Str "her",Space,Str "only",Space,Str "thirty-one.)"]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "can't",Space,Str "help",Space,Str "it,",Space,Str "she",Space,Str "said,",Space,Str "pulling",Space,Str "a",Space,Str "long",Space,Str "face,"]]
-   ,Div ("",[],[])
-    [Plain [Str "It's",Space,Str "them",Space,Str "pills",Space,Str "I",Space,Str "took,",Space,Str "to",Space,Str "bring",Space,Str "it",Space,Str "off,",Space,Str "she",Space,Str "said."]]
-   ,Div ("",[],[])
-    [Plain [Str "(She's",Space,Str "had",Space,Str "five",Space,Str "already,",Space,Str "and",Space,Str "nearly",Space,Str "died",Space,Str "of",Space,Str "young",Space,Str "George.)",Span ("",["lnum"],[]) [Str "160"]]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "chemist",Space,Str "said",Space,Str "it",Space,Str "would",Space,Str "be",Space,Str "all",Space,Str "right,",Space,Str "but",Space,Str "I've",Space,Str "never",Space,Str "been",Space,Str "the",SoftBreak,Str "same."]]
-   ,Div ("",[],[])
-    [Plain [Str "You",Space,Emph [Str "are"],Space,Str "a",Space,Str "proper",Space,Str "fool,",Space,Str "I",Space,Str "said."]]
-   ,Div ("",[],[])
-    [Plain [Str "Well,",Space,Str "if",Space,Str "Albert",Space,Str "won't",Space,Str "leave",Space,Str "you",Space,Str "alone,",Space,Str "there",Space,Str "it",Space,Str "is,",Space,Str "I",SoftBreak,Str "said,"]]
-   ,Div ("",[],[])
-    [Plain [Str "What",Space,Str "you",Space,Str "get",Space,Str "married",Space,Str "for",Space,Str "if",Space,Str "you",Space,Str "don't",Space,Str "want",Space,Str "children?"]]
-   ,Div ("",[],[])
-    [Plain [Str "HURRY",Space,Str "UP",Space,Str "PLEASE",Space,Str "ITS",Space,Str "TIME"]]
-   ,Div ("",[],[])
-    [Plain [Str "Well,",Space,Str "that",Space,Str "Sunday",Space,Str "Albert",Space,Str "was",Space,Str "home,",Space,Str "they",Space,Str "had",Space,Str "a",Space,Str "hot",SoftBreak,Str "gammon,"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "they",Space,Str "asked",Space,Str "me",Space,Str "in",Space,Str "to",Space,Str "dinner,",Space,Str "to",Space,Str "get",Space,Str "the",Space,Str "beauty",Space,Str "of",Space,Str "it",SoftBreak,Str "hot\8213"]]
-   ,Div ("",[],[])
-    [Plain [Str "HURRY",Space,Str "UP",Space,Str "PLEASE",Space,Str "ITS",Space,Str "TIME"]]
-   ,Div ("",[],[])
-    [Plain [Str "HURRY",Space,Str "UP",Space,Str "PLEASE",Space,Str "ITS",Space,Str "TIME"]]
-   ,Div ("",[],[])
-    [Plain [Str "Goonight",Space,Str "Bill.",Space,Str "Goonight",Space,Str "Lou.",Space,Str "Goonight",Space,Str "May.",Space,Str "Goonight.",Span ("",["lnum"],[]) [Str "170"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Ta",Space,Str "ta.",Space,Str "Goonight.",Space,Str "Goonight."]]
-   ,Div ("",[],[])
-    [Plain [Str "Good",Space,Str "night,",Space,Str "ladies,",Space,Str "good",Space,Str "night,",Space,Str "sweet",Space,Str "ladies,",Space,Str "good",Space,Str "night,",Space,Str "good",SoftBreak,Str "night."]]]]
- ,Div ("wasteland-content.xhtml#ch3",["section"],[])
-  [Header 2 ("",[],[]) [Str "III.",Space,Str "THE",Space,Str "FIRE",Space,Str "SERMON"]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "The",Space,Str "river's",Space,Str "tent",Space,Str "is",Space,Str "broken:",Space,Str "the",Space,Str "last",Space,Str "fingers",Space,Str "of",Space,Str "leaf"]]
-   ,Div ("",[],[])
-    [Plain [Str "Clutch",Space,Str "and",Space,Str "sink",Space,Str "into",Space,Str "the",Space,Str "wet",Space,Str "bank.",Space,Str "The",Space,Str "wind"]]
-   ,Div ("",[],[])
-    [Plain [Str "Crosses",Space,Str "the",Space,Str "brown",Space,Str "land,",Space,Str "unheard.",Space,Str "The",Space,Str "nymphs",Space,Str "are",SoftBreak,Str "departed."]]
-   ,Div ("wasteland-content.xhtml#ln176",[],[])
-    [Plain [Str "Sweet",Space,Str "Thames,",Space,Str "run",Space,Str "softly,",Space,Str "till",Space,Str "I",Space,Str "end",Space,Str "my",Space,Str "song.",Note [Para [Link ("",[],[]) [Str "176."] ("#wasteland-content.xhtml#ln176",""),Space,Str "V.",Space,Str "Spenser,",Space,Str "Prothalamion."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "river",Space,Str "bears",Space,Str "no",Space,Str "empty",Space,Str "bottles,",Space,Str "sandwich",Space,Str "papers,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Silk",Space,Str "handkerchiefs,",Space,Str "cardboard",Space,Str "boxes,",Space,Str "cigarette",Space,Str "ends"]]
-   ,Div ("",[],[])
-    [Plain [Str "Or",Space,Str "other",Space,Str "testimony",Space,Str "of",Space,Str "summer",Space,Str "nights.",Space,Str "The",Space,Str "nymphs",Space,Str "are",SoftBreak,Str "departed."]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "their",Space,Str "friends,",Space,Str "the",Space,Str "loitering",Space,Str "heirs",Space,Str "of",Space,Str "city",Space,Str "directors;",Span ("",["lnum"],[]) [Str "180"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Departed,",Space,Str "have",Space,Str "left",Space,Str "no",Space,Str "addresses."]]
-   ,Div ("",[],[])
-    [Plain [Str "By",Space,Str "the",Space,Str "waters",Space,Str "of",Space,Str "Leman",Space,Str "I",Space,Str "sat",Space,Str "down",Space,Str "and",Space,Str "wept",Space,Str ".",Space,Str ".",Space,Str "."]]
-   ,Div ("",[],[])
-    [Plain [Str "Sweet",Space,Str "Thames,",Space,Str "run",Space,Str "softly",Space,Str "till",Space,Str "I",Space,Str "end",Space,Str "my",Space,Str "song,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Sweet",Space,Str "Thames,",Space,Str "run",Space,Str "softly,",Space,Str "for",Space,Str "I",Space,Str "speak",Space,Str "not",Space,Str "loud",Space,Str "or",Space,Str "long."]]
-   ,Div ("",[],[])
-    [Plain [Str "But",Space,Str "at",Space,Str "my",Space,Str "back",Space,Str "in",Space,Str "a",Space,Str "cold",Space,Str "blast",Space,Str "I",Space,Str "hear"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "rattle",Space,Str "of",Space,Str "the",Space,Str "bones,",Space,Str "and",Space,Str "chuckle",Space,Str "spread",Space,Str "from",Space,Str "ear",Space,Str "to",SoftBreak,Str "ear."]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "A",Space,Str "rat",Space,Str "crept",Space,Str "softly",Space,Str "through",Space,Str "the",Space,Str "vegetation"]]
-   ,Div ("",[],[])
-    [Plain [Str "Dragging",Space,Str "its",Space,Str "slimy",Space,Str "belly",Space,Str "on",Space,Str "the",Space,Str "bank"]]
-   ,Div ("",[],[])
-    [Plain [Str "While",Space,Str "I",Space,Str "was",Space,Str "fishing",Space,Str "in",Space,Str "the",Space,Str "dull",Space,Str "canal"]]
-   ,Div ("",[],[])
-    [Plain [Str "On",Space,Str "a",Space,Str "winter",Space,Str "evening",Space,Str "round",Space,Str "behind",Space,Str "the",Space,Str "gashouse",Span ("",["lnum"],[]) [Str "190"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Musing",Space,Str "upon",Space,Str "the",Space,Str "king",Space,Str "my",Space,Str "brother's",Space,Str "wreck"]]
-   ,Div ("wasteland-content.xhtml#ln192",[],[])
-    [Plain [Str "And",Space,Str "on",Space,Str "the",Space,Str "king",Space,Str "my",Space,Str "father's",Space,Str "death",Space,Str "before",Space,Str "him.",Note [Para [Link ("",[],[]) [Str "192."] ("#wasteland-content.xhtml#ln192",""),Space,Str "Cf.",Space,Str "The",Space,Str "Tempest,",Space,Str "I.",Space,Str "ii."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "White",Space,Str "bodies",Space,Str "naked",Space,Str "on",Space,Str "the",Space,Str "low",Space,Str "damp",Space,Str "ground"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "bones",Space,Str "cast",Space,Str "in",Space,Str "a",Space,Str "little",Space,Str "low",Space,Str "dry",Space,Str "garret,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Rattled",Space,Str "by",Space,Str "the",Space,Str "rat's",Space,Str "foot",Space,Str "only,",Space,Str "year",Space,Str "to",Space,Str "year."]]
-   ,Div ("wasteland-content.xhtml#ln196",[],[])
-    [Plain [Str "But",Space,Str "at",Space,Str "my",Space,Str "back",Space,Str "from",Space,Str "time",Space,Str "to",Space,Str "time",Space,Str "I",Space,Str "hear",Note [Para [Link ("",[],[]) [Str "196."] ("#wasteland-content.xhtml#ln196",""),Space,Str "Cf.",Space,Str "Marvell,",Space,Str "To",Space,Str "His",Space,Str "Coy",Space,Str "Mistress."]]]]
-   ,Div ("wasteland-content.xhtml#ln197",[],[])
-    [Plain [Str "The",Space,Str "sound",Space,Str "of",Space,Str "horns",Space,Str "and",Space,Str "motors,",Space,Str "which",Space,Str "shall",Space,Str "bring",Note [Para [Link ("",[],[]) [Str "197."] ("#wasteland-content.xhtml#ln197",""),Space,Str "Cf.",Space,Str "Day,",Space,Str "Parliament",Space,Str "of",Space,Str "Bees:"],BlockQuote [Div ("",[],[]) [Div ("",[],[]) [Plain [Str "\"When",Space,Str "of",Space,Str "the",Space,Str "sudden,",Space,Str "listening,",Space,Str "you",Space,Str "shall",SoftBreak,Str "hear,"]],Div ("",[],[]) [Plain [Str "\"A",Space,Str "noise",Space,Str "of",Space,Str "horns",Space,Str "and",Space,Str "hunting,",Space,Str "which",Space,Str "shall",SoftBreak,Str "bring"]],Div ("",[],[]) [Plain [Str "\"Actaeon",Space,Str "to",Space,Str "Diana",Space,Str "in",Space,Str "the",Space,Str "spring,"]],Div ("",[],[]) [Plain [Str "\"Where",Space,Str "all",Space,Str "shall",Space,Str "see",Space,Str "her",Space,Str "naked",Space,Str "skin",Space,Str ".",Space,Str ".",Space,Str ".\""]]]]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Sweeney",Space,Str "to",Space,Str "Mrs.",Space,Str "Porter",Space,Str "in",Space,Str "the",Space,Str "spring."]]
-   ,Div ("wasteland-content.xhtml#ln199",[],[])
-    [Plain [Str "O",Space,Str "the",Space,Str "moon",Space,Str "shone",Space,Str "bright",Space,Str "on",Space,Str "Mrs.",Space,Str "Porter",Note [Para [Link ("",[],[]) [Str "199."] ("#wasteland-content.xhtml#ln199",""),Space,Str "I",Space,Str "do",Space,Str "not",Space,Str "know",Space,Str "the",Space,Str "origin",Space,Str "of",Space,Str "the",Space,Str "ballad",Space,Str "from",Space,Str "which",Space,Str "these",Space,Str "lines",Space,Str "are",SoftBreak,Str "taken:",Space,Str "it",Space,Str "was",Space,Str "reported",Space,Str "to",Space,Str "me",Space,Str "from",Space,Str "Sydney,",Space,Str "Australia."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "on",Space,Str "her",Space,Str "daughter",Span ("",["lnum"],[]) [Str "200"]]]
-   ,Div ("",[],[])
-    [Plain [Str "They",Space,Str "wash",Space,Str "their",Space,Str "feet",Space,Str "in",Space,Str "soda",Space,Str "water"]]
-   ,Div ("wasteland-content.xhtml#ln202",[],[("lang","fr")])
-    [Plain [Emph [Str "Et",Space,Str "O",Space,Str "ces",Space,Str "voix",Space,Str "d'enfants,",Space,Str "chantant",Space,Str "dans",Space,Str "la",Space,Str "coupole"],Str "!",Note [Para [Link ("",[],[]) [Str "202."] ("#wasteland-content.xhtml#ln202",""),Space,Str "V.",Space,Str "Verlaine,",Space,Str "Parsifal."]]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "Twit",Space,Str "twit",Space,Str "twit"]]
-   ,Div ("",[],[])
-    [Plain [Str "Jug",Space,Str "jug",Space,Str "jug",Space,Str "jug",Space,Str "jug",Space,Str "jug"]]
-   ,Div ("",[],[])
-    [Plain [Str "So",Space,Str "rudely",Space,Str "forc'd."]]
-   ,Div ("",[],[])
-    [Plain [Str "Tereu"]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "Unreal",Space,Str "City"]]
-   ,Div ("",[],[])
-    [Plain [Str "Under",Space,Str "the",Space,Str "brown",Space,Str "fog",Space,Str "of",Space,Str "a",Space,Str "winter",Space,Str "noon"]]
-   ,Div ("",[],[])
-    [Plain [Str "Mr.",Space,Str "Eugenides,",Space,Str "the",Space,Str "Smyrna",Space,Str "merchant"]]
-   ,Div ("wasteland-content.xhtml#ln210",[],[])
-    [Plain [Str "Unshaven,",Space,Str "with",Space,Str "a",Space,Str "pocket",Space,Str "full",Space,Str "of",Space,Str "currants",Note [Para [Link ("",[],[]) [Str "210."] ("#wasteland-content.xhtml#ln210",""),Space,Str "The",Space,Str "currants",Space,Str "were",Space,Str "quoted",Space,Str "at",Space,Str "a",Space,Str "price",Space,Str "\"cost",Space,Str "insurance",Space,Str "and",Space,Str "freight",Space,Str "to",SoftBreak,Str "London\";",Space,Str "and",Space,Str "the",Space,Str "Bill",Space,Str "of",Space,Str "Lading",Space,Str "etc.",Space,Str "were",Space,Str "to",Space,Str "be",Space,Str "handed",Space,Str "to",Space,Str "the",Space,Str "buyer",Space,Str "upon",SoftBreak,Str "payment",Space,Str "of",Space,Str "the",Space,Str "sight",Space,Str "draft."]],SoftBreak,Span ("",["lnum"],[]) [Str "210"]]]
-   ,Div ("",[],[])
-    [Plain [Str "C.i.f.",Space,Str "London:",Space,Str "documents",Space,Str "at",Space,Str "sight,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Asked",Space,Str "me",Space,Str "in",Space,Str "demotic",Space,Str "French"]]
-   ,Div ("",[],[])
-    [Plain [Str "To",Space,Str "luncheon",Space,Str "at",Space,Str "the",Space,Str "Cannon",Space,Str "Street",Space,Str "Hotel"]]
-   ,Div ("",[],[])
-    [Plain [Str "Followed",Space,Str "by",Space,Str "a",Space,Str "weekend",Space,Str "at",Space,Str "the",Space,Str "Metropole."]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "At",Space,Str "the",Space,Str "violet",Space,Str "hour,",Space,Str "when",Space,Str "the",Space,Str "eyes",Space,Str "and",Space,Str "back"]]
-   ,Div ("",[],[])
-    [Plain [Str "Turn",Space,Str "upward",Space,Str "from",Space,Str "the",Space,Str "desk,",Space,Str "when",Space,Str "the",Space,Str "human",Space,Str "engine",Space,Str "waits"]]
-   ,Div ("",[],[])
-    [Plain [Str "Like",Space,Str "a",Space,Str "taxi",Space,Str "throbbing",Space,Str "waiting,"]]
-   ,Div ("wasteland-content.xhtml#ln218",[],[])
-    [Plain [Str "I",Space,Str "Tiresias,",Space,Str "though",Space,Str "blind,",Space,Str "throbbing",Space,Str "between",Space,Str "two",Space,Str "lives,",Note [Para [Link ("",[],[]) [Str "218."] ("#wasteland-content.xhtml#ln218",""),Space,Str "Tiresias,",Space,Str "although",Space,Str "a",Space,Str "mere",Space,Str "spectator",Space,Str "and",Space,Str "not",Space,Str "indeed",Space,Str "a",Space,Str "\"character,\"",Space,Str "is",SoftBreak,Str "yet",Space,Str "the",Space,Str "most",Space,Str "important",Space,Str "personage",Space,Str "in",Space,Str "the",Space,Str "poem,",Space,Str "uniting",Space,Str "all",Space,Str "the",Space,Str "rest.",Space,Str "Just",SoftBreak,Str "as",Space,Str "the",Space,Str "one-eyed",Space,Str "merchant,",Space,Str "seller",Space,Str "of",Space,Str "currants,",Space,Str "melts",Space,Str "into",Space,Str "the",Space,Str "Phoenician",SoftBreak,Str "Sailor,",Space,Str "and",Space,Str "the",Space,Str "latter",Space,Str "is",Space,Str "not",Space,Str "wholly",Space,Str "distinct",Space,Str "from",Space,Str "Ferdinand",Space,Str "Prince",Space,Str "of",SoftBreak,Str "Naples,",Space,Str "so",Space,Str "all",Space,Str "the",Space,Str "women",Space,Str "are",Space,Str "one",Space,Str "woman,",Space,Str "and",Space,Str "the",Space,Str "two",Space,Str "sexes",Space,Str "meet",Space,Str "in",SoftBreak,Str "Tiresias.",Space,Str "What",Space,Str "Tiresias",Space,Str "sees,",Space,Str "in",Space,Str "fact,",Space,Str "is",Space,Str "the",Space,Str "substance",Space,Str "of",Space,Str "the",Space,Str "poem.",Space,Str "The",SoftBreak,Str "whole",Space,Str "passage",Space,Str "from",Space,Str "Ovid",Space,Str "is",Space,Str "of",Space,Str "great",Space,Str "anthropological",Space,Str "interest:"],BlockQuote [Para [Str "'.",Space,Str ".",Space,Str ".",Space,Str "Cum",Space,Str "Iunone",Space,Str "iocos",Space,Str "et",Space,Str "maior",Space,Str "vestra",Space,Str "profecto",Space,Str "est",LineBreak,Str "Quam,",Space,Str "quae",SoftBreak,Str "contingit",Space,Str "maribus,'",Space,Str "dixisse,",Space,Str "'voluptas.'",LineBreak,Str "Illa",Space,Str "negat;",Space,Str "placuit",SoftBreak,Str "quae",Space,Str "sit",Space,Str "sententia",Space,Str "docti",LineBreak,Str "Quaerere",Space,Str "Tiresiae:",Space,Str "venus",Space,Str "huic",Space,Str "erat",SoftBreak,Str "utraque",Space,Str "nota.",LineBreak,Str "Nam",Space,Str "duo",Space,Str "magnorum",Space,Str "viridi",Space,Str "coeuntia",Space,Str "silva",LineBreak,Str "Corpora",Space,Str "serpentum",Space,Str "baculi",Space,Str "violaverat",Space,Str "ictu",LineBreak,Str "Deque",Space,Str "viro",Space,Str "factus,",SoftBreak,Str "mirabile,",Space,Str "femina",Space,Str "septem",LineBreak,Str "Egerat",Space,Str "autumnos;",Space,Str "octavo",Space,Str "rursus",SoftBreak,Str "eosdem",LineBreak,Str "Vidit",Space,Str "et",Space,Str "'est",Space,Str "vestrae",Space,Str "si",Space,Str "tanta",Space,Str "potentia",Space,Str "plagae,'",LineBreak,Str "Dixit",Space,Str "'ut",Space,Str "auctoris",Space,Str "sortem",Space,Str "in",Space,Str "contraria",Space,Str "mutet,",LineBreak,Str "Nunc",Space,Str "quoque",Space,Str "vos",SoftBreak,Str "feriam!'",Space,Str "percussis",Space,Str "anguibus",Space,Str "isdem",LineBreak,Str "Forma",Space,Str "prior",Space,Str "rediit",SoftBreak,Str "genetivaque",Space,Str "venit",Space,Str "imago.",LineBreak,Str "Arbiter",Space,Str "hic",Space,Str "igitur",Space,Str "sumptus",Space,Str "de",Space,Str "lite",SoftBreak,Str "iocosa",LineBreak,Str "Dicta",Space,Str "Iovis",Space,Str "firmat;",Space,Str "gravius",Space,Str "Saturnia",Space,Str "iusto",LineBreak,Str "Nec",SoftBreak,Str "pro",Space,Str "materia",Space,Str "fertur",Space,Str "doluisse",Space,Str "suique",LineBreak,Str "Iudicis",Space,Str "aeterna",Space,Str "damnavit",SoftBreak,Str "lumina",Space,Str "nocte,",LineBreak,Str "At",Space,Str "pater",Space,Str "omnipotens",Space,Str "(neque",Space,Str "enim",Space,Str "licet",Space,Str "inrita",SoftBreak,Str "cuiquam",LineBreak,Str "Facta",Space,Str "dei",Space,Str "fecisse",Space,Str "deo)",Space,Str "pro",Space,Str "lumine",Space,Str "adempto",LineBreak,Str "Scire",SoftBreak,Str "futura",Space,Str "dedit",Space,Str "poenamque",Space,Str "levavit",Space,Str "honore.",LineBreak]]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Old",Space,Str "man",Space,Str "with",Space,Str "wrinkled",Space,Str "female",Space,Str "breasts,",Space,Str "can",Space,Str "see"]]
-   ,Div ("",[],[])
-    [Plain [Str "At",Space,Str "the",Space,Str "violet",Space,Str "hour,",Space,Str "the",Space,Str "evening",Space,Str "hour",Space,Str "that",Space,Str "strives",Span ("",["lnum"],[]) [Str "220"]]]
-   ,Div ("wasteland-content.xhtml#ln221",[],[])
-    [Plain [Str "Homeward,",Space,Str "and",Space,Str "brings",Space,Str "the",Space,Str "sailor",Space,Str "home",Space,Str "from",Space,Str "sea,",Note [Para [Link ("",[],[]) [Str "221."] ("#wasteland-content.xhtml#ln221",""),Space,Str "This",Space,Str "may",Space,Str "not",Space,Str "appear",Space,Str "as",Space,Str "exact",Space,Str "as",Space,Str "Sappho's",Space,Str "lines,",Space,Str "but",Space,Str "I",Space,Str "had",Space,Str "in",Space,Str "mind",SoftBreak,Str "the",Space,Str "\"longshore\"",Space,Str "or",Space,Str "\"dory\"",Space,Str "fisherman,",Space,Str "who",Space,Str "returns",Space,Str "at",Space,Str "nightfall."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "typist",Space,Str "home",Space,Str "at",Space,Str "teatime,",Space,Str "clears",Space,Str "her",Space,Str "breakfast,",Space,Str "lights"]]
-   ,Div ("",[],[])
-    [Plain [Str "Her",Space,Str "stove,",Space,Str "and",Space,Str "lays",Space,Str "out",Space,Str "food",Space,Str "in",Space,Str "tins."]]
-   ,Div ("",[],[])
-    [Plain [Str "Out",Space,Str "of",Space,Str "the",Space,Str "window",Space,Str "perilously",Space,Str "spread"]]
-   ,Div ("",[],[])
-    [Plain [Str "Her",Space,Str "drying",Space,Str "combinations",Space,Str "touched",Space,Str "by",Space,Str "the",Space,Str "sun's",Space,Str "last",Space,Str "rays,"]]
-   ,Div ("",[],[])
-    [Plain [Str "On",Space,Str "the",Space,Str "divan",Space,Str "are",Space,Str "piled",Space,Str "(at",Space,Str "night",Space,Str "her",Space,Str "bed)"]]
-   ,Div ("",[],[])
-    [Plain [Str "Stockings,",Space,Str "slippers,",Space,Str "camisoles,",Space,Str "and",Space,Str "stays."]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "Tiresias,",Space,Str "old",Space,Str "man",Space,Str "with",Space,Str "wrinkled",Space,Str "dugs"]]
-   ,Div ("",[],[])
-    [Plain [Str "Perceived",Space,Str "the",Space,Str "scene,",Space,Str "and",Space,Str "foretold",Space,Str "the",Space,Str "rest",Space,Str "-"]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "too",Space,Str "awaited",Space,Str "the",Space,Str "expected",Space,Str "guest.",Span ("",["lnum"],[]) [Str "230"]]]
-   ,Div ("",[],[])
-    [Plain [Str "He,",Space,Str "the",Space,Str "young",Space,Str "man",Space,Str "carbuncular,",Space,Str "arrives,"]]
-   ,Div ("",[],[])
-    [Plain [Str "A",Space,Str "small",Space,Str "house",Space,Str "agent's",Space,Str "clerk,",Space,Str "with",Space,Str "one",Space,Str "bold",Space,Str "stare,"]]
-   ,Div ("",[],[])
-    [Plain [Str "One",Space,Str "of",Space,Str "the",Space,Str "low",Space,Str "on",Space,Str "whom",Space,Str "assurance",Space,Str "sits"]]
-   ,Div ("",[],[])
-    [Plain [Str "As",Space,Str "a",Space,Str "silk",Space,Str "hat",Space,Str "on",Space,Str "a",Space,Str "Bradford",Space,Str "millionaire."]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "time",Space,Str "is",Space,Str "now",Space,Str "propitious,",Space,Str "as",Space,Str "he",Space,Str "guesses,"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "meal",Space,Str "is",Space,Str "ended,",Space,Str "she",Space,Str "is",Space,Str "bored",Space,Str "and",Space,Str "tired,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Endeavours",Space,Str "to",Space,Str "engage",Space,Str "her",Space,Str "in",Space,Str "caresses"]]
-   ,Div ("",[],[])
-    [Plain [Str "Which",Space,Str "still",Space,Str "are",Space,Str "unreproved,",Space,Str "if",Space,Str "undesired."]]
-   ,Div ("",[],[])
-    [Plain [Str "Flushed",Space,Str "and",Space,Str "decided,",Space,Str "he",Space,Str "assaults",Space,Str "at",Space,Str "once;"]]
-   ,Div ("",[],[])
-    [Plain [Str "Exploring",Space,Str "hands",Space,Str "encounter",Space,Str "no",Space,Str "defence;",Span ("",["lnum"],[]) [Str "240"]]]
-   ,Div ("",[],[])
-    [Plain [Str "His",Space,Str "vanity",Space,Str "requires",Space,Str "no",Space,Str "response,"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "makes",Space,Str "a",Space,Str "welcome",Space,Str "of",Space,Str "indifference."]]
-   ,Div ("",[],[])
-    [Plain [Str "(And",Space,Str "I",Space,Str "Tiresias",Space,Str "have",Space,Str "foresuffered",Space,Str "all"]]
-   ,Div ("",[],[])
-    [Plain [Str "Enacted",Space,Str "on",Space,Str "this",Space,Str "same",Space,Str "divan",Space,Str "or",Space,Str "bed;"]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "who",Space,Str "have",Space,Str "sat",Space,Str "by",Space,Str "Thebes",Space,Str "below",Space,Str "the",Space,Str "wall"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "walked",Space,Str "among",Space,Str "the",Space,Str "lowest",Space,Str "of",Space,Str "the",Space,Str "dead.)"]]
-   ,Div ("",[],[])
-    [Plain [Str "Bestows",Space,Str "one",Space,Str "final",Space,Str "patronising",Space,Str "kiss,"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "gropes",Space,Str "his",Space,Str "way,",Space,Str "finding",Space,Str "the",Space,Str "stairs",Space,Str "unlit",Space,Str ".",Space,Str ".",Space,Str "."]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "She",Space,Str "turns",Space,Str "and",Space,Str "looks",Space,Str "a",Space,Str "moment",Space,Str "in",Space,Str "the",Space,Str "glass,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Hardly",Space,Str "aware",Space,Str "of",Space,Str "her",Space,Str "departed",Space,Str "lover;",Span ("",["lnum"],[]) [Str "250"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Her",Space,Str "brain",Space,Str "allows",Space,Str "one",Space,Str "half-formed",Space,Str "thought",Space,Str "to",Space,Str "pass:"]]
-   ,Div ("",[],[])
-    [Plain [Str "\"Well",Space,Str "now",Space,Str "that's",Space,Str "done:",Space,Str "and",Space,Str "I'm",Space,Str "glad",Space,Str "it's",Space,Str "over.\""]]
-   ,Div ("wasteland-content.xhtml#ln253",[],[])
-    [Plain [Str "When",Space,Str "lovely",Space,Str "woman",Space,Str "stoops",Space,Str "to",Space,Str "folly",Space,Str "and",Note [Para [Link ("",[],[]) [Str "253."] ("#wasteland-content.xhtml#ln253",""),Space,Str "V.",Space,Str "Goldsmith,",Space,Str "the",Space,Str "song",Space,Str "in",Space,Str "The",Space,Str "Vicar",Space,Str "of",Space,Str "Wakefield."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Paces",Space,Str "about",Space,Str "her",Space,Str "room",Space,Str "again,",Space,Str "alone,"]]
-   ,Div ("",[],[])
-    [Plain [Str "She",Space,Str "smoothes",Space,Str "her",Space,Str "hair",Space,Str "with",Space,Str "automatic",Space,Str "hand,"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "puts",Space,Str "a",Space,Str "record",Space,Str "on",Space,Str "the",Space,Str "gramophone."]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("wasteland-content.xhtml#ln257",[],[])
-    [Plain [Str "\"This",Space,Str "music",Space,Str "crept",Space,Str "by",Space,Str "me",Space,Str "upon",Space,Str "the",Space,Str "waters\"",Note [Para [Link ("",[],[]) [Str "257."] ("#wasteland-content.xhtml#ln257",""),Space,Str "V.",Space,Str "The",Space,Str "Tempest,",Space,Str "as",Space,Str "above."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "along",Space,Str "the",Space,Str "Strand,",Space,Str "up",Space,Str "Queen",Space,Str "Victoria",Space,Str "Street."]]
-   ,Div ("",[],[])
-    [Plain [Str "O",Space,Str "City",Space,Str "city,",Space,Str "I",Space,Str "can",Space,Str "sometimes",Space,Str "hear"]]
-   ,Div ("",[],[])
-    [Plain [Str "Beside",Space,Str "a",Space,Str "public",Space,Str "bar",Space,Str "in",Space,Str "Lower",Space,Str "Thames",Space,Str "Street,",Span ("",["lnum"],[]) [Str "260"]]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "pleasant",Space,Str "whining",Space,Str "of",Space,Str "a",Space,Str "mandoline"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "a",Space,Str "clatter",Space,Str "and",Space,Str "a",Space,Str "chatter",Space,Str "from",Space,Str "within"]]
-   ,Div ("",[],[])
-    [Plain [Str "Where",Space,Str "fishmen",Space,Str "lounge",Space,Str "at",Space,Str "noon:",Space,Str "where",Space,Str "the",Space,Str "walls"]]
-   ,Div ("wasteland-content.xhtml#ln264",[],[])
-    [Plain [Str "Of",Space,Str "Magnus",Space,Str "Martyr",Space,Str "hold",Note [Para [Link ("",[],[]) [Str "264."] ("#wasteland-content.xhtml#ln264",""),Space,Str "The",Space,Str "interior",Space,Str "of",Space,Str "St.",Space,Str "Magnus",Space,Str "Martyr",Space,Str "is",Space,Str "to",Space,Str "my",Space,Str "mind",Space,Str "one",Space,Str "of",Space,Str "the",Space,Str "finest",SoftBreak,Str "among",Space,Str "Wren's",Space,Str "interiors.",Space,Str "See",Space,Str "The",Space,Str "Proposed",Space,Str "Demolition",Space,Str "of",Space,Str "Nineteen",Space,Str "City",SoftBreak,Str "Churches",Space,Str "(P.",Space,Str "S.",Space,Str "King",Space,Str "&",Space,Str "Son,",Space,Str "Ltd.)."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Inexplicable",Space,Str "splendour",Space,Str "of",Space,Str "Ionian",Space,Str "white",Space,Str "and",Space,Str "gold."]]]
-  ,Div ("",["linegroup","indent"],[])
-   [Div ("wasteland-content.xhtml#ln266",[],[])
-    [Plain [Str "The",Space,Str "river",Space,Str "sweats",Note [Para [Link ("",[],[]) [Str "266."] ("#wasteland-content.xhtml#ln266",""),Space,Str "The",Space,Str "Song",Space,Str "of",Space,Str "the",Space,Str "(three)",Space,Str "Thames-daughters",Space,Str "begins",Space,Str "here.",Space,Str "From",Space,Str "line",Space,Str "292",SoftBreak,Str "to",Space,Str "306",Space,Str "inclusive",Space,Str "they",Space,Str "speak",Space,Str "in",Space,Str "turn.",Space,Str "V.",Space,Str "Gutterdsammerung,",Space,Str "III.",Space,Str "i:",Space,Str "the",SoftBreak,Str "Rhine-daughters."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Oil",Space,Str "and",Space,Str "tar"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "barges",Space,Str "drift"]]
-   ,Div ("",[],[])
-    [Plain [Str "With",Space,Str "the",Space,Str "turning",Space,Str "tide"]]
-   ,Div ("",[],[])
-    [Plain [Str "Red",Space,Str "sails",Span ("",["lnum"],[]) [Str "270"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Wide"]]
-   ,Div ("",[],[])
-    [Plain [Str "To",Space,Str "leeward,",Space,Str "swing",Space,Str "on",Space,Str "the",Space,Str "heavy",Space,Str "spar."]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "barges",Space,Str "wash"]]
-   ,Div ("",[],[])
-    [Plain [Str "Drifting",Space,Str "logs"]]
-   ,Div ("",[],[])
-    [Plain [Str "Down",Space,Str "Greenwich",Space,Str "reach"]]
-   ,Div ("",[],[])
-    [Plain [Str "Past",Space,Str "the",Space,Str "Isle",Space,Str "of",Space,Str "Dogs."]]
-   ,Div ("",["indent"],[])
-    [Plain [Str "Weialala",Space,Str "leia"]]
-   ,Div ("",["indent"],[])
-    [Plain [Str "Wallala",Space,Str "leialala"]]]
-  ,Div ("",["linegroup","indent"],[])
-   [Div ("wasteland-content.xhtml#ln279",[],[])
-    [Plain [Str "Elizabeth",Space,Str "and",Space,Str "Leicester",Note [Para [Link ("",[],[]) [Str "279."] ("#wasteland-content.xhtml#ln279",""),Space,Str "V.",Space,Str "Froude,",Space,Str "Elizabeth,",Space,Str "Vol.",Space,Str "I,",Space,Str "ch.",Space,Str "iv,",Space,Str "letter",Space,Str "of",Space,Str "De",Space,Str "Quadra",Space,Str "to",Space,Str "Philip",SoftBreak,Str "of",Space,Str "Spain:"],BlockQuote [Div ("",[],[]) [Div ("",[],[]) [Plain [Str "\"In",Space,Str "the",Space,Str "afternoon",Space,Str "we",Space,Str "were",Space,Str "in",Space,Str "a",Space,Str "barge,",Space,Str "watching",Space,Str "the",SoftBreak,Str "games",Space,Str "on",Space,Str "the",Space,Str "river."]],Div ("",[],[]) [Plain [Str "(The",Space,Str "queen)",Space,Str "was",Space,Str "alone",Space,Str "with",Space,Str "Lord",Space,Str "Robert",Space,Str "and",Space,Str "myself",SoftBreak,Str "on",Space,Str "the",Space,Str "poop,"]],Div ("",[],[]) [Plain [Str "when",Space,Str "they",Space,Str "began",Space,Str "to",Space,Str "talk",Space,Str "nonsense,",Space,Str "and",Space,Str "went",Space,Str "so",Space,Str "far",SoftBreak,Str "that",Space,Str "Lord",Space,Str "Robert"]],Div ("",[],[]) [Plain [Str "at",Space,Str "last",Space,Str "said,",Space,Str "as",Space,Str "I",Space,Str "was",Space,Str "on",Space,Str "the",Space,Str "spot",Space,Str "there",Space,Str "was",Space,Str "no",SoftBreak,Str "reason",Space,Str "why",Space,Str "they"]],Div ("",[],[]) [Plain [Str "should",Space,Str "not",Space,Str "be",Space,Str "married",Space,Str "if",Space,Str "the",Space,Str "queen",Space,Str "pleased.\""]]]]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Beating",Space,Str "oars",Span ("",["lnum"],[]) [Str "280"]]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "stern",Space,Str "was",Space,Str "formed"]]
-   ,Div ("",[],[])
-    [Plain [Str "A",Space,Str "gilded",Space,Str "shell"]]
-   ,Div ("",[],[])
-    [Plain [Str "Red",Space,Str "and",Space,Str "gold"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "brisk",Space,Str "swell"]]
-   ,Div ("",[],[])
-    [Plain [Str "Rippled",Space,Str "both",Space,Str "shores"]]
-   ,Div ("",[],[])
-    [Plain [Str "Southwest",Space,Str "wind"]]
-   ,Div ("",[],[])
-    [Plain [Str "Carried",Space,Str "down",Space,Str "stream"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "peal",Space,Str "of",Space,Str "bells"]]
-   ,Div ("",[],[])
-    [Plain [Str "White",Space,Str "towers"]]
-   ,Div ("",["indent"],[])
-    [Plain [Str "Weialala",Space,Str "leia",Span ("",["lnum"],[]) [Str "290"]]]
-   ,Div ("",["indent"],[])
-    [Plain [Str "Wallala",Space,Str "leialala"]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "\"Trams",Space,Str "and",Space,Str "dusty",Space,Str "trees."]]
-   ,Div ("wasteland-content.xhtml#ln293",[],[])
-    [Plain [Str "Highbury",Space,Str "bore",Space,Str "me.",Space,Str "Richmond",Space,Str "and",Space,Str "Kew",Note [Para [Link ("",[],[]) [Str "293."] ("#wasteland-content.xhtml#ln293",""),Space,Str "Cf.",Space,Str "Purgatorio,",Space,Str "v.",Space,Str "133:"],BlockQuote [Para [Str "\"Ricorditi",Space,Str "di",Space,Str "me,",Space,Str "che",Space,Str "son",Space,Str "la",Space,Str "Pia;",LineBreak,Str "Siena",Space,Str "mi",Space,Str "fe',",Space,Str "disfecemi",SoftBreak,Str "Maremma.\""]]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Undid",Space,Str "me.",Space,Str "By",Space,Str "Richmond",Space,Str "I",Space,Str "raised",Space,Str "my",Space,Str "knees"]]
-   ,Div ("",[],[])
-    [Plain [Str "Supine",Space,Str "on",Space,Str "the",Space,Str "floor",Space,Str "of",Space,Str "a",Space,Str "narrow",Space,Str "canoe.\""]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "\"My",Space,Str "feet",Space,Str "are",Space,Str "at",Space,Str "Moorgate,",Space,Str "and",Space,Str "my",Space,Str "heart"]]
-   ,Div ("",[],[])
-    [Plain [Str "Under",Space,Str "my",Space,Str "feet.",Space,Str "After",Space,Str "the",Space,Str "event"]]
-   ,Div ("",[],[])
-    [Plain [Str "He",Space,Str "wept.",Space,Str "He",Space,Str "promised",Space,Str "'a",Space,Str "new",Space,Str "start'."]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "made",Space,Str "no",Space,Str "comment.",Space,Str "What",Space,Str "should",Space,Str "I",Space,Str "resent?\""]]
-   ,Div ("",[],[])
-    [Plain [Str "\"On",Space,Str "Margate",Space,Str "Sands.",Span ("",["lnum"],[]) [Str "300"]]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "can",Space,Str "connect"]]
-   ,Div ("",[],[])
-    [Plain [Str "Nothing",Space,Str "with",Space,Str "nothing."]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "broken",Space,Str "fingernails",Space,Str "of",Space,Str "dirty",Space,Str "hands."]]
-   ,Div ("",[],[])
-    [Plain [Str "My",Space,Str "people",Space,Str "humble",Space,Str "people",Space,Str "who",Space,Str "expect"]]
-   ,Div ("",[],[])
-    [Plain [Str "Nothing.\""]]
-   ,Div ("",["indent"],[])
-    [Plain [Str "la",Space,Str "la"]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("wasteland-content.xhtml#ln307",[],[])
-    [Plain [Str "To",Space,Str "Carthage",Space,Str "then",Space,Str "I",Space,Str "came",Note [Para [Link ("",[],[]) [Str "307."] ("#wasteland-content.xhtml#ln307",""),Space,Str "V.",Space,Str "St.",Space,Str "Augustine's",Space,Str "Confessions:",Space,Str "\"to",Space,Str "Carthage",Space,Str "then",Space,Str "I",Space,Str "came,",Space,Str "where",Space,Str "a",SoftBreak,Str "cauldron",Space,Str "of",Space,Str "unholy",Space,Str "loves",Space,Str "sang",Space,Str "all",Space,Str "about",Space,Str "mine",Space,Str "ears.\""]]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("wasteland-content.xhtml#ln308",[],[])
-    [Plain [Str "Burning",Space,Str "burning",Space,Str "burning",Space,Str "burning",Note [Para [Link ("",[],[]) [Str "308."] ("#wasteland-content.xhtml#ln308",""),Space,Str "The",Space,Str "complete",Space,Str "text",Space,Str "of",Space,Str "the",Space,Str "Buddha's",Space,Str "Fire",Space,Str "Sermon",Space,Str "(which",Space,Str "corresponds",Space,Str "in",SoftBreak,Str "importance",Space,Str "to",Space,Str "the",Space,Str "Sermon",Space,Str "on",Space,Str "the",Space,Str "Mount)",Space,Str "from",Space,Str "which",Space,Str "these",Space,Str "words",Space,Str "are",Space,Str "taken,",SoftBreak,Str "will",Space,Str "be",Space,Str "found",Space,Str "translated",Space,Str "in",Space,Str "the",Space,Str "late",Space,Str "Henry",Space,Str "Clarke",Space,Str "Warren's",Space,Str "Buddhism",Space,Str "in",SoftBreak,Str "Translation",Space,Str "(Harvard",Space,Str "Oriental",Space,Str "Series).",Space,Str "Mr.",Space,Str "Warren",Space,Str "was",Space,Str "one",Space,Str "of",Space,Str "the",Space,Str "great",SoftBreak,Str "pioneers",Space,Str "of",Space,Str "Buddhist",Space,Str "studies",Space,Str "in",Space,Str "the",Space,Str "Occident."]]]]
-   ,Div ("wasteland-content.xhtml#ln309",[],[])
-    [Plain [Str "O",Space,Str "Lord",Space,Str "Thou",Space,Str "pluckest",Space,Str "me",Space,Str "out",Note [Para [Link ("",[],[]) [Str "309."] ("#wasteland-content.xhtml#ln309",""),Space,Str "From",Space,Str "St.",Space,Str "Augustine's",Space,Str "Confessions",Space,Str "again.",Space,Str "The",Space,Str "collocation",Space,Str "of",Space,Str "these",Space,Str "two",SoftBreak,Str "representatives",Space,Str "of",Space,Str "eastern",Space,Str "and",Space,Str "western",Space,Str "asceticism,",Space,Str "as",Space,Str "the",Space,Str "culmination",Space,Str "of",SoftBreak,Str "this",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "poem,",Space,Str "is",Space,Str "not",Space,Str "an",Space,Str "accident."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "O",Space,Str "Lord",Space,Str "Thou",Space,Str "pluckest",Span ("",["lnum"],[]) [Str "310"]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "burning"]]]]
- ,Div ("wasteland-content.xhtml#ch4",["section"],[])
-  [Header 2 ("",[],[]) [Str "IV.",Space,Str "DEATH",Space,Str "BY",Space,Str "WATER"]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "Phlebas",Space,Str "the",Space,Str "Phoenician,",Space,Str "a",Space,Str "fortnight",Space,Str "dead,"]]
-   ,Div ("",[],[])
-    [Plain [Str "Forgot",Space,Str "the",Space,Str "cry",Space,Str "of",Space,Str "gulls,",Space,Str "and",Space,Str "the",Space,Str "deep",Space,Str "sea",Space,Str "swell"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "the",Space,Str "profit",Space,Str "and",Space,Str "loss."]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",["indent2"],[])
-    [Plain [Str "A",Space,Str "current",Space,Str "under",Space,Str "sea"]]
-   ,Div ("",[],[])
-    [Plain [Str "Picked",Space,Str "his",Space,Str "bones",Space,Str "in",Space,Str "whispers.",Space,Str "As",Space,Str "he",Space,Str "rose",Space,Str "and",Space,Str "fell"]]
-   ,Div ("",[],[])
-    [Plain [Str "He",Space,Str "passed",Space,Str "the",Space,Str "stages",Space,Str "of",Space,Str "his",Space,Str "age",Space,Str "and",Space,Str "youth"]]
-   ,Div ("",[],[])
-    [Plain [Str "Entering",Space,Str "the",Space,Str "whirlpool."]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",["indent2"],[])
-    [Plain [Str "Gentile",Space,Str "or",Space,Str "Jew"]]
-   ,Div ("",[],[])
-    [Plain [Str "O",Space,Str "you",Space,Str "who",Space,Str "turn",Space,Str "the",Space,Str "wheel",Space,Str "and",Space,Str "look",Space,Str "to",Space,Str "windward,",Span ("",["lnum"],[]) [Str "320"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Consider",Space,Str "Phlebas,",Space,Str "who",Space,Str "was",Space,Str "once",Space,Str "handsome",Space,Str "and",Space,Str "tall",Space,Str "as",Space,Str "you."]]]]
- ,Div ("wasteland-content.xhtml#ch5",["section"],[])
-  [Header 2 ("",[],[]) [Str "V.",Space,Str "WHAT",Space,Str "THE",Space,Str "THUNDER",Space,Str "SAID"]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "After",Space,Str "the",Space,Str "torchlight",Space,Str "red",Space,Str "on",Space,Str "sweaty",Space,Str "faces"]]
-   ,Div ("",[],[])
-    [Plain [Str "After",Space,Str "the",Space,Str "frosty",Space,Str "silence",Space,Str "in",Space,Str "the",Space,Str "gardens"]]
-   ,Div ("",[],[])
-    [Plain [Str "After",Space,Str "the",Space,Str "agony",Space,Str "in",Space,Str "stony",Space,Str "places"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "shouting",Space,Str "and",Space,Str "the",Space,Str "crying"]]
-   ,Div ("",[],[])
-    [Plain [Str "Prison",Space,Str "and",Space,Str "palace",Space,Str "and",Space,Str "reverberation"]]
-   ,Div ("",[],[])
-    [Plain [Str "Of",Space,Str "thunder",Space,Str "of",Space,Str "spring",Space,Str "over",Space,Str "distant",Space,Str "mountains"]]
-   ,Div ("",[],[])
-    [Plain [Str "He",Space,Str "who",Space,Str "was",Space,Str "living",Space,Str "is",Space,Str "now",Space,Str "dead"]]
-   ,Div ("",[],[])
-    [Plain [Str "We",Space,Str "who",Space,Str "were",Space,Str "living",Space,Str "are",Space,Str "now",Space,Str "dying"]]
-   ,Div ("",[],[])
-    [Plain [Str "With",Space,Str "a",Space,Str "little",Space,Str "patience",Span ("",["lnum"],[]) [Str "330"]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "Here",Space,Str "is",Space,Str "no",Space,Str "water",Space,Str "but",Space,Str "only",Space,Str "rock"]]
-   ,Div ("",[],[])
-    [Plain [Str "Rock",Space,Str "and",Space,Str "no",Space,Str "water",Space,Str "and",Space,Str "the",Space,Str "sandy",Space,Str "road"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "road",Space,Str "winding",Space,Str "above",Space,Str "among",Space,Str "the",Space,Str "mountains"]]
-   ,Div ("",[],[])
-    [Plain [Str "Which",Space,Str "are",Space,Str "mountains",Space,Str "of",Space,Str "rock",Space,Str "without",Space,Str "water"]]
-   ,Div ("",[],[])
-    [Plain [Str "If",Space,Str "there",Space,Str "were",Space,Str "water",Space,Str "we",Space,Str "should",Space,Str "stop",Space,Str "and",Space,Str "drink"]]
-   ,Div ("",[],[])
-    [Plain [Str "Amongst",Space,Str "the",Space,Str "rock",Space,Str "one",Space,Str "cannot",Space,Str "stop",Space,Str "or",Space,Str "think"]]
-   ,Div ("",[],[])
-    [Plain [Str "Sweat",Space,Str "is",Space,Str "dry",Space,Str "and",Space,Str "feet",Space,Str "are",Space,Str "in",Space,Str "the",Space,Str "sand"]]
-   ,Div ("",[],[])
-    [Plain [Str "If",Space,Str "there",Space,Str "were",Space,Str "only",Space,Str "water",Space,Str "amongst",Space,Str "the",Space,Str "rock"]]
-   ,Div ("",[],[])
-    [Plain [Str "Dead",Space,Str "mountain",Space,Str "mouth",Space,Str "of",Space,Str "carious",Space,Str "teeth",Space,Str "that",Space,Str "cannot",Space,Str "spit"]]
-   ,Div ("",[],[])
-    [Plain [Str "Here",Space,Str "one",Space,Str "can",Space,Str "neither",Space,Str "stand",Space,Str "nor",Space,Str "lie",Space,Str "nor",Space,Str "sit",Span ("",["lnum"],[]) [Str "340"]]]
-   ,Div ("",[],[])
-    [Plain [Str "There",Space,Str "is",Space,Str "not",Space,Str "even",Space,Str "silence",Space,Str "in",Space,Str "the",Space,Str "mountains"]]
-   ,Div ("",[],[])
-    [Plain [Str "But",Space,Str "dry",Space,Str "sterile",Space,Str "thunder",Space,Str "without",Space,Str "rain"]]
-   ,Div ("",[],[])
-    [Plain [Str "There",Space,Str "is",Space,Str "not",Space,Str "even",Space,Str "solitude",Space,Str "in",Space,Str "the",Space,Str "mountains"]]
-   ,Div ("",[],[])
-    [Plain [Str "But",Space,Str "red",Space,Str "sullen",Space,Str "faces",Space,Str "sneer",Space,Str "and",Space,Str "snarl"]]
-   ,Div ("",[],[])
-    [Plain [Str "From",Space,Str "doors",Space,Str "of",Space,Str "mudcracked",Space,Str "houses"]]
-   ,Div ("",["linegroup"],[])
-    [Div ("",["indent2"],[])
-     [Plain [Str "If",Space,Str "there",Space,Str "were",Space,Str "water"]]
-    ,Div ("",[],[])
-     [Plain [Str "And",Space,Str "no",Space,Str "rock"]]
-    ,Div ("",[],[])
-     [Plain [Str "If",Space,Str "there",Space,Str "were",Space,Str "rock"]]
-    ,Div ("",[],[])
-     [Plain [Str "And",Space,Str "also",Space,Str "water"]]
-    ,Div ("",[],[])
-     [Plain [Str "And",Space,Str "water",Span ("",["lnum"],[]) [Str "350"]]]
-    ,Div ("",[],[])
-     [Plain [Str "A",Space,Str "spring"]]
-    ,Div ("",[],[])
-     [Plain [Str "A",Space,Str "pool",Space,Str "among",Space,Str "the",Space,Str "rock"]]
-    ,Div ("",[],[])
-     [Plain [Str "If",Space,Str "there",Space,Str "were",Space,Str "the",Space,Str "sound",Space,Str "of",Space,Str "water",Space,Str "only"]]
-    ,Div ("",[],[])
-     [Plain [Str "Not",Space,Str "the",Space,Str "cicada"]]
-    ,Div ("",[],[])
-     [Plain [Str "And",Space,Str "dry",Space,Str "grass",Space,Str "singing"]]
-    ,Div ("",[],[])
-     [Plain [Str "But",Space,Str "sound",Space,Str "of",Space,Str "water",Space,Str "over",Space,Str "a",Space,Str "rock"]]
-    ,Div ("wasteland-content.xhtml#ln357",[],[])
-     [Plain [Str "Where",Space,Str "the",Space,Str "hermit-thrush",Space,Str "sings",Space,Str "in",Space,Str "the",Space,Str "pine",Space,Str "trees",Note [Para [Link ("",[],[]) [Str "357."] ("#wasteland-content.xhtml#ln357",""),Space,Str "This",Space,Str "is",Space,Str "Turdus",Space,Str "aonalaschkae",Space,Str "pallasii,",Space,Str "the",Space,Str "hermit-thrush",Space,Str "which",Space,Str "I",Space,Str "have",SoftBreak,Str "heard",Space,Str "in",Space,Str "Quebec",Space,Str "County.",Space,Str "Chapman",Space,Str "says",Space,Str "(Handbook",Space,Str "of",Space,Str "Birds",Space,Str "of",Space,Str "Eastern",Space,Str "North",SoftBreak,Str "America)",Space,Str "\"it",Space,Str "is",Space,Str "most",Space,Str "at",Space,Str "home",Space,Str "in",Space,Str "secluded",Space,Str "woodland",Space,Str "and",Space,Str "thickety",Space,Str "retreats.",SoftBreak,Str ".",Space,Str ".",Space,Str ".",Space,Str "Its",Space,Str "notes",Space,Str "are",Space,Str "not",Space,Str "remarkable",Space,Str "for",Space,Str "variety",Space,Str "or",Space,Str "volume,",Space,Str "but",Space,Str "in",Space,Str "purity",SoftBreak,Str "and",Space,Str "sweetness",Space,Str "of",Space,Str "tone",Space,Str "and",Space,Str "exquisite",Space,Str "modulation",Space,Str "they",Space,Str "are",Space,Str "unequalled.\"",Space,Str "Its",SoftBreak,Str "\"water-dripping",Space,Str "song\"",Space,Str "is",Space,Str "justly",Space,Str "celebrated."]]]]
-    ,Div ("",[],[])
-     [Plain [Str "Drip",Space,Str "drop",Space,Str "drip",Space,Str "drop",Space,Str "drop",Space,Str "drop",Space,Str "drop"]]
-    ,Div ("",[],[])
-     [Plain [Str "But",Space,Str "there",Space,Str "is",Space,Str "no",Space,Str "water"]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("wasteland-content.xhtml#ln360",[],[])
-    [Plain [Str "Who",Space,Str "is",Space,Str "the",Space,Str "third",Space,Str "who",Space,Str "walks",Space,Str "always",Space,Str "beside",Space,Str "you?",Note [Para [Link ("",[],[]) [Str "360."] ("#wasteland-content.xhtml#ln360",""),Space,Str "The",Space,Str "following",Space,Str "lines",Space,Str "were",Space,Str "stimulated",Space,Str "by",Space,Str "the",Space,Str "account",Space,Str "of",Space,Str "one",Space,Str "of",Space,Str "the",SoftBreak,Str "Antarctic",Space,Str "expeditions",Space,Str "(I",Space,Str "forget",Space,Str "which,",Space,Str "but",Space,Str "I",Space,Str "think",Space,Str "one",Space,Str "of",Space,Str "Shackleton's):",SoftBreak,Str "it",Space,Str "was",Space,Str "related",Space,Str "that",Space,Str "the",Space,Str "party",Space,Str "of",Space,Str "explorers,",Space,Str "at",Space,Str "the",Space,Str "extremity",Space,Str "of",Space,Str "their",SoftBreak,Str "strength,",Space,Str "had",Space,Str "the",Space,Str "constant",Space,Str "delusion",Space,Str "that",Space,Str "there",Space,Str "was",Space,Str "one",Space,Str "more",Space,Str "member",Space,Str "than",SoftBreak,Str "could",Space,Str "actually",Space,Str "be",Space,Str "counted."]],SoftBreak,Span ("",["lnum"],[]) [Str "360"]]]
-   ,Div ("",[],[])
-    [Plain [Str "When",Space,Str "I",Space,Str "count,",Space,Str "there",Space,Str "are",Space,Str "only",Space,Str "you",Space,Str "and",Space,Str "I",Space,Str "together"]]
-   ,Div ("",[],[])
-    [Plain [Str "But",Space,Str "when",Space,Str "I",Space,Str "look",Space,Str "ahead",Space,Str "up",Space,Str "the",Space,Str "white",Space,Str "road"]]
-   ,Div ("",[],[])
-    [Plain [Str "There",Space,Str "is",Space,Str "always",Space,Str "another",Space,Str "one",Space,Str "walking",Space,Str "beside",Space,Str "you"]]
-   ,Div ("",[],[])
-    [Plain [Str "Gliding",Space,Str "wrapt",Space,Str "in",Space,Str "a",Space,Str "brown",Space,Str "mantle,",Space,Str "hooded"]]
-   ,Div ("",[],[])
-    [Plain [Str "I",Space,Str "do",Space,Str "not",Space,Str "know",Space,Str "whether",Space,Str "a",Space,Str "man",Space,Str "or",Space,Str "a",Space,Str "woman"]]
-   ,Div ("wasteland-content.xhtml#ln367",[],[])
-    [Plain [Str "\8213But",Space,Str "who",Space,Str "is",Space,Str "that",Space,Str "on",Space,Str "the",Space,Str "other",Space,Str "side",Space,Str "of",Space,Str "you?",Note [Para [Link ("",[],[]) [Str "367-77."] ("#wasteland-content.xhtml#ln367",""),Space,Str "Cf.",Space,Str "Hermann",Space,Str "Hesse,",Space,Str "Blick",Space,Str "ins",Space,Str "Chaos:"],BlockQuote [Para [Str "\"Schon",Space,Str "ist",Space,Str "halb",Space,Str "Europa,",Space,Str "schon",Space,Str "ist",Space,Str "zumindest",Space,Str "der",Space,Str "halbe",Space,Str "Osten",Space,Str "Europas",SoftBreak,Str "auf",Space,Str "dem",LineBreak,Str "Wege",Space,Str "zum",Space,Str "Chaos,",Space,Str "fhrt",Space,Str "betrunken",Space,Str "im",Space,Str "heiligem",Space,Str "Wahn",Space,Str "am",SoftBreak,Str "Abgrund",Space,Str "entlang",LineBreak,Str "und",Space,Str "singt",Space,Str "dazu,",Space,Str "singt",Space,Str "betrunken",Space,Str "und",Space,Str "hymnisch",SoftBreak,Str "wie",Space,Str "Dmitri",Space,Str "Karamasoff",Space,Str "sang.",LineBreak,Str "Ueber",Space,Str "diese",Space,Str "Lieder",Space,Str "lacht",Space,Str "der",SoftBreak,Str "Bsrger",Space,Str "beleidigt,",Space,Str "der",Space,Str "Heilige",LineBreak,Str "und",Space,Str "Seher",Space,Str "hrt",Space,Str "sie",Space,Str "mit",SoftBreak,Str "Trvnen.\""]]]]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "What",Space,Str "is",Space,Str "that",Space,Str "sound",Space,Str "high",Space,Str "in",Space,Str "the",Space,Str "air"]]
-   ,Div ("",[],[])
-    [Plain [Str "Murmur",Space,Str "of",Space,Str "maternal",Space,Str "lamentation"]]
-   ,Div ("",[],[])
-    [Plain [Str "Who",Space,Str "are",Space,Str "those",Space,Str "hooded",Space,Str "hordes",Space,Str "swarming"]]
-   ,Div ("",[],[])
-    [Plain [Str "Over",Space,Str "endless",Space,Str "plains,",Space,Str "stumbling",Space,Str "in",Space,Str "cracked",Space,Str "earth",Span ("",["lnum"],[]) [Str "370"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Ringed",Space,Str "by",Space,Str "the",Space,Str "flat",Space,Str "horizon",Space,Str "only"]]
-   ,Div ("",[],[])
-    [Plain [Str "What",Space,Str "is",Space,Str "the",Space,Str "city",Space,Str "over",Space,Str "the",Space,Str "mountains"]]
-   ,Div ("",[],[])
-    [Plain [Str "Cracks",Space,Str "and",Space,Str "reforms",Space,Str "and",Space,Str "bursts",Space,Str "in",Space,Str "the",Space,Str "violet",Space,Str "air"]]
-   ,Div ("",[],[])
-    [Plain [Str "Falling",Space,Str "towers"]]
-   ,Div ("",[],[])
-    [Plain [Str "Jerusalem",Space,Str "Athens",Space,Str "Alexandria"]]
-   ,Div ("",[],[])
-    [Plain [Str "Vienna",Space,Str "London"]]
-   ,Div ("",[],[])
-    [Plain [Str "Unreal"]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "A",Space,Str "woman",Space,Str "drew",Space,Str "her",Space,Str "long",Space,Str "black",Space,Str "hair",Space,Str "out",Space,Str "tight"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "fiddled",Space,Str "whisper",Space,Str "music",Space,Str "on",Space,Str "those",Space,Str "strings"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "bats",Space,Str "with",Space,Str "baby",Space,Str "faces",Space,Str "in",Space,Str "the",Space,Str "violet",Space,Str "light",Span ("",["lnum"],[]) [Str "380"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Whistled,",Space,Str "and",Space,Str "beat",Space,Str "their",Space,Str "wings"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "crawled",Space,Str "head",Space,Str "downward",Space,Str "down",Space,Str "a",Space,Str "blackened",Space,Str "wall"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "upside",Space,Str "down",Space,Str "in",Space,Str "air",Space,Str "were",Space,Str "towers"]]
-   ,Div ("",[],[])
-    [Plain [Str "Tolling",Space,Str "reminiscent",Space,Str "bells,",Space,Str "that",Space,Str "kept",Space,Str "the",Space,Str "hours"]]
-   ,Div ("",[],[])
-    [Plain [Str "And",Space,Str "voices",Space,Str "singing",Space,Str "out",Space,Str "of",Space,Str "empty",Space,Str "cisterns",Space,Str "and",Space,Str "exhausted",SoftBreak,Str "wells."]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "In",Space,Str "this",Space,Str "decayed",Space,Str "hole",Space,Str "among",Space,Str "the",Space,Str "mountains"]]
-   ,Div ("",[],[])
-    [Plain [Str "In",Space,Str "the",Space,Str "faint",Space,Str "moonlight,",Space,Str "the",Space,Str "grass",Space,Str "is",Space,Str "singing"]]
-   ,Div ("",[],[])
-    [Plain [Str "Over",Space,Str "the",Space,Str "tumbled",Space,Str "graves,",Space,Str "about",Space,Str "the",Space,Str "chapel"]]
-   ,Div ("",[],[])
-    [Plain [Str "There",Space,Str "is",Space,Str "the",Space,Str "empty",Space,Str "chapel,",Space,Str "only",Space,Str "the",Space,Str "wind's",Space,Str "home."]]
-   ,Div ("",[],[])
-    [Plain [Str "It",Space,Str "has",Space,Str "no",Space,Str "windows,",Space,Str "and",Space,Str "the",Space,Str "door",Space,Str "swings,",Span ("",["lnum"],[]) [Str "390"]]]
-   ,Div ("",[],[])
-    [Plain [Str "Dry",Space,Str "bones",Space,Str "can",Space,Str "harm",Space,Str "no",Space,Str "one."]]
-   ,Div ("",[],[])
-    [Plain [Str "Only",Space,Str "a",Space,Str "cock",Space,Str "stood",Space,Str "on",Space,Str "the",Space,Str "rooftree"]]
-   ,Div ("",[],[])
-    [Plain [Str "Co",Space,Str "co",Space,Str "rico",Space,Str "co",Space,Str "co",Space,Str "rico"]]
-   ,Div ("",[],[])
-    [Plain [Str "In",Space,Str "a",Space,Str "flash",Space,Str "of",Space,Str "lightning.",Space,Str "Then",Space,Str "a",Space,Str "damp",Space,Str "gust"]]
-   ,Div ("",[],[])
-    [Plain [Str "Bringing",Space,Str "rain"]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",[],[])
-    [Plain [Str "Ganga",Space,Str "was",Space,Str "sunken,",Space,Str "and",Space,Str "the",Space,Str "limp",Space,Str "leaves"]]
-   ,Div ("",[],[])
-    [Plain [Str "Waited",Space,Str "for",Space,Str "rain,",Space,Str "while",Space,Str "the",Space,Str "black",Space,Str "clouds"]]
-   ,Div ("",[],[])
-    [Plain [Str "Gathered",Space,Str "far",Space,Str "distant,",Space,Str "over",Space,Str "Himavant."]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "jungle",Space,Str "crouched,",Space,Str "humped",Space,Str "in",Space,Str "silence."]]
-   ,Div ("",[],[])
-    [Plain [Str "Then",Space,Str "spoke",Space,Str "the",Space,Str "thunder",Span ("",["lnum"],[]) [Str "400"]]]
-   ,Div ("",[],[])
-    [Plain [Str "DA"]]
-   ,Div ("wasteland-content.xhtml#ln402",[],[])
-    [Plain [Span ("",[],[("lang","sa")]) [Str "Datta"],Str ":",Space,Str "what",Space,Str "have",Space,Str "we",Space,Str "given?",Note [Para [Link ("",[],[]) [Str "402."] ("#wasteland-content.xhtml#ln402",""),Space,Quoted DoubleQuote [Str "\"Datta,",Space,Str "dayadhvam,",Space,Str "damyata\""],Space,Str "(Give,",Space,Str "sympathize,",SoftBreak,Str "control).",Space,Str "The",Space,Str "fable",Space,Str "of",Space,Str "the",Space,Str "meaning",Space,Str "of",Space,Str "the",Space,Str "Thunder",Space,Str "is",Space,Str "found",Space,Str "in",Space,Str "the",SoftBreak,Str "Brihadaranyaka-Upanishad,",Space,Str "5,",Space,Str "1.",Space,Str "A",Space,Str "translation",Space,Str "is",Space,Str "found",Space,Str "in",Space,Str "Deussen's",SoftBreak,Str "Sechzig",Space,Str "Upanishads",Space,Str "des",Space,Str "Veda,",Space,Str "p.",Space,Str "489."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "My",Space,Str "friend,",Space,Str "blood",Space,Str "shaking",Space,Str "my",Space,Str "heart"]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "awful",Space,Str "daring",Space,Str "of",Space,Str "a",Space,Str "moment's",Space,Str "surrender"]]
-   ,Div ("",[],[])
-    [Plain [Str "Which",Space,Str "an",Space,Str "age",Space,Str "of",Space,Str "prudence",Space,Str "can",Space,Str "never",Space,Str "retract"]]
-   ,Div ("",[],[])
-    [Plain [Str "By",Space,Str "this,",Space,Str "and",Space,Str "this",Space,Str "only,",Space,Str "we",Space,Str "have",Space,Str "existed"]]
-   ,Div ("",[],[])
-    [Plain [Str "Which",Space,Str "is",Space,Str "not",Space,Str "to",Space,Str "be",Space,Str "found",Space,Str "in",Space,Str "our",Space,Str "obituaries"]]
-   ,Div ("wasteland-content.xhtml#ln408",[],[])
-    [Plain [Str "Or",Space,Str "in",Space,Str "memories",Space,Str "draped",Space,Str "by",Space,Str "the",Space,Str "beneficent",Space,Str "spider",Note [Para [Link ("",[],[]) [Str "408."] ("#wasteland-content.xhtml#ln408",""),Space,Str "Cf.",Space,Str "Webster,",Space,Str "The",Space,Str "White",Space,Str "Devil,",Space,Str "v.",Space,Str "vi:"],BlockQuote [Para [Str "\".",Space,Str ".",Space,Str ".",Space,Str "they'll",Space,Str "remarry",LineBreak,Str "Ere",Space,Str "the",Space,Str "worm",Space,Str "pierce",Space,Str "your",Space,Str "winding-sheet,",SoftBreak,Str "ere",Space,Str "the",Space,Str "spider",LineBreak,Str "Make",Space,Str "a",Space,Str "thin",Space,Str "curtain",Space,Str "for",Space,Str "your",Space,Str "epitaphs.\""]]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Or",Space,Str "under",Space,Str "seals",Space,Str "broken",Space,Str "by",Space,Str "the",Space,Str "lean",Space,Str "solicitor"]]
-   ,Div ("",[],[])
-    [Plain [Str "In",Space,Str "our",Space,Str "empty",Space,Str "rooms",Span ("",["lnum"],[]) [Str "410"]]]
-   ,Div ("",[],[])
-    [Plain [Str "DA"]]
-   ,Div ("wasteland-content.xhtml#ln412",[],[])
-    [Plain [Span ("",[],[("lang","sa")]) [Str "Dayadhvam"],Str ":",Space,Str "I",Space,Str "have",Space,Str "heard",Space,Str "the",Space,Str "key",Note [Para [Link ("",[],[]) [Str "412."] ("#wasteland-content.xhtml#ln412",""),Space,Str "Cf.",Space,Str "Inferno,",Space,Str "xxxiii.",Space,Str "46:"],BlockQuote [Para [Str "\"ed",Space,Str "io",Space,Str "sentii",Space,Str "chiavar",Space,Str "l'uscio",Space,Str "di",Space,Str "sotto",LineBreak,Str "all'orribile",Space,Str "torre.\""]],Para [Str "Also",Space,Str "F.",Space,Str "H.",Space,Str "Bradley,",Space,Str "Appearance",Space,Str "and",Space,Str "Reality,",Space,Str "p.",Space,Str "346:"],BlockQuote [Para [Str "\"My",Space,Str "external",Space,Str "sensations",Space,Str "are",Space,Str "no",Space,Str "less",Space,Str "private",Space,Str "to",Space,Str "myself",Space,Str "than",Space,Str "are",Space,Str "my",SoftBreak,Str "thoughts",Space,Str "or",Space,Str "my",Space,Str "feelings.",Space,Str "In",Space,Str "either",Space,Str "case",Space,Str "my",Space,Str "experience",Space,Str "falls",Space,Str "within",SoftBreak,Str "my",Space,Str "own",Space,Str "circle,",Space,Str "a",Space,Str "circle",Space,Str "closed",Space,Str "on",Space,Str "the",Space,Str "outside;",Space,Str "and,",Space,Str "with",Space,Str "all",Space,Str "its",SoftBreak,Str "elements",Space,Str "alike,",Space,Str "every",Space,Str "sphere",Space,Str "is",Space,Str "opaque",Space,Str "to",Space,Str "the",Space,Str "others",Space,Str "which",Space,Str "surround",SoftBreak,Str "it.",Space,Str ".",Space,Str ".",Space,Str ".",Space,Str "In",Space,Str "brief,",Space,Str "regarded",Space,Str "as",Space,Str "an",Space,Str "existence",Space,Str "which",Space,Str "appears",Space,Str "in",Space,Str "a",SoftBreak,Str "soul,",Space,Str "the",Space,Str "whole",Space,Str "world",Space,Str "for",Space,Str "each",Space,Str "is",Space,Str "peculiar",Space,Str "and",Space,Str "private",Space,Str "to",Space,Str "that",SoftBreak,Str "soul.\""]]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Turn",Space,Str "in",Space,Str "the",Space,Str "door",Space,Str "once",Space,Str "and",Space,Str "turn",Space,Str "once",Space,Str "only"]]
-   ,Div ("",[],[])
-    [Plain [Str "We",Space,Str "think",Space,Str "of",Space,Str "the",Space,Str "key,",Space,Str "each",Space,Str "in",Space,Str "his",Space,Str "prison"]]
-   ,Div ("",[],[])
-    [Plain [Str "Thinking",Space,Str "of",Space,Str "the",Space,Str "key,",Space,Str "each",Space,Str "confirms",Space,Str "a",Space,Str "prison"]]
-   ,Div ("",[],[])
-    [Plain [Str "Only",Space,Str "at",Space,Str "nightfall,",Space,Str "aetherial",Space,Str "rumours"]]
-   ,Div ("",[],[])
-    [Plain [Str "Revive",Space,Str "for",Space,Str "a",Space,Str "moment",Space,Str "a",Space,Str "broken",Space,Str "Coriolanus"]]
-   ,Div ("",[],[])
-    [Plain [Str "DA"]]
-   ,Div ("",[],[])
-    [Plain [Span ("",[],[("lang","sa")]) [Str "Damyata"],Str ":",Space,Str "The",Space,Str "boat",Space,Str "responded"]]
-   ,Div ("",[],[])
-    [Plain [Str "Gaily,",Space,Str "to",Space,Str "the",Space,Str "hand",Space,Str "expert",Space,Str "with",Space,Str "sail",Space,Str "and",Space,Str "oar",Span ("",["lnum"],[]) [Str "420"]]]
-   ,Div ("",[],[])
-    [Plain [Str "The",Space,Str "sea",Space,Str "was",Space,Str "calm,",Space,Str "your",Space,Str "heart",Space,Str "would",Space,Str "have",Space,Str "responded"]]
-   ,Div ("",[],[])
-    [Plain [Str "Gaily,",Space,Str "when",Space,Str "invited,",Space,Str "beating",Space,Str "obedient"]]
-   ,Div ("",[],[])
-    [Plain [Str "To",Space,Str "controlling",Space,Str "hands"]]]
-  ,Div ("",["linegroup"],[])
-   [Div ("",["indent"],[])
-    [Plain [Str "I",Space,Str "sat",Space,Str "upon",Space,Str "the",Space,Str "shore"]]
-   ,Div ("wasteland-content.xhtml#ln425",[],[])
-    [Plain [Str "Fishing,",Space,Str "with",Space,Str "the",Space,Str "arid",Space,Str "plain",Space,Str "behind",Space,Str "me",Note [Para [Link ("",[],[]) [Str "425."] ("#wasteland-content.xhtml#ln425",""),Space,Str "V.",Space,Str "Weston,",Space,Str "From",Space,Str "Ritual",Space,Str "to",Space,Str "Romance;",Space,Str "chapter",Space,Str "on",Space,Str "the",Space,Str "Fisher",Space,Str "King."]]]]
-   ,Div ("",[],[])
-    [Plain [Str "Shall",Space,Str "I",Space,Str "at",Space,Str "least",Space,Str "set",Space,Str "my",Space,Str "lands",Space,Str "in",Space,Str "order?"]]
-   ,Div ("",[],[])
-    [Plain [Str "London",Space,Str "Bridge",Space,Str "is",Space,Str "falling",Space,Str "down",Space,Str "falling",Space,Str "down",Space,Str "falling",Space,Str "down"]]
-   ,Div ("wasteland-content.xhtml#ln428",[],[("lang","it")])
-    [Plain [Emph [Str "Poi",Space,Str "s'ascose",Space,Str "nel",Space,Str "foco",Space,Str "che",Space,Str "gli",Space,Str "affina"],SoftBreak,Note [Para [Link ("",[],[]) [Str "428."] ("#wasteland-content.xhtml#ln428",""),Space,Str "V.",Space,Str "Purgatorio,",Space,Str "xxvi.",Space,Str "148."],BlockQuote [Para [Str "\"'Ara",Space,Str "vos",Space,Str "prec",Space,Str "per",Space,Str "aquella",Space,Str "valor",LineBreak,Str "'que",Space,Str "vos",Space,Str "guida",Space,Str "al",Space,Str "som",Space,Str "de",SoftBreak,Str "l'escalina,",LineBreak,Str "'sovegna",Space,Str "vos",Space,Str "a",Space,Str "temps",Space,Str "de",Space,Str "ma",Space,Str "dolor.'",LineBreak,Str "Poi",SoftBreak,Str "s'ascose",Space,Str "nel",Space,Str "foco",Space,Str "che",Space,Str "gli",Space,Str "affina.\""]]]]]
-   ,Div ("wasteland-content.xhtml#ln429",[],[])
-    [Plain [Span ("",[],[("lang","it")]) [SoftBreak,Emph [Str "Quando",Space,Str "fiam",Space,Str "ceu",Space,Str "chelidon"],SoftBreak],Space,Str "-",Space,Str "O",Space,Str "swallow",Space,Str "swallow",Note [Para [Link ("",[],[]) [Str "429."] ("#wasteland-content.xhtml#ln429",""),Space,Str "V.",Space,Str "Pervigilium",Space,Str "Veneris.",Space,Str "Cf.",Space,Str "Philomela",Space,Str "in",Space,Str "Parts",Space,Str "II",Space,Str "and",Space,Str "III."]]]]
-   ,Div ("wasteland-content.xhtml#ln430",[],[("lang","fr")])
-    [Plain [Emph [Str "Le",Space,Str "Prince",Space,Str "d'Aquitaine",Space,Str "a",Space,Str "la",Space,Str "tour",Space,Str "abolie"],SoftBreak,Note [Para [Link ("",[],[]) [Str "430."] ("#wasteland-content.xhtml#ln430",""),Space,Str "V.",Space,Str "Gerard",Space,Str "de",Space,Str "Nerval,",Space,Str "Sonnet",Space,Str "El",Space,Str "Desdichado."]],SoftBreak,Span ("",["lnum"],[]) [Str "430"]]]
-   ,Div ("",[],[])
-    [Plain [Str "These",Space,Str "fragments",Space,Str "I",Space,Str "have",Space,Str "shored",Space,Str "against",Space,Str "my",Space,Str "ruins"]]
-   ,Div ("wasteland-content.xhtml#ln432",[],[])
-    [Plain [Str "Why",Space,Str "then",Space,Str "Ile",Space,Str "fit",Space,Str "you.",Space,Str "Hieronymo's",Space,Str "mad",Space,Str "againe.",Note [Para [Link ("",[],[]) [Str "432."] ("#wasteland-content.xhtml#ln432",""),Space,Str "V.",Space,Str "Kyd's",Space,Str "Spanish",Space,Str "Tragedy."]]]]
-   ,Div ("",[],[("lang","sa")])
-    [Plain [Str "Datta.",Space,Str "Dayadhvam.",Space,Str "Damyata."]]
-   ,Div ("wasteland-content.xhtml#ln434",["linegroup","indent"],[])
-    [Plain [Span ("",[],[("lang","sa")]) [Str "Shantih",Space,Str "shantih",Space,Str "shantih",Note [Para [Link ("",[],[]) [Str "434."] ("#wasteland-content.xhtml#ln434",""),Space,Str "Shantih.",Space,Str "Repeated",Space,Str "as",Space,Str "here,",Space,Str "a",Space,Str "formal",Space,Str "ending",Space,Str "to",Space,Str "an",Space,Str "Upanishad.",Space,Str "'The",SoftBreak,Str "Peace",Space,Str "which",Space,Str "passeth",Space,Str "understanding'",Space,Str "is",Space,Str "a",Space,Str "feeble",Space,Str "translation",Space,Str "of",Space,Str "the",SoftBreak,Str "content",Space,Str "of",Space,Str "this",Space,Str "word."]],SoftBreak]]]]]]
-,Div ("wasteland-content.xhtml#backmatter",["section","backmatter"],[])
- [Div ("wasteland-content.xhtml#rearnotes",["section","rearnotes"],[])
-  [Header 2 ("",[],[]) [Str "NOTES",Space,Str "ON",Space,Str "\"THE",Space,Str "WASTE",Space,Str "LAND\""]
-  ,Para [Str "Not",Space,Str "only",Space,Str "the",Space,Str "title,",Space,Str "but",Space,Str "the",Space,Str "plan",Space,Str "and",Space,Str "a",Space,Str "good",Space,Str "deal",Space,Str "of",Space,Str "the",Space,Str "incidental",Space,Str "symbolism",Space,Str "of",SoftBreak,Str "the",Space,Str "poem",Space,Str "were",Space,Str "suggested",Space,Str "by",Space,Str "Miss",Space,Str "Jessie",Space,Str "L.",Space,Str "Weston's",Space,Str "book",Space,Str "on",Space,Str "the",Space,Str "Grail",Space,Str "legend:",SoftBreak,Str "From",Space,Str "Ritual",Space,Str "to",Space,Str "Romance"]
-  ,Para [Str "Indeed,",Space,Str "so",Space,Str "deeply",Space,Str "am",Space,Str "I",Space,Str "indebted,",Space,Str "Miss",Space,Str "Weston's",Space,Str "book",Space,Str "will",Space,Str "elucidate",Space,Str "the",SoftBreak,Str "difficulties",Space,Str "of",Space,Str "the",Space,Str "poem",Space,Str "much",Space,Str "better",Space,Str "than",Space,Str "my",Space,Str "notes",Space,Str "can",Space,Str "do;",Space,Str "and",Space,Str "I",Space,Str "recommend",Space,Str "it",SoftBreak,Str "(apart",Space,Str "from",Space,Str "the",Space,Str "great",Space,Str "interest",Space,Str "of",Space,Str "the",Space,Str "book",Space,Str "itself)",Space,Str "to",Space,Str "any",Space,Str "who",Space,Str "think",Space,Str "such",SoftBreak,Str "elucidation",Space,Str "of",Space,Str "the",Space,Str "poem",Space,Str "worth",Space,Str "the",Space,Str "trouble.",Space,Str "To",Space,Str "another",Space,Str "work",Space,Str "of",Space,Str "anthropology",Space,Str "I",Space,Str "am",SoftBreak,Str "indebted",Space,Str "in",Space,Str "general,",Space,Str "one",Space,Str "which",Space,Str "has",Space,Str "influenced",Space,Str "our",Space,Str "generation",Space,Str "profoundly;",Space,Str "I",Space,Str "mean",SoftBreak,Str "The",Space,Str "Golden",Space,Str "Bough;",Space,Str "I",Space,Str "have",Space,Str "used",Space,Str "especially",Space,Str "the",Space,Str "two",Space,Str "volumes",Space,Str "Adonis,",Space,Str "Attis,",Space,Str "Osiris.",SoftBreak,Str "Anyone",Space,Str "who",Space,Str "is",Space,Str "acquainted",Space,Str "with",Space,Str "these",Space,Str "works",Space,Str "will",Space,Str "immediately",Space,Str "recognise",Space,Str "in",Space,Str "the",Space,Str "poem",SoftBreak,Str "certain",Space,Str "references",Space,Str "to",Space,Str "vegetation",Space,Str "ceremonies."]
-  ,Div ("",["section"],[])
-   [Header 3 ("",[],[]) [Str "I.",Space,Str "THE",Space,Str "BURIAL",Space,Str "OF",Space,Str "THE",Space,Str "DEAD"]]
-  ,Div ("",["section"],[])
-   [Header 3 ("",[],[]) [Str "II.",Space,Str "A",Space,Str "GAME",Space,Str "OF",Space,Str "CHESS"]]
-  ,Div ("",["section"],[])
-   [Header 3 ("",[],[]) [Str "III.",Space,Str "THE",Space,Str "FIRE",Space,Str "SERMON"]]
-  ,Div ("",["section"],[])
-   [Header 3 ("",[],[]) [Str "V.",Space,Str "WHAT",Space,Str "THE",Space,Str "THUNDER",Space,Str "SAID"]
-   ,Para [Str "In",Space,Str "the",Space,Str "first",Space,Str "part",Space,Str "of",Space,Str "Part",Space,Str "V",Space,Str "three",Space,Str "themes",Space,Str "are",Space,Str "employed:",Space,Str "the",Space,Str "journey",Space,Str "to",Space,Str "Emmaus,",SoftBreak,Str "the",Space,Str "approach",Space,Str "to",Space,Str "the",Space,Str "Chapel",Space,Str "Perilous",Space,Str "(see",Space,Str "Miss",Space,Str "Weston's",Space,Str "book)",Space,Str "and",Space,Str "the",Space,Str "present",SoftBreak,Str "decay",Space,Str "of",Space,Str "eastern",Space,Str "Europe."]]]]]
+[ Para
+    [ Image ( "" , [] , [] ) [] ( "wasteland-cover.jpg" , "" ) ]
+, Para [ Span ( "wasteland-content.xhtml" , [] , [] ) [] ]
+, Div
+    ( "wasteland-content.xhtml#frontmatter"
+    , [ "section" , "frontmatter" ]
+    , []
+    )
+    []
+, Div
+    ( "wasteland-content.xhtml#bodymatter"
+    , [ "section" , "bodymatter" ]
+    , []
+    )
+    [ Div
+        ( "wasteland-content.xhtml#ch1" , [ "section" ] , [] )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Str "I."
+            , Space
+            , Str "THE"
+            , Space
+            , Str "BURIAL"
+            , Space
+            , Str "OF"
+            , Space
+            , Str "THE"
+            , Space
+            , Str "DEAD"
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "April"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "cruellest"
+                    , Space
+                    , Str "month,"
+                    , Space
+                    , Str "breeding"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Lilacs"
+                    , Space
+                    , Str "out"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "dead"
+                    , Space
+                    , Str "land,"
+                    , Space
+                    , Str "mixing"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Memory"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "desire,"
+                    , Space
+                    , Str "stirring"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Dull"
+                    , Space
+                    , Str "roots"
+                    , Space
+                    , Str "with"
+                    , Space
+                    , Str "spring"
+                    , Space
+                    , Str "rain."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Winter"
+                    , Space
+                    , Str "kept"
+                    , Space
+                    , Str "us"
+                    , Space
+                    , Str "warm,"
+                    , Space
+                    , Str "covering"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Earth"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "forgetful"
+                    , Space
+                    , Str "snow,"
+                    , Space
+                    , Str "feeding"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "A"
+                    , Space
+                    , Str "little"
+                    , Space
+                    , Str "life"
+                    , Space
+                    , Str "with"
+                    , Space
+                    , Str "dried"
+                    , Space
+                    , Str "tubers."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Summer"
+                    , Space
+                    , Str "surprised"
+                    , Space
+                    , Str "us,"
+                    , Space
+                    , Str "coming"
+                    , Space
+                    , Str "over"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "Starnbergersee"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "With"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "shower"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "rain;"
+                    , Space
+                    , Str "we"
+                    , Space
+                    , Str "stopped"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "colonnade,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "went"
+                    , Space
+                    , Str "on"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "sunlight,"
+                    , Space
+                    , Str "into"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "Hofgarten,"
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "10" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "drank"
+                    , Space
+                    , Str "coffee,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "talked"
+                    , Space
+                    , Str "for"
+                    , Space
+                    , Str "an"
+                    , Space
+                    , Str "hour."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [ ( "lang" , "de" ) ] )
+                [ Plain
+                    [ Str "Bin"
+                    , Space
+                    , Str "gar"
+                    , Space
+                    , Str "keine"
+                    , Space
+                    , Str "Russin,"
+                    , Space
+                    , Str "stamm'"
+                    , Space
+                    , Str "aus"
+                    , Space
+                    , Str "Litauen,"
+                    , Space
+                    , Str "echt"
+                    , SoftBreak
+                    , Str "deutsch."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "when"
+                    , Space
+                    , Str "we"
+                    , Space
+                    , Str "were"
+                    , Space
+                    , Str "children,"
+                    , Space
+                    , Str "staying"
+                    , Space
+                    , Str "at"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "archduke's,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "My"
+                    , Space
+                    , Str "cousin's,"
+                    , Space
+                    , Str "he"
+                    , Space
+                    , Str "took"
+                    , Space
+                    , Str "me"
+                    , Space
+                    , Str "out"
+                    , Space
+                    , Str "on"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "sled,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "was"
+                    , Space
+                    , Str "frightened."
+                    , Space
+                    , Str "He"
+                    , Space
+                    , Str "said,"
+                    , Space
+                    , Str "Marie,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Marie,"
+                    , Space
+                    , Str "hold"
+                    , Space
+                    , Str "on"
+                    , Space
+                    , Str "tight."
+                    , Space
+                    , Str "And"
+                    , Space
+                    , Str "down"
+                    , Space
+                    , Str "we"
+                    , Space
+                    , Str "went."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "In"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "mountains,"
+                    , Space
+                    , Str "there"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "feel"
+                    , Space
+                    , Str "free."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "I"
+                    , Space
+                    , Str "read,"
+                    , Space
+                    , Str "much"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "night,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "go"
+                    , Space
+                    , Str "south"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "winter."
+                    ]
+                ]
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "What"
+                    , Space
+                    , Str "are"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "roots"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "clutch,"
+                    , Space
+                    , Str "what"
+                    , Space
+                    , Str "branches"
+                    , Space
+                    , Str "grow"
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln20" , [] , [] )
+                [ Plain
+                    [ Str "Out"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "this"
+                    , Space
+                    , Str "stony"
+                    , Space
+                    , Str "rubbish?"
+                    , Space
+                    , Str "Son"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "man,"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "Line" , Space , Str "20." ]
+                                ( "#wasteland-content.xhtml#ln20" , "" )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "Ezekiel"
+                            , Space
+                            , Str "2:1."
+                            ]
+                        ]
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "20" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "You"
+                    , Space
+                    , Str "cannot"
+                    , Space
+                    , Str "say,"
+                    , Space
+                    , Str "or"
+                    , Space
+                    , Str "guess,"
+                    , Space
+                    , Str "for"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "know"
+                    , Space
+                    , Str "only"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "A"
+                    , Space
+                    , Str "heap"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "broken"
+                    , Space
+                    , Str "images,"
+                    , Space
+                    , Str "where"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "sun"
+                    , Space
+                    , Str "beats,"
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln23" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "dead"
+                    , Space
+                    , Str "tree"
+                    , Space
+                    , Str "gives"
+                    , Space
+                    , Str "no"
+                    , Space
+                    , Str "shelter,"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "cricket"
+                    , Space
+                    , Str "no"
+                    , Space
+                    , Str "relief,"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "23." ]
+                                ( "#wasteland-content.xhtml#ln23" , "" )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "Ecclesiastes"
+                            , Space
+                            , Str "12:5."
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "dry"
+                    , Space
+                    , Str "stone"
+                    , Space
+                    , Str "no"
+                    , Space
+                    , Str "sound"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "water."
+                    , Space
+                    , Str "Only"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "There"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "shadow"
+                    , Space
+                    , Str "under"
+                    , Space
+                    , Str "this"
+                    , Space
+                    , Str "red"
+                    , Space
+                    , Str "rock,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "(Come"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "under"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "shadow"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "this"
+                    , Space
+                    , Str "red"
+                    , Space
+                    , Str "rock),"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "will"
+                    , Space
+                    , Str "show"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "something"
+                    , Space
+                    , Str "different"
+                    , Space
+                    , Str "from"
+                    , Space
+                    , Str "either"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Your"
+                    , Space
+                    , Str "shadow"
+                    , Space
+                    , Str "at"
+                    , Space
+                    , Str "morning"
+                    , Space
+                    , Str "striding"
+                    , Space
+                    , Str "behind"
+                    , Space
+                    , Str "you"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Or"
+                    , Space
+                    , Str "your"
+                    , Space
+                    , Str "shadow"
+                    , Space
+                    , Str "at"
+                    , Space
+                    , Str "evening"
+                    , Space
+                    , Str "rising"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "meet"
+                    , Space
+                    , Str "you;"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "I"
+                    , Space
+                    , Str "will"
+                    , Space
+                    , Str "show"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "fear"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "handful"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "dust."
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "30" ]
+                    ]
+                ]
+            , BlockQuote
+                [ Div
+                    ( "" , [] , [] )
+                    [ Div
+                        ( "wasteland-content.xhtml#ln31" , [] , [] )
+                        [ Plain
+                            [ Str "Frisch"
+                            , Space
+                            , Str "weht"
+                            , Space
+                            , Str "der"
+                            , Space
+                            , Str "Wind"
+                            , Note
+                                [ Para
+                                    [ Link
+                                        ( "" , [] , [] )
+                                        [ Str "31." ]
+                                        ( "#wasteland-content.xhtml#ln31"
+                                        , ""
+                                        )
+                                    , Space
+                                    , Str "V."
+                                    , Space
+                                    , Str "Tristan"
+                                    , Space
+                                    , Str "und"
+                                    , Space
+                                    , Str "Isolde,"
+                                    , Space
+                                    , Str "i,"
+                                    , Space
+                                    , Str "verses"
+                                    , Space
+                                    , Str "5-8."
+                                    ]
+                                ]
+                            ]
+                        ]
+                    , Div
+                        ( "" , [] , [] )
+                        [ Plain
+                            [ Str "Der"
+                            , Space
+                            , Str "Heimat"
+                            , Space
+                            , Str "zu"
+                            ]
+                        ]
+                    , Div
+                        ( "" , [] , [] )
+                        [ Plain
+                            [ Str "Mein"
+                            , Space
+                            , Str "Irisch"
+                            , Space
+                            , Str "Kind,"
+                            ]
+                        ]
+                    , Div
+                        ( "" , [] , [] )
+                        [ Plain
+                            [ Str "Wo"
+                            , Space
+                            , Str "weilest"
+                            , Space
+                            , Str "du?"
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"You"
+                    , Space
+                    , Str "gave"
+                    , Space
+                    , Str "me"
+                    , Space
+                    , Str "hyacinths"
+                    , Space
+                    , Str "first"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "year"
+                    , Space
+                    , Str "ago;"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"They"
+                    , Space
+                    , Str "called"
+                    , Space
+                    , Str "me"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "hyacinth"
+                    , Space
+                    , Str "girl.\""
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\8213Yet"
+                    , Space
+                    , Str "when"
+                    , Space
+                    , Str "we"
+                    , Space
+                    , Str "came"
+                    , Space
+                    , Str "back,"
+                    , Space
+                    , Str "late,"
+                    , Space
+                    , Str "from"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "Hyacinth"
+                    , SoftBreak
+                    , Str "garden,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Your"
+                    , Space
+                    , Str "arms"
+                    , Space
+                    , Str "full,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "your"
+                    , Space
+                    , Str "hair"
+                    , Space
+                    , Str "wet,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "could"
+                    , Space
+                    , Str "not"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Speak,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "my"
+                    , Space
+                    , Str "eyes"
+                    , Space
+                    , Str "failed,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "was"
+                    , Space
+                    , Str "neither"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Living"
+                    , Space
+                    , Str "nor"
+                    , Space
+                    , Str "dead,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "knew"
+                    , Space
+                    , Str "nothing,"
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "40" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Looking"
+                    , Space
+                    , Str "into"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "heart"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "light,"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "silence."
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln42"
+                , []
+                , [ ( "lang" , "de" ) ]
+                )
+                [ Plain
+                    [ Emph
+                        [ Str "Od'"
+                        , Space
+                        , Str "und"
+                        , Space
+                        , Str "leer"
+                        , Space
+                        , Str "das"
+                        , Space
+                        , Str "Meer"
+                        ]
+                    , Str "."
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "42." ]
+                                ( "#wasteland-content.xhtml#ln42" , "" )
+                            , Space
+                            , Str "Id."
+                            , Space
+                            , Str "iii,"
+                            , Space
+                            , Str "verse"
+                            , Space
+                            , Str "24."
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Madame"
+                    , Space
+                    , Str "Sosostris,"
+                    , Space
+                    , Str "famous"
+                    , Space
+                    , Str "clairvoyante,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Had"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "bad"
+                    , Space
+                    , Str "cold,"
+                    , Space
+                    , Str "nevertheless"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Is"
+                    , Space
+                    , Str "known"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "be"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "wisest"
+                    , Space
+                    , Str "woman"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "Europe,"
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln46" , [] , [] )
+                [ Plain
+                    [ Str "With"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "wicked"
+                    , Space
+                    , Str "pack"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "cards."
+                    , Space
+                    , Str "Here,"
+                    , Space
+                    , Str "said"
+                    , Space
+                    , Str "she,"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "46." ]
+                                ( "#wasteland-content.xhtml#ln46" , "" )
+                            , Space
+                            , Str "I"
+                            , Space
+                            , Str "am"
+                            , Space
+                            , Str "not"
+                            , Space
+                            , Str "familiar"
+                            , Space
+                            , Str "with"
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "exact"
+                            , Space
+                            , Str "constitution"
+                            , Space
+                            , Str "of"
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "Tarot"
+                            , Space
+                            , Str "pack"
+                            , Space
+                            , Str "of"
+                            , SoftBreak
+                            , Str "cards,"
+                            , Space
+                            , Str "from"
+                            , Space
+                            , Str "which"
+                            , Space
+                            , Str "I"
+                            , Space
+                            , Str "have"
+                            , Space
+                            , Str "obviously"
+                            , Space
+                            , Str "departed"
+                            , Space
+                            , Str "to"
+                            , Space
+                            , Str "suit"
+                            , Space
+                            , Str "my"
+                            , Space
+                            , Str "own"
+                            , Space
+                            , Str "convenience."
+                            , SoftBreak
+                            , Str "The"
+                            , Space
+                            , Str "Hanged"
+                            , Space
+                            , Str "Man,"
+                            , Space
+                            , Str "a"
+                            , Space
+                            , Str "member"
+                            , Space
+                            , Str "of"
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "traditional"
+                            , Space
+                            , Str "pack,"
+                            , Space
+                            , Str "fits"
+                            , Space
+                            , Str "my"
+                            , Space
+                            , Str "purpose"
+                            , Space
+                            , Str "in"
+                            , Space
+                            , Str "two"
+                            , SoftBreak
+                            , Str "ways:"
+                            , Space
+                            , Str "because"
+                            , Space
+                            , Str "he"
+                            , Space
+                            , Str "is"
+                            , Space
+                            , Str "associated"
+                            , Space
+                            , Str "in"
+                            , Space
+                            , Str "my"
+                            , Space
+                            , Str "mind"
+                            , Space
+                            , Str "with"
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "Hanged"
+                            , Space
+                            , Str "God"
+                            , Space
+                            , Str "of"
+                            , Space
+                            , Str "Frazer,"
+                            , SoftBreak
+                            , Str "and"
+                            , Space
+                            , Str "because"
+                            , Space
+                            , Str "I"
+                            , Space
+                            , Str "associate"
+                            , Space
+                            , Str "him"
+                            , Space
+                            , Str "with"
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "hooded"
+                            , Space
+                            , Str "figure"
+                            , Space
+                            , Str "in"
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "passage"
+                            , Space
+                            , Str "of"
+                            , Space
+                            , Str "the"
+                            , SoftBreak
+                            , Str "disciples"
+                            , Space
+                            , Str "to"
+                            , Space
+                            , Str "Emmaus"
+                            , Space
+                            , Str "in"
+                            , Space
+                            , Str "Part"
+                            , Space
+                            , Str "V."
+                            , Space
+                            , Str "The"
+                            , Space
+                            , Str "Phoenician"
+                            , Space
+                            , Str "Sailor"
+                            , Space
+                            , Str "and"
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "Merchant"
+                            , SoftBreak
+                            , Str "appear"
+                            , Space
+                            , Str "later;"
+                            , Space
+                            , Str "also"
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "\"crowds"
+                            , Space
+                            , Str "of"
+                            , Space
+                            , Str "people,\""
+                            , Space
+                            , Str "and"
+                            , Space
+                            , Str "Death"
+                            , Space
+                            , Str "by"
+                            , Space
+                            , Str "Water"
+                            , Space
+                            , Str "is"
+                            , SoftBreak
+                            , Str "executed"
+                            , Space
+                            , Str "in"
+                            , Space
+                            , Str "Part"
+                            , Space
+                            , Str "IV."
+                            , Space
+                            , Str "The"
+                            , Space
+                            , Str "Man"
+                            , Space
+                            , Str "with"
+                            , Space
+                            , Str "Three"
+                            , Space
+                            , Str "Staves"
+                            , Space
+                            , Str "(an"
+                            , Space
+                            , Str "authentic"
+                            , Space
+                            , Str "member"
+                            , Space
+                            , Str "of"
+                            , SoftBreak
+                            , Str "the"
+                            , Space
+                            , Str "Tarot"
+                            , Space
+                            , Str "pack)"
+                            , Space
+                            , Str "I"
+                            , Space
+                            , Str "associate,"
+                            , Space
+                            , Str "quite"
+                            , Space
+                            , Str "arbitrarily,"
+                            , Space
+                            , Str "with"
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "Fisher"
+                            , Space
+                            , Str "King"
+                            , SoftBreak
+                            , Str "himself."
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Is"
+                    , Space
+                    , Str "your"
+                    , Space
+                    , Str "card,"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "drowned"
+                    , Space
+                    , Str "Phoenician"
+                    , Space
+                    , Str "Sailor,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "(Those"
+                    , Space
+                    , Str "are"
+                    , Space
+                    , Str "pearls"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "were"
+                    , Space
+                    , Str "his"
+                    , Space
+                    , Str "eyes."
+                    , Space
+                    , Str "Look!)"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Here"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "Belladonna,"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "Lady"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "Rocks,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "The"
+                    , Space
+                    , Str "lady"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "situations."
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "50" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Here"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "man"
+                    , Space
+                    , Str "with"
+                    , Space
+                    , Str "three"
+                    , Space
+                    , Str "staves,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "here"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "Wheel,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "here"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "one-eyed"
+                    , Space
+                    , Str "merchant,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "this"
+                    , Space
+                    , Str "card,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Which"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "blank,"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "something"
+                    , Space
+                    , Str "he"
+                    , Space
+                    , Str "carries"
+                    , Space
+                    , Str "on"
+                    , Space
+                    , Str "his"
+                    , Space
+                    , Str "back,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Which"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "am"
+                    , Space
+                    , Str "forbidden"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "see."
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "do"
+                    , Space
+                    , Str "not"
+                    , Space
+                    , Str "find"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "The"
+                    , Space
+                    , Str "Hanged"
+                    , Space
+                    , Str "Man."
+                    , Space
+                    , Str "Fear"
+                    , Space
+                    , Str "death"
+                    , Space
+                    , Str "by"
+                    , Space
+                    , Str "water."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "I"
+                    , Space
+                    , Str "see"
+                    , Space
+                    , Str "crowds"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "people,"
+                    , Space
+                    , Str "walking"
+                    , Space
+                    , Str "round"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "ring."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Thank"
+                    , Space
+                    , Str "you."
+                    , Space
+                    , Str "If"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "see"
+                    , Space
+                    , Str "dear"
+                    , Space
+                    , Str "Mrs."
+                    , Space
+                    , Str "Equitone,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Tell"
+                    , Space
+                    , Str "her"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "bring"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "horoscope"
+                    , Space
+                    , Str "myself:"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "One"
+                    , Space
+                    , Str "must"
+                    , Space
+                    , Str "be"
+                    , Space
+                    , Str "so"
+                    , Space
+                    , Str "careful"
+                    , Space
+                    , Str "these"
+                    , Space
+                    , Str "days."
+                    ]
+                ]
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div
+                ( "wasteland-content.xhtml#ln60" , [] , [] )
+                [ Plain
+                    [ Str "Unreal"
+                    , Space
+                    , Str "City,"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "60." ]
+                                ( "#wasteland-content.xhtml#ln60" , "" )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "Baudelaire:"
+                            ]
+                        , BlockQuote
+                            [ Para
+                                [ Str "\"Fourmillante"
+                                , Space
+                                , Str "cite;,"
+                                , Space
+                                , Str "cite;"
+                                , Space
+                                , Str "pleine"
+                                , Space
+                                , Str "de"
+                                , Space
+                                , Str "reves,"
+                                , LineBreak
+                                , Str "Ou"
+                                , Space
+                                , Str "le"
+                                , Space
+                                , Str "spectre"
+                                , Space
+                                , Str "en"
+                                , SoftBreak
+                                , Str "plein"
+                                , Space
+                                , Str "jour"
+                                , Space
+                                , Str "raccroche"
+                                , Space
+                                , Str "le"
+                                , Space
+                                , Str "passant.\""
+                                ]
+                            ]
+                        ]
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "60" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Under"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "brown"
+                    , Space
+                    , Str "fog"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "winter"
+                    , Space
+                    , Str "dawn,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "A"
+                    , Space
+                    , Str "crowd"
+                    , Space
+                    , Str "flowed"
+                    , Space
+                    , Str "over"
+                    , Space
+                    , Str "London"
+                    , Space
+                    , Str "Bridge,"
+                    , Space
+                    , Str "so"
+                    , Space
+                    , Str "many,"
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln63" , [] , [] )
+                [ Plain
+                    [ Str "I"
+                    , Space
+                    , Str "had"
+                    , Space
+                    , Str "not"
+                    , Space
+                    , Str "thought"
+                    , Space
+                    , Str "death"
+                    , Space
+                    , Str "had"
+                    , Space
+                    , Str "undone"
+                    , Space
+                    , Str "so"
+                    , Space
+                    , Str "many."
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "63." ]
+                                ( "#wasteland-content.xhtml#ln63" , "" )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "Inferno,"
+                            , Space
+                            , Str "iii."
+                            , Space
+                            , Str "55-7."
+                            ]
+                        , BlockQuote
+                            [ Para
+                                [ Str "\"si"
+                                , Space
+                                , Str "lunga"
+                                , Space
+                                , Str "tratta"
+                                , LineBreak
+                                , Str "di"
+                                , Space
+                                , Str "gente,"
+                                , Space
+                                , Str "ch'io"
+                                , Space
+                                , Str "non"
+                                , Space
+                                , Str "avrei"
+                                , Space
+                                , Str "mai"
+                                , Space
+                                , Str "creduto"
+                                , LineBreak
+                                , Str "che"
+                                , SoftBreak
+                                , Str "morte"
+                                , Space
+                                , Str "tanta"
+                                , Space
+                                , Str "n'avesse"
+                                , Space
+                                , Str "disfatta.\""
+                                ]
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln64" , [] , [] )
+                [ Plain
+                    [ Str "Sighs,"
+                    , Space
+                    , Str "short"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "infrequent,"
+                    , Space
+                    , Str "were"
+                    , Space
+                    , Str "exhaled,"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "64." ]
+                                ( "#wasteland-content.xhtml#ln64" , "" )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "Inferno,"
+                            , Space
+                            , Str "iv."
+                            , Space
+                            , Str "25-7:"
+                            ]
+                        , BlockQuote
+                            [ Para
+                                [ Str "\"Quivi,"
+                                , Space
+                                , Str "secondo"
+                                , Space
+                                , Str "che"
+                                , Space
+                                , Str "per"
+                                , Space
+                                , Str "ascoltahre,"
+                                , LineBreak
+                                , Str "\"non"
+                                , Space
+                                , Str "avea"
+                                , Space
+                                , Str "pianto,"
+                                , Space
+                                , Str "ma'"
+                                , Space
+                                , Str "che"
+                                , Space
+                                , Str "di"
+                                , SoftBreak
+                                , Str "sospiri,"
+                                , LineBreak
+                                , Str "\"che"
+                                , Space
+                                , Str "l'aura"
+                                , Space
+                                , Str "eterna"
+                                , Space
+                                , Str "facevan"
+                                , Space
+                                , Str "tremare.\""
+                                ]
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "each"
+                    , Space
+                    , Str "man"
+                    , Space
+                    , Str "fixed"
+                    , Space
+                    , Str "his"
+                    , Space
+                    , Str "eyes"
+                    , Space
+                    , Str "before"
+                    , Space
+                    , Str "his"
+                    , Space
+                    , Str "feet."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Flowed"
+                    , Space
+                    , Str "up"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "hill"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "down"
+                    , Space
+                    , Str "King"
+                    , Space
+                    , Str "William"
+                    , Space
+                    , Str "Street,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "To"
+                    , Space
+                    , Str "where"
+                    , Space
+                    , Str "Saint"
+                    , Space
+                    , Str "Mary"
+                    , Space
+                    , Str "Woolnoth"
+                    , Space
+                    , Str "kept"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "hours"
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln68" , [] , [] )
+                [ Plain
+                    [ Str "With"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "dead"
+                    , Space
+                    , Str "sound"
+                    , Space
+                    , Str "on"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "final"
+                    , Space
+                    , Str "stroke"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "nine."
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "68." ]
+                                ( "#wasteland-content.xhtml#ln68" , "" )
+                            , Space
+                            , Str "A"
+                            , Space
+                            , Str "phenomenon"
+                            , Space
+                            , Str "which"
+                            , Space
+                            , Str "I"
+                            , Space
+                            , Str "have"
+                            , Space
+                            , Str "often"
+                            , Space
+                            , Str "noticed."
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "There"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "saw"
+                    , Space
+                    , Str "one"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "knew,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "stopped"
+                    , Space
+                    , Str "him,"
+                    , Space
+                    , Str "crying"
+                    , SoftBreak
+                    , Str "\"Stetson!"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"You"
+                    , Space
+                    , Str "who"
+                    , Space
+                    , Str "were"
+                    , Space
+                    , Str "with"
+                    , Space
+                    , Str "me"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "ships"
+                    , Space
+                    , Str "at"
+                    , Space
+                    , Str "Mylae!"
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "70" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"That"
+                    , Space
+                    , Str "corpse"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "planted"
+                    , Space
+                    , Str "last"
+                    , Space
+                    , Str "year"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "your"
+                    , Space
+                    , Str "garden,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"Has"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "begun"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "sprout?"
+                    , Space
+                    , Str "Will"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "bloom"
+                    , Space
+                    , Str "this"
+                    , Space
+                    , Str "year?"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"Or"
+                    , Space
+                    , Str "has"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "sudden"
+                    , Space
+                    , Str "frost"
+                    , Space
+                    , Str "disturbed"
+                    , Space
+                    , Str "its"
+                    , Space
+                    , Str "bed?"
+                    ]
+                ]
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div
+                ( "wasteland-content.xhtml#ln74" , [] , [] )
+                [ Plain
+                    [ Str "\"Oh"
+                    , Space
+                    , Str "keep"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "Dog"
+                    , Space
+                    , Str "far"
+                    , Space
+                    , Str "hence,"
+                    , Space
+                    , Str "that's"
+                    , Space
+                    , Str "friend"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "men,"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "74." ]
+                                ( "#wasteland-content.xhtml#ln74" , "" )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "Dirge"
+                            , Space
+                            , Str "in"
+                            , Space
+                            , Str "Webster's"
+                            , Space
+                            , Str "White"
+                            , Space
+                            , Str "Devil"
+                            , Space
+                            , Str "."
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"Or"
+                    , Space
+                    , Str "with"
+                    , Space
+                    , Str "his"
+                    , Space
+                    , Str "nails"
+                    , Space
+                    , Str "he'll"
+                    , Space
+                    , Str "dig"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "up"
+                    , Space
+                    , Str "again!"
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln76" , [] , [] )
+                [ Plain
+                    [ Str "\"You!"
+                    , Space
+                    , Span
+                        ( "" , [] , [ ( "lang" , "fr" ) ] )
+                        [ Str "hypocrite"
+                        , Space
+                        , Str "lecteur!"
+                        , Space
+                        , Str "-"
+                        , Space
+                        , Str "mon"
+                        , Space
+                        , Str "semblable,"
+                        , Space
+                        , Str "-"
+                        , SoftBreak
+                        , Str "mon"
+                        , Space
+                        , Str "frere"
+                        ]
+                    , Space
+                    , Str "!\""
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "76." ]
+                                ( "#wasteland-content.xhtml#ln76" , "" )
+                            , Space
+                            , Str "V."
+                            , Space
+                            , Str "Baudelaire,"
+                            , Space
+                            , Str "Preface"
+                            , Space
+                            , Str "to"
+                            , Space
+                            , Str "Fleurs"
+                            , Space
+                            , Str "du"
+                            , Space
+                            , Str "Mal."
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        ]
+    , Div
+        ( "wasteland-content.xhtml#ch2" , [ "section" ] , [] )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Str "II."
+            , Space
+            , Str "A"
+            , Space
+            , Str "GAME"
+            , Space
+            , Str "OF"
+            , Space
+            , Str "CHESS"
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div
+                ( "wasteland-content.xhtml#ln77" , [] , [] )
+                [ Plain
+                    [ Str "The"
+                    , Space
+                    , Str "Chair"
+                    , Space
+                    , Str "she"
+                    , Space
+                    , Str "sat"
+                    , Space
+                    , Str "in,"
+                    , Space
+                    , Str "like"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "burnished"
+                    , Space
+                    , Str "throne,"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "77." ]
+                                ( "#wasteland-content.xhtml#ln77" , "" )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "Antony"
+                            , Space
+                            , Str "and"
+                            , Space
+                            , Str "Cleopatra,"
+                            , Space
+                            , Str "II."
+                            , Space
+                            , Str "ii.,"
+                            , Space
+                            , Str "l."
+                            , Space
+                            , Str "190."
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Glowed"
+                    , Space
+                    , Str "on"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "marble,"
+                    , Space
+                    , Str "where"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "glass"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Held"
+                    , Space
+                    , Str "up"
+                    , Space
+                    , Str "by"
+                    , Space
+                    , Str "standards"
+                    , Space
+                    , Str "wrought"
+                    , Space
+                    , Str "with"
+                    , Space
+                    , Str "fruited"
+                    , Space
+                    , Str "vines"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "From"
+                    , Space
+                    , Str "which"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "golden"
+                    , Space
+                    , Str "Cupidon"
+                    , Space
+                    , Str "peeped"
+                    , Space
+                    , Str "out"
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "80" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "(Another"
+                    , Space
+                    , Str "hid"
+                    , Space
+                    , Str "his"
+                    , Space
+                    , Str "eyes"
+                    , Space
+                    , Str "behind"
+                    , Space
+                    , Str "his"
+                    , Space
+                    , Str "wing)"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Doubled"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "flames"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "sevenbranched"
+                    , Space
+                    , Str "candelabra"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Reflecting"
+                    , Space
+                    , Str "light"
+                    , Space
+                    , Str "upon"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "table"
+                    , Space
+                    , Str "as"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "The"
+                    , Space
+                    , Str "glitter"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "her"
+                    , Space
+                    , Str "jewels"
+                    , Space
+                    , Str "rose"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "meet"
+                    , Space
+                    , Str "it,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "From"
+                    , Space
+                    , Str "satin"
+                    , Space
+                    , Str "cases"
+                    , Space
+                    , Str "poured"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "rich"
+                    , Space
+                    , Str "profusion;"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "In"
+                    , Space
+                    , Str "vials"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "ivory"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "coloured"
+                    , Space
+                    , Str "glass"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Unstoppered,"
+                    , Space
+                    , Str "lurked"
+                    , Space
+                    , Str "her"
+                    , Space
+                    , Str "strange"
+                    , Space
+                    , Str "synthetic"
+                    , Space
+                    , Str "perfumes,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Unguent,"
+                    , Space
+                    , Str "powdered,"
+                    , Space
+                    , Str "or"
+                    , Space
+                    , Str "liquid"
+                    , Space
+                    , Str "-"
+                    , Space
+                    , Str "troubled,"
+                    , Space
+                    , Str "confused"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "drowned"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "sense"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "odours;"
+                    , Space
+                    , Str "stirred"
+                    , Space
+                    , Str "by"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "air"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "That"
+                    , Space
+                    , Str "freshened"
+                    , Space
+                    , Str "from"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "window,"
+                    , Space
+                    , Str "these"
+                    , Space
+                    , Str "ascended"
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "90" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "In"
+                    , Space
+                    , Str "fattening"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "prolonged"
+                    , Space
+                    , Str "candle-flames,"
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln92" , [] , [] )
+                [ Plain
+                    [ Str "Flung"
+                    , Space
+                    , Str "their"
+                    , Space
+                    , Str "smoke"
+                    , Space
+                    , Str "into"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "laquearia,"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "92." ]
+                                ( "#wasteland-content.xhtml#ln92" , "" )
+                            , Space
+                            , Str "Laquearia."
+                            , Space
+                            , Str "V."
+                            , Space
+                            , Str "Aeneid,"
+                            , Space
+                            , Str "I."
+                            , Space
+                            , Str "726:"
+                            ]
+                        , BlockQuote
+                            [ Para
+                                [ Str "dependent"
+                                , Space
+                                , Str "lychni"
+                                , Space
+                                , Str "laquearibus"
+                                , Space
+                                , Str "aureis"
+                                , Space
+                                , Str "incensi,"
+                                , Space
+                                , Str "et"
+                                , Space
+                                , Str "noctem"
+                                , SoftBreak
+                                , Str "flammis"
+                                , LineBreak
+                                , Str "funalia"
+                                , Space
+                                , Str "vincunt."
+                                ]
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Stirring"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "pattern"
+                    , Space
+                    , Str "on"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "coffered"
+                    , Space
+                    , Str "ceiling."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Huge"
+                    , Space
+                    , Str "sea-wood"
+                    , Space
+                    , Str "fed"
+                    , Space
+                    , Str "with"
+                    , Space
+                    , Str "copper"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Burned"
+                    , Space
+                    , Str "green"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "orange,"
+                    , Space
+                    , Str "framed"
+                    , Space
+                    , Str "by"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "coloured"
+                    , Space
+                    , Str "stone,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "In"
+                    , Space
+                    , Str "which"
+                    , Space
+                    , Str "sad"
+                    , Space
+                    , Str "light"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "carved"
+                    , Space
+                    , Str "dolphin"
+                    , Space
+                    , Str "swam."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Above"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "antique"
+                    , Space
+                    , Str "mantel"
+                    , Space
+                    , Str "was"
+                    , Space
+                    , Str "displayed"
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln98" , [] , [] )
+                [ Plain
+                    [ Str "As"
+                    , Space
+                    , Str "though"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "window"
+                    , Space
+                    , Str "gave"
+                    , Space
+                    , Str "upon"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "sylvan"
+                    , Space
+                    , Str "scene"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "98." ]
+                                ( "#wasteland-content.xhtml#ln98" , "" )
+                            , Space
+                            , Str "Sylvan"
+                            , Space
+                            , Str "scene."
+                            , Space
+                            , Str "V."
+                            , Space
+                            , Str "Milton,"
+                            , Space
+                            , Str "Paradise"
+                            , Space
+                            , Str "Lost,"
+                            , Space
+                            , Str "iv."
+                            , Space
+                            , Str "140."
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln99" , [] , [] )
+                [ Plain
+                    [ Str "The"
+                    , Space
+                    , Str "change"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "Philomel,"
+                    , Space
+                    , Str "by"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "barbarous"
+                    , Space
+                    , Str "king"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "99." ]
+                                ( "#wasteland-content.xhtml#ln99" , "" )
+                            , Space
+                            , Str "V."
+                            , Space
+                            , Str "Ovid,"
+                            , Space
+                            , Str "Metamorphoses,"
+                            , Space
+                            , Str "vi,"
+                            , Space
+                            , Str "Philomela."
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln100" , [] , [] )
+                [ Plain
+                    [ Str "So"
+                    , Space
+                    , Str "rudely"
+                    , Space
+                    , Str "forced;"
+                    , Space
+                    , Str "yet"
+                    , Space
+                    , Str "there"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "nightingale"
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "100." ]
+                                ( "#wasteland-content.xhtml#ln100"
+                                , ""
+                                )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "Part"
+                            , Space
+                            , Str "III,"
+                            , Space
+                            , Str "l."
+                            , Space
+                            , Str "204."
+                            ]
+                        ]
+                    , SoftBreak
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "100" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Filled"
+                    , Space
+                    , Str "all"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "desert"
+                    , Space
+                    , Str "with"
+                    , Space
+                    , Str "inviolable"
+                    , Space
+                    , Str "voice"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "still"
+                    , Space
+                    , Str "she"
+                    , Space
+                    , Str "cried,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "still"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "world"
+                    , Space
+                    , Str "pursues,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"Jug"
+                    , Space
+                    , Str "Jug\""
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "dirty"
+                    , Space
+                    , Str "ears."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "other"
+                    , Space
+                    , Str "withered"
+                    , Space
+                    , Str "stumps"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "time"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Were"
+                    , Space
+                    , Str "told"
+                    , Space
+                    , Str "upon"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "walls;"
+                    , Space
+                    , Str "staring"
+                    , Space
+                    , Str "forms"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Leaned"
+                    , Space
+                    , Str "out,"
+                    , Space
+                    , Str "leaning,"
+                    , Space
+                    , Str "hushing"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "room"
+                    , Space
+                    , Str "enclosed."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Footsteps"
+                    , Space
+                    , Str "shuffled"
+                    , Space
+                    , Str "on"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "stair."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Under"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "firelight,"
+                    , Space
+                    , Str "under"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "brush,"
+                    , Space
+                    , Str "her"
+                    , Space
+                    , Str "hair"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Spread"
+                    , Space
+                    , Str "out"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "fiery"
+                    , Space
+                    , Str "points"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Glowed"
+                    , Space
+                    , Str "into"
+                    , Space
+                    , Str "words,"
+                    , Space
+                    , Str "then"
+                    , Space
+                    , Str "would"
+                    , Space
+                    , Str "be"
+                    , Space
+                    , Str "savagely"
+                    , Space
+                    , Str "still."
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "110" ]
+                    ]
+                ]
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div
+                ( "" , [ "linegroup" ] , [] )
+                [ Div
+                    ( "" , [] , [] )
+                    [ Plain
+                        [ Str "\"My"
+                        , Space
+                        , Str "nerves"
+                        , Space
+                        , Str "are"
+                        , Space
+                        , Str "bad"
+                        , Space
+                        , Str "to-night."
+                        , Space
+                        , Str "Yes,"
+                        , Space
+                        , Str "bad."
+                        , Space
+                        , Str "Stay"
+                        , Space
+                        , Str "with"
+                        , Space
+                        , Str "me."
+                        ]
+                    ]
+                , Div
+                    ( "" , [] , [] )
+                    [ Plain
+                        [ Str "\"Speak"
+                        , Space
+                        , Str "to"
+                        , Space
+                        , Str "me."
+                        , Space
+                        , Str "Why"
+                        , Space
+                        , Str "do"
+                        , Space
+                        , Str "you"
+                        , Space
+                        , Str "never"
+                        , Space
+                        , Str "speak."
+                        , Space
+                        , Str "Speak."
+                        ]
+                    ]
+                , Div
+                    ( "" , [] , [] )
+                    [ Plain
+                        [ Str "\"What"
+                        , Space
+                        , Str "are"
+                        , Space
+                        , Str "you"
+                        , Space
+                        , Str "thinking"
+                        , Space
+                        , Str "of?"
+                        , Space
+                        , Str "What"
+                        , Space
+                        , Str "thinking?"
+                        , Space
+                        , Str "What?"
+                        ]
+                    ]
+                , Div
+                    ( "" , [] , [] )
+                    [ Plain
+                        [ Str "\"I"
+                        , Space
+                        , Str "never"
+                        , Space
+                        , Str "know"
+                        , Space
+                        , Str "what"
+                        , Space
+                        , Str "you"
+                        , Space
+                        , Str "are"
+                        , Space
+                        , Str "thinking."
+                        , Space
+                        , Str "Think.\""
+                        ]
+                    ]
+                ]
+            , Div
+                ( "" , [ "linegroup" ] , [] )
+                [ Div
+                    ( "wasteland-content.xhtml#ln115" , [] , [] )
+                    [ Plain
+                        [ Str "I"
+                        , Space
+                        , Str "think"
+                        , Space
+                        , Str "we"
+                        , Space
+                        , Str "are"
+                        , Space
+                        , Str "in"
+                        , Space
+                        , Str "rats'"
+                        , Space
+                        , Str "alley"
+                        , Note
+                            [ Para
+                                [ Link
+                                    ( "" , [] , [] )
+                                    [ Str "115." ]
+                                    ( "#wasteland-content.xhtml#ln115"
+                                    , ""
+                                    )
+                                , Space
+                                , Str "Cf."
+                                , Space
+                                , Str "Part"
+                                , Space
+                                , Str "III,"
+                                , Space
+                                , Str "l."
+                                , Space
+                                , Str "195."
+                                ]
+                            ]
+                        ]
+                    ]
+                , Div
+                    ( "" , [] , [] )
+                    [ Plain
+                        [ Str "Where"
+                        , Space
+                        , Str "the"
+                        , Space
+                        , Str "dead"
+                        , Space
+                        , Str "men"
+                        , Space
+                        , Str "lost"
+                        , Space
+                        , Str "their"
+                        , Space
+                        , Str "bones."
+                        ]
+                    ]
+                ]
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"What"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "noise?\""
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln118" , [ "indent" ] , [] )
+                [ Plain
+                    [ Str "The"
+                    , Space
+                    , Str "wind"
+                    , Space
+                    , Str "under"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "door."
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "118." ]
+                                ( "#wasteland-content.xhtml#ln118"
+                                , ""
+                                )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "Webster:"
+                            ]
+                        , BlockQuote
+                            [ Para
+                                [ Str "\"Is"
+                                , Space
+                                , Str "the"
+                                , Space
+                                , Str "wind"
+                                , Space
+                                , Str "in"
+                                , Space
+                                , Str "that"
+                                , Space
+                                , Str "door"
+                                , Space
+                                , Str "still?\""
+                                ]
+                            ]
+                        ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"What"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "noise"
+                    , Space
+                    , Str "now?"
+                    , Space
+                    , Str "What"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "wind"
+                    , Space
+                    , Str "doing?\""
+                    ]
+                ]
+            , Div
+                ( "" , [ "indent" ] , [] )
+                [ Plain
+                    [ Str "Nothing"
+                    , Space
+                    , Str "again"
+                    , Space
+                    , Str "nothing."
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "120" ]
+                    ]
+                ]
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div ( "" , [] , [] ) [ Plain [ Str "\"Do" ] ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"You"
+                    , Space
+                    , Str "know"
+                    , Space
+                    , Str "nothing?"
+                    , Space
+                    , Str "Do"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "see"
+                    , Space
+                    , Str "nothing?"
+                    , Space
+                    , Str "Do"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "remember"
+                    ]
+                ]
+            , Div ( "" , [] , [] ) [ Plain [ Str "\"Nothing?\"" ] ]
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div
+                ( "" , [] , [] )
+                [ Plain [ Str "I" , Space , Str "remember" ] ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Those"
+                    , Space
+                    , Str "are"
+                    , Space
+                    , Str "pearls"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "were"
+                    , Space
+                    , Str "his"
+                    , Space
+                    , Str "eyes."
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln126" , [] , [] )
+                [ Plain
+                    [ Str "\"Are"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "alive,"
+                    , Space
+                    , Str "or"
+                    , Space
+                    , Str "not?"
+                    , Space
+                    , Str "Is"
+                    , Space
+                    , Str "there"
+                    , Space
+                    , Str "nothing"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "your"
+                    , Space
+                    , Str "head?\""
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "126." ]
+                                ( "#wasteland-content.xhtml#ln126"
+                                , ""
+                                )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "Part"
+                            , Space
+                            , Str "I,"
+                            , Space
+                            , Str "l."
+                            , Space
+                            , Str "37,"
+                            , Space
+                            , Str "48."
+                            ]
+                        ]
+                    ]
+                ]
+            , Div ( "" , [] , [] ) [ Plain [ Str "But" ] ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "O"
+                    , Space
+                    , Str "O"
+                    , Space
+                    , Str "O"
+                    , Space
+                    , Str "O"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "Shakespeherian"
+                    , Space
+                    , Str "Rag\8213"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "It's"
+                    , Space
+                    , Str "so"
+                    , Space
+                    , Str "elegant"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "So"
+                    , Space
+                    , Str "intelligent"
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "130" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"What"
+                    , Space
+                    , Str "shall"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "do"
+                    , Space
+                    , Str "now?"
+                    , Space
+                    , Str "What"
+                    , Space
+                    , Str "shall"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "do?\""
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "I"
+                    , Space
+                    , Str "shall"
+                    , Space
+                    , Str "rush"
+                    , Space
+                    , Str "out"
+                    , Space
+                    , Str "as"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "am,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "walk"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "street"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"With"
+                    , Space
+                    , Str "my"
+                    , Space
+                    , Str "hair"
+                    , Space
+                    , Str "down,"
+                    , Space
+                    , Str "so."
+                    , Space
+                    , Str "What"
+                    , Space
+                    , Str "shall"
+                    , Space
+                    , Str "we"
+                    , Space
+                    , Str "do"
+                    , Space
+                    , Str "to-morrow?"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "\"What"
+                    , Space
+                    , Str "shall"
+                    , Space
+                    , Str "we"
+                    , Space
+                    , Str "ever"
+                    , Space
+                    , Str "do?\""
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "The"
+                    , Space
+                    , Str "hot"
+                    , Space
+                    , Str "water"
+                    , Space
+                    , Str "at"
+                    , Space
+                    , Str "ten."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "if"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "rains,"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "closed"
+                    , Space
+                    , Str "car"
+                    , Space
+                    , Str "at"
+                    , Space
+                    , Str "four."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "we"
+                    , Space
+                    , Str "shall"
+                    , Space
+                    , Str "play"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "game"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "chess,"
+                    ]
+                ]
+            , Div
+                ( "wasteland-content.xhtml#ln138" , [] , [] )
+                [ Plain
+                    [ Str "Pressing"
+                    , Space
+                    , Str "lidless"
+                    , Space
+                    , Str "eyes"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "waiting"
+                    , Space
+                    , Str "for"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "knock"
+                    , Space
+                    , Str "upon"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "door."
+                    , Note
+                        [ Para
+                            [ Link
+                                ( "" , [] , [] )
+                                [ Str "138." ]
+                                ( "#wasteland-content.xhtml#ln138"
+                                , ""
+                                )
+                            , Space
+                            , Str "Cf."
+                            , Space
+                            , Str "the"
+                            , Space
+                            , Str "game"
+                            , Space
+                            , Str "of"
+                            , Space
+                            , Str "chess"
+                            , Space
+                            , Str "in"
+                            , Space
+                            , Str "Middleton's"
+                            , Space
+                            , Str "Women"
+                            , Space
+                            , Str "beware"
+                            , Space
+                            , Str "Women."
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        , Div
+            ( "" , [ "linegroup" ] , [] )
+            [ Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "When"
+                    , Space
+                    , Str "Lil's"
+                    , Space
+                    , Str "husband"
+                    , Space
+                    , Str "got"
+                    , Space
+                    , Str "demobbed,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "said"
+                    , Space
+                    , Str "-"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "I"
+                    , Space
+                    , Str "didn't"
+                    , Space
+                    , Str "mince"
+                    , Space
+                    , Str "my"
+                    , Space
+                    , Str "words,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "said"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "her"
+                    , Space
+                    , Str "myself,"
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "140" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "HURRY"
+                    , Space
+                    , Str "UP"
+                    , Space
+                    , Str "PLEASE"
+                    , Space
+                    , Str "ITS"
+                    , Space
+                    , Str "TIME"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Now"
+                    , Space
+                    , Str "Albert's"
+                    , Space
+                    , Str "coming"
+                    , Space
+                    , Str "back,"
+                    , Space
+                    , Str "make"
+                    , Space
+                    , Str "yourself"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "bit"
+                    , Space
+                    , Str "smart."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "He'll"
+                    , Space
+                    , Str "want"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "know"
+                    , Space
+                    , Str "what"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "done"
+                    , Space
+                    , Str "with"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "money"
+                    , Space
+                    , Str "he"
+                    , Space
+                    , Str "gave"
+                    , SoftBreak
+                    , Str "you"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "To"
+                    , Space
+                    , Str "get"
+                    , Space
+                    , Str "yourself"
+                    , Space
+                    , Str "some"
+                    , Space
+                    , Str "teeth."
+                    , Space
+                    , Str "He"
+                    , Space
+                    , Str "did,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "was"
+                    , Space
+                    , Str "there."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "You"
+                    , Space
+                    , Str "have"
+                    , Space
+                    , Str "them"
+                    , Space
+                    , Str "all"
+                    , Space
+                    , Str "out,"
+                    , Space
+                    , Str "Lil,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "get"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "nice"
+                    , Space
+                    , Str "set,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "He"
+                    , Space
+                    , Str "said,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "swear,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "can't"
+                    , Space
+                    , Str "bear"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "look"
+                    , Space
+                    , Str "at"
+                    , Space
+                    , Str "you."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "no"
+                    , Space
+                    , Str "more"
+                    , Space
+                    , Str "can't"
+                    , Space
+                    , Str "I,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "said,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "think"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "poor"
+                    , Space
+                    , Str "Albert,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "He's"
+                    , Space
+                    , Str "been"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "army"
+                    , Space
+                    , Str "four"
+                    , Space
+                    , Str "years,"
+                    , Space
+                    , Str "he"
+                    , Space
+                    , Str "wants"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "good"
+                    , Space
+                    , Str "time,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "if"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "don't"
+                    , Space
+                    , Str "give"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "him,"
+                    , Space
+                    , Str "there's"
+                    , Space
+                    , Str "others"
+                    , Space
+                    , Str "will,"
+                    , Space
+                    , Str "I"
+                    , SoftBreak
+                    , Str "said."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Oh"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "there,"
+                    , Space
+                    , Str "she"
+                    , Space
+                    , Str "said."
+                    , Space
+                    , Str "Something"
+                    , Space
+                    , Str "o'"
+                    , Space
+                    , Str "that,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "said."
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "150" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Then"
+                    , Space
+                    , Str "I'll"
+                    , Space
+                    , Str "know"
+                    , Space
+                    , Str "who"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "thank,"
+                    , Space
+                    , Str "she"
+                    , Space
+                    , Str "said,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "give"
+                    , Space
+                    , Str "me"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "straight"
+                    , SoftBreak
+                    , Str "look."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "HURRY"
+                    , Space
+                    , Str "UP"
+                    , Space
+                    , Str "PLEASE"
+                    , Space
+                    , Str "ITS"
+                    , Space
+                    , Str "TIME"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "If"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "don't"
+                    , Space
+                    , Str "like"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "can"
+                    , Space
+                    , Str "get"
+                    , Space
+                    , Str "on"
+                    , Space
+                    , Str "with"
+                    , Space
+                    , Str "it,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "said."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Others"
+                    , Space
+                    , Str "can"
+                    , Space
+                    , Str "pick"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "choose"
+                    , Space
+                    , Str "if"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "can't."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "But"
+                    , Space
+                    , Str "if"
+                    , Space
+                    , Str "Albert"
+                    , Space
+                    , Str "makes"
+                    , Space
+                    , Str "off,"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "won't"
+                    , Space
+                    , Str "be"
+                    , Space
+                    , Str "for"
+                    , Space
+                    , Str "lack"
+                    , Space
+                    , Str "of"
+                    , SoftBreak
+                    , Str "telling."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "You"
+                    , Space
+                    , Str "ought"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "be"
+                    , Space
+                    , Str "ashamed,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "said,"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "look"
+                    , Space
+                    , Str "so"
+                    , Space
+                    , Str "antique."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "(And"
+                    , Space
+                    , Str "her"
+                    , Space
+                    , Str "only"
+                    , Space
+                    , Str "thirty-one.)"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "I"
+                    , Space
+                    , Str "can't"
+                    , Space
+                    , Str "help"
+                    , Space
+                    , Str "it,"
+                    , Space
+                    , Str "she"
+                    , Space
+                    , Str "said,"
+                    , Space
+                    , Str "pulling"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "long"
+                    , Space
+                    , Str "face,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "It's"
+                    , Space
+                    , Str "them"
+                    , Space
+                    , Str "pills"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "took,"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "bring"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "off,"
+                    , Space
+                    , Str "she"
+                    , Space
+                    , Str "said."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "(She's"
+                    , Space
+                    , Str "had"
+                    , Space
+                    , Str "five"
+                    , Space
+                    , Str "already,"
+                    , Space
+                    , Str "and"
+                    , Space
+                    , Str "nearly"
+                    , Space
+                    , Str "died"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "young"
+                    , Space
+                    , Str "George.)"
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "160" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "The"
+                    , Space
+                    , Str "chemist"
+                    , Space
+                    , Str "said"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "would"
+                    , Space
+                    , Str "be"
+                    , Space
+                    , Str "all"
+                    , Space
+                    , Str "right,"
+                    , Space
+                    , Str "but"
+                    , Space
+                    , Str "I've"
+                    , Space
+                    , Str "never"
+                    , Space
+                    , Str "been"
+                    , Space
+                    , Str "the"
+                    , SoftBreak
+                    , Str "same."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "You"
+                    , Space
+                    , Emph [ Str "are" ]
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "proper"
+                    , Space
+                    , Str "fool,"
+                    , Space
+                    , Str "I"
+                    , Space
+                    , Str "said."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Well,"
+                    , Space
+                    , Str "if"
+                    , Space
+                    , Str "Albert"
+                    , Space
+                    , Str "won't"
+                    , Space
+                    , Str "leave"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "alone,"
+                    , Space
+                    , Str "there"
+                    , Space
+                    , Str "it"
+                    , Space
+                    , Str "is,"
+                    , Space
+                    , Str "I"
+                    , SoftBreak
+                    , Str "said,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "What"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "get"
+                    , Space
+                    , Str "married"
+                    , Space
+                    , Str "for"
+                    , Space
+                    , Str "if"
+                    , Space
+                    , Str "you"
+                    , Space
+                    , Str "don't"
+                    , Space
+                    , Str "want"
+                    , Space
+                    , Str "children?"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "HURRY"
+                    , Space
+                    , Str "UP"
+                    , Space
+                    , Str "PLEASE"
+                    , Space
+                    , Str "ITS"
+                    , Space
+                    , Str "TIME"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Well,"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "Sunday"
+                    , Space
+                    , Str "Albert"
+                    , Space
+                    , Str "was"
+                    , Space
+                    , Str "home,"
+                    , Space
+                    , Str "they"
+                    , Space
+                    , Str "had"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "hot"
+                    , SoftBreak
+                    , Str "gammon,"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "And"
+                    , Space
+                    , Str "they"
+                    , Space
+                    , Str "asked"
+                    , Space
+                    , Str "me"
+                    , Space
+                    , Str "in"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "dinner,"
+                    , Space
+                    , Str "to"
+                    , Space
+                    , Str "get"
+                    , Space
+                    , Str "the"
+                    , Space
+                    , Str "beauty"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "it"
+                    , SoftBreak
+                    , Str "hot\8213"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "HURRY"
+                    , Space
+                    , Str "UP"
+                    , Space
+                    , Str "PLEASE"
+                    , Space
+                    , Str "ITS"
+                    , Space
+                    , Str "TIME"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "HURRY"
+                    , Space
+                    , Str "UP"
+                    , Space
+                    , Str "PLEASE"
+                    , Space
+                    , Str "ITS"
+                    , Space
+                    , Str "TIME"
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Goonight"
+                    , Space
+                    , Str "Bill."
+                    , Space
+                    , Str "Goonight"
+                    , Space
+                    , Str "Lou."
+                    , Space
+                    , Str "Goonight"
+                    , Space
+                    , Str "May."
+                    , Space
+                    , Str "Goonight."
+                    , Span ( "" , [ "lnum" ] , [] ) [ Str "170" ]
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Ta"
+                    , Space
+                    , Str "ta."
+                    , Space
+                    , Str "Goonight."
+                    , Space
+                    , Str "Goonight."
+                    ]
+                ]
+            , Div
+                ( "" , [] , [] )
+                [ Plain
+                    [ Str "Good"
+                    , Space
+                    , Str "night,"
+                    , Space
+                    , Str "ladies,"
+                    , Space
+                    , Str "good"
+                    , Space
+                    , Str "night,"
+                    , Space
+                    , Str "sweet"
+                    , Space
+                    , Str "ladies,"
+                    , Space
+                    , Str "good"
+                    , Space
+                    , Str "night,"
+                    , Space
+                    , Str "good"
+                    , SoftBreak
+                    , Str "night."
+                    ]
+                ]
+            ]
+        ]
+    ]
+, Div
+    ( "wasteland-content.xhtml#backmatter"
+    , [ "section" , "backmatter" ]
+    , []
+    )
+    [ Div
+        ( "wasteland-content.xhtml#rearnotes"
+        , [ "section" , "rearnotes" ]
+        , []
+        )
+        [ Header
+            2
+            ( "" , [] , [] )
+            [ Str "NOTES"
+            , Space
+            , Str "ON"
+            , Space
+            , Str "\"THE"
+            , Space
+            , Str "WASTE"
+            , Space
+            , Str "LAND\""
+            ]
+        , Para
+            [ Str "Not"
+            , Space
+            , Str "only"
+            , Space
+            , Str "the"
+            , Space
+            , Str "title,"
+            , Space
+            , Str "but"
+            , Space
+            , Str "the"
+            , Space
+            , Str "plan"
+            , Space
+            , Str "and"
+            , Space
+            , Str "a"
+            , Space
+            , Str "good"
+            , Space
+            , Str "deal"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "incidental"
+            , Space
+            , Str "symbolism"
+            , Space
+            , Str "of"
+            , SoftBreak
+            , Str "the"
+            , Space
+            , Str "poem"
+            , Space
+            , Str "were"
+            , Space
+            , Str "suggested"
+            , Space
+            , Str "by"
+            , Space
+            , Str "Miss"
+            , Space
+            , Str "Jessie"
+            , Space
+            , Str "L."
+            , Space
+            , Str "Weston's"
+            , Space
+            , Str "book"
+            , Space
+            , Str "on"
+            , Space
+            , Str "the"
+            , Space
+            , Str "Grail"
+            , Space
+            , Str "legend:"
+            , SoftBreak
+            , Str "From"
+            , Space
+            , Str "Ritual"
+            , Space
+            , Str "to"
+            , Space
+            , Str "Romance"
+            ]
+        , Para
+            [ Str "Indeed,"
+            , Space
+            , Str "so"
+            , Space
+            , Str "deeply"
+            , Space
+            , Str "am"
+            , Space
+            , Str "I"
+            , Space
+            , Str "indebted,"
+            , Space
+            , Str "Miss"
+            , Space
+            , Str "Weston's"
+            , Space
+            , Str "book"
+            , Space
+            , Str "will"
+            , Space
+            , Str "elucidate"
+            , Space
+            , Str "the"
+            , SoftBreak
+            , Str "difficulties"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "poem"
+            , Space
+            , Str "much"
+            , Space
+            , Str "better"
+            , Space
+            , Str "than"
+            , Space
+            , Str "my"
+            , Space
+            , Str "notes"
+            , Space
+            , Str "can"
+            , Space
+            , Str "do;"
+            , Space
+            , Str "and"
+            , Space
+            , Str "I"
+            , Space
+            , Str "recommend"
+            , Space
+            , Str "it"
+            , SoftBreak
+            , Str "(apart"
+            , Space
+            , Str "from"
+            , Space
+            , Str "the"
+            , Space
+            , Str "great"
+            , Space
+            , Str "interest"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "book"
+            , Space
+            , Str "itself)"
+            , Space
+            , Str "to"
+            , Space
+            , Str "any"
+            , Space
+            , Str "who"
+            , Space
+            , Str "think"
+            , Space
+            , Str "such"
+            , SoftBreak
+            , Str "elucidation"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "poem"
+            , Space
+            , Str "worth"
+            , Space
+            , Str "the"
+            , Space
+            , Str "trouble."
+            , Space
+            , Str "To"
+            , Space
+            , Str "another"
+            , Space
+            , Str "work"
+            , Space
+            , Str "of"
+            , Space
+            , Str "anthropology"
+            , Space
+            , Str "I"
+            , Space
+            , Str "am"
+            , SoftBreak
+            , Str "indebted"
+            , Space
+            , Str "in"
+            , Space
+            , Str "general,"
+            , Space
+            , Str "one"
+            , Space
+            , Str "which"
+            , Space
+            , Str "has"
+            , Space
+            , Str "influenced"
+            , Space
+            , Str "our"
+            , Space
+            , Str "generation"
+            , Space
+            , Str "profoundly;"
+            , Space
+            , Str "I"
+            , Space
+            , Str "mean"
+            , SoftBreak
+            , Str "The"
+            , Space
+            , Str "Golden"
+            , Space
+            , Str "Bough;"
+            , Space
+            , Str "I"
+            , Space
+            , Str "have"
+            , Space
+            , Str "used"
+            , Space
+            , Str "especially"
+            , Space
+            , Str "the"
+            , Space
+            , Str "two"
+            , Space
+            , Str "volumes"
+            , Space
+            , Str "Adonis,"
+            , Space
+            , Str "Attis,"
+            , Space
+            , Str "Osiris."
+            , SoftBreak
+            , Str "Anyone"
+            , Space
+            , Str "who"
+            , Space
+            , Str "is"
+            , Space
+            , Str "acquainted"
+            , Space
+            , Str "with"
+            , Space
+            , Str "these"
+            , Space
+            , Str "works"
+            , Space
+            , Str "will"
+            , Space
+            , Str "immediately"
+            , Space
+            , Str "recognise"
+            , Space
+            , Str "in"
+            , Space
+            , Str "the"
+            , Space
+            , Str "poem"
+            , SoftBreak
+            , Str "certain"
+            , Space
+            , Str "references"
+            , Space
+            , Str "to"
+            , Space
+            , Str "vegetation"
+            , Space
+            , Str "ceremonies."
+            ]
+        , Div
+            ( "" , [ "section" ] , [] )
+            [ Header
+                3
+                ( "" , [] , [] )
+                [ Str "I."
+                , Space
+                , Str "THE"
+                , Space
+                , Str "BURIAL"
+                , Space
+                , Str "OF"
+                , Space
+                , Str "THE"
+                , Space
+                , Str "DEAD"
+                ]
+            ]
+        , Div
+            ( "" , [ "section" ] , [] )
+            [ Header
+                3
+                ( "" , [] , [] )
+                [ Str "II."
+                , Space
+                , Str "A"
+                , Space
+                , Str "GAME"
+                , Space
+                , Str "OF"
+                , Space
+                , Str "CHESS"
+                ]
+            ]
+        ]
+    ]
+]
diff --git a/test/fb2/reader/emphasis.native b/test/fb2/reader/emphasis.native
--- a/test/fb2/reader/emphasis.native
+++ b/test/fb2/reader/emphasis.native
@@ -1,6 +1,35 @@
-Pandoc (Meta {unMeta = fromList []})
-[Div ("",["section"],[])
- [Para [Str "Plain,",Space,Strong [Str "strong"],Str ",",Space,Emph [Str "emphasis"],Str ",",Space,Strong [Emph [Str "strong",Space,Str "emphasis"]],Str ",",Space,Emph [Strong [Str "emphasized",Space,Str "strong"]],Str "."]
- ,Para [Str "Strikethrough:",Space,Strikeout [Str "deleted"]]
- ,Para [Subscript [Str "Subscript"],Space,Str "and",Space,Superscript [Str "superscript"]]
- ,Para [Str "Some",Space,Code ("",[],[]) "code"]]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Div
+      ( "" , [ "section" ] , [] )
+      [ Para
+          [ Str "Plain,"
+          , Space
+          , Strong [ Str "strong" ]
+          , Str ","
+          , Space
+          , Emph [ Str "emphasis" ]
+          , Str ","
+          , Space
+          , Strong [ Emph [ Str "strong" , Space , Str "emphasis" ] ]
+          , Str ","
+          , Space
+          , Emph
+              [ Strong [ Str "emphasized" , Space , Str "strong" ] ]
+          , Str "."
+          ]
+      , Para
+          [ Str "Strikethrough:"
+          , Space
+          , Strikeout [ Str "deleted" ]
+          ]
+      , Para
+          [ Subscript [ Str "Subscript" ]
+          , Space
+          , Str "and"
+          , Space
+          , Superscript [ Str "superscript" ]
+          ]
+      , Para [ Str "Some" , Space , Code ( "" , [] , [] ) "code" ]
+      ]
+  ]
diff --git a/test/fb2/reader/epigraph.native b/test/fb2/reader/epigraph.native
--- a/test/fb2/reader/epigraph.native
+++ b/test/fb2/reader/epigraph.native
@@ -1,9 +1,18 @@
-Pandoc (Meta {unMeta = fromList []})
-[Div ("",["epigraph"],[])
- [Para [Str "Body",Space,Str "epigraph"]]
-,Div ("",["section"],[])
- [Div ("",["epigraph"],[])
-  [Para [Str "Section",Space,Str "epigraph"]]
- ,Div ("",["section"],[])
-  [Div ("",["epigraph"],[])
-   [Para [Str "Subsection",Space,Str "epigraph"]]]]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Div
+      ( "" , [ "epigraph" ] , [] )
+      [ Para [ Str "Body" , Space , Str "epigraph" ] ]
+  , Div
+      ( "" , [ "section" ] , [] )
+      [ Div
+          ( "" , [ "epigraph" ] , [] )
+          [ Para [ Str "Section" , Space , Str "epigraph" ] ]
+      , Div
+          ( "" , [ "section" ] , [] )
+          [ Div
+              ( "" , [ "epigraph" ] , [] )
+              [ Para [ Str "Subsection" , Space , Str "epigraph" ] ]
+          ]
+      ]
+  ]
diff --git a/test/fb2/reader/meta.native b/test/fb2/reader/meta.native
--- a/test/fb2/reader/meta.native
+++ b/test/fb2/reader/meta.native
@@ -1,2 +1,48 @@
-Pandoc (Meta {unMeta = fromList [("abstract",MetaBlocks [Para [Str "Book",Space,Str "annotation"],Para [Str "Second",Space,Str "paragraph",Space,Str "of",Space,Str "book",Space,Str "annotation"]]),("author",MetaList [MetaInlines [Str "First",Space,Str "Middle",Space,Str "Last"],MetaInlines [Str "Another",Space,Str "Author"]]),("date",MetaInlines [Str "2018"]),("keywords",MetaList [MetaString "foo",MetaString "bar",MetaString "baz"]),("title",MetaInlines [Str "Book",Space,Str "title"])]})
-[Header 1 ("",[],[]) [Str "Body",Space,Str "title"]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "abstract"
+            , MetaBlocks
+                [ Para [ Str "Book" , Space , Str "annotation" ]
+                , Para
+                    [ Str "Second"
+                    , Space
+                    , Str "paragraph"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "book"
+                    , Space
+                    , Str "annotation"
+                    ]
+                ]
+            )
+          , ( "author"
+            , MetaList
+                [ MetaInlines
+                    [ Str "First"
+                    , Space
+                    , Str "Middle"
+                    , Space
+                    , Str "Last"
+                    ]
+                , MetaInlines [ Str "Another" , Space , Str "Author" ]
+                ]
+            )
+          , ( "date" , MetaInlines [ Str "2018" ] )
+          , ( "keywords"
+            , MetaList
+                [ MetaString "foo"
+                , MetaString "bar"
+                , MetaString "baz"
+                ]
+            )
+          , ( "title"
+            , MetaInlines [ Str "Book" , Space , Str "title" ]
+            )
+          ]
+    }
+  [ Header
+      1 ( "" , [] , [] ) [ Str "Body" , Space , Str "title" ]
+  ]
diff --git a/test/fb2/reader/notes.native b/test/fb2/reader/notes.native
--- a/test/fb2/reader/notes.native
+++ b/test/fb2/reader/notes.native
@@ -1,4 +1,28 @@
-Pandoc (Meta {unMeta = fromList []})
-[Div ("",["section"],[])
- [Para [Str "Note",Space,Note [Para [Str "Note",Space,Str "contents"]],Str "."]
- ,Para [Str "Second",Space,Str "note",Space,Note [Para [Str "Second",Space,Str "note",Space,Str "contents."]],Str "."]]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Div
+      ( "" , [ "section" ] , [] )
+      [ Para
+          [ Str "Note"
+          , Space
+          , Note [ Para [ Str "Note" , Space , Str "contents" ] ]
+          , Str "."
+          ]
+      , Para
+          [ Str "Second"
+          , Space
+          , Str "note"
+          , Space
+          , Note
+              [ Para
+                  [ Str "Second"
+                  , Space
+                  , Str "note"
+                  , Space
+                  , Str "contents."
+                  ]
+              ]
+          , Str "."
+          ]
+      ]
+  ]
diff --git a/test/fb2/reader/poem.native b/test/fb2/reader/poem.native
--- a/test/fb2/reader/poem.native
+++ b/test/fb2/reader/poem.native
@@ -1,14 +1,25 @@
-Pandoc (Meta {unMeta = fromList []})
-[Div ("",["section"],[])
- [Header 2 ("",[],[]) [Str "Poem",Space,Str "title"]
- ,Div ("",["epigraph"],[])
-  [Para [Str "Poem",Space,Str "epigraph"]]
- ,Header 2 ("",["unnumbered"],[]) [Str "Subtitle"]
- ,Header 2 ("",[],[]) [Str "First",Space,Str "stanza",Space,Str "title"]
- ,LineBlock
-  [[Str "Verse"]
-  ,[Emph [Str "More"],Space,Str "verse"]]
- ,LineBlock
-  [[Str "One",Space,Str "more",Space,Str "stanza"]]
- ,Para [Str "Author"]
- ,Para [Str "April",Space,Str "2018"]]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Div
+      ( "" , [ "section" ] , [] )
+      [ Header
+          2 ( "" , [] , [] ) [ Str "Poem" , Space , Str "title" ]
+      , Div
+          ( "" , [ "epigraph" ] , [] )
+          [ Para [ Str "Poem" , Space , Str "epigraph" ] ]
+      , Header 2 ( "" , [ "unnumbered" ] , [] ) [ Str "Subtitle" ]
+      , Header
+          2
+          ( "" , [] , [] )
+          [ Str "First" , Space , Str "stanza" , Space , Str "title" ]
+      , LineBlock
+          [ [ Str "Verse" ]
+          , [ Emph [ Str "More" ] , Space , Str "verse" ]
+          ]
+      , LineBlock
+          [ [ Str "One" , Space , Str "more" , Space , Str "stanza" ]
+          ]
+      , Para [ Str "Author" ]
+      , Para [ Str "April" , Space , Str "2018" ]
+      ]
+  ]
diff --git a/test/fb2/reader/titles.native b/test/fb2/reader/titles.native
--- a/test/fb2/reader/titles.native
+++ b/test/fb2/reader/titles.native
@@ -1,8 +1,38 @@
-Pandoc (Meta {unMeta = fromList []})
-[Header 1 ("",[],[]) [Str "Body",Space,Str "title"]
-,Div ("",["section"],[])
- [Header 2 ("",[],[]) [Str "Section",Space,Str "title"]
- ,Div ("",["section"],[])
-  [Header 3 ("",[],[]) [Str "Subsection",Space,Str "title",LineBreak,Str "with",Space,Str "multiple",Space,Str "paragraphs"]]
- ,Div ("",["section"],[])
-  [Header 3 ("",[],[]) [Str "Another",Space,Str "subsection",Space,Str "title"]]]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Header
+      1 ( "" , [] , [] ) [ Str "Body" , Space , Str "title" ]
+  , Div
+      ( "" , [ "section" ] , [] )
+      [ Header
+          2 ( "" , [] , [] ) [ Str "Section" , Space , Str "title" ]
+      , Div
+          ( "" , [ "section" ] , [] )
+          [ Header
+              3
+              ( "" , [] , [] )
+              [ Str "Subsection"
+              , Space
+              , Str "title"
+              , LineBreak
+              , Str "with"
+              , Space
+              , Str "multiple"
+              , Space
+              , Str "paragraphs"
+              ]
+          ]
+      , Div
+          ( "" , [ "section" ] , [] )
+          [ Header
+              3
+              ( "" , [] , [] )
+              [ Str "Another"
+              , Space
+              , Str "subsection"
+              , Space
+              , Str "title"
+              ]
+          ]
+      ]
+  ]
diff --git a/test/haddock-reader.native b/test/haddock-reader.native
--- a/test/haddock-reader.native
+++ b/test/haddock-reader.native
@@ -1,31 +1,401 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Str "This",Space,Str "file",Space,Str "tests",Space,Str "the",Space,Str "Pandoc",Space,Str "reader",Space,Str "for",Space,Str "Haddock.",SoftBreak,Str "We've",Space,Str "borrowed",Space,Str "examples",Space,Str "from",Space,Str "Haddock's",Space,Str "documentation:",Space,Link ("",[],[]) [Str "http://www.haskell.org/haddock/doc/html/ch03s08.html"] ("http://www.haskell.org/haddock/doc/html/ch03s08.html","http://www.haskell.org/haddock/doc/html/ch03s08.html"),Str "."]
-,Para [Str "The",Space,Str "following",Space,Str "characters",Space,Str "have",Space,Str "special",Space,Str "meanings",Space,Str "in",Space,Str "Haddock,",Space,Str "/,",Space,Str "',",Space,Str "`,",Space,Str "\",",Space,Str "@,",Space,Str "<,",Space,Str "so",Space,Str "they",Space,Str "must",Space,Str "be",Space,Str "escaped."]
-,Para [Str "*",Space,Str "This",Space,Str "is",Space,Str "a",Space,Str "paragraph,",Space,Str "not",Space,Str "a",Space,Str "list",Space,Str "item.",SoftBreak,Str ">",Space,Str "This",Space,Str "sentence",Space,Str "is",Space,Str "not",Space,Str "code.",SoftBreak,Str ">>>",Space,Str "This",Space,Str "is",Space,Str "not",Space,Str "an",Space,Str "example."]
-,Para [Str "The",Space,Str "references",Space,Str "\955,",Space,Str "\955",Space,Str "and",Space,Str "\955",Space,Str "all",Space,Str "represent",Space,Str "the",Space,Str "lower-case",Space,Str "letter",Space,Str "lambda."]
-,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "code",Space,Str "block:"]
-,CodeBlock ("",[],[]) "map :: (a -> b) -> [a] -> [b]\nmap _ []     = []\nmap f (x:xs) = f x : map f xs"
-,Para [Str "This",Space,Str "is",Space,Str "another",Space,Str "code",Space,Str "block:"]
-,Para [Code ("",[],[]) "f x = x + x.",LineBreak,Code ("",[],[]) "The @...@ code block ",Emph [Code ("",[],[]) "interprets markup normally"],Code ("",[],[]) ".",Code ("",["haskell","module"],[]) "Module.Foo",Code ("",[],[]) "",LineBreak,Code ("",[],[]) "\"Hello World\""]
-,Para [Str "Haddock",Space,Str "supports",Space,Str "REPL",Space,Str "examples:"]
-,Para [Code ("",["prompt"],[]) ">>>",Space,Code ("",["haskell","expr"],[]) "fib 10",LineBreak,Code ("",["result"],[]) "55"]
-,Para [Code ("",["prompt"],[]) ">>>",Space,Code ("",["haskell","expr"],[]) "putStrLn \"foo\\nbar\"",LineBreak,Code ("",["result"],[]) "foo",LineBreak,Code ("",["result"],[]) "bar"]
-,Para [Str "That",Space,Str "was",Space,Emph [Str "really",Space,Str "cool"],Str "!",SoftBreak,Str "I",Space,Str "had",Space,Str "no",Space,Str "idea",Space,Code ("",[],[]) "fib 10 = 55",Str "."]
-,Para [Str "This",Space,Str "module",Space,Str "defines",Space,Str "the",Space,Str "type",Space,Code ("",["haskell","identifier"],[]) "T",Str ".",SoftBreak,Str "The",Space,Str "identifier",Space,Code ("",["haskell","identifier"],[]) "M.T",Space,Str "is",Space,Str "not",Space,Str "in",Space,Str "scope",SoftBreak,Str "I",Space,Str "don't",Space,Str "have",Space,Str "to",Space,Str "escape",Space,Str "my",Space,Str "apostrophes;",Space,Str "great,",Space,Str "isn't",Space,Str "it?",SoftBreak,Str "This",Space,Str "is",Space,Str "a",Space,Str "reference",Space,Str "to",Space,Str "the",Space,Code ("",["haskell","module"],[]) "Foo",Space,Str "module."]
-,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "bulleted",Space,Str "list:"]
-,BulletList
- [[Para [Str "first",Space,Str "item"]]
- ,[Para [Str "second",Space,Str "item"]]]
-,Para [Str "This",Space,Str "is",Space,Str "an",Space,Str "enumerated",Space,Str "list:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "first",Space,Str "item"]]
- ,[Para [Str "second",Space,Str "item"]]]
-,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "definition",Space,Str "list:"]
-,DefinitionList
- [([Code ("",[],[]) "foo"],
-   [[Para [Str "The",Space,Str "description",Space,Str "of",Space,Code ("",[],[]) "foo",Str "."]]])
- ,([Code ("",[],[]) "bar"],
-   [[Para [Str "The",Space,Str "description",Space,Str "of",Space,Code ("",[],[]) "bar",Str "."]]])]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "link:",Space,Link ("",[],[]) [Str "http://haskell.org"] ("http://haskell.org","http://haskell.org")]
-,Para [Link ("",[],[]) [Str "Haskell"] ("http://haskell.org","http://haskell.org"),Space,Str "is",Space,Str "a",Space,Str "fun",Space,Str "language!"]
-,Para [Link ("",[],[]) [Str "Click",Space,Str "Here!"] ("http://example.com","http://example.com")]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Para
+      [ Str "This"
+      , Space
+      , Str "file"
+      , Space
+      , Str "tests"
+      , Space
+      , Str "the"
+      , Space
+      , Str "Pandoc"
+      , Space
+      , Str "reader"
+      , Space
+      , Str "for"
+      , Space
+      , Str "Haddock."
+      , SoftBreak
+      , Str "We've"
+      , Space
+      , Str "borrowed"
+      , Space
+      , Str "examples"
+      , Space
+      , Str "from"
+      , Space
+      , Str "Haddock's"
+      , Space
+      , Str "documentation:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.haskell.org/haddock/doc/html/ch03s08.html"
+          ]
+          ( "http://www.haskell.org/haddock/doc/html/ch03s08.html"
+          , "http://www.haskell.org/haddock/doc/html/ch03s08.html"
+          )
+      , Str "."
+      ]
+  , Para
+      [ Str "The"
+      , Space
+      , Str "following"
+      , Space
+      , Str "characters"
+      , Space
+      , Str "have"
+      , Space
+      , Str "special"
+      , Space
+      , Str "meanings"
+      , Space
+      , Str "in"
+      , Space
+      , Str "Haddock,"
+      , Space
+      , Str "/,"
+      , Space
+      , Str "',"
+      , Space
+      , Str "`,"
+      , Space
+      , Str "\","
+      , Space
+      , Str "@,"
+      , Space
+      , Str "<,"
+      , Space
+      , Str "so"
+      , Space
+      , Str "they"
+      , Space
+      , Str "must"
+      , Space
+      , Str "be"
+      , Space
+      , Str "escaped."
+      ]
+  , Para
+      [ Str "*"
+      , Space
+      , Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph,"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      , SoftBreak
+      , Str ">"
+      , Space
+      , Str "This"
+      , Space
+      , Str "sentence"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "code."
+      , SoftBreak
+      , Str ">>>"
+      , Space
+      , Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "an"
+      , Space
+      , Str "example."
+      ]
+  , Para
+      [ Str "The"
+      , Space
+      , Str "references"
+      , Space
+      , Str "\955,"
+      , Space
+      , Str "\955"
+      , Space
+      , Str "and"
+      , Space
+      , Str "\955"
+      , Space
+      , Str "all"
+      , Space
+      , Str "represent"
+      , Space
+      , Str "the"
+      , Space
+      , Str "lower-case"
+      , Space
+      , Str "letter"
+      , Space
+      , Str "lambda."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "code"
+      , Space
+      , Str "block:"
+      ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "map :: (a -> b) -> [a] -> [b]\nmap _ []     = []\nmap f (x:xs) = f x : map f xs"
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "another"
+      , Space
+      , Str "code"
+      , Space
+      , Str "block:"
+      ]
+  , Para
+      [ Code ( "" , [] , [] ) "f x = x + x."
+      , LineBreak
+      , Code ( "" , [] , [] ) "The @...@ code block "
+      , Emph
+          [ Code ( "" , [] , [] ) "interprets markup normally" ]
+      , Code ( "" , [] , [] ) "."
+      , Code ( "" , [ "haskell" , "module" ] , [] ) "Module.Foo"
+      , Code ( "" , [] , [] ) ""
+      , LineBreak
+      , Code ( "" , [] , [] ) "\"Hello World\""
+      ]
+  , Para
+      [ Str "Haddock"
+      , Space
+      , Str "supports"
+      , Space
+      , Str "REPL"
+      , Space
+      , Str "examples:"
+      ]
+  , Para
+      [ Code ( "" , [ "prompt" ] , [] ) ">>>"
+      , Space
+      , Code ( "" , [ "haskell" , "expr" ] , [] ) "fib 10"
+      , LineBreak
+      , Code ( "" , [ "result" ] , [] ) "55"
+      ]
+  , Para
+      [ Code ( "" , [ "prompt" ] , [] ) ">>>"
+      , Space
+      , Code
+          ( "" , [ "haskell" , "expr" ] , [] )
+          "putStrLn \"foo\\nbar\""
+      , LineBreak
+      , Code ( "" , [ "result" ] , [] ) "foo"
+      , LineBreak
+      , Code ( "" , [ "result" ] , [] ) "bar"
+      ]
+  , Para
+      [ Str "That"
+      , Space
+      , Str "was"
+      , Space
+      , Emph [ Str "really" , Space , Str "cool" ]
+      , Str "!"
+      , SoftBreak
+      , Str "I"
+      , Space
+      , Str "had"
+      , Space
+      , Str "no"
+      , Space
+      , Str "idea"
+      , Space
+      , Code ( "" , [] , [] ) "fib 10 = 55"
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "module"
+      , Space
+      , Str "defines"
+      , Space
+      , Str "the"
+      , Space
+      , Str "type"
+      , Space
+      , Code ( "" , [ "haskell" , "identifier" ] , [] ) "T"
+      , Str "."
+      , SoftBreak
+      , Str "The"
+      , Space
+      , Str "identifier"
+      , Space
+      , Code ( "" , [ "haskell" , "identifier" ] , [] ) "M.T"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "in"
+      , Space
+      , Str "scope"
+      , SoftBreak
+      , Str "I"
+      , Space
+      , Str "don't"
+      , Space
+      , Str "have"
+      , Space
+      , Str "to"
+      , Space
+      , Str "escape"
+      , Space
+      , Str "my"
+      , Space
+      , Str "apostrophes;"
+      , Space
+      , Str "great,"
+      , Space
+      , Str "isn't"
+      , Space
+      , Str "it?"
+      , SoftBreak
+      , Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "reference"
+      , Space
+      , Str "to"
+      , Space
+      , Str "the"
+      , Space
+      , Code ( "" , [ "haskell" , "module" ] , [] ) "Foo"
+      , Space
+      , Str "module."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "bulleted"
+      , Space
+      , Str "list:"
+      ]
+  , BulletList
+      [ [ Para [ Str "first" , Space , Str "item" ] ]
+      , [ Para [ Str "second" , Space , Str "item" ] ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "an"
+      , Space
+      , Str "enumerated"
+      , Space
+      , Str "list:"
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "first" , Space , Str "item" ] ]
+      , [ Para [ Str "second" , Space , Str "item" ] ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "definition"
+      , Space
+      , Str "list:"
+      ]
+  , DefinitionList
+      [ ( [ Code ( "" , [] , [] ) "foo" ]
+        , [ [ Para
+                [ Str "The"
+                , Space
+                , Str "description"
+                , Space
+                , Str "of"
+                , Space
+                , Code ( "" , [] , [] ) "foo"
+                , Str "."
+                ]
+            ]
+          ]
+        )
+      , ( [ Code ( "" , [] , [] ) "bar" ]
+        , [ [ Para
+                [ Str "The"
+                , Space
+                , Str "description"
+                , Space
+                , Str "of"
+                , Space
+                , Code ( "" , [] , [] ) "bar"
+                , Str "."
+                ]
+            ]
+          ]
+        )
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://haskell.org" ]
+          ( "http://haskell.org" , "http://haskell.org" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Haskell" ]
+          ( "http://haskell.org" , "http://haskell.org" )
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "fun"
+      , Space
+      , Str "language!"
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Click" , Space , Str "Here!" ]
+          ( "http://example.com" , "http://example.com" )
+      ]
+  ]
diff --git a/test/html-reader.native b/test/html-reader.native
--- a/test/html-reader.native
+++ b/test/html-reader.native
@@ -1,837 +1,3284 @@
-Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("title",MetaInlines [Str "Pandoc",Space,Str "Test",Space,Str "Suite"])]})
-[Header 1 ("pandoc-test-suite",["title"],[]) [Str "Pandoc",Space,Str "Test",Space,Str "Suite"]
-,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
-,HorizontalRule
-,Header 1 ("headers",[],[]) [Str "Headers"]
-,Header 2 ("level-2-with-an-embedded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link ("",[],[]) [Str "embedded",Space,Str "link"] ("/url","")]
-,Header 3 ("level-3-with-emphasis",[],[]) [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 4 ("level-4",[],[]) [Str "Level",Space,Str "4"]
-,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
-,Header 1 ("level-1",[],[]) [Str "Level",Space,Str "1"]
-,Header 2 ("level-2-with-emphasis",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 3 ("level-3",[],[]) [Str "Level",Space,Str "3"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,Header 2 ("level-2",[],[]) [Str "Level",Space,Str "2"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,HorizontalRule
-,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
-,Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
-,Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."]
-,Para [Str "Here's",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
-,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."]
-,HorizontalRule
-,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
-,Para [Str "E-mail",Space,Str "style:"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
-,BlockQuote
- [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- ,CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"
- ,Para [Str "A",Space,Str "list:"]
- ,OrderedList (1,DefaultStyle,DefaultDelim)
-  [[Plain [Str "item",Space,Str "one"]]
-  ,[Plain [Str "item",Space,Str "two"]]]
- ,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
- ,BlockQuote
-  [Para [Str "nested"]]
- ,BlockQuote
-  [Para [Str "nested"]]]
-,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",Space,Str ">",Space,Str "1."]
-,Para [Str "Box-style:"]
-,BlockQuote
- [Para [Str "Example:"]
- ,CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"]
-,BlockQuote
- [OrderedList (1,DefaultStyle,DefaultDelim)
-  [[Plain [Str "do",Space,Str "laundry"]]
-  ,[Plain [Str "take",Space,Str "out",Space,Str "the",Space,Str "trash"]]]]
-,Para [Str "Here's",Space,Str "a",Space,Str "nested",Space,Str "one:"]
-,BlockQuote
- [Para [Str "Joe",Space,Str "said:"]
- ,BlockQuote
-  [Para [Str "Don't",Space,Str "quote",Space,Str "me."]]]
-,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
-,HorizontalRule
-,Header 1 ("inline-quotes",[],[]) [Str "Inline",Space,Str "quotes"]
-,Para [Str "Normal",Space,Str "text",Space,Str "but",Space,Str "then",Space,Str "a",Space,Quoted DoubleQuote [Span ("",[],[("cite","https://www.imdb.com/title/tt0062622/quotes/qt0396921")]) [Str "inline",Space,Str "quote"]],Str "."]
-,Para [Quoted DoubleQuote [Str "Missing",Space,Str "a",Space,Str "cite",Space,Str "attribute",Space,Str "means",Space,Str "its",Space,Str "just",Space,Str "normal",Space,Str "text"]]
-,HorizontalRule
-,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
-,Para [Str "And:"]
-,CodeBlock ("",[],[]) "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
-,HorizontalRule
-,Header 1 ("lists",[],[]) [Str "Lists"]
-,Header 2 ("unordered",[],[]) [Str "Unordered"]
-,Para [Str "Asterisks",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "asterisk",Space,Str "1"]]
- ,[Plain [Str "asterisk",Space,Str "2"]]
- ,[Plain [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Asterisks",Space,Str "loose:"]
-,BulletList
- [[Para [Str "asterisk",Space,Str "1"]]
- ,[Para [Str "asterisk",Space,Str "2"]]
- ,[Para [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "Plus",Space,Str "1"]]
- ,[Plain [Str "Plus",Space,Str "2"]]
- ,[Plain [Str "Plus",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Plus",Space,Str "1"]]
- ,[Para [Str "Plus",Space,Str "2"]]
- ,[Para [Str "Plus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "Minus",Space,Str "1"]]
- ,[Plain [Str "Minus",Space,Str "2"]]
- ,[Plain [Str "Minus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Minus",Space,Str "1"]]
- ,[Para [Str "Minus",Space,Str "2"]]
- ,[Para [Str "Minus",Space,Str "3"]]]
-,Header 2 ("ordered",[],[]) [Str "Ordered"]
-,Para [Str "Tight:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "First"]]
- ,[Plain [Str "Second"]]
- ,[Plain [Str "Third"]]]
-,Para [Str "and:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "One"]]
- ,[Plain [Str "Two"]]
- ,[Plain [Str "Three"]]]
-,Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second"]]
- ,[Para [Str "Third"]]]
-,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "One"]]
- ,[Para [Str "Two"]]
- ,[Para [Str "Three"]]]
-,Para [Str "Multiple",Space,Str "paragraphs:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
-  ,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog's",Space,Str "back."]]
- ,[Para [Str "Item",Space,Str "2."]]
- ,[Para [Str "Item",Space,Str "3."]]]
-,Para [Str "List",Space,Str "styles:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- []
-,OrderedList (1,LowerRoman,DefaultDelim)
- []
-,OrderedList (1,LowerRoman,DefaultDelim)
- []
-,OrderedList (1,DefaultStyle,DefaultDelim)
- []
-,OrderedList (1,LowerRoman,DefaultDelim)
- []
-,OrderedList (1,LowerRoman,DefaultDelim)
- []
-,Header 2 ("nested",[],[]) [Str "Nested"]
-,BulletList
- [[Plain [Str "Tab"]
-  ,BulletList
-   [[Plain [Str "Tab"]
-    ,BulletList
-     [[Plain [Str "Tab"]]]]]]]
-,Para [Str "Here's",Space,Str "another:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "First"]]
- ,[Plain [Str "Second:"]
-  ,BulletList
-   [[Plain [Str "Fee"]]
-   ,[Plain [Str "Fie"]]
-   ,[Plain [Str "Foe"]]]]
- ,[Plain [Str "Third"]]]
-,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Plain [Str "Fee"]]
-   ,[Plain [Str "Fie"]]
-   ,[Plain [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Header 2 ("tabs-and-spaces",[],[]) [Str "Tabs",Space,Str "and",Space,Str "spaces"]
-,BulletList
- [[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"]]
- ,[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]
-  ,BulletList
-   [[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"]]
-   ,[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]]]]]
-,Header 2 ("fancy-list-markers",[],[]) [Str "Fancy",Space,Str "list",Space,Str "markers"]
-,OrderedList (2,Decimal,DefaultDelim)
- [[Plain [Str "begins",Space,Str "with",Space,Str "2"]]
- ,[Para [Str "and",Space,Str "now",Space,Str "3"]
-  ,Para [Str "with",Space,Str "a",Space,Str "continuation"]
-  ,OrderedList (4,LowerRoman,DefaultDelim)
-   [[Plain [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",Space,Str "starting",Space,Str "with",Space,Str "4"]]
-   ,[Plain [Str "more",Space,Str "items"]
-    ,OrderedList (1,UpperAlpha,DefaultDelim)
-     [[Plain [Str "a",Space,Str "subsublist"]]
-     ,[Plain [Str "a",Space,Str "subsublist"]]]]]]]
-,Para [Str "Nesting:"]
-,OrderedList (1,UpperAlpha,DefaultDelim)
- [[Plain [Str "Upper",Space,Str "Alpha"]
-  ,OrderedList (1,UpperRoman,DefaultDelim)
-   [[Plain [Str "Upper",Space,Str "Roman."]
-    ,OrderedList (6,Decimal,DefaultDelim)
-     [[Plain [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
-      ,OrderedList (3,LowerAlpha,DefaultDelim)
-       [[Plain [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
-,Para [Str "Autonumbering:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Autonumber."]]
- ,[Plain [Str "More."]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "Nested."]]]]]
-,HorizontalRule
-,Header 2 ("definition",[],[]) [Str "Definition"]
-,DefinitionList
- [([Str "Violin"],
-   [[Plain [Str "Stringed",Space,Str "musical",Space,Str "instrument."]]
-   ,[Plain [Str "Torture",Space,Str "device."]]])
- ,([Str "Cello",LineBreak,Str "Violoncello"],
-   [[Plain [Str "Low-voiced",Space,Str "stringed",Space,Str "instrument."]]])]
-,HorizontalRule
-,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
-,Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
-,Para [Str "Empty",Space,Strong [],Space,Str "and",Space,Emph [],Str "."]
-,Para [Str "An",Space,Emph [Link ("",[],[]) [Str "emphasized",Space,Str "link"] ("/url","")],Str "."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",Space,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",Space,Code ("",[],[]) "<html>",Str "."]
-,Para [Str "This",Space,Str "is",Space,SmallCaps [Str "small",Space,Str "caps"],Str "."]
-,Para [Str "These",Space,Str "are",Space,Str "all",Space,Str "underlined:",Space,Underline [Str "foo"],Space,Str "and",Space,Underline [Str "bar"],Str "."]
-,Para [Str "These",Space,Str "are",Space,Str "all",Space,Str "strikethrough:",Space,Strikeout [Str "foo"],Str ",",Space,Strikeout [Str "bar"],Str ",",Space,Str "and",Space,Strikeout [Str "baz"],Str "."]
-,HorizontalRule
-,Header 1 ("smart-quotes-ellipses-dashes",[],[]) [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
-,Para [Str "\"Hello,\"",Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Str "\"'Shelob'",Space,Str "is",Space,Str "my",Space,Str "name.\""]
-,Para [Str "'A',",Space,Str "'B',",Space,Str "and",Space,Str "'C'",Space,Str "are",Space,Str "letters."]
-,Para [Str "'Oak,'",Space,Str "'elm,'",Space,Str "and",Space,Str "'beech'",Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Str "'pine.'"]
-,Para [Str "'He",Space,Str "said,",Space,Str "\"I",Space,Str "want",Space,Str "to",Space,Str "go.\"'",Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70's?"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Str "'",Code ("",[],[]) "code",Str "'",Space,Str "and",Space,Str "a",Space,Str "\"",Link ("",[],[]) [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2",""),Str "\"."]
-,Para [Str "Some",Space,Str "dashes:",Space,Str "one---two",Space,Str "---",Space,Str "three--four",Space,Str "--",Space,Str "five."]
-,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5-7,",Space,Str "255-66,",Space,Str "1987-1999."]
-,Para [Str "Ellipses...and.",Space,Str ".",Space,Str ".and",Space,Str ".",Space,Str ".",Space,Str ".",Space,Str "."]
-,HorizontalRule
-,Header 1 ("latex",[],[]) [Str "LaTeX"]
-,BulletList
- [[Plain [Str "\\cite[22-23]{smith.1899}"]]
- ,[Plain [Str "\\doublespacing"]]
- ,[Plain [Str "$2+2=4$"]]
- ,[Plain [Str "$x",Space,Str "\\in",Space,Str "y$"]]
- ,[Plain [Str "$\\alpha",Space,Str "\\wedge",Space,Str "\\omega$"]]
- ,[Plain [Str "$223$"]]
- ,[Plain [Str "$p$-Tree"]]
- ,[Plain [Str "$\\frac{d}{dx}f(x)=\\lim_{h\\to",Space,Str "0}\\frac{f(x+h)-f(x)}{h}$"]]
- ,[Plain [Str "Here's",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Str "$\\alpha",Space,Str "+",Space,Str "\\omega",Space,Str "\\times",Space,Str "x^2$."]]]
-,Para [Str "These",Space,Str "shouldn't",Space,Str "be",Space,Str "math:"]
-,BulletList
- [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
- ,[Plain [Str "$22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$34,000.",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Str "\"lot\"",Space,Str "is",Space,Str "emphasized.)"]]
- ,[Plain [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23$."]]]
-,Para [Str "Here's",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
-,Para [Str "\\begin{tabular}{|l|l|}\\hline",Space,Str "Animal",Space,Str "&",Space,Str "Number",Space,Str "\\\\",Space,Str "\\hline",Space,Str "Dog",Space,Str "&",Space,Str "2",Space,Str "\\\\",Space,Str "Cat",Space,Str "&",Space,Str "1",Space,Str "\\\\",Space,Str "\\hline",Space,Str "\\end{tabular}"]
-,HorizontalRule
-,Header 1 ("special-characters",[],[]) [Str "Special",Space,Str "Characters"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
-,BulletList
- [[Plain [Str "I",Space,Str "hat:",Space,Str "\206"]]
- ,[Plain [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
- ,[Plain [Str "section:",Space,Str "\167"]]
- ,[Plain [Str "set",Space,Str "membership:",Space,Str "\8712"]]
- ,[Plain [Str "copyright:",Space,Str "\169"]]]
-,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
-,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
-,Para [Str "This",Space,Str "&",Space,Str "that."]
-,Para [Str "4",Space,Str "<",Space,Str "5."]
-,Para [Str "6",Space,Str ">",Space,Str "5."]
-,Para [Str "Backslash:",Space,Str "\\"]
-,Para [Str "Backtick:",Space,Str "`"]
-,Para [Str "Asterisk:",Space,Str "*"]
-,Para [Str "Underscore:",Space,Str "_"]
-,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
-,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
-,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
-,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
-,Para [Str "Left",Space,Str "paren:",Space,Str "("]
-,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
-,Para [Str "Greater-than:",Space,Str ">"]
-,Para [Str "Hash:",Space,Str "#"]
-,Para [Str "Period:",Space,Str "."]
-,Para [Str "Bang:",Space,Str "!"]
-,Para [Str "Plus:",Space,Str "+"]
-,Para [Str "Minus:",Space,Str "-"]
-,HorizontalRule
-,Header 1 ("links",[],[]) [Str "Links"]
-,Header 2 ("explicit",[],[]) [Str "Explicit"]
-,Para [Str "Just",Space,Str "a",Space,Link ("",[],[]) [Str "URL"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by two spaces"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by a tab"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with \"quotes\" in it")]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with single quotes")]
-,Para [Str "Email",Space,Str "link",Space,Str "(nobody",Space,Str "[at]",Space,Str "nowhere.net)"]
-,Para [Link ("",[],[]) [Str "Empty"] ("",""),Str "."]
-,Header 2 ("reference",[],[]) [Str "Reference"]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "With",Space,Link ("",[],[]) [Str "embedded",Space,Str "[brackets]"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "once"] ("/url",""),Str "."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "twice"] ("/url",""),Str "."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "thrice"] ("/url",""),Str "."]
-,Para [Str "This",Space,Str "should",Space,Str "[not]",Space,Str "be",Space,Str "a",Space,Str "link."]
-,CodeBlock ("",[],[]) "[not]: /url"
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."]
-,Header 2 ("with-ampersands",[],[]) [Str "With",Space,Str "ampersands"]
-,Para [Str "Here's",Space,Str "a",Space,Link ("",[],[]) [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
-,Para [Str "Here's",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link ("",[],[]) [Str "AT&T"] ("http://att.com/","AT&T"),Str "."]
-,Para [Str "Here's",Space,Str "an",Space,Link ("",[],[]) [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
-,Para [Str "Here's",Space,Str "an",Space,Link ("",[],[]) [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."]
-,Header 2 ("autolinks",[],[]) [Str "Autolinks"]
-,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link ("",[],[]) [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
-,BulletList
- [[Plain [Str "In",Space,Str "a",Space,Str "list?"]]
- ,[Plain [Link ("",[],[]) [Str "http://example.com/"] ("http://example.com/","")]]
- ,[Plain [Str "It",Space,Str "should."]]]
-,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Str "nobody",Space,Str "[at]",Space,Str "nowhere.net"]
-,BlockQuote
- [Para [Str "Blockquoted:",Space,Link ("",[],[]) [Str "http://example.com/"] ("http://example.com/","")]]
-,Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code ("",[],[]) "<http://example.com/>"]
-,CodeBlock ("",[],[]) "or here: <http://example.com/>"
-,HorizontalRule
-,Header 1 ("images",[],[]) [Str "Images"]
-,Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
-,Para [Image ("",[],[]) [Str "lalune"] ("lalune.jpg","Voyage dans la Lune")]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image ("",[],[]) [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
-,HorizontalRule
-,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Link ("",[],[]) [Str "(1)"] ("#note_1",""),Str ",",Space,Str "and",Space,Str "another",Link ("",[],[]) [Str "(longnote)"] ("#note_longnote",""),Str ".",Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space^(my",Space,Str "note)."]
-,Para [Link ("",[],[]) [Str "(1)"] ("#ref_1",""),Space,Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "in",Space,Str "the",Space,Str "document,",Space,Str "not",Space,Str "just",Space,Str "at",Space,Str "the",Space,Str "end."]
-,Para [Link ("",[],[]) [Str "(longnote)"] ("#ref_longnote",""),Space,Str "Here's",Space,Str "the",Space,Str "other",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."]
-,Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",Space,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)."]
-,CodeBlock ("",[],[]) "  { <code> }"
-,Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."]
-,Para [Str "text",Space,Emph [Str "Leading",Space,Str "space"]]
-,Para [Emph [Str "Trailing",Space,Str "space"],Space,Str "text"]
-,Para [Str "text",Space,Emph [Str "Leading",Space,Str "spaces"]]
-,Para [Emph [Str "Trailing",Space,Str "spaces"],Space,Str "text"]
-,Header 1 ("tables",[],[]) [Str "Tables"]
-,Header 2 ("tables-with-headers",[],[]) [Str "Tables",Space,Str "with",Space,Str "Headers"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Para [Str "Row",Space,Str "headers"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 1)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 1)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]])]
- (TableFoot ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "4"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "5"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "6"]]]])
-,HorizontalRule
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]]
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "X"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Y"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Z"]]]]
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "X"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Y"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Z"]]]]
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]])
- ,(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]])
- ,(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 2 ("tables-without-headers",[],[]) [Str "Tables",Space,Str "without",Space,Str "Headers"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Para [Str "tbody",Space,Str "tags",Space,Str "omitted"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Para [Str "empty",Space,Str "head"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Para [Str "explicit",Space,Str "body",Space,Str "and",Space,Str "foot"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]])]
- (TableFoot ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "4"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "5"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "6"]]]])
-,Header 2 ("colspans-and-rowspans",[],[]) [Str "Colspans",Space,Str "and",Space,Str "Rowspans"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 2)
-    [Plain [Str "1",Space,Str "and",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 3)
-    [Plain [Str "4,",Space,Str "5,",Space,Str "and",Space,Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,HorizontalRule
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 3)
-   [Plain [Str "Numbers"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 2) (ColSpan 1)
-    [Plain [Str "1",Space,Str "and",Space,Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 2 ("attributes",[],[]) [Str "Attributes"]
-,Table ("attrib-test-table",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",["table-head"],[])
- [Row ("",["table-head-row"],[])
-  [Cell ("",[],[("abbr","x")]) AlignDefault (RowSpan 1) (ColSpan 3)
-   [Plain [Str "Cat",Space,Str "X"]]]])
- [(TableBody ("",["main"],[("part","body")]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[("part","row")])
-   [Cell ("",[],[("part","cell")]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[("valign","bottom")]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[("style","color: #151950")]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]])]
- (TableFoot ("",["summary"],[])
- [Row ("",[],[("bgcolor","#ccc")])
-  [Cell ("",[],[("square","true")]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "4"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "5"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "6"]]]])
-,Header 2 ("tag-omission",[],[]) [Str "Tag",Space,Str "omission"]
-,Para [Str "thead,",Space,Str "tbody,",Space,Str "and",Space,Str "tfoot"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]]])]
- (TableFoot ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "4"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "5"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "6"]]]])
-,Header 2 ("empty-tables",[],[]) [Str "Empty",Space,Str "Tables"]
-,Para [Str "This",Space,Str "section",Space,Str "should",Space,Str "be",Space,Str "empty."]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "generator" , MetaInlines [ Str "pandoc" ] )
+          , ( "title"
+            , MetaInlines
+                [ Str "Pandoc"
+                , Space
+                , Str "Test"
+                , Space
+                , Str "Suite"
+                ]
+            )
+          ]
+    }
+  [ Header
+      1
+      ( "pandoc-test-suite" , [ "title" ] , [] )
+      [ Str "Pandoc" , Space , Str "Test" , Space , Str "Suite" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "set"
+      , Space
+      , Str "of"
+      , Space
+      , Str "tests"
+      , Space
+      , Str "for"
+      , Space
+      , Str "pandoc."
+      , Space
+      , Str "Most"
+      , Space
+      , Str "of"
+      , Space
+      , Str "them"
+      , Space
+      , Str "are"
+      , Space
+      , Str "adapted"
+      , Space
+      , Str "from"
+      , Space
+      , Str "John"
+      , Space
+      , Str "Gruber's"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "test"
+      , Space
+      , Str "suite."
+      ]
+  , HorizontalRule
+  , Header 1 ( "headers" , [] , [] ) [ Str "Headers" ]
+  , Header
+      2
+      ( "level-2-with-an-embedded-link" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "link" ]
+          ( "/url" , "" )
+      ]
+  , Header
+      3
+      ( "level-3-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "3"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      4 ( "level-4" , [] , [] ) [ Str "Level" , Space , Str "4" ]
+  , Header
+      5 ( "level-5" , [] , [] ) [ Str "Level" , Space , Str "5" ]
+  , Header
+      1 ( "level-1" , [] , [] ) [ Str "Level" , Space , Str "1" ]
+  , Header
+      2
+      ( "level-2-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      3 ( "level-3" , [] , [] ) [ Str "Level" , Space , Str "3" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , Header
+      2 ( "level-2" , [] , [] ) [ Str "Level" , Space , Str "2" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , HorizontalRule
+  , Header 1 ( "paragraphs" , [] , [] ) [ Str "Paragraphs" ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Str "regular"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "In"
+      , Space
+      , Str "Markdown"
+      , Space
+      , Str "1.0.0"
+      , Space
+      , Str "and"
+      , Space
+      , Str "earlier."
+      , Space
+      , Str "Version"
+      , Space
+      , Str "8."
+      , Space
+      , Str "This"
+      , Space
+      , Str "line"
+      , Space
+      , Str "turns"
+      , Space
+      , Str "into"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      , Space
+      , Str "Because"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard-wrapped"
+      , Space
+      , Str "line"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "middle"
+      , Space
+      , Str "of"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "looked"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "one"
+      , Space
+      , Str "with"
+      , Space
+      , Str "a"
+      , Space
+      , Str "bullet."
+      , Space
+      , Str "*"
+      , Space
+      , Str "criminey."
+      ]
+  , Para
+      [ Str "There"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard"
+      , Space
+      , Str "line"
+      , Space
+      , Str "break"
+      , LineBreak
+      , Str "here."
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "block-quotes" , [] , [] )
+      [ Str "Block" , Space , Str "Quotes" ]
+  , Para [ Str "E-mail" , Space , Str "style:" ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          , Space
+          , Str "It"
+          , Space
+          , Str "is"
+          , Space
+          , Str "pretty"
+          , Space
+          , Str "short."
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Code"
+          , Space
+          , Str "in"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote:"
+          ]
+      , CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      , Para [ Str "A" , Space , Str "list:" ]
+      , OrderedList
+          ( 1 , DefaultStyle , DefaultDelim )
+          [ [ Plain [ Str "item" , Space , Str "one" ] ]
+          , [ Plain [ Str "item" , Space , Str "two" ] ]
+          ]
+      , Para
+          [ Str "Nested"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quotes:"
+          ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "block"
+      , Space
+      , Str "quote:"
+      , Space
+      , Str "2"
+      , Space
+      , Str ">"
+      , Space
+      , Str "1."
+      ]
+  , Para [ Str "Box-style:" ]
+  , BlockQuote
+      [ Para [ Str "Example:" ]
+      , CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      ]
+  , BlockQuote
+      [ OrderedList
+          ( 1 , DefaultStyle , DefaultDelim )
+          [ [ Plain [ Str "do" , Space , Str "laundry" ] ]
+          , [ Plain
+                [ Str "take"
+                , Space
+                , Str "out"
+                , Space
+                , Str "the"
+                , Space
+                , Str "trash"
+                ]
+            ]
+          ]
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Str "nested"
+      , Space
+      , Str "one:"
+      ]
+  , BlockQuote
+      [ Para [ Str "Joe" , Space , Str "said:" ]
+      , BlockQuote
+          [ Para
+              [ Str "Don't" , Space , Str "quote" , Space , Str "me." ]
+          ]
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "a"
+      , Space
+      , Str "following"
+      , Space
+      , Str "paragraph."
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "inline-quotes" , [] , [] )
+      [ Str "Inline" , Space , Str "quotes" ]
+  , Para
+      [ Str "Normal"
+      , Space
+      , Str "text"
+      , Space
+      , Str "but"
+      , Space
+      , Str "then"
+      , Space
+      , Str "a"
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Span
+              ( ""
+              , []
+              , [ ( "cite"
+                  , "https://www.imdb.com/title/tt0062622/quotes/qt0396921"
+                  )
+                ]
+              )
+              [ Str "inline" , Space , Str "quote" ]
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Quoted
+          DoubleQuote
+          [ Str "Missing"
+          , Space
+          , Str "a"
+          , Space
+          , Str "cite"
+          , Space
+          , Str "attribute"
+          , Space
+          , Str "means"
+          , Space
+          , Str "its"
+          , Space
+          , Str "just"
+          , Space
+          , Str "normal"
+          , Space
+          , Str "text"
+          ]
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "code-blocks" , [] , [] )
+      [ Str "Code" , Space , Str "Blocks" ]
+  , Para [ Str "Code:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
+  , HorizontalRule
+  , Header 1 ( "lists" , [] , [] ) [ Str "Lists" ]
+  , Header 2 ( "unordered" , [] , [] ) [ Str "Unordered" ]
+  , Para [ Str "Asterisks" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Asterisks" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "Plus" , Space , Str "1" ] ]
+      , [ Plain [ Str "Plus" , Space , Str "2" ] ]
+      , [ Plain [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Plus" , Space , Str "1" ] ]
+      , [ Para [ Str "Plus" , Space , Str "2" ] ]
+      , [ Para [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "Minus" , Space , Str "1" ] ]
+      , [ Plain [ Str "Minus" , Space , Str "2" ] ]
+      , [ Plain [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Minus" , Space , Str "1" ] ]
+      , [ Para [ Str "Minus" , Space , Str "2" ] ]
+      , [ Para [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Header 2 ( "ordered" , [] , [] ) [ Str "Ordered" ]
+  , Para [ Str "Tight:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "First" ] ]
+      , [ Plain [ Str "Second" ] ]
+      , [ Plain [ Str "Third" ] ]
+      ]
+  , Para [ Str "and:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "One" ] ]
+      , [ Plain [ Str "Two" ] ]
+      , [ Plain [ Str "Three" ] ]
+      ]
+  , Para
+      [ Str "Loose" , Space , Str "using" , Space , Str "tabs:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second" ] ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "and" , Space , Str "using" , Space , Str "spaces:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "One" ] ]
+      , [ Para [ Str "Two" ] ]
+      , [ Para [ Str "Three" ] ]
+      ]
+  , Para [ Str "Multiple" , Space , Str "paragraphs:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para
+            [ Str "Item"
+            , Space
+            , Str "1,"
+            , Space
+            , Str "graf"
+            , Space
+            , Str "one."
+            ]
+        , Para
+            [ Str "Item"
+            , Space
+            , Str "1."
+            , Space
+            , Str "graf"
+            , Space
+            , Str "two."
+            , Space
+            , Str "The"
+            , Space
+            , Str "quick"
+            , Space
+            , Str "brown"
+            , Space
+            , Str "fox"
+            , Space
+            , Str "jumped"
+            , Space
+            , Str "over"
+            , Space
+            , Str "the"
+            , Space
+            , Str "lazy"
+            , Space
+            , Str "dog's"
+            , Space
+            , Str "back."
+            ]
+        ]
+      , [ Para [ Str "Item" , Space , Str "2." ] ]
+      , [ Para [ Str "Item" , Space , Str "3." ] ]
+      ]
+  , Para [ Str "List" , Space , Str "styles:" ]
+  , OrderedList ( 1 , DefaultStyle , DefaultDelim ) []
+  , OrderedList ( 1 , LowerRoman , DefaultDelim ) []
+  , OrderedList ( 1 , LowerRoman , DefaultDelim ) []
+  , OrderedList ( 1 , DefaultStyle , DefaultDelim ) []
+  , OrderedList ( 1 , LowerRoman , DefaultDelim ) []
+  , OrderedList ( 1 , LowerRoman , DefaultDelim ) []
+  , Header 2 ( "nested" , [] , [] ) [ Str "Nested" ]
+  , BulletList
+      [ [ Plain [ Str "Tab" ]
+        , BulletList
+            [ [ Plain [ Str "Tab" ]
+              , BulletList [ [ Plain [ Str "Tab" ] ] ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Here's" , Space , Str "another:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "First" ] ]
+      , [ Plain [ Str "Second:" ]
+        , BulletList
+            [ [ Plain [ Str "Fee" ] ]
+            , [ Plain [ Str "Fie" ] ]
+            , [ Plain [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Plain [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "Same"
+      , Space
+      , Str "thing"
+      , Space
+      , Str "but"
+      , Space
+      , Str "with"
+      , Space
+      , Str "paragraphs:"
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Plain [ Str "Fee" ] ]
+            , [ Plain [ Str "Fie" ] ]
+            , [ Plain [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Header
+      2
+      ( "tabs-and-spaces" , [] , [] )
+      [ Str "Tabs" , Space , Str "and" , Space , Str "spaces" ]
+  , BulletList
+      [ [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "tabs"
+            ]
+        ]
+      , [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "spaces"
+            ]
+        , BulletList
+            [ [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "tabs"
+                  ]
+              ]
+            , [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "spaces"
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "fancy-list-markers" , [] , [] )
+      [ Str "Fancy" , Space , Str "list" , Space , Str "markers" ]
+  , OrderedList
+      ( 2 , Decimal , DefaultDelim )
+      [ [ Plain
+            [ Str "begins" , Space , Str "with" , Space , Str "2" ]
+        ]
+      , [ Para [ Str "and" , Space , Str "now" , Space , Str "3" ]
+        , Para
+            [ Str "with"
+            , Space
+            , Str "a"
+            , Space
+            , Str "continuation"
+            ]
+        , OrderedList
+            ( 4 , LowerRoman , DefaultDelim )
+            [ [ Plain
+                  [ Str "sublist"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "roman"
+                  , Space
+                  , Str "numerals,"
+                  , Space
+                  , Str "starting"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "4"
+                  ]
+              ]
+            , [ Plain [ Str "more" , Space , Str "items" ]
+              , OrderedList
+                  ( 1 , UpperAlpha , DefaultDelim )
+                  [ [ Plain [ Str "a" , Space , Str "subsublist" ] ]
+                  , [ Plain [ Str "a" , Space , Str "subsublist" ] ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Nesting:" ]
+  , OrderedList
+      ( 1 , UpperAlpha , DefaultDelim )
+      [ [ Plain [ Str "Upper" , Space , Str "Alpha" ]
+        , OrderedList
+            ( 1 , UpperRoman , DefaultDelim )
+            [ [ Plain [ Str "Upper" , Space , Str "Roman." ]
+              , OrderedList
+                  ( 6 , Decimal , DefaultDelim )
+                  [ [ Plain
+                        [ Str "Decimal"
+                        , Space
+                        , Str "start"
+                        , Space
+                        , Str "with"
+                        , Space
+                        , Str "6"
+                        ]
+                    , OrderedList
+                        ( 3 , LowerAlpha , DefaultDelim )
+                        [ [ Plain
+                              [ Str "Lower"
+                              , Space
+                              , Str "alpha"
+                              , Space
+                              , Str "with"
+                              , Space
+                              , Str "paren"
+                              ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Autonumbering:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "Autonumber." ] ]
+      , [ Plain [ Str "More." ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain [ Str "Nested." ] ] ]
+        ]
+      ]
+  , HorizontalRule
+  , Header 2 ( "definition" , [] , [] ) [ Str "Definition" ]
+  , DefinitionList
+      [ ( [ Str "Violin" ]
+        , [ [ Plain
+                [ Str "Stringed"
+                , Space
+                , Str "musical"
+                , Space
+                , Str "instrument."
+                ]
+            ]
+          , [ Plain [ Str "Torture" , Space , Str "device." ] ]
+          ]
+        )
+      , ( [ Str "Cello" , LineBreak , Str "Violoncello" ]
+        , [ [ Plain
+                [ Str "Low-voiced"
+                , Space
+                , Str "stringed"
+                , Space
+                , Str "instrument."
+                ]
+            ]
+          ]
+        )
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "inline-markup" , [] , [] )
+      [ Str "Inline" , Space , Str "Markup" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Emph [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Strong [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Empty"
+      , Space
+      , Strong []
+      , Space
+      , Str "and"
+      , Space
+      , Emph []
+      , Str "."
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Emph
+          [ Link
+              ( "" , [] , [] )
+              [ Str "emphasized" , Space , Str "link" ]
+              ( "/url" , "" )
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "code:"
+      , Space
+      , Code ( "" , [] , [] ) ">"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "<html>"
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , SmallCaps [ Str "small" , Space , Str "caps" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "are"
+      , Space
+      , Str "all"
+      , Space
+      , Str "underlined:"
+      , Space
+      , Underline [ Str "foo" ]
+      , Space
+      , Str "and"
+      , Space
+      , Underline [ Str "bar" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "are"
+      , Space
+      , Str "all"
+      , Space
+      , Str "strikethrough:"
+      , Space
+      , Strikeout [ Str "foo" ]
+      , Str ","
+      , Space
+      , Strikeout [ Str "bar" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Strikeout [ Str "baz" ]
+      , Str "."
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "smart-quotes-ellipses-dashes" , [] , [] )
+      [ Str "Smart"
+      , Space
+      , Str "quotes,"
+      , Space
+      , Str "ellipses,"
+      , Space
+      , Str "dashes"
+      ]
+  , Para
+      [ Str "\"Hello,\""
+      , Space
+      , Str "said"
+      , Space
+      , Str "the"
+      , Space
+      , Str "spider."
+      , Space
+      , Str "\"'Shelob'"
+      , Space
+      , Str "is"
+      , Space
+      , Str "my"
+      , Space
+      , Str "name.\""
+      ]
+  , Para
+      [ Str "'A',"
+      , Space
+      , Str "'B',"
+      , Space
+      , Str "and"
+      , Space
+      , Str "'C'"
+      , Space
+      , Str "are"
+      , Space
+      , Str "letters."
+      ]
+  , Para
+      [ Str "'Oak,'"
+      , Space
+      , Str "'elm,'"
+      , Space
+      , Str "and"
+      , Space
+      , Str "'beech'"
+      , Space
+      , Str "are"
+      , Space
+      , Str "names"
+      , Space
+      , Str "of"
+      , Space
+      , Str "trees."
+      , Space
+      , Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Str "'pine.'"
+      ]
+  , Para
+      [ Str "'He"
+      , Space
+      , Str "said,"
+      , Space
+      , Str "\"I"
+      , Space
+      , Str "want"
+      , Space
+      , Str "to"
+      , Space
+      , Str "go.\"'"
+      , Space
+      , Str "Were"
+      , Space
+      , Str "you"
+      , Space
+      , Str "alive"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "70's?"
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "quoted"
+      , Space
+      , Str "'"
+      , Code ( "" , [] , [] ) "code"
+      , Str "'"
+      , Space
+      , Str "and"
+      , Space
+      , Str "a"
+      , Space
+      , Str "\""
+      , Link
+          ( "" , [] , [] )
+          [ Str "quoted" , Space , Str "link" ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Str "\"."
+      ]
+  , Para
+      [ Str "Some"
+      , Space
+      , Str "dashes:"
+      , Space
+      , Str "one---two"
+      , Space
+      , Str "---"
+      , Space
+      , Str "three--four"
+      , Space
+      , Str "--"
+      , Space
+      , Str "five."
+      ]
+  , Para
+      [ Str "Dashes"
+      , Space
+      , Str "between"
+      , Space
+      , Str "numbers:"
+      , Space
+      , Str "5-7,"
+      , Space
+      , Str "255-66,"
+      , Space
+      , Str "1987-1999."
+      ]
+  , Para
+      [ Str "Ellipses...and."
+      , Space
+      , Str "."
+      , Space
+      , Str ".and"
+      , Space
+      , Str "."
+      , Space
+      , Str "."
+      , Space
+      , Str "."
+      , Space
+      , Str "."
+      ]
+  , HorizontalRule
+  , Header 1 ( "latex" , [] , [] ) [ Str "LaTeX" ]
+  , BulletList
+      [ [ Plain [ Str "\\cite[22-23]{smith.1899}" ] ]
+      , [ Plain [ Str "\\doublespacing" ] ]
+      , [ Plain [ Str "$2+2=4$" ] ]
+      , [ Plain
+            [ Str "$x" , Space , Str "\\in" , Space , Str "y$" ]
+        ]
+      , [ Plain
+            [ Str "$\\alpha"
+            , Space
+            , Str "\\wedge"
+            , Space
+            , Str "\\omega$"
+            ]
+        ]
+      , [ Plain [ Str "$223$" ] ]
+      , [ Plain [ Str "$p$-Tree" ] ]
+      , [ Plain
+            [ Str "$\\frac{d}{dx}f(x)=\\lim_{h\\to"
+            , Space
+            , Str "0}\\frac{f(x+h)-f(x)}{h}$"
+            ]
+        ]
+      , [ Plain
+            [ Str "Here's"
+            , Space
+            , Str "one"
+            , Space
+            , Str "that"
+            , Space
+            , Str "has"
+            , Space
+            , Str "a"
+            , Space
+            , Str "line"
+            , Space
+            , Str "break"
+            , Space
+            , Str "in"
+            , Space
+            , Str "it:"
+            , Space
+            , Str "$\\alpha"
+            , Space
+            , Str "+"
+            , Space
+            , Str "\\omega"
+            , Space
+            , Str "\\times"
+            , Space
+            , Str "x^2$."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "shouldn't"
+      , Space
+      , Str "be"
+      , Space
+      , Str "math:"
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "To"
+            , Space
+            , Str "get"
+            , Space
+            , Str "the"
+            , Space
+            , Str "famous"
+            , Space
+            , Str "equation,"
+            , Space
+            , Str "write"
+            , Space
+            , Code ( "" , [] , [] ) "$e = mc^2$"
+            , Str "."
+            ]
+        ]
+      , [ Plain
+            [ Str "$22,000"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Emph [ Str "lot" ]
+            , Space
+            , Str "of"
+            , Space
+            , Str "money."
+            , Space
+            , Str "So"
+            , Space
+            , Str "is"
+            , Space
+            , Str "$34,000."
+            , Space
+            , Str "(It"
+            , Space
+            , Str "worked"
+            , Space
+            , Str "if"
+            , Space
+            , Str "\"lot\""
+            , Space
+            , Str "is"
+            , Space
+            , Str "emphasized.)"
+            ]
+        ]
+      , [ Plain
+            [ Str "Escaped"
+            , Space
+            , Code ( "" , [] , [] ) "$"
+            , Str ":"
+            , Space
+            , Str "$73"
+            , Space
+            , Emph
+                [ Str "this"
+                , Space
+                , Str "should"
+                , Space
+                , Str "be"
+                , Space
+                , Str "emphasized"
+                ]
+            , Space
+            , Str "23$."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Str "LaTeX"
+      , Space
+      , Str "table:"
+      ]
+  , Para
+      [ Str "\\begin{tabular}{|l|l|}\\hline"
+      , Space
+      , Str "Animal"
+      , Space
+      , Str "&"
+      , Space
+      , Str "Number"
+      , Space
+      , Str "\\\\"
+      , Space
+      , Str "\\hline"
+      , Space
+      , Str "Dog"
+      , Space
+      , Str "&"
+      , Space
+      , Str "2"
+      , Space
+      , Str "\\\\"
+      , Space
+      , Str "Cat"
+      , Space
+      , Str "&"
+      , Space
+      , Str "1"
+      , Space
+      , Str "\\\\"
+      , Space
+      , Str "\\hline"
+      , Space
+      , Str "\\end{tabular}"
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "special-characters" , [] , [] )
+      [ Str "Special" , Space , Str "Characters" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "unicode:"
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "I" , Space , Str "hat:" , Space , Str "\206" ]
+        ]
+      , [ Plain
+            [ Str "o" , Space , Str "umlaut:" , Space , Str "\246" ]
+        ]
+      , [ Plain [ Str "section:" , Space , Str "\167" ] ]
+      , [ Plain
+            [ Str "set"
+            , Space
+            , Str "membership:"
+            , Space
+            , Str "\8712"
+            ]
+        ]
+      , [ Plain [ Str "copyright:" , Space , Str "\169" ] ]
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "has"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "their"
+      , Space
+      , Str "name."
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "is"
+      , Space
+      , Str "another"
+      , Space
+      , Str "way"
+      , Space
+      , Str "to"
+      , Space
+      , Str "write"
+      , Space
+      , Str "it."
+      ]
+  , Para
+      [ Str "This" , Space , Str "&" , Space , Str "that." ]
+  , Para [ Str "4" , Space , Str "<" , Space , Str "5." ]
+  , Para [ Str "6" , Space , Str ">" , Space , Str "5." ]
+  , Para [ Str "Backslash:" , Space , Str "\\" ]
+  , Para [ Str "Backtick:" , Space , Str "`" ]
+  , Para [ Str "Asterisk:" , Space , Str "*" ]
+  , Para [ Str "Underscore:" , Space , Str "_" ]
+  , Para
+      [ Str "Left" , Space , Str "brace:" , Space , Str "{" ]
+  , Para
+      [ Str "Right" , Space , Str "brace:" , Space , Str "}" ]
+  , Para
+      [ Str "Left" , Space , Str "bracket:" , Space , Str "[" ]
+  , Para
+      [ Str "Right" , Space , Str "bracket:" , Space , Str "]" ]
+  , Para
+      [ Str "Left" , Space , Str "paren:" , Space , Str "(" ]
+  , Para
+      [ Str "Right" , Space , Str "paren:" , Space , Str ")" ]
+  , Para [ Str "Greater-than:" , Space , Str ">" ]
+  , Para [ Str "Hash:" , Space , Str "#" ]
+  , Para [ Str "Period:" , Space , Str "." ]
+  , Para [ Str "Bang:" , Space , Str "!" ]
+  , Para [ Str "Plus:" , Space , Str "+" ]
+  , Para [ Str "Minus:" , Space , Str "-" ]
+  , HorizontalRule
+  , Header 1 ( "links" , [] , [] ) [ Str "Links" ]
+  , Header 2 ( "explicit" , [] , [] ) [ Str "Explicit" ]
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "a"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "URL" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title preceded by two spaces" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title preceded by a tab" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title with \"quotes\" in it" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title with single quotes" )
+      ]
+  , Para
+      [ Str "Email"
+      , Space
+      , Str "link"
+      , Space
+      , Str "(nobody"
+      , Space
+      , Str "[at]"
+      , Space
+      , Str "nowhere.net)"
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "Empty" ] ( "" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "reference" , [] , [] ) [ Str "Reference" ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "With"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "[brackets]" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "b" ] ( "/url/" , "" )
+      , Space
+      , Str "by"
+      , Space
+      , Str "itself"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "once" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "twice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "thrice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "[not]"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , CodeBlock ( "" , [] , [] ) "[not]: /url"
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "bar" ]
+          ( "/url/" , "Title with \"quotes\" inside" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "biz" ]
+          ( "/url/" , "Title with \"quote\" inside" )
+      , Str "."
+      ]
+  , Header
+      2
+      ( "with-ampersands" , [] , [] )
+      [ Str "With" , Space , Str "ampersands" ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "link"
+          , Space
+          , Str "with"
+          , Space
+          , Str "an"
+          , Space
+          , Str "ampersand"
+          , Space
+          , Str "in"
+          , Space
+          , Str "the"
+          , Space
+          , Str "URL"
+          ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Str "amersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "link"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "AT&T" ]
+          ( "http://att.com/" , "AT&T" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline" , Space , Str "link" ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline"
+          , Space
+          , Str "link"
+          , Space
+          , Str "in"
+          , Space
+          , Str "pointy"
+          , Space
+          , Str "braces"
+          ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "autolinks" , [] , [] ) [ Str "Autolinks" ]
+  , Para
+      [ Str "With"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://example.com/?foo=1&bar=2" ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "In" , Space , Str "a" , Space , Str "list?" ]
+        ]
+      , [ Plain
+            [ Link
+                ( "" , [] , [] )
+                [ Str "http://example.com/" ]
+                ( "http://example.com/" , "" )
+            ]
+        ]
+      , [ Plain [ Str "It" , Space , Str "should." ] ]
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Str "e-mail"
+      , Space
+      , Str "address:"
+      , Space
+      , Str "nobody"
+      , Space
+      , Str "[at]"
+      , Space
+      , Str "nowhere.net"
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Blockquoted:"
+          , Space
+          , Link
+              ( "" , [] , [] )
+              [ Str "http://example.com/" ]
+              ( "http://example.com/" , "" )
+          ]
+      ]
+  , Para
+      [ Str "Auto-links"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "occur"
+      , Space
+      , Str "here:"
+      , Space
+      , Code ( "" , [] , [] ) "<http://example.com/>"
+      ]
+  , CodeBlock
+      ( "" , [] , [] ) "or here: <http://example.com/>"
+  , HorizontalRule
+  , Header 1 ( "images" , [] , [] ) [ Str "Images" ]
+  , Para
+      [ Str "From"
+      , Space
+      , Str "\"Voyage"
+      , Space
+      , Str "dans"
+      , Space
+      , Str "la"
+      , Space
+      , Str "Lune\""
+      , Space
+      , Str "by"
+      , Space
+      , Str "Georges"
+      , Space
+      , Str "Melies"
+      , Space
+      , Str "(1902):"
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "lalune" ]
+          ( "lalune.jpg" , "Voyage dans la Lune" )
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "movie"
+      , Space
+      , Image
+          ( "" , [] , [] ) [ Str "movie" ] ( "movie.jpg" , "" )
+      , Space
+      , Str "icon."
+      ]
+  , HorizontalRule
+  , Header 1 ( "footnotes" , [] , [] ) [ Str "Footnotes" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference"
+      , Link ( "" , [] , [] ) [ Str "(1)" ] ( "#note_1" , "" )
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "another"
+      , Link
+          ( "" , [] , [] )
+          [ Str "(longnote)" ]
+          ( "#note_longnote" , "" )
+      , Str "."
+      , Space
+      , Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Emph [ Str "not" ]
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference,"
+      , Space
+      , Str "because"
+      , Space
+      , Str "it"
+      , Space
+      , Str "contains"
+      , Space
+      , Str "a"
+      , Space
+      , Str "space^(my"
+      , Space
+      , Str "note)."
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "(1)" ] ( "#ref_1" , "" )
+      , Space
+      , Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "the"
+      , Space
+      , Str "footnote."
+      , Space
+      , Str "It"
+      , Space
+      , Str "can"
+      , Space
+      , Str "go"
+      , Space
+      , Str "anywhere"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "document,"
+      , Space
+      , Str "not"
+      , Space
+      , Str "just"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "end."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "(longnote)" ]
+          ( "#ref_longnote" , "" )
+      , Space
+      , Str "Here's"
+      , Space
+      , Str "the"
+      , Space
+      , Str "other"
+      , Space
+      , Str "note."
+      , Space
+      , Str "This"
+      , Space
+      , Str "one"
+      , Space
+      , Str "contains"
+      , Space
+      , Str "multiple"
+      , Space
+      , Str "blocks."
+      ]
+  , Para
+      [ Str "Caret"
+      , Space
+      , Str "characters"
+      , Space
+      , Str "are"
+      , Space
+      , Str "used"
+      , Space
+      , Str "to"
+      , Space
+      , Str "indicate"
+      , Space
+      , Str "that"
+      , Space
+      , Str "the"
+      , Space
+      , Str "blocks"
+      , Space
+      , Str "all"
+      , Space
+      , Str "belong"
+      , Space
+      , Str "to"
+      , Space
+      , Str "a"
+      , Space
+      , Str "single"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "(as"
+      , Space
+      , Str "with"
+      , Space
+      , Str "block"
+      , Space
+      , Str "quotes)."
+      ]
+  , CodeBlock ( "" , [] , [] ) "  { <code> }"
+  , Para
+      [ Str "If"
+      , Space
+      , Str "you"
+      , Space
+      , Str "want,"
+      , Space
+      , Str "you"
+      , Space
+      , Str "can"
+      , Space
+      , Str "use"
+      , Space
+      , Str "a"
+      , Space
+      , Str "caret"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "beginning"
+      , Space
+      , Str "of"
+      , Space
+      , Str "every"
+      , Space
+      , Str "line,"
+      , Space
+      , Str "as"
+      , Space
+      , Str "with"
+      , Space
+      , Str "blockquotes,"
+      , Space
+      , Str "but"
+      , Space
+      , Str "all"
+      , Space
+      , Str "that"
+      , Space
+      , Str "you"
+      , Space
+      , Str "need"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "caret"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "beginning"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "first"
+      , Space
+      , Str "line"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "block"
+      , Space
+      , Str "and"
+      , Space
+      , Str "any"
+      , Space
+      , Str "preceding"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "lines."
+      ]
+  , Para
+      [ Str "text"
+      , Space
+      , Emph [ Str "Leading" , Space , Str "space" ]
+      ]
+  , Para
+      [ Emph [ Str "Trailing" , Space , Str "space" ]
+      , Space
+      , Str "text"
+      ]
+  , Para
+      [ Str "text"
+      , Space
+      , Emph [ Str "Leading" , Space , Str "spaces" ]
+      ]
+  , Para
+      [ Emph [ Str "Trailing" , Space , Str "spaces" ]
+      , Space
+      , Str "text"
+      ]
+  , Header 1 ( "tables" , [] , [] ) [ Str "Tables" ]
+  , Header
+      2
+      ( "tables-with-headers" , [] , [] )
+      [ Str "Tables"
+      , Space
+      , Str "with"
+      , Space
+      , Str "Headers"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Para [ Str "Row" , Space , Str "headers" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 1)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 1)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          ]
+      ]
+      (TableFoot
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "4" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "5" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "6" ] ]
+             ]
+         ])
+  , HorizontalRule
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          ]
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "X" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Y" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Z" ] ]
+              ]
+          ]
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "X" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Y" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Z" ] ]
+              ]
+          ]
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          ]
+      , TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          ]
+      , TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header
+      2
+      ( "tables-without-headers" , [] , [] )
+      [ Str "Tables"
+      , Space
+      , Str "without"
+      , Space
+      , Str "Headers"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Para
+      [ Str "tbody" , Space , Str "tags" , Space , Str "omitted" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Para [ Str "empty" , Space , Str "head" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Para
+      [ Str "explicit"
+      , Space
+      , Str "body"
+      , Space
+      , Str "and"
+      , Space
+      , Str "foot"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          ]
+      ]
+      (TableFoot
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "4" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "5" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "6" ] ]
+             ]
+         ])
+  , Header
+      2
+      ( "colspans-and-rowspans" , [] , [] )
+      [ Str "Colspans"
+      , Space
+      , Str "and"
+      , Space
+      , Str "Rowspans"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 2)
+                  [ Plain
+                      [ Str "1" , Space , Str "and" , Space , Str "2" ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 3)
+                  [ Plain
+                      [ Str "4,"
+                      , Space
+                      , Str "5,"
+                      , Space
+                      , Str "and"
+                      , Space
+                      , Str "6"
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , HorizontalRule
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 3)
+                 [ Plain [ Str "Numbers" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 2)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "1" , Space , Str "and" , Space , Str "4" ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header 2 ( "attributes" , [] , [] ) [ Str "Attributes" ]
+  , Table
+      ( "attrib-test-table" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [ "table-head" ] , [] )
+         [ Row
+             ( "" , [ "table-head-row" ] , [] )
+             [ Cell
+                 ( "" , [] , [ ( "abbr" , "x" ) ] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 3)
+                 [ Plain [ Str "Cat" , Space , Str "X" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [ "main" ] , [ ( "part" , "body" ) ] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [ ( "part" , "row" ) ] )
+              [ Cell
+                  ( "" , [] , [ ( "part" , "cell" ) ] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [ ( "valign" , "bottom" ) ] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [ ( "style" , "color: #151950" ) ] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          ]
+      ]
+      (TableFoot
+         ( "" , [ "summary" ] , [] )
+         [ Row
+             ( "" , [] , [ ( "bgcolor" , "#ccc" ) ] )
+             [ Cell
+                 ( "" , [] , [ ( "square" , "true" ) ] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "4" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "5" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "6" ] ]
+             ]
+         ])
+  , Header
+      2
+      ( "tag-omission" , [] , [] )
+      [ Str "Tag" , Space , Str "omission" ]
+  , Para
+      [ Str "thead,"
+      , Space
+      , Str "tbody,"
+      , Space
+      , Str "and"
+      , Space
+      , Str "tfoot"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              ]
+          ]
+      ]
+      (TableFoot
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "4" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "5" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "6" ] ]
+             ]
+         ])
+  , Header
+      2
+      ( "empty-tables" , [] , [] )
+      [ Str "Empty" , Space , Str "Tables" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "section"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "empty."
+      ]
+  ]
diff --git a/test/ipynb/simple.out.native b/test/ipynb/simple.out.native
--- a/test/ipynb/simple.out.native
+++ b/test/ipynb/simple.out.native
@@ -1,15 +1,103 @@
-Pandoc (Meta {unMeta = fromList [("jupyter",MetaMap (fromList [("nbformat",MetaString "4"),("nbformat_minor",MetaString "5")]))]})
-[Div ("",["cell","markdown"],[])
- [Header 1 ("lorem-ipsum",[],[]) [Str "Lorem",Space,Str "ipsum"]
- ,Para [Strong [Str "Lorem",Space,Str "ipsum"],Space,Str "dolor",Space,Str "sit",Space,Str "amet,",Space,Str "consectetur",Space,Str "adipiscing",Space,Str "elit.",Space,Str "Nunc",Space,Str "luctus",SoftBreak,Str "bibendum",Space,Str "felis",Space,Str "dictum",Space,Str "sodales."]]
-,Div ("",["cell","code"],[])
- [CodeBlock ("",["python"],[]) "print(\"hello\")"]
-,Div ("",["cell","markdown"],[])
- [Header 2 ("pyout",[],[]) [Str "Pyout"]]
-,Div ("",["cell","code"],[("execution_count","2")])
- [CodeBlock ("",["python"],[]) "from IPython.display import HTML\nHTML(\"\"\"\n<script>\nconsole.log(\"hello\");\n</script>\n<b>HTML</b>\n\"\"\")"
- ,Div ("",["output","execute_result"],[("execution_count","2")])
-  [RawBlock (Format "html") "<script>\nconsole.log(\"hello\");\n</script>\n<b>HTML</b>\nhello"]]
-,Div ("",["cell","markdown"],[("tags","[\"foo\",\"bar\"]")])
- [Header 2 ("image",[],[]) [Str "Image"]
- ,Para [Str "This",Space,Str "image",Space,Image ("",[],[]) [Str "the",Space,Str "moon"] ("lalune.jpg",""),Space,Str "will",Space,Str "be",Space,Str "included",Space,Str "as",Space,Str "a",Space,Str "cell",SoftBreak,Str "attachment."]]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "jupyter"
+            , MetaMap
+                (fromList
+                   [ ( "nbformat" , MetaString "4" )
+                   , ( "nbformat_minor" , MetaString "5" )
+                   ])
+            )
+          ]
+    }
+  [ Div
+      ( "" , [ "cell" , "markdown" ] , [] )
+      [ Header
+          1
+          ( "lorem-ipsum" , [] , [] )
+          [ Str "Lorem" , Space , Str "ipsum" ]
+      , Para
+          [ Strong [ Str "Lorem" , Space , Str "ipsum" ]
+          , Space
+          , Str "dolor"
+          , Space
+          , Str "sit"
+          , Space
+          , Str "amet,"
+          , Space
+          , Str "consectetur"
+          , Space
+          , Str "adipiscing"
+          , Space
+          , Str "elit."
+          , Space
+          , Str "Nunc"
+          , Space
+          , Str "luctus"
+          , SoftBreak
+          , Str "bibendum"
+          , Space
+          , Str "felis"
+          , Space
+          , Str "dictum"
+          , Space
+          , Str "sodales."
+          ]
+      ]
+  , Div
+      ( "" , [ "cell" , "code" ] , [] )
+      [ CodeBlock ( "" , [ "python" ] , [] ) "print(\"hello\")" ]
+  , Div
+      ( "" , [ "cell" , "markdown" ] , [] )
+      [ Header 2 ( "pyout" , [] , [] ) [ Str "Pyout" ] ]
+  , Div
+      ( ""
+      , [ "cell" , "code" ]
+      , [ ( "execution_count" , "2" ) ]
+      )
+      [ CodeBlock
+          ( "" , [ "python" ] , [] )
+          "from IPython.display import HTML\nHTML(\"\"\"\n<script>\nconsole.log(\"hello\");\n</script>\n<b>HTML</b>\n\"\"\")"
+      , Div
+          ( ""
+          , [ "output" , "execute_result" ]
+          , [ ( "execution_count" , "2" ) ]
+          )
+          [ RawBlock
+              (Format "html")
+              "<script>\nconsole.log(\"hello\");\n</script>\n<b>HTML</b>\nhello"
+          ]
+      ]
+  , Div
+      ( ""
+      , [ "cell" , "markdown" ]
+      , [ ( "tags" , "[\"foo\",\"bar\"]" ) ]
+      )
+      [ Header 2 ( "image" , [] , [] ) [ Str "Image" ]
+      , Para
+          [ Str "This"
+          , Space
+          , Str "image"
+          , Space
+          , Image
+              ( "" , [] , [] )
+              [ Str "the" , Space , Str "moon" ]
+              ( "lalune.jpg" , "" )
+          , Space
+          , Str "will"
+          , Space
+          , Str "be"
+          , Space
+          , Str "included"
+          , Space
+          , Str "as"
+          , Space
+          , Str "a"
+          , Space
+          , Str "cell"
+          , SoftBreak
+          , Str "attachment."
+          ]
+      ]
+  ]
diff --git a/test/jats-reader.native b/test/jats-reader.native
--- a/test/jats-reader.native
+++ b/test/jats-reader.native
@@ -1,671 +1,2810 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Space,Str "MacFarlane"],MetaInlines [Str "Anonymous"]]),("title",MetaInlines [Str "Pandoc",Space,Str "Test",Space,Str "Suite"])]})
-[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
-,Header 1 ("headers",[],[]) [Str "Headers"]
-,Header 2 ("level-2-with-an-embedded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",SoftBreak,Link ("",[],[]) [Str "embedded",SoftBreak,Str "link"] ("/url","")]
-,Header 3 ("level-3-with-emphasis",[],[]) [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 4 ("level-4",[],[]) [Str "Level",Space,Str "4"]
-,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
-,Header 1 ("level-1",[],[]) [Str "Level",Space,Str "1"]
-,Header 2 ("level-2-with-emphasis",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 3 ("level-3",[],[]) [Str "Level",Space,Str "3"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,Header 2 ("level-2",[],[]) [Str "Level",Space,Str "2"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
-,Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
-,Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."]
-,Para [Str "Here's",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
-,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."]
-,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
-,Para [Str "E-mail",Space,Str "style:"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
-,BlockQuote
- [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- ,CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"
- ,Para [Str "A",Space,Str "list:"]
- ,OrderedList (1,DefaultStyle,DefaultDelim)
-  [[Para [Str "item",Space,Str "one"]]
-  ,[Para [Str "item",Space,Str "two"]]]
- ,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
- ,BlockQuote
-  [Para [Str "nested"]]
- ,BlockQuote
-  [Para [Str "nested"]]]
-,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",Space,Str ">",Space,Str "1."]
-,Para [Str "Box-style:"]
-,BlockQuote
- [Para [Str "Example:"]
- ,CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"]
-,BlockQuote
- [OrderedList (1,DefaultStyle,DefaultDelim)
-  [[Para [Str "do",Space,Str "laundry"]]
-  ,[Para [Str "take",Space,Str "out",Space,Str "the",Space,Str "trash"]]]]
-,Para [Str "Here's",Space,Str "a",Space,Str "nested",Space,Str "one:"]
-,BlockQuote
- [Para [Str "Joe",Space,Str "said:"]
- ,BlockQuote
-  [Para [Str "Don't",Space,Str "quote",Space,Str "me."]]]
-,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
-,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
-,Para [Str "And:"]
-,CodeBlock ("",[],[]) "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
-,Header 1 ("lists",[],[]) [Str "Lists"]
-,Header 2 ("unordered",[],[]) [Str "Unordered"]
-,Para [Str "Asterisks",Space,Str "tight:"]
-,BulletList
- [[Para [Str "asterisk",Space,Str "1"]]
- ,[Para [Str "asterisk",Space,Str "2"]]
- ,[Para [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Asterisks",Space,Str "loose:"]
-,BulletList
- [[Para [Str "asterisk",Space,Str "1"]]
- ,[Para [Str "asterisk",Space,Str "2"]]
- ,[Para [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "tight:"]
-,BulletList
- [[Para [Str "Plus",Space,Str "1"]]
- ,[Para [Str "Plus",Space,Str "2"]]
- ,[Para [Str "Plus",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Plus",Space,Str "1"]]
- ,[Para [Str "Plus",Space,Str "2"]]
- ,[Para [Str "Plus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "tight:"]
-,BulletList
- [[Para [Str "Minus",Space,Str "1"]]
- ,[Para [Str "Minus",Space,Str "2"]]
- ,[Para [Str "Minus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Minus",Space,Str "1"]]
- ,[Para [Str "Minus",Space,Str "2"]]
- ,[Para [Str "Minus",Space,Str "3"]]]
-,Header 2 ("ordered",[],[]) [Str "Ordered"]
-,Para [Str "Tight:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second"]]
- ,[Para [Str "Third"]]]
-,Para [Str "and:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "One"]]
- ,[Para [Str "Two"]]
- ,[Para [Str "Three"]]]
-,Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second"]]
- ,[Para [Str "Third"]]]
-,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "One"]]
- ,[Para [Str "Two"]]
- ,[Para [Str "Three"]]]
-,Para [Str "Multiple",Space,Str "paragraphs:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
-  ,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",SoftBreak,Str "dog's",Space,Str "back."]]
- ,[Para [Str "Item",Space,Str "2."]]
- ,[Para [Str "Item",Space,Str "3."]]]
-,Para [Str "List",Space,Str "styles:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- []
-,OrderedList (1,LowerRoman,DefaultDelim)
- []
-,Header 2 ("nested",[],[]) [Str "Nested"]
-,BulletList
- [[Para [Str "Tab"]
-  ,BulletList
-   [[Para [Str "Tab"]
-    ,BulletList
-     [[Para [Str "Tab"]]]]]]]
-,Para [Str "Here's",Space,Str "another:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Para [Str "Fee"]]
-   ,[Para [Str "Fie"]]
-   ,[Para [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Para [Str "Fee"]]
-   ,[Para [Str "Fie"]]
-   ,[Para [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Header 2 ("tabs-and-spaces",[],[]) [Str "Tabs",Space,Str "and",Space,Str "spaces"]
-,BulletList
- [[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"]]
- ,[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]
-  ,BulletList
-   [[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"]]
-   ,[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]]]]]
-,Header 2 ("fancy-list-markers",[],[]) [Str "Fancy",Space,Str "list",Space,Str "markers"]
-,Para [Str "Autonumbering:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "Autonumber."]]
- ,[Para [Str "More."]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Para [Str "Nested."]]]]]
-,Header 2 ("definition",[],[]) [Str "Definition"]
-,DefinitionList
- [([Str "Violin"],
-   [[Para [Str "Stringed",Space,Str "musical",Space,Str "instrument."]
-    ,Para [Str "Torture",Space,Str "device."]]])
- ,([Str "Cello",LineBreak,Str "Violoncello"],
-   [[Para [Str "Low-voiced",Space,Str "stringed",Space,Str "instrument."]]])]
-,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",SoftBreak,Str "this"],Str "."]
-,Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",SoftBreak,Strong [Str "is",Space,Str "this"],Str "."]
-,Para [Str "Empty",Space,Strong [],Space,Str "and",Space,Emph [],Str "."]
-,Para [Str "An",SoftBreak,Emph [Link ("",[],[]) [Str "emphasized",SoftBreak,Str "link"] ("/url","")],Str "."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",SoftBreak,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",SoftBreak,Code ("",[],[]) "<html>",Str "."]
-,Para [Str "This",Space,Str "is",Space,SmallCaps [Str "small",Space,Str "caps"],Str "."]
-,Para [Str "These",Space,Str "are",Space,Str "all",Space,Str "underlined:",Space,Str "foo",Space,Str "and",Space,Str "bar."]
-,Para [Str "These",Space,Str "are",Space,Str "all",Space,Str "strikethrough:",Space,Strikeout [Str "foo"],Str ",",SoftBreak,Strikeout [Str "bar"],Str ",",Space,Str "and",Space,Strikeout [Str "baz"],Str "."]
-,Header 1 ("smart-quotes-ellipses-dashes",[],[]) [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
-,Para [Str "\"Hello,\"",Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Str "\"'Shelob'",Space,Str "is",Space,Str "my",Space,Str "name.\""]
-,Para [Str "'A',",Space,Str "'B',",Space,Str "and",Space,Str "'C'",Space,Str "are",Space,Str "letters."]
-,Para [Str "'Oak,'",Space,Str "'elm,'",Space,Str "and",Space,Str "'beech'",Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Str "'pine.'"]
-,Para [Str "'He",Space,Str "said,",Space,Str "\"I",Space,Str "want",Space,Str "to",Space,Str "go.\"'",Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70's?"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Str "'",Code ("",[],[]) "code",Str "'",Space,Str "and",Space,Str "a",SoftBreak,Str "\"",Link ("",[],[]) [Str "quoted",SoftBreak,Str "link"] ("http://example.com/?foo=1&bar=2",""),Str "\"."]
-,Para [Str "Some",Space,Str "dashes:",Space,Str "one---two",Space,Str "---",Space,Str "three--four",Space,Str "--",Space,Str "five."]
-,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5-7,",Space,Str "255-66,",Space,Str "1987-1999."]
-,Para [Str "Ellipses...and.",Space,Str ".",Space,Str ".and",Space,Str ".",Space,Str ".",Space,Str ".",Space,Str "."]
-,Header 1 ("latex",[],[]) [Str "LaTeX"]
-,BulletList
- [[Para [Str "\\cite[22-23]{smith.1899}"]]
- ,[Para [Str "\\doublespacing"]]
- ,[Para [Str "$2+2=4$"]]
- ,[Para [Str "$x",Space,Str "\\in",Space,Str "y$"]]
- ,[Para [Str "$\\alpha",Space,Str "\\wedge",Space,Str "\\omega$"]]
- ,[Para [Str "$223$"]]
- ,[Para [Str "$p$-Tree"]]
- ,[Para [Str "$\\frac{d}{dx}f(x)=\\lim_{h\\to",Space,Str "0}\\frac{f(x+h)-f(x)}{h}$"]]
- ,[Para [Str "Here's",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Str "$\\alpha",Space,Str "+",Space,Str "\\omega",Space,Str "\\times",SoftBreak,Str "x^2$."]]]
-,Para [Str "These",Space,Str "shouldn't",Space,Str "be",Space,Str "math:"]
-,BulletList
- [[Para [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",SoftBreak,Code ("",[],[]) "$e = mc^2$",Str "."]]
- ,[Para [Str "$22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$34,000.",Space,Str "(It",SoftBreak,Str "worked",Space,Str "if",Space,Str "\"lot\"",Space,Str "is",Space,Str "emphasized.)"]]
- ,[Para [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",SoftBreak,Str "emphasized"],Space,Str "23$."]]]
-,Para [Str "Here's",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
-,Para [Str "\\begin{tabular}{|l|l|}\\hline",Space,Str "Animal",Space,Str "&",Space,Str "Number",Space,Str "\\\\",Space,Str "\\hline",Space,Str "Dog",Space,Str "&",SoftBreak,Str "2",Space,Str "\\\\",Space,Str "Cat",Space,Str "&",Space,Str "1",Space,Str "\\\\",Space,Str "\\hline",Space,Str "\\end{tabular}"]
-,Header 1 ("special-characters",[],[]) [Str "Special",Space,Str "Characters"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
-,BulletList
- [[Para [Str "I",Space,Str "hat:",Space,Str "\206"]]
- ,[Para [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
- ,[Para [Str "section:",Space,Str "\167"]]
- ,[Para [Str "set",Space,Str "membership:",Space,Str "elem"]]
- ,[Para [Str "copyright:",Space,Str "\169"]]]
-,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
-,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
-,Para [Str "This",Space,Str "&",Space,Str "that."]
-,Para [Str "4",Space,Str "<",Space,Str "5."]
-,Para [Str "6",Space,Str ">",Space,Str "5."]
-,Para [Str "Backslash:",Space,Str "\\"]
-,Para [Str "Backtick:",Space,Str "`"]
-,Para [Str "Asterisk:",Space,Str "*"]
-,Para [Str "Underscore:",Space,Str "_"]
-,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
-,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
-,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
-,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
-,Para [Str "Left",Space,Str "paren:",Space,Str "("]
-,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
-,Para [Str "Greater-than:",Space,Str ">"]
-,Para [Str "Hash:",Space,Str "#"]
-,Para [Str "Period:",Space,Str "."]
-,Para [Str "Bang:",Space,Str "!"]
-,Para [Str "Plus:",Space,Str "+"]
-,Para [Str "Minus:",Space,Str "-"]
-,Header 1 ("links",[],[]) [Str "Links"]
-,Header 2 ("explicit",[],[]) [Str "Explicit"]
-,Para [Str "Just",Space,Str "a",SoftBreak,Link ("",[],[]) [Str "URL"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",SoftBreak,Str "and",Space,Str "title"] ("/url/","title"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",SoftBreak,Str "and",Space,Str "title"] ("/url/","title preceded by two spaces"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",SoftBreak,Str "and",Space,Str "title"] ("/url/","title preceded by a tab"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",SoftBreak,Str "and",Space,Str "title"] ("/url/","title with \"quotes\" in it")]
-,Para [Link ("",[],[]) [Str "URL",SoftBreak,Str "and",Space,Str "title"] ("/url/","title with single quotes")]
-,Para [Str "Email",Space,Str "link",Space,Str "(nobody",Space,Str "[at]",Space,Str "nowhere.net)"]
-,Para [Link ("",[],[]) [Str "Empty"] ("",""),Str "."]
-,Header 2 ("reference",[],[]) [Str "Reference"]
-,Para [Str "Foo",SoftBreak,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "Foo",SoftBreak,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "Foo",SoftBreak,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "With",Space,Link ("",[],[]) [Str "embedded",SoftBreak,Str "[brackets]"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "b"] ("/url/",""),Space,Str "by",SoftBreak,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
-,Para [Str "Indented",SoftBreak,Link ("",[],[]) [Str "once"] ("/url",""),Str "."]
-,Para [Str "Indented",SoftBreak,Link ("",[],[]) [Str "twice"] ("/url",""),Str "."]
-,Para [Str "Indented",SoftBreak,Link ("",[],[]) [Str "thrice"] ("/url",""),Str "."]
-,Para [Str "This",Space,Str "should",Space,Str "[not]",Space,Str "be",Space,Str "a",Space,Str "link."]
-,CodeBlock ("",[],[]) "[not]: /url"
-,Para [Str "Foo",SoftBreak,Link ("",[],[]) [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."]
-,Para [Str "Foo",SoftBreak,Link ("",[],[]) [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."]
-,Header 2 ("with-ampersands",[],[]) [Str "With",Space,Str "ampersands"]
-,Para [Str "Here's",Space,Str "a",SoftBreak,Link ("",[],[]) [Str "link",SoftBreak,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
-,Para [Str "Here's",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",SoftBreak,Link ("",[],[]) [Str "AT&T"] ("http://att.com/","AT&T"),Str "."]
-,Para [Str "Here's",Space,Str "an",SoftBreak,Link ("",[],[]) [Str "inline",SoftBreak,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
-,Para [Str "Here's",Space,Str "an",SoftBreak,Link ("",[],[]) [Str "inline",SoftBreak,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."]
-,Header 2 ("autolinks",[],[]) [Str "Autolinks"]
-,Para [Str "With",Space,Str "an",Space,Str "ampersand:",SoftBreak,Link ("",[],[]) [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
-,BulletList
- [[Para [Str "In",Space,Str "a",Space,Str "list?"]]
- ,[Para [Link ("",[],[]) [Str "http://example.com/"] ("http://example.com/","")]]
- ,[Para [Str "It",Space,Str "should."]]]
-,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Str "nobody",Space,Str "[at]",Space,Str "nowhere.net"]
-,BlockQuote
- [Para [Str "Blockquoted:",SoftBreak,Link ("",[],[]) [Str "http://example.com/"] ("http://example.com/","")]]
-,Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",SoftBreak,Code ("",[],[]) "<http://example.com/>"]
-,CodeBlock ("",[],[]) "or here: <http://example.com/>"
-,Header 1 ("images",[],[]) [Str "Images"]
-,Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
-,Para [Image ("",[],[]) [] ("lalune.jpg","Voyage dans la Lune")]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",SoftBreak,Image ("",[],[]) [] ("movie.jpg",""),SoftBreak,Str "icon."]
-,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Link ("",[],[]) [Str "(1)"] ("#note_1",""),Str ",",SoftBreak,Str "and",SoftBreak,Str "another",Link ("",[],[]) [Str "(longnote)"] ("#note_longnote",""),Str ".",SoftBreak,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",SoftBreak,Str "contains",Space,Str "a",Space,Str "space^(my",Space,Str "note)."]
-,Para [Link ("",[],[]) [Str "(1)"] ("#ref_1",""),Space,Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",SoftBreak,Str "go",Space,Str "anywhere",Space,Str "in",Space,Str "the",Space,Str "document,",Space,Str "not",Space,Str "just",Space,Str "at",Space,Str "the",Space,Str "end."]
-,Para [Link ("",[],[]) [Str "(longnote)"] ("#ref_longnote",""),Space,Str "Here's",SoftBreak,Str "the",Space,Str "other",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."]
-,Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",SoftBreak,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)."]
-,CodeBlock ("",[],[]) "  { <code> }"
-,Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",SoftBreak,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",SoftBreak,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."]
-,Para [Str "text",Space,Emph [Str "Leading",Space,Str "space"]]
-,Para [Emph [Str "Trailing",Space,Str "space"],Space,Str "text"]
-,Para [Str "text",Space,Emph [Str "Leading",Space,Str "spaces"]]
-,Para [Emph [Str "Trailing",Space,Str "spaces"],Space,Str "text"]
-,Header 1 ("tables",[],[]) [Str "Tables"]
-,Header 2 ("tables-with-headers",[],[]) [Str "Tables",Space,Str "with",Space,Str "Headers"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "X"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Y"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Z"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 2 ("tables-without-headers",[],[]) [Str "Tables",Space,Str "without",Space,Str "Headers"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 2 ("empty-tables",[],[]) [Str "Empty",Space,Str "Tables"]
-,Para [Str "This",Space,Str "section",Space,Str "should",Space,Str "be",Space,Str "empty."]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author"
+            , MetaList
+                [ MetaInlines [ Str "John" , Space , Str "MacFarlane" ]
+                , MetaInlines [ Str "Anonymous" ]
+                ]
+            )
+          , ( "title"
+            , MetaInlines
+                [ Str "Pandoc"
+                , Space
+                , Str "Test"
+                , Space
+                , Str "Suite"
+                ]
+            )
+          ]
+    }
+  [ Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "set"
+      , Space
+      , Str "of"
+      , Space
+      , Str "tests"
+      , Space
+      , Str "for"
+      , Space
+      , Str "pandoc."
+      , Space
+      , Str "Most"
+      , Space
+      , Str "of"
+      , Space
+      , Str "them"
+      , Space
+      , Str "are"
+      , Space
+      , Str "adapted"
+      , Space
+      , Str "from"
+      , Space
+      , Str "John"
+      , Space
+      , Str "Gruber's"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "test"
+      , Space
+      , Str "suite."
+      ]
+  , Header 1 ( "headers" , [] , [] ) [ Str "Headers" ]
+  , Header
+      2
+      ( "level-2-with-an-embedded-link" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , SoftBreak , Str "link" ]
+          ( "/url" , "" )
+      ]
+  , Header
+      3
+      ( "level-3-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "3"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      4 ( "level-4" , [] , [] ) [ Str "Level" , Space , Str "4" ]
+  , Header
+      5 ( "level-5" , [] , [] ) [ Str "Level" , Space , Str "5" ]
+  , Header
+      1 ( "level-1" , [] , [] ) [ Str "Level" , Space , Str "1" ]
+  , Header
+      2
+      ( "level-2-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      3 ( "level-3" , [] , [] ) [ Str "Level" , Space , Str "3" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , Header
+      2 ( "level-2" , [] , [] ) [ Str "Level" , Space , Str "2" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , Header 1 ( "paragraphs" , [] , [] ) [ Str "Paragraphs" ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Str "regular"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "In"
+      , Space
+      , Str "Markdown"
+      , Space
+      , Str "1.0.0"
+      , Space
+      , Str "and"
+      , Space
+      , Str "earlier."
+      , Space
+      , Str "Version"
+      , Space
+      , Str "8."
+      , Space
+      , Str "This"
+      , Space
+      , Str "line"
+      , Space
+      , Str "turns"
+      , Space
+      , Str "into"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      , Space
+      , Str "Because"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard-wrapped"
+      , Space
+      , Str "line"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "middle"
+      , Space
+      , Str "of"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "looked"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "one"
+      , Space
+      , Str "with"
+      , Space
+      , Str "a"
+      , Space
+      , Str "bullet."
+      , Space
+      , Str "*"
+      , Space
+      , Str "criminey."
+      ]
+  , Para
+      [ Str "There"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard"
+      , Space
+      , Str "line"
+      , Space
+      , Str "break"
+      , LineBreak
+      , Str "here."
+      ]
+  , Header
+      1
+      ( "block-quotes" , [] , [] )
+      [ Str "Block" , Space , Str "Quotes" ]
+  , Para [ Str "E-mail" , Space , Str "style:" ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          , Space
+          , Str "It"
+          , Space
+          , Str "is"
+          , Space
+          , Str "pretty"
+          , Space
+          , Str "short."
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Code"
+          , Space
+          , Str "in"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote:"
+          ]
+      , CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      , Para [ Str "A" , Space , Str "list:" ]
+      , OrderedList
+          ( 1 , DefaultStyle , DefaultDelim )
+          [ [ Para [ Str "item" , Space , Str "one" ] ]
+          , [ Para [ Str "item" , Space , Str "two" ] ]
+          ]
+      , Para
+          [ Str "Nested"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quotes:"
+          ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "block"
+      , Space
+      , Str "quote:"
+      , Space
+      , Str "2"
+      , Space
+      , Str ">"
+      , Space
+      , Str "1."
+      ]
+  , Para [ Str "Box-style:" ]
+  , BlockQuote
+      [ Para [ Str "Example:" ]
+      , CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      ]
+  , BlockQuote
+      [ OrderedList
+          ( 1 , DefaultStyle , DefaultDelim )
+          [ [ Para [ Str "do" , Space , Str "laundry" ] ]
+          , [ Para
+                [ Str "take"
+                , Space
+                , Str "out"
+                , Space
+                , Str "the"
+                , Space
+                , Str "trash"
+                ]
+            ]
+          ]
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Str "nested"
+      , Space
+      , Str "one:"
+      ]
+  , BlockQuote
+      [ Para [ Str "Joe" , Space , Str "said:" ]
+      , BlockQuote
+          [ Para
+              [ Str "Don't" , Space , Str "quote" , Space , Str "me." ]
+          ]
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "a"
+      , Space
+      , Str "following"
+      , Space
+      , Str "paragraph."
+      ]
+  , Header
+      1
+      ( "code-blocks" , [] , [] )
+      [ Str "Code" , Space , Str "Blocks" ]
+  , Para [ Str "Code:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
+  , Header 1 ( "lists" , [] , [] ) [ Str "Lists" ]
+  , Header 2 ( "unordered" , [] , [] ) [ Str "Unordered" ]
+  , Para [ Str "Asterisks" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Para [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Asterisks" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Para [ Str "Plus" , Space , Str "1" ] ]
+      , [ Para [ Str "Plus" , Space , Str "2" ] ]
+      , [ Para [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Plus" , Space , Str "1" ] ]
+      , [ Para [ Str "Plus" , Space , Str "2" ] ]
+      , [ Para [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Para [ Str "Minus" , Space , Str "1" ] ]
+      , [ Para [ Str "Minus" , Space , Str "2" ] ]
+      , [ Para [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Minus" , Space , Str "1" ] ]
+      , [ Para [ Str "Minus" , Space , Str "2" ] ]
+      , [ Para [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Header 2 ( "ordered" , [] , [] ) [ Str "Ordered" ]
+  , Para [ Str "Tight:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second" ] ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para [ Str "and:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "One" ] ]
+      , [ Para [ Str "Two" ] ]
+      , [ Para [ Str "Three" ] ]
+      ]
+  , Para
+      [ Str "Loose" , Space , Str "using" , Space , Str "tabs:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second" ] ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "and" , Space , Str "using" , Space , Str "spaces:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "One" ] ]
+      , [ Para [ Str "Two" ] ]
+      , [ Para [ Str "Three" ] ]
+      ]
+  , Para [ Str "Multiple" , Space , Str "paragraphs:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para
+            [ Str "Item"
+            , Space
+            , Str "1,"
+            , Space
+            , Str "graf"
+            , Space
+            , Str "one."
+            ]
+        , Para
+            [ Str "Item"
+            , Space
+            , Str "1."
+            , Space
+            , Str "graf"
+            , Space
+            , Str "two."
+            , Space
+            , Str "The"
+            , Space
+            , Str "quick"
+            , Space
+            , Str "brown"
+            , Space
+            , Str "fox"
+            , Space
+            , Str "jumped"
+            , Space
+            , Str "over"
+            , Space
+            , Str "the"
+            , Space
+            , Str "lazy"
+            , SoftBreak
+            , Str "dog's"
+            , Space
+            , Str "back."
+            ]
+        ]
+      , [ Para [ Str "Item" , Space , Str "2." ] ]
+      , [ Para [ Str "Item" , Space , Str "3." ] ]
+      ]
+  , Para [ Str "List" , Space , Str "styles:" ]
+  , OrderedList ( 1 , DefaultStyle , DefaultDelim ) []
+  , OrderedList ( 1 , LowerRoman , DefaultDelim ) []
+  , Header 2 ( "nested" , [] , [] ) [ Str "Nested" ]
+  , BulletList
+      [ [ Para [ Str "Tab" ]
+        , BulletList
+            [ [ Para [ Str "Tab" ]
+              , BulletList [ [ Para [ Str "Tab" ] ] ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Here's" , Space , Str "another:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Para [ Str "Fee" ] ]
+            , [ Para [ Str "Fie" ] ]
+            , [ Para [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "Same"
+      , Space
+      , Str "thing"
+      , Space
+      , Str "but"
+      , Space
+      , Str "with"
+      , Space
+      , Str "paragraphs:"
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Para [ Str "Fee" ] ]
+            , [ Para [ Str "Fie" ] ]
+            , [ Para [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Header
+      2
+      ( "tabs-and-spaces" , [] , [] )
+      [ Str "Tabs" , Space , Str "and" , Space , Str "spaces" ]
+  , BulletList
+      [ [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "tabs"
+            ]
+        ]
+      , [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "spaces"
+            ]
+        , BulletList
+            [ [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "tabs"
+                  ]
+              ]
+            , [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "spaces"
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "fancy-list-markers" , [] , [] )
+      [ Str "Fancy" , Space , Str "list" , Space , Str "markers" ]
+  , Para [ Str "Autonumbering:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "Autonumber." ] ]
+      , [ Para [ Str "More." ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Para [ Str "Nested." ] ] ]
+        ]
+      ]
+  , Header 2 ( "definition" , [] , [] ) [ Str "Definition" ]
+  , DefinitionList
+      [ ( [ Str "Violin" ]
+        , [ [ Para
+                [ Str "Stringed"
+                , Space
+                , Str "musical"
+                , Space
+                , Str "instrument."
+                ]
+            , Para [ Str "Torture" , Space , Str "device." ]
+            ]
+          ]
+        )
+      , ( [ Str "Cello" , LineBreak , Str "Violoncello" ]
+        , [ [ Para
+                [ Str "Low-voiced"
+                , Space
+                , Str "stringed"
+                , Space
+                , Str "instrument."
+                ]
+            ]
+          ]
+        )
+      ]
+  , Header
+      1
+      ( "inline-markup" , [] , [] )
+      [ Str "Inline" , Space , Str "Markup" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Emph [ Str "is" , SoftBreak , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , SoftBreak
+      , Strong [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Empty"
+      , Space
+      , Strong []
+      , Space
+      , Str "and"
+      , Space
+      , Emph []
+      , Str "."
+      ]
+  , Para
+      [ Str "An"
+      , SoftBreak
+      , Emph
+          [ Link
+              ( "" , [] , [] )
+              [ Str "emphasized" , SoftBreak , Str "link" ]
+              ( "/url" , "" )
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "code:"
+      , Space
+      , Code ( "" , [] , [] ) ">"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "$"
+      , Str ","
+      , SoftBreak
+      , Code ( "" , [] , [] ) "\\"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\$"
+      , Str ","
+      , SoftBreak
+      , Code ( "" , [] , [] ) "<html>"
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , SmallCaps [ Str "small" , Space , Str "caps" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "are"
+      , Space
+      , Str "all"
+      , Space
+      , Str "underlined:"
+      , Space
+      , Str "foo"
+      , Space
+      , Str "and"
+      , Space
+      , Str "bar."
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "are"
+      , Space
+      , Str "all"
+      , Space
+      , Str "strikethrough:"
+      , Space
+      , Strikeout [ Str "foo" ]
+      , Str ","
+      , SoftBreak
+      , Strikeout [ Str "bar" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Strikeout [ Str "baz" ]
+      , Str "."
+      ]
+  , Header
+      1
+      ( "smart-quotes-ellipses-dashes" , [] , [] )
+      [ Str "Smart"
+      , Space
+      , Str "quotes,"
+      , Space
+      , Str "ellipses,"
+      , Space
+      , Str "dashes"
+      ]
+  , Para
+      [ Str "\"Hello,\""
+      , Space
+      , Str "said"
+      , Space
+      , Str "the"
+      , Space
+      , Str "spider."
+      , Space
+      , Str "\"'Shelob'"
+      , Space
+      , Str "is"
+      , Space
+      , Str "my"
+      , Space
+      , Str "name.\""
+      ]
+  , Para
+      [ Str "'A',"
+      , Space
+      , Str "'B',"
+      , Space
+      , Str "and"
+      , Space
+      , Str "'C'"
+      , Space
+      , Str "are"
+      , Space
+      , Str "letters."
+      ]
+  , Para
+      [ Str "'Oak,'"
+      , Space
+      , Str "'elm,'"
+      , Space
+      , Str "and"
+      , Space
+      , Str "'beech'"
+      , Space
+      , Str "are"
+      , Space
+      , Str "names"
+      , Space
+      , Str "of"
+      , Space
+      , Str "trees."
+      , Space
+      , Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Str "'pine.'"
+      ]
+  , Para
+      [ Str "'He"
+      , Space
+      , Str "said,"
+      , Space
+      , Str "\"I"
+      , Space
+      , Str "want"
+      , Space
+      , Str "to"
+      , Space
+      , Str "go.\"'"
+      , Space
+      , Str "Were"
+      , Space
+      , Str "you"
+      , Space
+      , Str "alive"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "70's?"
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "quoted"
+      , Space
+      , Str "'"
+      , Code ( "" , [] , [] ) "code"
+      , Str "'"
+      , Space
+      , Str "and"
+      , Space
+      , Str "a"
+      , SoftBreak
+      , Str "\""
+      , Link
+          ( "" , [] , [] )
+          [ Str "quoted" , SoftBreak , Str "link" ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Str "\"."
+      ]
+  , Para
+      [ Str "Some"
+      , Space
+      , Str "dashes:"
+      , Space
+      , Str "one---two"
+      , Space
+      , Str "---"
+      , Space
+      , Str "three--four"
+      , Space
+      , Str "--"
+      , Space
+      , Str "five."
+      ]
+  , Para
+      [ Str "Dashes"
+      , Space
+      , Str "between"
+      , Space
+      , Str "numbers:"
+      , Space
+      , Str "5-7,"
+      , Space
+      , Str "255-66,"
+      , Space
+      , Str "1987-1999."
+      ]
+  , Para
+      [ Str "Ellipses...and."
+      , Space
+      , Str "."
+      , Space
+      , Str ".and"
+      , Space
+      , Str "."
+      , Space
+      , Str "."
+      , Space
+      , Str "."
+      , Space
+      , Str "."
+      ]
+  , Header 1 ( "latex" , [] , [] ) [ Str "LaTeX" ]
+  , BulletList
+      [ [ Para [ Str "\\cite[22-23]{smith.1899}" ] ]
+      , [ Para [ Str "\\doublespacing" ] ]
+      , [ Para [ Str "$2+2=4$" ] ]
+      , [ Para
+            [ Str "$x" , Space , Str "\\in" , Space , Str "y$" ]
+        ]
+      , [ Para
+            [ Str "$\\alpha"
+            , Space
+            , Str "\\wedge"
+            , Space
+            , Str "\\omega$"
+            ]
+        ]
+      , [ Para [ Str "$223$" ] ]
+      , [ Para [ Str "$p$-Tree" ] ]
+      , [ Para
+            [ Str "$\\frac{d}{dx}f(x)=\\lim_{h\\to"
+            , Space
+            , Str "0}\\frac{f(x+h)-f(x)}{h}$"
+            ]
+        ]
+      , [ Para
+            [ Str "Here's"
+            , Space
+            , Str "one"
+            , Space
+            , Str "that"
+            , Space
+            , Str "has"
+            , Space
+            , Str "a"
+            , Space
+            , Str "line"
+            , Space
+            , Str "break"
+            , Space
+            , Str "in"
+            , Space
+            , Str "it:"
+            , Space
+            , Str "$\\alpha"
+            , Space
+            , Str "+"
+            , Space
+            , Str "\\omega"
+            , Space
+            , Str "\\times"
+            , SoftBreak
+            , Str "x^2$."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "shouldn't"
+      , Space
+      , Str "be"
+      , Space
+      , Str "math:"
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "To"
+            , Space
+            , Str "get"
+            , Space
+            , Str "the"
+            , Space
+            , Str "famous"
+            , Space
+            , Str "equation,"
+            , Space
+            , Str "write"
+            , SoftBreak
+            , Code ( "" , [] , [] ) "$e = mc^2$"
+            , Str "."
+            ]
+        ]
+      , [ Para
+            [ Str "$22,000"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Emph [ Str "lot" ]
+            , Space
+            , Str "of"
+            , Space
+            , Str "money."
+            , Space
+            , Str "So"
+            , Space
+            , Str "is"
+            , Space
+            , Str "$34,000."
+            , Space
+            , Str "(It"
+            , SoftBreak
+            , Str "worked"
+            , Space
+            , Str "if"
+            , Space
+            , Str "\"lot\""
+            , Space
+            , Str "is"
+            , Space
+            , Str "emphasized.)"
+            ]
+        ]
+      , [ Para
+            [ Str "Escaped"
+            , Space
+            , Code ( "" , [] , [] ) "$"
+            , Str ":"
+            , Space
+            , Str "$73"
+            , Space
+            , Emph
+                [ Str "this"
+                , Space
+                , Str "should"
+                , Space
+                , Str "be"
+                , SoftBreak
+                , Str "emphasized"
+                ]
+            , Space
+            , Str "23$."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Str "LaTeX"
+      , Space
+      , Str "table:"
+      ]
+  , Para
+      [ Str "\\begin{tabular}{|l|l|}\\hline"
+      , Space
+      , Str "Animal"
+      , Space
+      , Str "&"
+      , Space
+      , Str "Number"
+      , Space
+      , Str "\\\\"
+      , Space
+      , Str "\\hline"
+      , Space
+      , Str "Dog"
+      , Space
+      , Str "&"
+      , SoftBreak
+      , Str "2"
+      , Space
+      , Str "\\\\"
+      , Space
+      , Str "Cat"
+      , Space
+      , Str "&"
+      , Space
+      , Str "1"
+      , Space
+      , Str "\\\\"
+      , Space
+      , Str "\\hline"
+      , Space
+      , Str "\\end{tabular}"
+      ]
+  , Header
+      1
+      ( "special-characters" , [] , [] )
+      [ Str "Special" , Space , Str "Characters" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "unicode:"
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "I" , Space , Str "hat:" , Space , Str "\206" ]
+        ]
+      , [ Para
+            [ Str "o" , Space , Str "umlaut:" , Space , Str "\246" ]
+        ]
+      , [ Para [ Str "section:" , Space , Str "\167" ] ]
+      , [ Para
+            [ Str "set"
+            , Space
+            , Str "membership:"
+            , Space
+            , Str "elem"
+            ]
+        ]
+      , [ Para [ Str "copyright:" , Space , Str "\169" ] ]
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "has"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "their"
+      , Space
+      , Str "name."
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "is"
+      , Space
+      , Str "another"
+      , Space
+      , Str "way"
+      , Space
+      , Str "to"
+      , Space
+      , Str "write"
+      , Space
+      , Str "it."
+      ]
+  , Para
+      [ Str "This" , Space , Str "&" , Space , Str "that." ]
+  , Para [ Str "4" , Space , Str "<" , Space , Str "5." ]
+  , Para [ Str "6" , Space , Str ">" , Space , Str "5." ]
+  , Para [ Str "Backslash:" , Space , Str "\\" ]
+  , Para [ Str "Backtick:" , Space , Str "`" ]
+  , Para [ Str "Asterisk:" , Space , Str "*" ]
+  , Para [ Str "Underscore:" , Space , Str "_" ]
+  , Para
+      [ Str "Left" , Space , Str "brace:" , Space , Str "{" ]
+  , Para
+      [ Str "Right" , Space , Str "brace:" , Space , Str "}" ]
+  , Para
+      [ Str "Left" , Space , Str "bracket:" , Space , Str "[" ]
+  , Para
+      [ Str "Right" , Space , Str "bracket:" , Space , Str "]" ]
+  , Para
+      [ Str "Left" , Space , Str "paren:" , Space , Str "(" ]
+  , Para
+      [ Str "Right" , Space , Str "paren:" , Space , Str ")" ]
+  , Para [ Str "Greater-than:" , Space , Str ">" ]
+  , Para [ Str "Hash:" , Space , Str "#" ]
+  , Para [ Str "Period:" , Space , Str "." ]
+  , Para [ Str "Bang:" , Space , Str "!" ]
+  , Para [ Str "Plus:" , Space , Str "+" ]
+  , Para [ Str "Minus:" , Space , Str "-" ]
+  , Header 1 ( "links" , [] , [] ) [ Str "Links" ]
+  , Header 2 ( "explicit" , [] , [] ) [ Str "Explicit" ]
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "a"
+      , SoftBreak
+      , Link ( "" , [] , [] ) [ Str "URL" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , SoftBreak , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , SoftBreak , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title preceded by two spaces" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , SoftBreak , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title preceded by a tab" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , SoftBreak , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title with \"quotes\" in it" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , SoftBreak , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title with single quotes" )
+      ]
+  , Para
+      [ Str "Email"
+      , Space
+      , Str "link"
+      , Space
+      , Str "(nobody"
+      , Space
+      , Str "[at]"
+      , Space
+      , Str "nowhere.net)"
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "Empty" ] ( "" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "reference" , [] , [] ) [ Str "Reference" ]
+  , Para
+      [ Str "Foo"
+      , SoftBreak
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , SoftBreak
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , SoftBreak
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "With"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , SoftBreak , Str "[brackets]" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "b" ] ( "/url/" , "" )
+      , Space
+      , Str "by"
+      , SoftBreak
+      , Str "itself"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , Para
+      [ Str "Indented"
+      , SoftBreak
+      , Link ( "" , [] , [] ) [ Str "once" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , SoftBreak
+      , Link ( "" , [] , [] ) [ Str "twice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , SoftBreak
+      , Link ( "" , [] , [] ) [ Str "thrice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "[not]"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , CodeBlock ( "" , [] , [] ) "[not]: /url"
+  , Para
+      [ Str "Foo"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "bar" ]
+          ( "/url/" , "Title with \"quotes\" inside" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "biz" ]
+          ( "/url/" , "Title with \"quote\" inside" )
+      , Str "."
+      ]
+  , Header
+      2
+      ( "with-ampersands" , [] , [] )
+      [ Str "With" , Space , Str "ampersands" ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "link"
+          , SoftBreak
+          , Str "with"
+          , Space
+          , Str "an"
+          , Space
+          , Str "ampersand"
+          , Space
+          , Str "in"
+          , Space
+          , Str "the"
+          , Space
+          , Str "URL"
+          ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Str "amersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "link"
+      , Space
+      , Str "text:"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "AT&T" ]
+          ( "http://att.com/" , "AT&T" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "an"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline" , SoftBreak , Str "link" ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "an"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline"
+          , SoftBreak
+          , Str "link"
+          , Space
+          , Str "in"
+          , Space
+          , Str "pointy"
+          , Space
+          , Str "braces"
+          ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "autolinks" , [] , [] ) [ Str "Autolinks" ]
+  , Para
+      [ Str "With"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand:"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://example.com/?foo=1&bar=2" ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "In" , Space , Str "a" , Space , Str "list?" ]
+        ]
+      , [ Para
+            [ Link
+                ( "" , [] , [] )
+                [ Str "http://example.com/" ]
+                ( "http://example.com/" , "" )
+            ]
+        ]
+      , [ Para [ Str "It" , Space , Str "should." ] ]
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Str "e-mail"
+      , Space
+      , Str "address:"
+      , Space
+      , Str "nobody"
+      , Space
+      , Str "[at]"
+      , Space
+      , Str "nowhere.net"
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Blockquoted:"
+          , SoftBreak
+          , Link
+              ( "" , [] , [] )
+              [ Str "http://example.com/" ]
+              ( "http://example.com/" , "" )
+          ]
+      ]
+  , Para
+      [ Str "Auto-links"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "occur"
+      , Space
+      , Str "here:"
+      , SoftBreak
+      , Code ( "" , [] , [] ) "<http://example.com/>"
+      ]
+  , CodeBlock
+      ( "" , [] , [] ) "or here: <http://example.com/>"
+  , Header 1 ( "images" , [] , [] ) [ Str "Images" ]
+  , Para
+      [ Str "From"
+      , Space
+      , Str "\"Voyage"
+      , Space
+      , Str "dans"
+      , Space
+      , Str "la"
+      , Space
+      , Str "Lune\""
+      , Space
+      , Str "by"
+      , Space
+      , Str "Georges"
+      , Space
+      , Str "Melies"
+      , Space
+      , Str "(1902):"
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] ) [] ( "lalune.jpg" , "Voyage dans la Lune" )
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "movie"
+      , SoftBreak
+      , Image ( "" , [] , [] ) [] ( "movie.jpg" , "" )
+      , SoftBreak
+      , Str "icon."
+      ]
+  , Header 1 ( "footnotes" , [] , [] ) [ Str "Footnotes" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference"
+      , Link ( "" , [] , [] ) [ Str "(1)" ] ( "#note_1" , "" )
+      , Str ","
+      , SoftBreak
+      , Str "and"
+      , SoftBreak
+      , Str "another"
+      , Link
+          ( "" , [] , [] )
+          [ Str "(longnote)" ]
+          ( "#note_longnote" , "" )
+      , Str "."
+      , SoftBreak
+      , Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Emph [ Str "not" ]
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference,"
+      , Space
+      , Str "because"
+      , Space
+      , Str "it"
+      , SoftBreak
+      , Str "contains"
+      , Space
+      , Str "a"
+      , Space
+      , Str "space^(my"
+      , Space
+      , Str "note)."
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "(1)" ] ( "#ref_1" , "" )
+      , Space
+      , Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "the"
+      , Space
+      , Str "footnote."
+      , Space
+      , Str "It"
+      , Space
+      , Str "can"
+      , SoftBreak
+      , Str "go"
+      , Space
+      , Str "anywhere"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "document,"
+      , Space
+      , Str "not"
+      , Space
+      , Str "just"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "end."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "(longnote)" ]
+          ( "#ref_longnote" , "" )
+      , Space
+      , Str "Here's"
+      , SoftBreak
+      , Str "the"
+      , Space
+      , Str "other"
+      , Space
+      , Str "note."
+      , Space
+      , Str "This"
+      , Space
+      , Str "one"
+      , Space
+      , Str "contains"
+      , Space
+      , Str "multiple"
+      , Space
+      , Str "blocks."
+      ]
+  , Para
+      [ Str "Caret"
+      , Space
+      , Str "characters"
+      , Space
+      , Str "are"
+      , Space
+      , Str "used"
+      , Space
+      , Str "to"
+      , Space
+      , Str "indicate"
+      , Space
+      , Str "that"
+      , Space
+      , Str "the"
+      , Space
+      , Str "blocks"
+      , Space
+      , Str "all"
+      , Space
+      , Str "belong"
+      , Space
+      , Str "to"
+      , SoftBreak
+      , Str "a"
+      , Space
+      , Str "single"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "(as"
+      , Space
+      , Str "with"
+      , Space
+      , Str "block"
+      , Space
+      , Str "quotes)."
+      ]
+  , CodeBlock ( "" , [] , [] ) "  { <code> }"
+  , Para
+      [ Str "If"
+      , Space
+      , Str "you"
+      , Space
+      , Str "want,"
+      , Space
+      , Str "you"
+      , Space
+      , Str "can"
+      , Space
+      , Str "use"
+      , Space
+      , Str "a"
+      , Space
+      , Str "caret"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "beginning"
+      , Space
+      , Str "of"
+      , Space
+      , Str "every"
+      , Space
+      , Str "line,"
+      , Space
+      , Str "as"
+      , SoftBreak
+      , Str "with"
+      , Space
+      , Str "blockquotes,"
+      , Space
+      , Str "but"
+      , Space
+      , Str "all"
+      , Space
+      , Str "that"
+      , Space
+      , Str "you"
+      , Space
+      , Str "need"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "caret"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "beginning"
+      , SoftBreak
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "first"
+      , Space
+      , Str "line"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "block"
+      , Space
+      , Str "and"
+      , Space
+      , Str "any"
+      , Space
+      , Str "preceding"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "lines."
+      ]
+  , Para
+      [ Str "text"
+      , Space
+      , Emph [ Str "Leading" , Space , Str "space" ]
+      ]
+  , Para
+      [ Emph [ Str "Trailing" , Space , Str "space" ]
+      , Space
+      , Str "text"
+      ]
+  , Para
+      [ Str "text"
+      , Space
+      , Emph [ Str "Leading" , Space , Str "spaces" ]
+      ]
+  , Para
+      [ Emph [ Str "Trailing" , Space , Str "spaces" ]
+      , Space
+      , Str "text"
+      ]
+  , Header 1 ( "tables" , [] , [] ) [ Str "Tables" ]
+  , Header
+      2
+      ( "tables-with-headers" , [] , [] )
+      [ Str "Tables"
+      , Space
+      , Str "with"
+      , Space
+      , Str "Headers"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "X" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Y" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Z" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header
+      2
+      ( "tables-without-headers" , [] , [] )
+      [ Str "Tables"
+      , Space
+      , Str "without"
+      , Space
+      , Str "Headers"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header
+      2
+      ( "empty-tables" , [] , [] )
+      [ Str "Empty" , Space , Str "Tables" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "section"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "empty."
+      ]
+  ]
diff --git a/test/jira-reader.native b/test/jira-reader.native
--- a/test/jira-reader.native
+++ b/test/jira-reader.native
@@ -1,185 +1,947 @@
-Pandoc (Meta {unMeta = fromList []})
-[Header 1 ("",[],[]) [Span ("headers",[],[]) [],Str "Headers"]
-,Header 2 ("",[],[]) [Span ("level-2-with-an-embedded-link",[],[]) [],Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link ("",[],[]) [Str "embedded",Space,Str "link"] ("https://test.example/url","")]
-,Header 3 ("",[],[]) [Span ("level-3-with-emphasis",[],[]) [],Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 4 ("",[],[]) [Str "Level",Space,Str "4"]
-,Header 5 ("",[],[]) [Str "Level",Space,Str "5"]
-,Header 6 ("",[],[]) [Str "Level",Space,Str "6"]
-,Para [Str "h0.",Space,Str "this",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "header."]
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Paragraphs"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
-,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
-,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."]
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Block",Space,Str "Quotes"]
-,Para [Str "E-mail",Space,Str "style:"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
-,BlockQuote
- [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- ,CodeBlock ("",["java"],[]) "sub status {\n    print \"working\";\n}\n"
- ,Para [Str "An",Space,Str "enumeration:"]
- ,OrderedList (1,DefaultStyle,DefaultDelim)
-  [[Para [Str "item",Space,Str "one"]]
-  ,[Para [Str "item",Space,Str "two"]]]]
-,Para [Str "A",Space,Str "following",Space,Str "paragraph."]
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Code",Space,Str "Blocks"]
-,Para [Str "Code:"]
-,CodeBlock ("",["java"],[]) "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n"
-,Para [Str "And:"]
-,CodeBlock ("",["java"],[]) "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{\n"
-,HorizontalRule
-,Header 1 ("",[],[]) [Span ("lists",[],[]) [],Str "Lists"]
-,Header 2 ("",[],[]) [Span ("unordered",[],[]) [],Str "Unordered"]
-,Para [Str "Asterisks:"]
-,BulletList
- [[Para [Str "asterisk",Space,Str "1"]]
- ,[Para [Str "asterisk",Space,Str "2"]]
- ,[Para [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Minuses:"]
-,BulletList
- [[Para [Str "Minus",Space,Str "1"]]
- ,[Para [Str "Minus",Space,Str "2"]]
- ,[Para [Str "Minus",Space,Str "3"]]]
-,Header 2 ("",[],[]) [Str "Ordered"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second"]]
- ,[Para [Str "Third"]]]
-,Para [Str "Linebreak",Space,Str "in",Space,Str "paragraph:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "Item",Space,Str "1,",Space,Str "line",Space,Str "one.",LineBreak,Str "Item",Space,Str "1.",Space,Str "line",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",Space,Str "back."]]
- ,[Para [Str "Item",Space,Str "2."]]
- ,[Para [Str "Item",Space,Str "3."]]]
-,Header 2 ("",[],[]) [Str "Nested"]
-,BulletList
- [[Para [Str "Tab"]
-  ,BulletList
-   [[Para [Str "Tab"]
-    ,BulletList
-     [[Para [Str "Tab"]]]]]]]
-,Para [Str "Here\8217s",Space,Str "another:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Para [Str "Fee"]]
-   ,[Para [Str "Fie"]]
-   ,[Para [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Para [Str "Nested",Space,Str "enumerations:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "Essential"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Para [Str "Important"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Para [Str "Relevant"]
-      ,OrderedList (1,DefaultStyle,DefaultDelim)
-       [[Para [Str "Insignificant"]]]]]]]]]
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Linebreaks",Space,Str "and",Space,Str "Markup",Space,Str "in",Space,Str "Lists"]
-,BulletList
- [[Para [Strong [Str "apple"],LineBreak,Str "red",Space,Str "fruit"]]
- ,[Para [Strong [Str "orange"],LineBreak,Str "orange",Space,Str "fruit"]]
- ,[Para [Strong [Str "banana"],LineBreak,Str "yellow",Space,Str "fruit"]]]
-,Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics:"]
-,BulletList
- [[Para [Strong [Emph [Str "apple"]],LineBreak,Str "red",Space,Str "fruit",LineBreak,Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"]]
- ,[Para [Strong [Emph [Str "orange"]],LineBreak,Str "orange",Space,Str "fruit"]
-  ,CodeBlock ("",["java"],[]) "{ orange code block }\n"
-  ,BlockQuote
-   [Para [Str "orange",Space,Str "block",Space,Str "quote"]]]]
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Colored",Space,Str "Text",Space,Str "Blocks"]
-,Div ("",[],[("color","red")])
- [Para [LineBreak,Str "This",Space,Str "is",Space,Str "red."]]
-,Header 2 ("",[],[]) [Str "Eiffel",Space,Str "65"]
-,Div ("",[],[("color","blue")])
- [Para [LineBreak,Str "da",Space,Str "ba",Space,Str "dee"]]
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Inline",Space,Str "Markup"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
-,Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
-,Para [Str "An",Space,Emph [Link ("",[],[]) [Str "emphasized",Space,Str "link"] ("https://my.example/url","")],Str "."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",Space,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",Space,Code ("",[],[]) "<html>",Str "."]
-,Para [Strikeout [Str "This",Space,Str "is",Space,Emph [Str "strikeout"],Str "."]]
-,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello\160there"],Str "."]
-,Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "C",Subscript [Str "6"],Str "H",Subscript [Str "12"],Str "O",Subscript [Str "6"],Str ",",Space,Str "C",Subscript [Str "\160n\160"],Str "H",Subscript [Emph [Str "2n"]],Str "O",Subscript [Str "n"],Str "."]
-,Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts,",Space,Str "because",Space,Str "of",Space,Str "markers",Space,Str "used",Space,Str "within",Space,Str "words:",Space,Str "a^b",Space,Str "c^d,",Space,Str "a~b",Space,Str "c~d."]
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Dashes,",Space,Str "and",Space,Str "emoticons"]
-,Para [Str "Some",Space,Str "dashes:",Space,Str "one",Space,Str "\8211",Space,Str "two",Space,Str "\8212",Space,Str "three."]
-,Para [Str "Sure",Space,Str "\10004",LineBreak,Str "Nope",Space,Str "\10060"]
-,Para [Str "Nice",Space,Str "\128515"]
-,Para [Str "Capital",Space,Str "d:D"]
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Math"]
-,BulletList
- [[Para [Str "2\8197+\8197\&2\8196=\8196\&4"]]
- ,[Para [Emph [Str "x"],Str "\8196\8712\8196",Emph [Str "y"]]]
- ,[Para [Emph [Str "\945"],Str "\8197\8743\8197",Emph [Str "\969"]]]
- ,[Para [Emph [Str "p"],Str "-Tree"]]
- ,[Para [Str "Here\8217s",Space,Str "one",Space,Str "more:",Space,Emph [Str "\945"],Str "\8197+\8197",Emph [Str "\969"],Str "\8197\215\8197",Emph [Str "x"],Superscript [Str "2"],Str "."]]]
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Special",Space,Str "Characters"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
-,BulletList
- [[Para [Str "I",Space,Str "hat:",Space,Str "\206"]]
- ,[Para [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
- ,[Para [Str "section:",Space,Str "\167"]]
- ,[Para [Str "set",Space,Str "membership:",Space,Str "\8712"]]
- ,[Para [Str "copyright:",Space,Str "\169"]]]
-,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
-,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
-,Para [Str "This",Space,Str "&",Space,Str "that."]
-,Para [Str "4",Space,Str "<",Space,Str "5."]
-,Para [Str "6",Space,Str ">",Space,Str "5."]
-,Para [Str "Backslash:",Space,Str "\\"]
-,Para [Str "Backtick:",Space,Str "`"]
-,Para [Str "Asterisk:",Space,Str "*"]
-,Para [Str "Underscore:",Space,Str "_"]
-,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
-,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
-,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
-,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
-,Para [Str "Left",Space,Str "paren:",Space,Str "("]
-,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
-,Para [Str "Greater-than:",Space,Str ">"]
-,Para [Str "Hash:",Space,Str "#"]
-,Para [Str "Period:",Space,Str "."]
-,Para [Str "Bang:",Space,Str "!"]
-,Para [Str "Plus:",Space,Str "+"]
-,Para [Str "Minus:",Space,Str "-"]
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Links"]
-,Header 2 ("",[],[]) [Str "Explicit"]
-,Para [Str "Just",Space,Str "a",Space,Link ("",[],[]) [Str "URL"] ("https://example.org/url",""),Str "."]
-,Para [Link ("",[],[]) [Str "File",Space,Str "URL"] ("file://some/file/name/",""),Str "."]
-,Para [Link ("",[],[]) [Str "IRC",Space,Str "link"] ("irc://example.org/pandoc",""),Str "."]
-,Para [Link ("",[],[]) [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.invalid","")]
-,Para [Str "[Not",Space,Str "a",Space,Str "link|not",Space,Str "a",Space,Str "URL]."]
-,Header 2 ("",[],[]) [Str "Reference"]
-,Para [Str "With",Space,Link ("",[],[]) [Str "embedded",Space,Str "[brackets]"] ("https://example.net/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "https://pandoc.org"] ("https://pandoc.org",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
-,Header 2 ("",[],[]) [Str "With",Space,Str "ampersands"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Link ("",[],[]) [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link ("",[],[]) [Str "AT&T"] ("http://att.com/",""),Str "."]
-,Header 2 ("",[],[]) [Str "Autolinks"]
-,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link ("",[],[]) [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
-,BulletList
- [[Para [Str "In",Space,Str "a",Space,Str "list?"]]
- ,[Para [Link ("",[],[]) [Str "http://example.com/"] ("http://example.com/","")]]
- ,[Para [Str "It",Space,Str "should."]]]
-,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Link ("",[],[]) [Str "mailto:nobody@nowhere.invalid"] ("mailto:nobody@nowhere.invalid","")]
-,BlockQuote
- [Para [Str "Blockquoted:",Space,Link ("",[],[]) [Str "http://example.com/"] ("http://example.com/","")]]
-,CodeBlock ("",["java"],[]) "Autolink should not occur here: <http://example.com/>\n"
-,HorizontalRule
-,Header 1 ("",[],[]) [Str "Images"]
-,Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
-,Para [Image ("",[],[]) [] ("lalune.jpg","")]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image ("",[],[]) [] ("movie.jpg",""),Space,Str "icon."]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Header
+      1
+      ( "" , [] , [] )
+      [ Span ( "headers" , [] , [] ) [] , Str "Headers" ]
+  , Header
+      2
+      ( "" , [] , [] )
+      [ Span ( "level-2-with-an-embedded-link" , [] , [] ) []
+      , Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "link" ]
+          ( "https://test.example/url" , "" )
+      ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Span ( "level-3-with-emphasis" , [] , [] ) []
+      , Str "Level"
+      , Space
+      , Str "3"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      4 ( "" , [] , [] ) [ Str "Level" , Space , Str "4" ]
+  , Header
+      5 ( "" , [] , [] ) [ Str "Level" , Space , Str "5" ]
+  , Header
+      6 ( "" , [] , [] ) [ Str "Level" , Space , Str "6" ]
+  , Para
+      [ Str "h0."
+      , Space
+      , Str "this"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header."
+      ]
+  , HorizontalRule
+  , Header 1 ( "" , [] , [] ) [ Str "Paragraphs" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "regular"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "one"
+      , Space
+      , Str "with"
+      , Space
+      , Str "a"
+      , Space
+      , Str "bullet."
+      , Space
+      , Str "*"
+      , Space
+      , Str "criminey."
+      ]
+  , Para
+      [ Str "There"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard"
+      , Space
+      , Str "line"
+      , Space
+      , Str "break"
+      , LineBreak
+      , Str "here."
+      ]
+  , HorizontalRule
+  , Header
+      1 ( "" , [] , [] ) [ Str "Block" , Space , Str "Quotes" ]
+  , Para [ Str "E-mail" , Space , Str "style:" ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          , Space
+          , Str "It"
+          , Space
+          , Str "is"
+          , Space
+          , Str "pretty"
+          , Space
+          , Str "short."
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Code"
+          , Space
+          , Str "in"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote:"
+          ]
+      , CodeBlock
+          ( "" , [ "java" ] , [] )
+          "sub status {\n    print \"working\";\n}\n"
+      , Para [ Str "An" , Space , Str "enumeration:" ]
+      , OrderedList
+          ( 1 , DefaultStyle , DefaultDelim )
+          [ [ Para [ Str "item" , Space , Str "one" ] ]
+          , [ Para [ Str "item" , Space , Str "two" ] ]
+          ]
+      ]
+  , Para
+      [ Str "A"
+      , Space
+      , Str "following"
+      , Space
+      , Str "paragraph."
+      ]
+  , HorizontalRule
+  , Header
+      1 ( "" , [] , [] ) [ Str "Code" , Space , Str "Blocks" ]
+  , Para [ Str "Code:" ]
+  , CodeBlock
+      ( "" , [ "java" ] , [] )
+      "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [ "java" ] , [] )
+      "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{\n"
+  , HorizontalRule
+  , Header
+      1
+      ( "" , [] , [] )
+      [ Span ( "lists" , [] , [] ) [] , Str "Lists" ]
+  , Header
+      2
+      ( "" , [] , [] )
+      [ Span ( "unordered" , [] , [] ) [] , Str "Unordered" ]
+  , Para [ Str "Asterisks:" ]
+  , BulletList
+      [ [ Para [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses:" ]
+  , BulletList
+      [ [ Para [ Str "Minus" , Space , Str "1" ] ]
+      , [ Para [ Str "Minus" , Space , Str "2" ] ]
+      , [ Para [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Header 2 ( "" , [] , [] ) [ Str "Ordered" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second" ] ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "Linebreak"
+      , Space
+      , Str "in"
+      , Space
+      , Str "paragraph:"
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para
+            [ Str "Item"
+            , Space
+            , Str "1,"
+            , Space
+            , Str "line"
+            , Space
+            , Str "one."
+            , LineBreak
+            , Str "Item"
+            , Space
+            , Str "1."
+            , Space
+            , Str "line"
+            , Space
+            , Str "two."
+            , Space
+            , Str "The"
+            , Space
+            , Str "quick"
+            , Space
+            , Str "brown"
+            , Space
+            , Str "fox"
+            , Space
+            , Str "jumped"
+            , Space
+            , Str "over"
+            , Space
+            , Str "the"
+            , Space
+            , Str "lazy"
+            , Space
+            , Str "dog\8217s"
+            , Space
+            , Str "back."
+            ]
+        ]
+      , [ Para [ Str "Item" , Space , Str "2." ] ]
+      , [ Para [ Str "Item" , Space , Str "3." ] ]
+      ]
+  , Header 2 ( "" , [] , [] ) [ Str "Nested" ]
+  , BulletList
+      [ [ Para [ Str "Tab" ]
+        , BulletList
+            [ [ Para [ Str "Tab" ]
+              , BulletList [ [ Para [ Str "Tab" ] ] ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Here\8217s" , Space , Str "another:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Para [ Str "Fee" ] ]
+            , [ Para [ Str "Fie" ] ]
+            , [ Para [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para [ Str "Nested" , Space , Str "enumerations:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "Essential" ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Para [ Str "Important" ]
+              , OrderedList
+                  ( 1 , DefaultStyle , DefaultDelim )
+                  [ [ Para [ Str "Relevant" ]
+                    , OrderedList
+                        ( 1 , DefaultStyle , DefaultDelim )
+                        [ [ Para [ Str "Insignificant" ] ] ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "" , [] , [] )
+      [ Str "Linebreaks"
+      , Space
+      , Str "and"
+      , Space
+      , Str "Markup"
+      , Space
+      , Str "in"
+      , Space
+      , Str "Lists"
+      ]
+  , BulletList
+      [ [ Para
+            [ Strong [ Str "apple" ]
+            , LineBreak
+            , Str "red"
+            , Space
+            , Str "fruit"
+            ]
+        ]
+      , [ Para
+            [ Strong [ Str "orange" ]
+            , LineBreak
+            , Str "orange"
+            , Space
+            , Str "fruit"
+            ]
+        ]
+      , [ Para
+            [ Strong [ Str "banana" ]
+            , LineBreak
+            , Str "yellow"
+            , Space
+            , Str "fruit"
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "blocks"
+      , Space
+      , Str "with"
+      , Space
+      , Str "italics:"
+      ]
+  , BulletList
+      [ [ Para
+            [ Strong [ Emph [ Str "apple" ] ]
+            , LineBreak
+            , Str "red"
+            , Space
+            , Str "fruit"
+            , LineBreak
+            , Str "contains"
+            , Space
+            , Str "seeds,"
+            , Space
+            , Str "crisp,"
+            , Space
+            , Str "pleasant"
+            , Space
+            , Str "to"
+            , Space
+            , Str "taste"
+            ]
+        ]
+      , [ Para
+            [ Strong [ Emph [ Str "orange" ] ]
+            , LineBreak
+            , Str "orange"
+            , Space
+            , Str "fruit"
+            ]
+        , CodeBlock
+            ( "" , [ "java" ] , [] ) "{ orange code block }\n"
+        , BlockQuote
+            [ Para
+                [ Str "orange"
+                , Space
+                , Str "block"
+                , Space
+                , Str "quote"
+                ]
+            ]
+        ]
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "" , [] , [] )
+      [ Str "Colored"
+      , Space
+      , Str "Text"
+      , Space
+      , Str "Blocks"
+      ]
+  , Div
+      ( "" , [] , [ ( "color" , "red" ) ] )
+      [ Para
+          [ LineBreak
+          , Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "red."
+          ]
+      ]
+  , Header
+      2 ( "" , [] , [] ) [ Str "Eiffel" , Space , Str "65" ]
+  , Div
+      ( "" , [] , [ ( "color" , "blue" ) ] )
+      [ Para
+          [ LineBreak
+          , Str "da"
+          , Space
+          , Str "ba"
+          , Space
+          , Str "dee"
+          ]
+      ]
+  , HorizontalRule
+  , Header
+      1 ( "" , [] , [] ) [ Str "Inline" , Space , Str "Markup" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Emph [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Strong [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Emph
+          [ Link
+              ( "" , [] , [] )
+              [ Str "emphasized" , Space , Str "link" ]
+              ( "https://my.example/url" , "" )
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "code:"
+      , Space
+      , Code ( "" , [] , [] ) ">"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "<html>"
+      , Str "."
+      ]
+  , Para
+      [ Strikeout
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Emph [ Str "strikeout" ]
+          , Str "."
+          ]
+      ]
+  , Para
+      [ Str "Superscripts:"
+      , Space
+      , Str "a"
+      , Superscript [ Str "bc" ]
+      , Str "d"
+      , Space
+      , Str "a"
+      , Superscript [ Emph [ Str "hello" ] ]
+      , Space
+      , Str "a"
+      , Superscript [ Str "hello\160there" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Subscripts:"
+      , Space
+      , Str "H"
+      , Subscript [ Str "2" ]
+      , Str "O,"
+      , Space
+      , Str "C"
+      , Subscript [ Str "6" ]
+      , Str "H"
+      , Subscript [ Str "12" ]
+      , Str "O"
+      , Subscript [ Str "6" ]
+      , Str ","
+      , Space
+      , Str "C"
+      , Subscript [ Str "\160n\160" ]
+      , Str "H"
+      , Subscript [ Emph [ Str "2n" ] ]
+      , Str "O"
+      , Subscript [ Str "n" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "superscripts"
+      , Space
+      , Str "or"
+      , Space
+      , Str "subscripts,"
+      , Space
+      , Str "because"
+      , Space
+      , Str "of"
+      , Space
+      , Str "markers"
+      , Space
+      , Str "used"
+      , Space
+      , Str "within"
+      , Space
+      , Str "words:"
+      , Space
+      , Str "a^b"
+      , Space
+      , Str "c^d,"
+      , Space
+      , Str "a~b"
+      , Space
+      , Str "c~d."
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "" , [] , [] )
+      [ Str "Dashes,"
+      , Space
+      , Str "and"
+      , Space
+      , Str "emoticons"
+      ]
+  , Para
+      [ Str "Some"
+      , Space
+      , Str "dashes:"
+      , Space
+      , Str "one"
+      , Space
+      , Str "\8211"
+      , Space
+      , Str "two"
+      , Space
+      , Str "\8212"
+      , Space
+      , Str "three."
+      ]
+  , Para
+      [ Str "Sure"
+      , Space
+      , Str "\10004"
+      , LineBreak
+      , Str "Nope"
+      , Space
+      , Str "\10060"
+      ]
+  , Para [ Str "Nice" , Space , Str "\128515" ]
+  , Para [ Str "Capital" , Space , Str "d:D" ]
+  , HorizontalRule
+  , Header 1 ( "" , [] , [] ) [ Str "Math" ]
+  , BulletList
+      [ [ Para [ Str "2\8197+\8197\&2\8196=\8196\&4" ] ]
+      , [ Para
+            [ Emph [ Str "x" ]
+            , Str "\8196\8712\8196"
+            , Emph [ Str "y" ]
+            ]
+        ]
+      , [ Para
+            [ Emph [ Str "\945" ]
+            , Str "\8197\8743\8197"
+            , Emph [ Str "\969" ]
+            ]
+        ]
+      , [ Para [ Emph [ Str "p" ] , Str "-Tree" ] ]
+      , [ Para
+            [ Str "Here\8217s"
+            , Space
+            , Str "one"
+            , Space
+            , Str "more:"
+            , Space
+            , Emph [ Str "\945" ]
+            , Str "\8197+\8197"
+            , Emph [ Str "\969" ]
+            , Str "\8197\215\8197"
+            , Emph [ Str "x" ]
+            , Superscript [ Str "2" ]
+            , Str "."
+            ]
+        ]
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "" , [] , [] )
+      [ Str "Special" , Space , Str "Characters" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "unicode:"
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "I" , Space , Str "hat:" , Space , Str "\206" ]
+        ]
+      , [ Para
+            [ Str "o" , Space , Str "umlaut:" , Space , Str "\246" ]
+        ]
+      , [ Para [ Str "section:" , Space , Str "\167" ] ]
+      , [ Para
+            [ Str "set"
+            , Space
+            , Str "membership:"
+            , Space
+            , Str "\8712"
+            ]
+        ]
+      , [ Para [ Str "copyright:" , Space , Str "\169" ] ]
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "has"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "their"
+      , Space
+      , Str "name."
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "is"
+      , Space
+      , Str "another"
+      , Space
+      , Str "way"
+      , Space
+      , Str "to"
+      , Space
+      , Str "write"
+      , Space
+      , Str "it."
+      ]
+  , Para
+      [ Str "This" , Space , Str "&" , Space , Str "that." ]
+  , Para [ Str "4" , Space , Str "<" , Space , Str "5." ]
+  , Para [ Str "6" , Space , Str ">" , Space , Str "5." ]
+  , Para [ Str "Backslash:" , Space , Str "\\" ]
+  , Para [ Str "Backtick:" , Space , Str "`" ]
+  , Para [ Str "Asterisk:" , Space , Str "*" ]
+  , Para [ Str "Underscore:" , Space , Str "_" ]
+  , Para
+      [ Str "Left" , Space , Str "brace:" , Space , Str "{" ]
+  , Para
+      [ Str "Right" , Space , Str "brace:" , Space , Str "}" ]
+  , Para
+      [ Str "Left" , Space , Str "bracket:" , Space , Str "[" ]
+  , Para
+      [ Str "Right" , Space , Str "bracket:" , Space , Str "]" ]
+  , Para
+      [ Str "Left" , Space , Str "paren:" , Space , Str "(" ]
+  , Para
+      [ Str "Right" , Space , Str "paren:" , Space , Str ")" ]
+  , Para [ Str "Greater-than:" , Space , Str ">" ]
+  , Para [ Str "Hash:" , Space , Str "#" ]
+  , Para [ Str "Period:" , Space , Str "." ]
+  , Para [ Str "Bang:" , Space , Str "!" ]
+  , Para [ Str "Plus:" , Space , Str "+" ]
+  , Para [ Str "Minus:" , Space , Str "-" ]
+  , HorizontalRule
+  , Header 1 ( "" , [] , [] ) [ Str "Links" ]
+  , Header 2 ( "" , [] , [] ) [ Str "Explicit" ]
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "a"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "URL" ]
+          ( "https://example.org/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "File" , Space , Str "URL" ]
+          ( "file://some/file/name/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "IRC" , Space , Str "link" ]
+          ( "irc://example.org/pandoc" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Email" , Space , Str "link" ]
+          ( "mailto:nobody@nowhere.invalid" , "" )
+      ]
+  , Para
+      [ Str "[Not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link|not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "URL]."
+      ]
+  , Header 2 ( "" , [] , [] ) [ Str "Reference" ]
+  , Para
+      [ Str "With"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "[brackets]" ]
+          ( "https://example.net/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "https://pandoc.org" ]
+          ( "https://pandoc.org" , "" )
+      , Space
+      , Str "by"
+      , Space
+      , Str "itself"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , Header
+      2 ( "" , [] , [] ) [ Str "With" , Space , Str "ampersands" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "link"
+          , Space
+          , Str "with"
+          , Space
+          , Str "an"
+          , Space
+          , Str "ampersand"
+          , Space
+          , Str "in"
+          , Space
+          , Str "the"
+          , Space
+          , Str "URL"
+          ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "link"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] ) [ Str "AT&T" ] ( "http://att.com/" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "" , [] , [] ) [ Str "Autolinks" ]
+  , Para
+      [ Str "With"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://example.com/?foo=1&bar=2" ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "In" , Space , Str "a" , Space , Str "list?" ]
+        ]
+      , [ Para
+            [ Link
+                ( "" , [] , [] )
+                [ Str "http://example.com/" ]
+                ( "http://example.com/" , "" )
+            ]
+        ]
+      , [ Para [ Str "It" , Space , Str "should." ] ]
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Str "e-mail"
+      , Space
+      , Str "address:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "mailto:nobody@nowhere.invalid" ]
+          ( "mailto:nobody@nowhere.invalid" , "" )
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Blockquoted:"
+          , Space
+          , Link
+              ( "" , [] , [] )
+              [ Str "http://example.com/" ]
+              ( "http://example.com/" , "" )
+          ]
+      ]
+  , CodeBlock
+      ( "" , [ "java" ] , [] )
+      "Autolink should not occur here: <http://example.com/>\n"
+  , HorizontalRule
+  , Header 1 ( "" , [] , [] ) [ Str "Images" ]
+  , Para
+      [ Str "From"
+      , Space
+      , Str "\"Voyage"
+      , Space
+      , Str "dans"
+      , Space
+      , Str "la"
+      , Space
+      , Str "Lune\""
+      , Space
+      , Str "by"
+      , Space
+      , Str "Georges"
+      , Space
+      , Str "Melies"
+      , Space
+      , Str "(1902):"
+      ]
+  , Para [ Image ( "" , [] , [] ) [] ( "lalune.jpg" , "" ) ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "movie"
+      , Space
+      , Image ( "" , [] , [] ) [] ( "movie.jpg" , "" )
+      , Space
+      , Str "icon."
+      ]
+  ]
diff --git a/test/latex-reader.native b/test/latex-reader.native
--- a/test/latex-reader.native
+++ b/test/latex-reader.native
@@ -1,416 +1,2291 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Space,Str "MacFarlane"],MetaInlines [Str "Anonymous"]]),("date",MetaInlines [Str "July",Space,Str "17,",Space,Str "2006"]),("title",MetaInlines [Str "Pandoc",Space,Str "Test",Space,Str "Suite"])]})
-[RawBlock (Format "latex") "\\maketitle"
-,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",SoftBreak,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("headers",[],[]) [Str "Headers"]
-,Header 2 ("level-2-with-an-embedded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link ("",[],[]) [Str "embedded",Space,Str "link"] ("/url","")]
-,Header 3 ("level-3-with-emphasis",[],[]) [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Para [Str "Level",Space,Str "4"]
-,Para [Str "Level",Space,Str "5"]
-,Header 1 ("level-1",[],[]) [Str "Level",Space,Str "1"]
-,Header 2 ("level-2-with-emphasis",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 3 ("level-3",[],[]) [Str "Level",Space,Str "3"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,Header 2 ("level-2",[],[]) [Str "Level",Space,Str "2"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
-,Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",SoftBreak,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",SoftBreak,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."]
-,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
-,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
-,Para [Str "E-mail",Space,Str "style:"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
-,BlockQuote
- [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- ,CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"
- ,Para [Str "A",Space,Str "list:"]
- ,OrderedList (1,Decimal,Period)
-  [[Para [Str "item",Space,Str "one"]]
-  ,[Para [Str "item",Space,Str "two"]]]
- ,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
- ,BlockQuote
-  [Para [Str "nested"]]
- ,BlockQuote
-  [Para [Str "nested"]]]
-,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",Space,Str ">",Space,Str "1."]
-,Para [Str "Box-style:"]
-,BlockQuote
- [Para [Str "Example:"]
- ,CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"]
-,BlockQuote
- [OrderedList (1,Decimal,Period)
-  [[Para [Str "do",Space,Str "laundry"]]
-  ,[Para [Str "take",Space,Str "out",Space,Str "the",Space,Str "trash"]]]]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "nested",Space,Str "one:"]
-,BlockQuote
- [Para [Str "Joe",Space,Str "said:"]
- ,BlockQuote
-  [Para [Str "Don\8217t",Space,Str "quote",Space,Str "me."]]]
-,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
-,Para [Str "And:"]
-,CodeBlock ("",[],[]) "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
-,Para [Str "this",Space,Str "has",Space,Emph [Str "two",LineBreak,Str "lines"]]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("lists",[],[]) [Str "Lists"]
-,Header 2 ("unordered",[],[]) [Str "Unordered"]
-,Para [Str "Asterisks",Space,Str "tight:"]
-,BulletList
- [[Para [Str "asterisk",Space,Str "1"]]
- ,[Para [Str "asterisk",Space,Str "2"]]
- ,[Para [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Asterisks",Space,Str "loose:"]
-,BulletList
- [[Para [Str "asterisk",Space,Str "1"]]
- ,[Para [Str "asterisk",Space,Str "2"]]
- ,[Para [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "tight:"]
-,BulletList
- [[Para [Str "Plus",Space,Str "1"]]
- ,[Para [Str "Plus",Space,Str "2"]]
- ,[Para [Str "Plus",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Plus",Space,Str "1"]]
- ,[Para [Str "Plus",Space,Str "2"]]
- ,[Para [Str "Plus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "tight:"]
-,BulletList
- [[Para [Str "Minus",Space,Str "1"]]
- ,[Para [Str "Minus",Space,Str "2"]]
- ,[Para [Str "Minus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Minus",Space,Str "1"]]
- ,[Para [Str "Minus",Space,Str "2"]]
- ,[Para [Str "Minus",Space,Str "3"]]]
-,Header 2 ("ordered",[],[]) [Str "Ordered"]
-,Para [Str "Tight:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second"]]
- ,[Para [Str "Third"]]]
-,Para [Str "and:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "One"]]
- ,[Para [Str "Two"]]
- ,[Para [Str "Three"]]]
-,Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second"]]
- ,[Para [Str "Third"]]]
-,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "One"]]
- ,[Para [Str "Two"]]
- ,[Para [Str "Three"]]]
-,Para [Str "Multiple",Space,Str "paragraphs:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
-  ,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",SoftBreak,Str "back."]]
- ,[Para [Str "Item",Space,Str "2."]]
- ,[Para [Str "Item",Space,Str "3."]]]
-,Header 2 ("nested",[],[]) [Str "Nested"]
-,BulletList
- [[Para [Str "Tab"]
-  ,BulletList
-   [[Para [Str "Tab"]
-    ,BulletList
-     [[Para [Str "Tab"]]]]]]]
-,Para [Str "Here\8217s",Space,Str "another:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Para [Str "Fee"]]
-   ,[Para [Str "Fie"]]
-   ,[Para [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Para [Str "Fee"]]
-   ,[Para [Str "Fie"]]
-   ,[Para [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Header 2 ("tabs-and-spaces",[],[]) [Str "Tabs",Space,Str "and",Space,Str "spaces"]
-,BulletList
- [[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"]]
- ,[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]
-  ,BulletList
-   [[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"]]
-   ,[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]]]]]
-,Header 2 ("fancy-list-markers",[],[]) [Str "Fancy",Space,Str "list",Space,Str "markers"]
-,OrderedList (2,Decimal,TwoParens)
- [[Para [Str "begins",Space,Str "with",Space,Str "2"]]
- ,[Para [Str "and",Space,Str "now",Space,Str "3"]
-  ,Para [Str "with",Space,Str "a",Space,Str "continuation"]
-  ,OrderedList (4,LowerRoman,Period)
-   [[Para [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",Space,Str "starting",Space,Str "with",Space,Str "4"]]
-   ,[Para [Str "more",Space,Str "items"]
-    ,OrderedList (1,UpperAlpha,TwoParens)
-     [[Para [Str "a",Space,Str "subsublist"]]
-     ,[Para [Str "a",Space,Str "subsublist"]]]]]]]
-,Para [Str "Nesting:"]
-,OrderedList (1,UpperAlpha,Period)
- [[Para [Str "Upper",Space,Str "Alpha"]
-  ,OrderedList (1,UpperRoman,Period)
-   [[Para [Str "Upper",Space,Str "Roman."]
-    ,OrderedList (6,Decimal,TwoParens)
-     [[Para [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
-      ,OrderedList (3,LowerAlpha,OneParen)
-       [[Para [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
-,Para [Str "Autonumbering:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "Autonumber."]]
- ,[Para [Str "More."]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Para [Str "Nested."]]]]]
-,Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item:"]
-,Para [Str "M.A.",Space,Str "2007"]
-,Para [Str "B.",Space,Str "Williams"]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("definition-lists",[],[]) [Str "Definition",Space,Str "Lists"]
-,Para [Str "Tight",Space,Str "using",Space,Str "spaces:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]]])
- ,([Str "banana"],
-   [[Para [Str "yellow",Space,Str "fruit"]]])]
-,Para [Str "Tight",Space,Str "using",Space,Str "tabs:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]]])
- ,([Str "banana"],
-   [[Para [Str "yellow",Space,Str "fruit"]]])]
-,Para [Str "Loose:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]]])
- ,([Str "banana"],
-   [[Para [Str "yellow",Space,Str "fruit"]]])]
-,Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics:"]
-,DefinitionList
- [([Emph [Str "apple"]],
-   [[Para [Str "red",Space,Str "fruit"]
-    ,Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"]]])
- ,([Emph [Str "orange"]],
-   [[Para [Str "orange",Space,Str "fruit"]
-    ,CodeBlock ("",[],[]) "{ orange code block }"
-    ,BlockQuote
-     [Para [Str "orange",Space,Str "block",Space,Str "quote"]]]])]
-,Header 1 ("html-blocks",[],[]) [Str "HTML",Space,Str "Blocks"]
-,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
-,Para [Str "foo",SoftBreak,Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"]
-,Para [Str "foo",SoftBreak,Str "bar",SoftBreak,Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],SoftBreak,Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"],SoftBreak,Str "Here\8217s",Space,Str "a",Space,Str "simple",Space,Str "block:"]
-,Para [Str "foo",SoftBreak,Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
-,CodeBlock ("",[],[]) "<div>\n    foo\n</div>"
-,Para [Str "As",Space,Str "should",Space,Str "this:"]
-,CodeBlock ("",[],[]) "<div>foo</div>"
-,Para [Str "Now,",Space,Str "nested:"]
-,Para [Str "foo",SoftBreak,Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"]
-,Para [Str "Multiline:"]
-,Para [Str "Code",Space,Str "block:"]
-,CodeBlock ("",[],[]) "<!-- Comment -->"
-,Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"]
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "<hr />"
-,Para [Str "Hr\8217s:"]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
-,Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
-,Para [Str "An",Space,Emph [Link ("",[],[]) [Str "emphasized",Space,Str "link"] ("/url","")],Str "."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",Space,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",SoftBreak,Code ("",[],[]) "<html>",Str "."]
-,Para [Strikeout [Str "This",Space,Str "is",Space,Emph [Str "strikeout"],Str "."]]
-,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",SoftBreak,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello",Space,Str "there"],Str "."]
-,Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",SoftBreak,Str "H",Subscript [Str "many",Space,Str "of",Space,Str "them"],Str "O."]
-,Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts,",Space,Str "because",Space,Str "of",Space,Str "the",SoftBreak,Str "unescaped",Space,Str "spaces:",Space,Str "a^b",Space,Str "c^d,",Space,Str "a",Math InlineMath "\\sim",Str "b",SoftBreak,Str "c",Math InlineMath "\\sim",Str "d."]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("smart-quotes-ellipses-dashes",[],[]) [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
-,Para [Quoted DoubleQuote [Str "Hello,"],Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Quoted DoubleQuote [Str "\8198",Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",Space,Str "name."]]
-,Para [Quoted SingleQuote [Str "A"],Str ",",Space,Quoted SingleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted SingleQuote [Str "C"],Space,Str "are",Space,Str "letters."]
-,Para [Quoted SingleQuote [Str "Oak,"],Space,Quoted SingleQuote [Str "elm,"],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine."]]
-,Para [Quoted SingleQuote [Str "He",Space,Str "said,",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go."],Str "\8198"],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70\8217s?"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Quoted SingleQuote [Code ("",[],[]) "code"],Space,Str "and",Space,Str "a",SoftBreak,Quoted DoubleQuote [Link ("",[],[]) [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."]
-,Para [Str "Some",Space,Str "dashes:",Space,Str "one\8212two\8212three\8212four\8212five."]
-,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5\8211\&7,",Space,Str "255\8211\&66,",Space,Str "1987\8211\&1999."]
-,Para [Str "Ellipses\8230and\8230and\8230."]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("latex",[],[]) [Str "LaTeX"]
-,BulletList
- [[Para [Cite [Citation {citationId = "smith.1899", citationPrefix = [], citationSuffix = [Str "22-23"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cite[22-23]{smith.1899}"]]]
- ,[RawBlock (Format "latex") "\\doublespacing"]
- ,[Para [Math InlineMath "2+2=4"]]
- ,[Para [Math InlineMath "x \\in y"]]
- ,[Para [Math InlineMath "\\alpha \\wedge \\omega"]]
- ,[Para [Math InlineMath "223"]]
- ,[Para [Math InlineMath "p",Str "-Tree"]]
- ,[Para [Math InlineMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]]
- ,[Para [Str "Here\8217s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",SoftBreak,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]]
-,Para [Str "These",Space,Str "shouldn\8217t",Space,Str "be",Space,Str "math:"]
-,BulletList
- [[Para [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
- ,[Para [Str "$22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$34,000.",Space,Str "(It",Space,Str "worked",Space,Str "if",SoftBreak,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized.)"]]
- ,[Para [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23$."]]]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Animal"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Number"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Dog"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cat"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "A",Space,Str "table",Space,Str "with",Space,Str "one",Space,Str "column:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Animal"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Vegetable"]]]])]
- (TableFoot ("",[],[])
- [])
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("special-characters",[],[]) [Str "Special",Space,Str "Characters"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
-,BulletList
- [[Para [Str "I",Space,Str "hat:",Space,Str "\206"]]
- ,[Para [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
- ,[Para [Str "section:",Space,Str "\167"]]
- ,[Para [Str "set",Space,Str "membership:",Space,Str "\8712"]]
- ,[Para [Str "copyright:",Space,Str "\169"]]]
-,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
-,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
-,Para [Str "This",Space,Str "&",Space,Str "that."]
-,Para [Str "4",Space,Str "<",Space,Str "5."]
-,Para [Str "6",Space,Str ">",Space,Str "5."]
-,Para [Str "Backslash:",Space,Str "\\"]
-,Para [Str "Backtick:",Space,Str "\8216"]
-,Para [Str "Asterisk:",Space,Str "*"]
-,Para [Str "Underscore:",Space,Str "_"]
-,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
-,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
-,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
-,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
-,Para [Str "Left",Space,Str "paren:",Space,Str "("]
-,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
-,Para [Str "Greater-than:",Space,Str ">"]
-,Para [Str "Hash:",Space,Str "#"]
-,Para [Str "Period:",Space,Str "."]
-,Para [Str "Bang:",Space,Str "!"]
-,Para [Str "Plus:",Space,Str "+"]
-,Para [Str "Minus:",Space,Str "-"]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("links",[],[]) [Str "Links"]
-,Header 2 ("explicit",[],[]) [Str "Explicit"]
-,Para [Str "Just",Space,Str "a",Space,Link ("",[],[]) [Str "URL"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","")]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","")]
-,Para [Link ("",[],[]) [Str "with_underscore"] ("/url/with_underscore","")]
-,Para [Link ("",[],[]) [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
-,Para [Link ("",[],[]) [Str "Empty"] ("",""),Str "."]
-,Header 2 ("reference",[],[]) [Str "Reference"]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "With",Space,Link ("",[],[]) [Str "embedded",Space,Str "[brackets]"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "once"] ("/url",""),Str "."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "twice"] ("/url",""),Str "."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "thrice"] ("/url",""),Str "."]
-,Para [Str "This",Space,Str "should",Space,Str "[not][]",Space,Str "be",Space,Str "a",Space,Str "link."]
-,CodeBlock ("",[],[]) "[not]: /url"
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "biz"] ("/url/",""),Str "."]
-,Header 2 ("with-ampersands",[],[]) [Str "With",Space,Str "ampersands"]
-,Para [Str "Here\8217s",Space,Str "a",SoftBreak,Link ("",[],[]) [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",SoftBreak,Link ("",[],[]) [Str "AT&T"] ("http://att.com/",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "an",Space,Link ("",[],[]) [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "an",SoftBreak,Link ("",[],[]) [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."]
-,Header 2 ("autolinks",[],[]) [Str "Autolinks"]
-,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link ("",[],[]) [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
-,BulletList
- [[Para [Str "In",Space,Str "a",Space,Str "list?"]]
- ,[Para [Link ("",[],[]) [Str "http://example.com/"] ("http://example.com/","")]]
- ,[Para [Str "It",Space,Str "should."]]]
-,Para [Str "An",Space,Str "e-mail",Space,Str "address:",SoftBreak,Link ("",[],[]) [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
-,BlockQuote
- [Para [Str "Blockquoted:",Space,Link ("",[],[]) [Str "http://example.com/"] ("http://example.com/","")]]
-,Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code ("",[],[]) "<http://example.com/>"]
-,CodeBlock ("",[],[]) "or here: <http://example.com/>"
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("images",[],[]) [Str "Images"]
-,Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
-,Para [Image ("",[],[]) [Str "image"] ("lalune.jpg","")]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image ("",[],[]) [Str "image"] ("movie.jpg",""),Space,Str "icon."]
-,Div ("",["center"],[])
- [HorizontalRule]
-,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",SoftBreak,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",SoftBreak,Str "reference.",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],SoftBreak,Str "and",SoftBreak,Str "another.",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",SoftBreak,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock ("",[],[]) "  { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",SoftBreak,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],SoftBreak,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",SoftBreak,Str "a",Space,Str "space.[^my",Space,Str "note]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",SoftBreak,Str "note.",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",SoftBreak,Link ("",[],[]) [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",SoftBreak,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
-,BlockQuote
- [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]]]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "And",Space,Str "in",Space,Str "list",Space,Str "items.",Note [Para [Str "In",Space,Str "list."]]]]]
-,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",SoftBreak,Str "indented."]
-,Header 1 ("escaped-characters",[],[]) [Str "Escaped",Space,Str "characters"]
-,Para [Str "$",Space,Str "%",Space,Str "&",Space,Str "#",Space,Str "_",Space,Str "{",Space,Str "}"]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author"
+            , MetaList
+                [ MetaInlines [ Str "John" , Space , Str "MacFarlane" ]
+                , MetaInlines [ Str "Anonymous" ]
+                ]
+            )
+          , ( "date"
+            , MetaInlines
+                [ Str "July" , Space , Str "17," , Space , Str "2006" ]
+            )
+          , ( "title"
+            , MetaInlines
+                [ Str "Pandoc"
+                , Space
+                , Str "Test"
+                , Space
+                , Str "Suite"
+                ]
+            )
+          ]
+    }
+  [ RawBlock (Format "latex") "\\maketitle"
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "set"
+      , Space
+      , Str "of"
+      , Space
+      , Str "tests"
+      , Space
+      , Str "for"
+      , Space
+      , Str "pandoc."
+      , Space
+      , Str "Most"
+      , Space
+      , Str "of"
+      , Space
+      , Str "them"
+      , Space
+      , Str "are"
+      , Space
+      , Str "adapted"
+      , Space
+      , Str "from"
+      , SoftBreak
+      , Str "John"
+      , Space
+      , Str "Gruber\8217s"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "test"
+      , Space
+      , Str "suite."
+      ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header 1 ( "headers" , [] , [] ) [ Str "Headers" ]
+  , Header
+      2
+      ( "level-2-with-an-embedded-link" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "link" ]
+          ( "/url" , "" )
+      ]
+  , Header
+      3
+      ( "level-3-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "3"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Para [ Str "Level" , Space , Str "4" ]
+  , Para [ Str "Level" , Space , Str "5" ]
+  , Header
+      1 ( "level-1" , [] , [] ) [ Str "Level" , Space , Str "1" ]
+  , Header
+      2
+      ( "level-2-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      3 ( "level-3" , [] , [] ) [ Str "Level" , Space , Str "3" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , Header
+      2 ( "level-2" , [] , [] ) [ Str "Level" , Space , Str "2" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header 1 ( "paragraphs" , [] , [] ) [ Str "Paragraphs" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "regular"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "In"
+      , Space
+      , Str "Markdown"
+      , Space
+      , Str "1.0.0"
+      , Space
+      , Str "and"
+      , Space
+      , Str "earlier."
+      , Space
+      , Str "Version"
+      , Space
+      , Str "8."
+      , Space
+      , Str "This"
+      , Space
+      , Str "line"
+      , Space
+      , Str "turns"
+      , Space
+      , Str "into"
+      , Space
+      , Str "a"
+      , SoftBreak
+      , Str "list"
+      , Space
+      , Str "item."
+      , Space
+      , Str "Because"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard-wrapped"
+      , Space
+      , Str "line"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "middle"
+      , Space
+      , Str "of"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph"
+      , SoftBreak
+      , Str "looked"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "one"
+      , Space
+      , Str "with"
+      , Space
+      , Str "a"
+      , Space
+      , Str "bullet."
+      , Space
+      , Str "*"
+      , Space
+      , Str "criminey."
+      ]
+  , Para
+      [ Str "There"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard"
+      , Space
+      , Str "line"
+      , Space
+      , Str "break"
+      , LineBreak
+      , Str "here."
+      ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header
+      1
+      ( "block-quotes" , [] , [] )
+      [ Str "Block" , Space , Str "Quotes" ]
+  , Para [ Str "E-mail" , Space , Str "style:" ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          , Space
+          , Str "It"
+          , Space
+          , Str "is"
+          , Space
+          , Str "pretty"
+          , Space
+          , Str "short."
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Code"
+          , Space
+          , Str "in"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote:"
+          ]
+      , CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      , Para [ Str "A" , Space , Str "list:" ]
+      , OrderedList
+          ( 1 , Decimal , Period )
+          [ [ Para [ Str "item" , Space , Str "one" ] ]
+          , [ Para [ Str "item" , Space , Str "two" ] ]
+          ]
+      , Para
+          [ Str "Nested"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quotes:"
+          ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "block"
+      , Space
+      , Str "quote:"
+      , Space
+      , Str "2"
+      , Space
+      , Str ">"
+      , Space
+      , Str "1."
+      ]
+  , Para [ Str "Box-style:" ]
+  , BlockQuote
+      [ Para [ Str "Example:" ]
+      , CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      ]
+  , BlockQuote
+      [ OrderedList
+          ( 1 , Decimal , Period )
+          [ [ Para [ Str "do" , Space , Str "laundry" ] ]
+          , [ Para
+                [ Str "take"
+                , Space
+                , Str "out"
+                , Space
+                , Str "the"
+                , Space
+                , Str "trash"
+                ]
+            ]
+          ]
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "nested"
+      , Space
+      , Str "one:"
+      ]
+  , BlockQuote
+      [ Para [ Str "Joe" , Space , Str "said:" ]
+      , BlockQuote
+          [ Para
+              [ Str "Don\8217t"
+              , Space
+              , Str "quote"
+              , Space
+              , Str "me."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "a"
+      , Space
+      , Str "following"
+      , Space
+      , Str "paragraph."
+      ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header
+      1
+      ( "code-blocks" , [] , [] )
+      [ Str "Code" , Space , Str "Blocks" ]
+  , Para [ Str "Code:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
+  , Para
+      [ Str "this"
+      , Space
+      , Str "has"
+      , Space
+      , Emph [ Str "two" , LineBreak , Str "lines" ]
+      ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header 1 ( "lists" , [] , [] ) [ Str "Lists" ]
+  , Header 2 ( "unordered" , [] , [] ) [ Str "Unordered" ]
+  , Para [ Str "Asterisks" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Para [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Asterisks" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Para [ Str "Plus" , Space , Str "1" ] ]
+      , [ Para [ Str "Plus" , Space , Str "2" ] ]
+      , [ Para [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Plus" , Space , Str "1" ] ]
+      , [ Para [ Str "Plus" , Space , Str "2" ] ]
+      , [ Para [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Para [ Str "Minus" , Space , Str "1" ] ]
+      , [ Para [ Str "Minus" , Space , Str "2" ] ]
+      , [ Para [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Minus" , Space , Str "1" ] ]
+      , [ Para [ Str "Minus" , Space , Str "2" ] ]
+      , [ Para [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Header 2 ( "ordered" , [] , [] ) [ Str "Ordered" ]
+  , Para [ Str "Tight:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second" ] ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para [ Str "and:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "One" ] ]
+      , [ Para [ Str "Two" ] ]
+      , [ Para [ Str "Three" ] ]
+      ]
+  , Para
+      [ Str "Loose" , Space , Str "using" , Space , Str "tabs:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second" ] ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "and" , Space , Str "using" , Space , Str "spaces:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "One" ] ]
+      , [ Para [ Str "Two" ] ]
+      , [ Para [ Str "Three" ] ]
+      ]
+  , Para [ Str "Multiple" , Space , Str "paragraphs:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para
+            [ Str "Item"
+            , Space
+            , Str "1,"
+            , Space
+            , Str "graf"
+            , Space
+            , Str "one."
+            ]
+        , Para
+            [ Str "Item"
+            , Space
+            , Str "1."
+            , Space
+            , Str "graf"
+            , Space
+            , Str "two."
+            , Space
+            , Str "The"
+            , Space
+            , Str "quick"
+            , Space
+            , Str "brown"
+            , Space
+            , Str "fox"
+            , Space
+            , Str "jumped"
+            , Space
+            , Str "over"
+            , Space
+            , Str "the"
+            , Space
+            , Str "lazy"
+            , Space
+            , Str "dog\8217s"
+            , SoftBreak
+            , Str "back."
+            ]
+        ]
+      , [ Para [ Str "Item" , Space , Str "2." ] ]
+      , [ Para [ Str "Item" , Space , Str "3." ] ]
+      ]
+  , Header 2 ( "nested" , [] , [] ) [ Str "Nested" ]
+  , BulletList
+      [ [ Para [ Str "Tab" ]
+        , BulletList
+            [ [ Para [ Str "Tab" ]
+              , BulletList [ [ Para [ Str "Tab" ] ] ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Here\8217s" , Space , Str "another:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Para [ Str "Fee" ] ]
+            , [ Para [ Str "Fie" ] ]
+            , [ Para [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "Same"
+      , Space
+      , Str "thing"
+      , Space
+      , Str "but"
+      , Space
+      , Str "with"
+      , Space
+      , Str "paragraphs:"
+      ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Para [ Str "Fee" ] ]
+            , [ Para [ Str "Fie" ] ]
+            , [ Para [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Header
+      2
+      ( "tabs-and-spaces" , [] , [] )
+      [ Str "Tabs" , Space , Str "and" , Space , Str "spaces" ]
+  , BulletList
+      [ [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "tabs"
+            ]
+        ]
+      , [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "spaces"
+            ]
+        , BulletList
+            [ [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "tabs"
+                  ]
+              ]
+            , [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "spaces"
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "fancy-list-markers" , [] , [] )
+      [ Str "Fancy" , Space , Str "list" , Space , Str "markers" ]
+  , OrderedList
+      ( 2 , Decimal , TwoParens )
+      [ [ Para
+            [ Str "begins" , Space , Str "with" , Space , Str "2" ]
+        ]
+      , [ Para [ Str "and" , Space , Str "now" , Space , Str "3" ]
+        , Para
+            [ Str "with"
+            , Space
+            , Str "a"
+            , Space
+            , Str "continuation"
+            ]
+        , OrderedList
+            ( 4 , LowerRoman , Period )
+            [ [ Para
+                  [ Str "sublist"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "roman"
+                  , Space
+                  , Str "numerals,"
+                  , Space
+                  , Str "starting"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "4"
+                  ]
+              ]
+            , [ Para [ Str "more" , Space , Str "items" ]
+              , OrderedList
+                  ( 1 , UpperAlpha , TwoParens )
+                  [ [ Para [ Str "a" , Space , Str "subsublist" ] ]
+                  , [ Para [ Str "a" , Space , Str "subsublist" ] ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Nesting:" ]
+  , OrderedList
+      ( 1 , UpperAlpha , Period )
+      [ [ Para [ Str "Upper" , Space , Str "Alpha" ]
+        , OrderedList
+            ( 1 , UpperRoman , Period )
+            [ [ Para [ Str "Upper" , Space , Str "Roman." ]
+              , OrderedList
+                  ( 6 , Decimal , TwoParens )
+                  [ [ Para
+                        [ Str "Decimal"
+                        , Space
+                        , Str "start"
+                        , Space
+                        , Str "with"
+                        , Space
+                        , Str "6"
+                        ]
+                    , OrderedList
+                        ( 3 , LowerAlpha , OneParen )
+                        [ [ Para
+                              [ Str "Lower"
+                              , Space
+                              , Str "alpha"
+                              , Space
+                              , Str "with"
+                              , Space
+                              , Str "paren"
+                              ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Autonumbering:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "Autonumber." ] ]
+      , [ Para [ Str "More." ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Para [ Str "Nested." ] ] ]
+        ]
+      ]
+  , Para
+      [ Str "Should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item:"
+      ]
+  , Para [ Str "M.A." , Space , Str "2007" ]
+  , Para [ Str "B." , Space , Str "Williams" ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header
+      1
+      ( "definition-lists" , [] , [] )
+      [ Str "Definition" , Space , Str "Lists" ]
+  , Para
+      [ Str "Tight"
+      , Space
+      , Str "using"
+      , Space
+      , Str "spaces:"
+      ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "banana" ]
+        , [ [ Para [ Str "yellow" , Space , Str "fruit" ] ] ]
+        )
+      ]
+  , Para
+      [ Str "Tight" , Space , Str "using" , Space , Str "tabs:" ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "banana" ]
+        , [ [ Para [ Str "yellow" , Space , Str "fruit" ] ] ]
+        )
+      ]
+  , Para [ Str "Loose:" ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "banana" ]
+        , [ [ Para [ Str "yellow" , Space , Str "fruit" ] ] ]
+        )
+      ]
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "blocks"
+      , Space
+      , Str "with"
+      , Space
+      , Str "italics:"
+      ]
+  , DefinitionList
+      [ ( [ Emph [ Str "apple" ] ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ]
+            , Para
+                [ Str "contains"
+                , Space
+                , Str "seeds,"
+                , Space
+                , Str "crisp,"
+                , Space
+                , Str "pleasant"
+                , Space
+                , Str "to"
+                , Space
+                , Str "taste"
+                ]
+            ]
+          ]
+        )
+      , ( [ Emph [ Str "orange" ] ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ]
+            , CodeBlock ( "" , [] , [] ) "{ orange code block }"
+            , BlockQuote
+                [ Para
+                    [ Str "orange"
+                    , Space
+                    , Str "block"
+                    , Space
+                    , Str "quote"
+                    ]
+                ]
+            ]
+          ]
+        )
+      ]
+  , Header
+      1
+      ( "html-blocks" , [] , [] )
+      [ Str "HTML" , Space , Str "Blocks" ]
+  , Para
+      [ Str "Simple"
+      , Space
+      , Str "block"
+      , Space
+      , Str "on"
+      , Space
+      , Str "one"
+      , Space
+      , Str "line:"
+      ]
+  , Para
+      [ Str "foo"
+      , SoftBreak
+      , Str "And"
+      , Space
+      , Str "nested"
+      , Space
+      , Str "without"
+      , Space
+      , Str "indentation:"
+      ]
+  , Para
+      [ Str "foo"
+      , SoftBreak
+      , Str "bar"
+      , SoftBreak
+      , Str "Interpreted"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "in"
+      , Space
+      , Str "a"
+      , Space
+      , Str "table:"
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      , SoftBreak
+      , Str "And"
+      , Space
+      , Str "this"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      , SoftBreak
+      , Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "simple"
+      , Space
+      , Str "block:"
+      ]
+  , Para
+      [ Str "foo"
+      , SoftBreak
+      , Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "code"
+      , Space
+      , Str "block,"
+      , Space
+      , Str "though:"
+      ]
+  , CodeBlock ( "" , [] , [] ) "<div>\n    foo\n</div>"
+  , Para
+      [ Str "As" , Space , Str "should" , Space , Str "this:" ]
+  , CodeBlock ( "" , [] , [] ) "<div>foo</div>"
+  , Para [ Str "Now," , Space , Str "nested:" ]
+  , Para
+      [ Str "foo"
+      , SoftBreak
+      , Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "just"
+      , Space
+      , Str "be"
+      , Space
+      , Str "an"
+      , Space
+      , Str "HTML"
+      , Space
+      , Str "comment:"
+      ]
+  , Para [ Str "Multiline:" ]
+  , Para [ Str "Code" , Space , Str "block:" ]
+  , CodeBlock ( "" , [] , [] ) "<!-- Comment -->"
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "plain"
+      , Space
+      , Str "comment,"
+      , Space
+      , Str "with"
+      , Space
+      , Str "trailing"
+      , Space
+      , Str "spaces"
+      , Space
+      , Str "on"
+      , Space
+      , Str "the"
+      , Space
+      , Str "line:"
+      ]
+  , Para [ Str "Code:" ]
+  , CodeBlock ( "" , [] , [] ) "<hr />"
+  , Para [ Str "Hr\8217s:" ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header
+      1
+      ( "inline-markup" , [] , [] )
+      [ Str "Inline" , Space , Str "Markup" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Emph [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Strong [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Emph
+          [ Link
+              ( "" , [] , [] )
+              [ Str "emphasized" , Space , Str "link" ]
+              ( "/url" , "" )
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "code:"
+      , Space
+      , Code ( "" , [] , [] ) ">"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\$"
+      , Str ","
+      , SoftBreak
+      , Code ( "" , [] , [] ) "<html>"
+      , Str "."
+      ]
+  , Para
+      [ Strikeout
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Emph [ Str "strikeout" ]
+          , Str "."
+          ]
+      ]
+  , Para
+      [ Str "Superscripts:"
+      , Space
+      , Str "a"
+      , Superscript [ Str "bc" ]
+      , Str "d"
+      , SoftBreak
+      , Str "a"
+      , Superscript [ Emph [ Str "hello" ] ]
+      , Space
+      , Str "a"
+      , Superscript [ Str "hello" , Space , Str "there" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Subscripts:"
+      , Space
+      , Str "H"
+      , Subscript [ Str "2" ]
+      , Str "O,"
+      , Space
+      , Str "H"
+      , Subscript [ Str "23" ]
+      , Str "O,"
+      , SoftBreak
+      , Str "H"
+      , Subscript
+          [ Str "many" , Space , Str "of" , Space , Str "them" ]
+      , Str "O."
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "superscripts"
+      , Space
+      , Str "or"
+      , Space
+      , Str "subscripts,"
+      , Space
+      , Str "because"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "unescaped"
+      , Space
+      , Str "spaces:"
+      , Space
+      , Str "a^b"
+      , Space
+      , Str "c^d,"
+      , Space
+      , Str "a"
+      , Math InlineMath "\\sim"
+      , Str "b"
+      , SoftBreak
+      , Str "c"
+      , Math InlineMath "\\sim"
+      , Str "d."
+      ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header
+      1
+      ( "smart-quotes-ellipses-dashes" , [] , [] )
+      [ Str "Smart"
+      , Space
+      , Str "quotes,"
+      , Space
+      , Str "ellipses,"
+      , Space
+      , Str "dashes"
+      ]
+  , Para
+      [ Quoted DoubleQuote [ Str "Hello," ]
+      , Space
+      , Str "said"
+      , Space
+      , Str "the"
+      , Space
+      , Str "spider."
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Str "\8198"
+          , Quoted SingleQuote [ Str "Shelob" ]
+          , Space
+          , Str "is"
+          , Space
+          , Str "my"
+          , Space
+          , Str "name."
+          ]
+      ]
+  , Para
+      [ Quoted SingleQuote [ Str "A" ]
+      , Str ","
+      , Space
+      , Quoted SingleQuote [ Str "B" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Quoted SingleQuote [ Str "C" ]
+      , Space
+      , Str "are"
+      , Space
+      , Str "letters."
+      ]
+  , Para
+      [ Quoted SingleQuote [ Str "Oak," ]
+      , Space
+      , Quoted SingleQuote [ Str "elm," ]
+      , Space
+      , Str "and"
+      , Space
+      , Quoted SingleQuote [ Str "beech" ]
+      , Space
+      , Str "are"
+      , Space
+      , Str "names"
+      , Space
+      , Str "of"
+      , Space
+      , Str "trees."
+      , Space
+      , Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Quoted SingleQuote [ Str "pine." ]
+      ]
+  , Para
+      [ Quoted
+          SingleQuote
+          [ Str "He"
+          , Space
+          , Str "said,"
+          , Space
+          , Quoted
+              DoubleQuote
+              [ Str "I"
+              , Space
+              , Str "want"
+              , Space
+              , Str "to"
+              , Space
+              , Str "go."
+              ]
+          , Str "\8198"
+          ]
+      , Space
+      , Str "Were"
+      , Space
+      , Str "you"
+      , Space
+      , Str "alive"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "70\8217s?"
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "quoted"
+      , Space
+      , Quoted SingleQuote [ Code ( "" , [] , [] ) "code" ]
+      , Space
+      , Str "and"
+      , Space
+      , Str "a"
+      , SoftBreak
+      , Quoted
+          DoubleQuote
+          [ Link
+              ( "" , [] , [] )
+              [ Str "quoted" , Space , Str "link" ]
+              ( "http://example.com/?foo=1&bar=2" , "" )
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Some"
+      , Space
+      , Str "dashes:"
+      , Space
+      , Str "one\8212two\8212three\8212four\8212five."
+      ]
+  , Para
+      [ Str "Dashes"
+      , Space
+      , Str "between"
+      , Space
+      , Str "numbers:"
+      , Space
+      , Str "5\8211\&7,"
+      , Space
+      , Str "255\8211\&66,"
+      , Space
+      , Str "1987\8211\&1999."
+      ]
+  , Para [ Str "Ellipses\8230and\8230and\8230." ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header 1 ( "latex" , [] , [] ) [ Str "LaTeX" ]
+  , BulletList
+      [ [ Para
+            [ Cite
+                [ Citation
+                    { citationId = "smith.1899"
+                    , citationPrefix = []
+                    , citationSuffix = [ Str "22-23" ]
+                    , citationMode = NormalCitation
+                    , citationNoteNum = 0
+                    , citationHash = 0
+                    }
+                ]
+                [ RawInline (Format "latex") "\\cite[22-23]{smith.1899}"
+                ]
+            ]
+        ]
+      , [ RawBlock (Format "latex") "\\doublespacing" ]
+      , [ Para [ Math InlineMath "2+2=4" ] ]
+      , [ Para [ Math InlineMath "x \\in y" ] ]
+      , [ Para [ Math InlineMath "\\alpha \\wedge \\omega" ] ]
+      , [ Para [ Math InlineMath "223" ] ]
+      , [ Para [ Math InlineMath "p" , Str "-Tree" ] ]
+      , [ Para
+            [ Math
+                InlineMath
+                "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"
+            ]
+        ]
+      , [ Para
+            [ Str "Here\8217s"
+            , Space
+            , Str "one"
+            , Space
+            , Str "that"
+            , Space
+            , Str "has"
+            , Space
+            , Str "a"
+            , Space
+            , Str "line"
+            , Space
+            , Str "break"
+            , Space
+            , Str "in"
+            , Space
+            , Str "it:"
+            , SoftBreak
+            , Math InlineMath "\\alpha + \\omega \\times x^2"
+            , Str "."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "shouldn\8217t"
+      , Space
+      , Str "be"
+      , Space
+      , Str "math:"
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "To"
+            , Space
+            , Str "get"
+            , Space
+            , Str "the"
+            , Space
+            , Str "famous"
+            , Space
+            , Str "equation,"
+            , Space
+            , Str "write"
+            , Space
+            , Code ( "" , [] , [] ) "$e = mc^2$"
+            , Str "."
+            ]
+        ]
+      , [ Para
+            [ Str "$22,000"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Emph [ Str "lot" ]
+            , Space
+            , Str "of"
+            , Space
+            , Str "money."
+            , Space
+            , Str "So"
+            , Space
+            , Str "is"
+            , Space
+            , Str "$34,000."
+            , Space
+            , Str "(It"
+            , Space
+            , Str "worked"
+            , Space
+            , Str "if"
+            , SoftBreak
+            , Quoted DoubleQuote [ Str "lot" ]
+            , Space
+            , Str "is"
+            , Space
+            , Str "emphasized.)"
+            ]
+        ]
+      , [ Para
+            [ Str "Escaped"
+            , Space
+            , Code ( "" , [] , [] ) "$"
+            , Str ":"
+            , Space
+            , Str "$73"
+            , Space
+            , Emph
+                [ Str "this"
+                , Space
+                , Str "should"
+                , Space
+                , Str "be"
+                , Space
+                , Str "emphasized"
+                ]
+            , Space
+            , Str "23$."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "LaTeX"
+      , Space
+      , Str "table:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Animal" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Number" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Dog" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cat" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "A"
+      , Space
+      , Str "table"
+      , Space
+      , Str "with"
+      , Space
+      , Str "one"
+      , Space
+      , Str "column:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault ) ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Animal" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Vegetable" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header
+      1
+      ( "special-characters" , [] , [] )
+      [ Str "Special" , Space , Str "Characters" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "unicode:"
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "I" , Space , Str "hat:" , Space , Str "\206" ]
+        ]
+      , [ Para
+            [ Str "o" , Space , Str "umlaut:" , Space , Str "\246" ]
+        ]
+      , [ Para [ Str "section:" , Space , Str "\167" ] ]
+      , [ Para
+            [ Str "set"
+            , Space
+            , Str "membership:"
+            , Space
+            , Str "\8712"
+            ]
+        ]
+      , [ Para [ Str "copyright:" , Space , Str "\169" ] ]
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "has"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "their"
+      , Space
+      , Str "name."
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "is"
+      , Space
+      , Str "another"
+      , Space
+      , Str "way"
+      , Space
+      , Str "to"
+      , Space
+      , Str "write"
+      , Space
+      , Str "it."
+      ]
+  , Para
+      [ Str "This" , Space , Str "&" , Space , Str "that." ]
+  , Para [ Str "4" , Space , Str "<" , Space , Str "5." ]
+  , Para [ Str "6" , Space , Str ">" , Space , Str "5." ]
+  , Para [ Str "Backslash:" , Space , Str "\\" ]
+  , Para [ Str "Backtick:" , Space , Str "\8216" ]
+  , Para [ Str "Asterisk:" , Space , Str "*" ]
+  , Para [ Str "Underscore:" , Space , Str "_" ]
+  , Para
+      [ Str "Left" , Space , Str "brace:" , Space , Str "{" ]
+  , Para
+      [ Str "Right" , Space , Str "brace:" , Space , Str "}" ]
+  , Para
+      [ Str "Left" , Space , Str "bracket:" , Space , Str "[" ]
+  , Para
+      [ Str "Right" , Space , Str "bracket:" , Space , Str "]" ]
+  , Para
+      [ Str "Left" , Space , Str "paren:" , Space , Str "(" ]
+  , Para
+      [ Str "Right" , Space , Str "paren:" , Space , Str ")" ]
+  , Para [ Str "Greater-than:" , Space , Str ">" ]
+  , Para [ Str "Hash:" , Space , Str "#" ]
+  , Para [ Str "Period:" , Space , Str "." ]
+  , Para [ Str "Bang:" , Space , Str "!" ]
+  , Para [ Str "Plus:" , Space , Str "+" ]
+  , Para [ Str "Minus:" , Space , Str "-" ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header 1 ( "links" , [] , [] ) [ Str "Links" ]
+  , Header 2 ( "explicit" , [] , [] ) [ Str "Explicit" ]
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "a"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "URL" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "with_underscore" ]
+          ( "/url/with_underscore" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Email" , Space , Str "link" ]
+          ( "mailto:nobody@nowhere.net" , "" )
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "Empty" ] ( "" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "reference" , [] , [] ) [ Str "Reference" ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "With"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "[brackets]" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "b" ] ( "/url/" , "" )
+      , Space
+      , Str "by"
+      , Space
+      , Str "itself"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "once" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "twice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "thrice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "[not][]"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , CodeBlock ( "" , [] , [] ) "[not]: /url"
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "biz" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Header
+      2
+      ( "with-ampersands" , [] , [] )
+      [ Str "With" , Space , Str "ampersands" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "link"
+          , Space
+          , Str "with"
+          , Space
+          , Str "an"
+          , Space
+          , Str "ampersand"
+          , Space
+          , Str "in"
+          , Space
+          , Str "the"
+          , Space
+          , Str "URL"
+          ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Str "amersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "link"
+      , Space
+      , Str "text:"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "AT&T" ] ( "http://att.com/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline" , Space , Str "link" ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "an"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline"
+          , Space
+          , Str "link"
+          , Space
+          , Str "in"
+          , Space
+          , Str "pointy"
+          , Space
+          , Str "braces"
+          ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "autolinks" , [] , [] ) [ Str "Autolinks" ]
+  , Para
+      [ Str "With"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://example.com/?foo=1&bar=2" ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "In" , Space , Str "a" , Space , Str "list?" ]
+        ]
+      , [ Para
+            [ Link
+                ( "" , [] , [] )
+                [ Str "http://example.com/" ]
+                ( "http://example.com/" , "" )
+            ]
+        ]
+      , [ Para [ Str "It" , Space , Str "should." ] ]
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Str "e-mail"
+      , Space
+      , Str "address:"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "nobody@nowhere.net" ]
+          ( "mailto:nobody@nowhere.net" , "" )
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Blockquoted:"
+          , Space
+          , Link
+              ( "" , [] , [] )
+              [ Str "http://example.com/" ]
+              ( "http://example.com/" , "" )
+          ]
+      ]
+  , Para
+      [ Str "Auto-links"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "occur"
+      , Space
+      , Str "here:"
+      , Space
+      , Code ( "" , [] , [] ) "<http://example.com/>"
+      ]
+  , CodeBlock
+      ( "" , [] , [] ) "or here: <http://example.com/>"
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header 1 ( "images" , [] , [] ) [ Str "Images" ]
+  , Para
+      [ Str "From"
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Str "Voyage"
+          , Space
+          , Str "dans"
+          , Space
+          , Str "la"
+          , Space
+          , Str "Lune"
+          ]
+      , Space
+      , Str "by"
+      , Space
+      , Str "Georges"
+      , Space
+      , Str "Melies"
+      , Space
+      , Str "(1902):"
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] ) [ Str "image" ] ( "lalune.jpg" , "" )
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "movie"
+      , Space
+      , Image
+          ( "" , [] , [] ) [ Str "image" ] ( "movie.jpg" , "" )
+      , Space
+      , Str "icon."
+      ]
+  , Div ( "" , [ "center" ] , [] ) [ HorizontalRule ]
+  , Header 1 ( "footnotes" , [] , [] ) [ Str "Footnotes" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , SoftBreak
+      , Str "reference,"
+      , Note
+          [ Para
+              [ Str "Here"
+              , Space
+              , Str "is"
+              , Space
+              , Str "the"
+              , Space
+              , Str "footnote."
+              , Space
+              , Str "It"
+              , Space
+              , Str "can"
+              , Space
+              , Str "go"
+              , Space
+              , Str "anywhere"
+              , Space
+              , Str "after"
+              , Space
+              , Str "the"
+              , Space
+              , Str "footnote"
+              , SoftBreak
+              , Str "reference."
+              , Space
+              , Str "It"
+              , Space
+              , Str "need"
+              , Space
+              , Str "not"
+              , Space
+              , Str "be"
+              , Space
+              , Str "placed"
+              , Space
+              , Str "at"
+              , Space
+              , Str "the"
+              , Space
+              , Str "end"
+              , Space
+              , Str "of"
+              , Space
+              , Str "the"
+              , Space
+              , Str "document."
+              ]
+          ]
+      , SoftBreak
+      , Str "and"
+      , SoftBreak
+      , Str "another."
+      , Note
+          [ Para
+              [ Str "Here\8217s"
+              , Space
+              , Str "the"
+              , Space
+              , Str "long"
+              , Space
+              , Str "note."
+              , Space
+              , Str "This"
+              , Space
+              , Str "one"
+              , Space
+              , Str "contains"
+              , Space
+              , Str "multiple"
+              , Space
+              , Str "blocks."
+              ]
+          , Para
+              [ Str "Subsequent"
+              , Space
+              , Str "blocks"
+              , Space
+              , Str "are"
+              , Space
+              , Str "indented"
+              , Space
+              , Str "to"
+              , Space
+              , Str "show"
+              , Space
+              , Str "that"
+              , Space
+              , Str "they"
+              , Space
+              , Str "belong"
+              , Space
+              , Str "to"
+              , Space
+              , Str "the"
+              , SoftBreak
+              , Str "footnote"
+              , Space
+              , Str "(as"
+              , Space
+              , Str "with"
+              , Space
+              , Str "list"
+              , Space
+              , Str "items)."
+              ]
+          , CodeBlock ( "" , [] , [] ) "  { <code> }"
+          , Para
+              [ Str "If"
+              , Space
+              , Str "you"
+              , Space
+              , Str "want,"
+              , Space
+              , Str "you"
+              , Space
+              , Str "can"
+              , Space
+              , Str "indent"
+              , Space
+              , Str "every"
+              , Space
+              , Str "line,"
+              , Space
+              , Str "but"
+              , Space
+              , Str "you"
+              , Space
+              , Str "can"
+              , Space
+              , Str "also"
+              , Space
+              , Str "be"
+              , Space
+              , Str "lazy"
+              , SoftBreak
+              , Str "and"
+              , Space
+              , Str "just"
+              , Space
+              , Str "indent"
+              , Space
+              , Str "the"
+              , Space
+              , Str "first"
+              , Space
+              , Str "line"
+              , Space
+              , Str "of"
+              , Space
+              , Str "each"
+              , Space
+              , Str "block."
+              ]
+          ]
+      , SoftBreak
+      , Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Emph [ Str "not" ]
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference,"
+      , Space
+      , Str "because"
+      , Space
+      , Str "it"
+      , Space
+      , Str "contains"
+      , SoftBreak
+      , Str "a"
+      , Space
+      , Str "space.[^my"
+      , Space
+      , Str "note]"
+      , Space
+      , Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "an"
+      , Space
+      , Str "inline"
+      , SoftBreak
+      , Str "note."
+      , Note
+          [ Para
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Emph [ Str "easier" ]
+              , Space
+              , Str "to"
+              , Space
+              , Str "type."
+              , Space
+              , Str "Inline"
+              , Space
+              , Str "notes"
+              , Space
+              , Str "may"
+              , Space
+              , Str "contain"
+              , SoftBreak
+              , Link
+                  ( "" , [] , [] )
+                  [ Str "links" ]
+                  ( "http://google.com" , "" )
+              , Space
+              , Str "and"
+              , Space
+              , Code ( "" , [] , [] ) "]"
+              , Space
+              , Str "verbatim"
+              , Space
+              , Str "characters,"
+              , SoftBreak
+              , Str "as"
+              , Space
+              , Str "well"
+              , Space
+              , Str "as"
+              , Space
+              , Str "[bracketed"
+              , Space
+              , Str "text]."
+              ]
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Notes"
+          , Space
+          , Str "can"
+          , Space
+          , Str "go"
+          , Space
+          , Str "in"
+          , Space
+          , Str "quotes."
+          , Note [ Para [ Str "In" , Space , Str "quote." ] ]
+          ]
+      ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para
+            [ Str "And"
+            , Space
+            , Str "in"
+            , Space
+            , Str "list"
+            , Space
+            , Str "items."
+            , Note [ Para [ Str "In" , Space , Str "list." ] ]
+            ]
+        ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "part"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "note,"
+      , Space
+      , Str "as"
+      , Space
+      , Str "it"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , SoftBreak
+      , Str "indented."
+      ]
+  , Header
+      1
+      ( "escaped-characters" , [] , [] )
+      [ Str "Escaped" , Space , Str "characters" ]
+  , Para
+      [ Str "$"
+      , Space
+      , Str "%"
+      , Space
+      , Str "&"
+      , Space
+      , Str "#"
+      , Space
+      , Str "_"
+      , Space
+      , Str "{"
+      , Space
+      , Str "}"
+      ]
+  ]
diff --git a/test/lhs-test-markdown.native b/test/lhs-test-markdown.native
--- a/test/lhs-test-markdown.native
+++ b/test/lhs-test-markdown.native
@@ -1,8 +1,124 @@
-[Header 1 ("lhs-test",[],[]) [Str "lhs",Space,Str "test"]
-,Para [Code ("",[],[]) "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",SoftBreak,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]
-,CodeBlock ("",["haskell","literate"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry\n          -- arr (\\op (x,y) -> x `op` y)"
-,Para [Code ("",[],[]) "(***)",Space,Str "combines",Space,Str "two",Space,Str "arrows",Space,Str "into",Space,Str "a",Space,Str "new",Space,Str "arrow",Space,Str "by",Space,Str "running",Space,Str "the",Space,Str "two",Space,Str "arrows",Space,Str "on",Space,Str "a",SoftBreak,Str "pair",Space,Str "of",Space,Str "values",Space,Str "(one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "first",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair",Space,Str "and",Space,Str "one",Space,Str "arrow",Space,Str "on",Space,Str "the",SoftBreak,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)."]
-,CodeBlock ("",[],[]) "f *** g = first f >>> second g"
-,Para [Str "Block",Space,Str "quote:"]
-,BlockQuote
- [Para [Str "foo",Space,Str "bar"]]]
+[ Header
+    1
+    ( "lhs-test" , [] , [] )
+    [ Str "lhs" , Space , Str "test" ]
+, Para
+    [ Code ( "" , [] , [] ) "unsplit"
+    , Space
+    , Str "is"
+    , Space
+    , Str "an"
+    , Space
+    , Str "arrow"
+    , Space
+    , Str "that"
+    , Space
+    , Str "takes"
+    , Space
+    , Str "a"
+    , Space
+    , Str "pair"
+    , Space
+    , Str "of"
+    , Space
+    , Str "values"
+    , Space
+    , Str "and"
+    , Space
+    , Str "combines"
+    , Space
+    , Str "them"
+    , Space
+    , Str "to"
+    , SoftBreak
+    , Str "return"
+    , Space
+    , Str "a"
+    , Space
+    , Str "single"
+    , Space
+    , Str "value:"
+    ]
+, CodeBlock
+    ( "" , [ "haskell" , "literate" ] , [] )
+    "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry\n          -- arr (\\op (x,y) -> x `op` y)"
+, Para
+    [ Code ( "" , [] , [] ) "(***)"
+    , Space
+    , Str "combines"
+    , Space
+    , Str "two"
+    , Space
+    , Str "arrows"
+    , Space
+    , Str "into"
+    , Space
+    , Str "a"
+    , Space
+    , Str "new"
+    , Space
+    , Str "arrow"
+    , Space
+    , Str "by"
+    , Space
+    , Str "running"
+    , Space
+    , Str "the"
+    , Space
+    , Str "two"
+    , Space
+    , Str "arrows"
+    , Space
+    , Str "on"
+    , Space
+    , Str "a"
+    , SoftBreak
+    , Str "pair"
+    , Space
+    , Str "of"
+    , Space
+    , Str "values"
+    , Space
+    , Str "(one"
+    , Space
+    , Str "arrow"
+    , Space
+    , Str "on"
+    , Space
+    , Str "the"
+    , Space
+    , Str "first"
+    , Space
+    , Str "item"
+    , Space
+    , Str "of"
+    , Space
+    , Str "the"
+    , Space
+    , Str "pair"
+    , Space
+    , Str "and"
+    , Space
+    , Str "one"
+    , Space
+    , Str "arrow"
+    , Space
+    , Str "on"
+    , Space
+    , Str "the"
+    , SoftBreak
+    , Str "second"
+    , Space
+    , Str "item"
+    , Space
+    , Str "of"
+    , Space
+    , Str "the"
+    , Space
+    , Str "pair)."
+    ]
+, CodeBlock
+    ( "" , [] , [] ) "f *** g = first f >>> second g"
+, Para [ Str "Block" , Space , Str "quote:" ]
+, BlockQuote [ Para [ Str "foo" , Space , Str "bar" ] ]
+]
diff --git a/test/lhs-test.native b/test/lhs-test.native
--- a/test/lhs-test.native
+++ b/test/lhs-test.native
@@ -1,8 +1,124 @@
-[Header 1 ("lhs-test",[],[]) [Str "lhs",Space,Str "test"]
-,Para [Code ("",[],[]) "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",SoftBreak,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]
-,CodeBlock ("",["haskell","literate"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry\n          -- arr (\\op (x,y) -> x `op` y)"
-,Para [Code ("",[],[]) "(***)",Space,Str "combines",Space,Str "two",Space,Str "arrows",Space,Str "into",Space,Str "a",Space,Str "new",Space,Str "arrow",Space,Str "by",Space,Str "running",Space,Str "the",Space,Str "two",Space,Str "arrows",Space,Str "on",Space,Str "a",SoftBreak,Str "pair",Space,Str "of",Space,Str "values",Space,Str "(one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "first",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair",Space,Str "and",Space,Str "one",Space,Str "arrow",Space,Str "on",Space,Str "the",SoftBreak,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)."]
-,CodeBlock ("",[],[]) "f *** g = first f >>> second g"
-,Para [Str "Block",Space,Str "quote:"]
-,BlockQuote
- [Para [Str "foo",Space,Str "bar"]]]
+[ Header
+    1
+    ( "lhs-test" , [] , [] )
+    [ Str "lhs" , Space , Str "test" ]
+, Para
+    [ Code ( "" , [] , [] ) "unsplit"
+    , Space
+    , Str "is"
+    , Space
+    , Str "an"
+    , Space
+    , Str "arrow"
+    , Space
+    , Str "that"
+    , Space
+    , Str "takes"
+    , Space
+    , Str "a"
+    , Space
+    , Str "pair"
+    , Space
+    , Str "of"
+    , Space
+    , Str "values"
+    , Space
+    , Str "and"
+    , Space
+    , Str "combines"
+    , Space
+    , Str "them"
+    , Space
+    , Str "to"
+    , SoftBreak
+    , Str "return"
+    , Space
+    , Str "a"
+    , Space
+    , Str "single"
+    , Space
+    , Str "value:"
+    ]
+, CodeBlock
+    ( "" , [ "haskell" , "literate" ] , [] )
+    "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry\n          -- arr (\\op (x,y) -> x `op` y)"
+, Para
+    [ Code ( "" , [] , [] ) "(***)"
+    , Space
+    , Str "combines"
+    , Space
+    , Str "two"
+    , Space
+    , Str "arrows"
+    , Space
+    , Str "into"
+    , Space
+    , Str "a"
+    , Space
+    , Str "new"
+    , Space
+    , Str "arrow"
+    , Space
+    , Str "by"
+    , Space
+    , Str "running"
+    , Space
+    , Str "the"
+    , Space
+    , Str "two"
+    , Space
+    , Str "arrows"
+    , Space
+    , Str "on"
+    , Space
+    , Str "a"
+    , SoftBreak
+    , Str "pair"
+    , Space
+    , Str "of"
+    , Space
+    , Str "values"
+    , Space
+    , Str "(one"
+    , Space
+    , Str "arrow"
+    , Space
+    , Str "on"
+    , Space
+    , Str "the"
+    , Space
+    , Str "first"
+    , Space
+    , Str "item"
+    , Space
+    , Str "of"
+    , Space
+    , Str "the"
+    , Space
+    , Str "pair"
+    , Space
+    , Str "and"
+    , Space
+    , Str "one"
+    , Space
+    , Str "arrow"
+    , Space
+    , Str "on"
+    , Space
+    , Str "the"
+    , SoftBreak
+    , Str "second"
+    , Space
+    , Str "item"
+    , Space
+    , Str "of"
+    , Space
+    , Str "the"
+    , Space
+    , Str "pair)."
+    ]
+, CodeBlock
+    ( "" , [] , [] ) "f *** g = first f >>> second g"
+, Para [ Str "Block" , Space , Str "quote:" ]
+, BlockQuote [ Para [ Str "foo" , Space , Str "bar" ] ]
+]
diff --git a/test/lua/module/pandoc-types.lua b/test/lua/module/pandoc-types.lua
--- a/test/lua/module/pandoc-types.lua
+++ b/test/lua/module/pandoc-types.lua
@@ -55,31 +55,6 @@
       end),
     },
 
-    group 'list-like behavior' {
-      test('can access version component numbers', function ()
-        local version = Version '2.7.3'
-        assert.is_nil(version[0])
-        assert.are_equal(version[1], 2)
-        assert.are_equal(version[2], 7)
-        assert.are_equal(version[3], 3)
-      end),
-      test('can be iterated over', function ()
-        local version_list = {2, 7, 3}
-        local final_index = 0
-        for i, v in pairs(Version(version_list)) do
-          assert.are_equal(v, version_list[i])
-          final_index = i
-        end
-        assert.are_equal(final_index, 3)
-      end),
-      test('length is the number of components', function ()
-        assert.are_equal(#(Version '0'), 1)
-        assert.are_equal(#(Version '1.6'), 2)
-        assert.are_equal(#(Version '8.7.5'), 3)
-        assert.are_equal(#(Version '2.9.1.5'), 4)
-      end)
-    },
-
     group 'conversion to string' {
       test('converting from and to string is a noop', function ()
         local version_string = '1.19.4'
diff --git a/test/lua/module/pandoc.lua b/test/lua/module/pandoc.lua
--- a/test/lua/module/pandoc.lua
+++ b/test/lua/module/pandoc.lua
@@ -11,34 +11,32 @@
 return {
   group 'Attr' {
     group 'Constructor' {
+      test('pandoc.Attr is a function', function ()
+        assert.are_equal(type(pandoc.Attr), 'function')
+      end),
       test('returns null-Attr if no arguments are given', function ()
         local attr = pandoc.Attr()
         assert.are_equal(attr.identifier, '')
         assert.are_same(attr.classes, {})
-        assert.are_same(attr.attributes, {})
+        assert.are_same(#attr.attributes, 0)
       end),
       test(
         'accepts string-indexed table or list of pairs as attributes',
         function ()
-          local attributes_list = pandoc.List:new {{'one', '1'}, {'two', '2'}}
-          local attr_from_list = pandoc.Attr('', {}, attributes_list:clone())
+          local attributes_list = {{'one', '1'}, {'two', '2'}}
+          local attr_from_list = pandoc.Attr('', {}, attributes_list)
 
-          assert.are_same(
-            pandoc.List:new(attr_from_list.attributes),
-            attributes_list
-          )
+          assert.are_equal(attr_from_list.attributes.one, '1')
+          assert.are_equal(attr_from_list.attributes.two, '2')
 
           local attributes_table = {one = '1', two = '2'}
           local attr_from_table = pandoc.Attr('', {}, attributes_table)
-
-          local assoc_list_from_table =
-            pandoc.List:new(attr_from_table.attributes)
-          -- won't work in general, but does in this special case
-          table.sort(assoc_list_from_table, function(x, y) return x[1]<y[1] end)
-          assert.are_same(
-            assoc_list_from_table,
-            attributes_list
+          assert.are_equal(
+            attr_from_table.attributes,
+            pandoc.AttributeList(attributes_table)
           )
+          assert.are_equal(attr_from_table.attributes.one, '1')
+          assert.are_equal(attr_from_table.attributes.two, '2')
         end
       )
     },
@@ -53,27 +51,41 @@
         assert.are_same(attributes[1], {'a', '1'})
         assert.are_same(attributes[2], {'b', '2'})
       end),
+      test('allows replacing a pair', function ()
+        local attributes = pandoc.AttributeList{{'a', '1'}, {'b', '2'}}
+        attributes[1] = {'t','five'}
+        assert.are_same(attributes[1], {'t', 'five'})
+        assert.are_same(attributes[2], {'b', '2'})
+      end),
+      test('allows to remove a pair', function ()
+         local attributes = pandoc.AttributeList{{'a', '1'}, {'b', '2'}}
+         attributes[1] = nil
+         assert.are_equal(#attributes, 1)
+      end),
       test('adds entries by field name', function ()
         local attributes = pandoc.Attr('',{}, {{'c', '1'}, {'d', '2'}}).attributes
         attributes.e = '3'
         assert.are_same(
+          attributes,
           -- checking the full AttributeList would "duplicate" entries
-          setmetatable(attributes, nil),
-          {{'c', '1'}, {'d', '2'}, {'e', '3'}}
+          pandoc.AttributeList{{'c', '1'}, {'d', '2'}, {'e', '3'}}
         )
       end),
       test('deletes entries by field name', function ()
         local attributes = pandoc.Attr('',{}, {a = '1', b = '2'}).attributes
         attributes.a = nil
         assert.is_nil(attributes.a)
-        local assoc_list = setmetatable(attributes, nil)
-        assert.are_same(assoc_list, {{'b', '2'}})
+        assert.are_same(attributes, pandoc.AttributeList{{'b', '2'}})
       end),
       test('remains unchanged if deleted key did not exist', function ()
         local assoc_list = pandoc.List:new {{'alpha', 'x'}, {'beta', 'y'}}
-        local attributes = pandoc.Attr('', {}, assoc_list:clone()).attributes
+        local attributes = pandoc.Attr('', {}, assoc_list).attributes
         attributes.a = nil
-        assert.are_same(pandoc.List:new(attributes), assoc_list)
+        local new_assoc_list = pandoc.List()
+        for k, v in pairs(attributes) do
+          new_assoc_list:insert({k, v})
+        end
+        assert.are_same(new_assoc_list, assoc_list)
       end),
       test('gives key-value pairs when iterated-over', function ()
         local attributes = {width = '11', height = '22', name = 'test'}
@@ -110,6 +122,7 @@
         }
         local span = pandoc.Span 'test'
         span.attr = html_attributes
+        span = span:clone() -- normalize
         assert.are_equal(span.attr.identifier, 'the-id')
         assert.are_equal(span.attr.classes[1], 'class1')
         assert.are_equal(span.attr.classes[2], 'class2')
diff --git a/test/man-reader.native b/test/man-reader.native
--- a/test/man-reader.native
+++ b/test/man-reader.native
@@ -1,300 +1,951 @@
-Pandoc (Meta {unMeta = fromList [("date",MetaInlines [Str "Oct",Space,Str "17,",Space,Str "2018"]),("section",MetaInlines []),("title",MetaInlines [Str "Pandoc",Space,Str "Man",Space,Str "tests"])]})
-[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc."]
-,Para [Str "*",Space,Str "*",Space,Str "*",Space,Str "*",Space,Str "*"]
-,Header 1 ("",[],[]) [Str "Headers"]
-,Header 1 ("",[],[]) [Str "Level",Space,Str "1"]
-,Header 2 ("",[],[]) [Str "Level",Space,Str "2"]
-,Para [Str "*",Space,Str "*",Space,Str "*",Space,Str "*",Space,Str "*"]
-,Header 1 ("",[],[]) [Str "Paragraphs"]
-,Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
-,Para [Str "Another",Space,Str "paragraph",Space,Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."]
-,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break"]
-,Para [Str "here."]
-,Para [Str "*",Space,Str "*",Space,Str "*",Space,Str "*",Space,Str "*"]
-,Header 1 ("",[],[]) [Str "Block",Space,Str "Quotes"]
-,Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
-,BlockQuote
- [CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"]
-,Para [Str "A",Space,Str "list:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "item",Space,Str "one"]]
- ,[Para [Str "item",Space,Str "two"]]]
-,Header 1 ("",[],[]) [Str "Code",Space,Str "Blocks"]
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n"
-,Para [Str "And:"]
-,CodeBlock ("",[],[]) "\tthis code line is indented by one tab"
-,Para [Str "*",Space,Str "*",Space,Str "*",Space,Str "*",Space,Str "*"]
-,Header 1 ("",[],[]) [Str "Lists"]
-,Header 2 ("",[],[]) [Str "Unordered"]
-,Para [Str "Asterisks:"]
-,BulletList
- [[Para [Str "asterisk",Space,Str "1"]]
- ,[Para [Str "asterisk",Space,Str "2"]]
- ,[Para [Str "asterisk",Space,Str "3"]]]
-,Header 2 ("",[],[]) [Str "Ordered"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second"]]
- ,[Para [Str "Third"]]]
-,Header 2 ("",[],[]) [Str "Nested"]
-,BulletList
- [[Para [Str "Tab"]
-  ,BulletList
-   [[Para [Str "Tab"]
-    ,BulletList
-     [[Para [Str "Tab"]]]]]]]
-,Para [Str "Here's",Space,Str "another:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Para [Str "Fee"]]
-   ,[Para [Str "Fie"]]
-   ,[Para [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Para [Str "Same",Space,Str "thing:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Para [Str "Fee"]]
-   ,[Para [Str "Fie"]]
-   ,[Para [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Header 2 ("",[],[]) [Str "different",Space,Str "styles:"]
-,OrderedList (1,UpperAlpha,Period)
- [[Para [Str "Upper",Space,Str "Alpha"]
-  ,OrderedList (1,UpperRoman,Period)
-   [[Para [Str "Upper",Space,Str "Roman."]
-    ,OrderedList (6,Decimal,TwoParens)
-     [[Para [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
-      ,OrderedList (3,LowerAlpha,OneParen)
-       [[Para [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
-,Header 2 ("",[],[]) [Str "Ordered"]
-,Para [Str "Definition",Space,Str "lists"]
-,DefinitionList
- [([Strong [Str "term1"]],
-   [[Para [Str "definition",Space,Str "1"]
-    ,Para [Str "continued"]]])
- ,([Strong [Str "term2"]],
-   [[Para [Str "definition",Space,Str "2",Space,Str "*",Space,Str "*",Space,Str "*",Space,Str "*",Space,Str "*"]]])]
-,Header 1 ("",[],[]) [Str "Special",Space,Str "Characters"]
-,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
-,Para [Str "4",Space,Str "<",Space,Str "5."]
-,Para [Str "6",Space,Str ">",Space,Str "5."]
-,Para [Str "Backslash:",Space,Str "\\"]
-,Para [Str "Backtick:",Space,Str "`"]
-,Para [Str "Asterisk:",Space,Str "*"]
-,Para [Str "Underscore:",Space,Str "_"]
-,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
-,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
-,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
-,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
-,Para [Str "Left",Space,Str "paren:",Space,Str "("]
-,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
-,Para [Str "Greater-than:",Space,Str ">"]
-,Para [Str "Hash:",Space,Str "#"]
-,Para [Str "Period:",Space,Str "."]
-,Para [Str "Bang:",Space,Str "!"]
-,Para [Str "Plus:",Space,Str "+"]
-,Para [Str "Minus:",Space,Str "-"]
-,Header 1 ("",[],[]) [Str "Links"]
-,Para [Link ("",[],[]) [Str "some",Space,Str "randomsite"] ("http://example.com",""),Str "."]
-,Para [Link ("",[],[]) [Str "my",Space,Str "email",Space,Str "address"] ("mailto:me@example.com",""),Str "."]
-,Header 1 ("",[],[]) [Str "Macros"]
-,Para [Strong [Str "Me",Space,Str "Myself"],Space,Str "and",Space,Str "I.",Space,Emph [Str "The",Space,Str "author",Space,Str "is",Space,Str "John",Space,Str "Jones."],Space,Str "It's",Space,Str "The",Space,Strong [Str "Author"],Str "."]
-,Header 1 ("",[],[]) [Str "Tables"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left",Space,Emph [Str "more"]]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Centered",Space,Str "Header"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left",Space,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right",Space,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default",Space,Str "aligned"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "First"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Second"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidth 0.5)
- ,(AlignLeft,ColWidth 0.5)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "a"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "one"]
-    ,Para [Str "two"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [CodeBlock ("",[],[]) "some\n   code"]]])]
- (TableFoot ("",[],[])
- [])]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "date"
+            , MetaInlines
+                [ Str "Oct" , Space , Str "17," , Space , Str "2018" ]
+            )
+          , ( "section" , MetaInlines [] )
+          , ( "title"
+            , MetaInlines
+                [ Str "Pandoc"
+                , Space
+                , Str "Man"
+                , Space
+                , Str "tests"
+                ]
+            )
+          ]
+    }
+  [ Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "set"
+      , Space
+      , Str "of"
+      , Space
+      , Str "tests"
+      , Space
+      , Str "for"
+      , Space
+      , Str "pandoc."
+      ]
+  , Para
+      [ Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      ]
+  , Header 1 ( "" , [] , [] ) [ Str "Headers" ]
+  , Header
+      1 ( "" , [] , [] ) [ Str "Level" , Space , Str "1" ]
+  , Header
+      2 ( "" , [] , [] ) [ Str "Level" , Space , Str "2" ]
+  , Para
+      [ Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      ]
+  , Header 1 ( "" , [] , [] ) [ Str "Paragraphs" ]
+  , Para
+      [ Str "Here's"
+      , Space
+      , Str "a"
+      , Space
+      , Str "regular"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "Another"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "In"
+      , Space
+      , Str "Markdown"
+      , Space
+      , Str "1.0.0"
+      , Space
+      , Str "and"
+      , Space
+      , Str "earlier."
+      , Space
+      , Str "Version"
+      , Space
+      , Str "8."
+      , Space
+      , Str "This"
+      , Space
+      , Str "line"
+      , Space
+      , Str "turns"
+      , Space
+      , Str "into"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      , Space
+      , Str "Because"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard-wrapped"
+      , Space
+      , Str "line"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "middle"
+      , Space
+      , Str "of"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "looked"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      ]
+  , Para
+      [ Str "There"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard"
+      , Space
+      , Str "line"
+      , Space
+      , Str "break"
+      ]
+  , Para [ Str "here." ]
+  , Para
+      [ Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      ]
+  , Header
+      1 ( "" , [] , [] ) [ Str "Block" , Space , Str "Quotes" ]
+  , Para
+      [ Str "Code"
+      , Space
+      , Str "in"
+      , Space
+      , Str "a"
+      , Space
+      , Str "block"
+      , Space
+      , Str "quote:"
+      ]
+  , BlockQuote
+      [ CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      ]
+  , Para [ Str "A" , Space , Str "list:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "item" , Space , Str "one" ] ]
+      , [ Para [ Str "item" , Space , Str "two" ] ]
+      ]
+  , Header
+      1 ( "" , [] , [] ) [ Str "Code" , Space , Str "Blocks" ]
+  , Para [ Str "Code:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [] , [] ) "\tthis code line is indented by one tab"
+  , Para
+      [ Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      , Space
+      , Str "*"
+      ]
+  , Header 1 ( "" , [] , [] ) [ Str "Lists" ]
+  , Header 2 ( "" , [] , [] ) [ Str "Unordered" ]
+  , Para [ Str "Asterisks:" ]
+  , BulletList
+      [ [ Para [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Header 2 ( "" , [] , [] ) [ Str "Ordered" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second" ] ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Header 2 ( "" , [] , [] ) [ Str "Nested" ]
+  , BulletList
+      [ [ Para [ Str "Tab" ]
+        , BulletList
+            [ [ Para [ Str "Tab" ]
+              , BulletList [ [ Para [ Str "Tab" ] ] ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Here's" , Space , Str "another:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Para [ Str "Fee" ] ]
+            , [ Para [ Str "Fie" ] ]
+            , [ Para [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para [ Str "Same" , Space , Str "thing:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Para [ Str "Fee" ] ]
+            , [ Para [ Str "Fie" ] ]
+            , [ Para [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Header
+      2
+      ( "" , [] , [] )
+      [ Str "different" , Space , Str "styles:" ]
+  , OrderedList
+      ( 1 , UpperAlpha , Period )
+      [ [ Para [ Str "Upper" , Space , Str "Alpha" ]
+        , OrderedList
+            ( 1 , UpperRoman , Period )
+            [ [ Para [ Str "Upper" , Space , Str "Roman." ]
+              , OrderedList
+                  ( 6 , Decimal , TwoParens )
+                  [ [ Para
+                        [ Str "Decimal"
+                        , Space
+                        , Str "start"
+                        , Space
+                        , Str "with"
+                        , Space
+                        , Str "6"
+                        ]
+                    , OrderedList
+                        ( 3 , LowerAlpha , OneParen )
+                        [ [ Para
+                              [ Str "Lower"
+                              , Space
+                              , Str "alpha"
+                              , Space
+                              , Str "with"
+                              , Space
+                              , Str "paren"
+                              ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Header 2 ( "" , [] , [] ) [ Str "Ordered" ]
+  , Para [ Str "Definition" , Space , Str "lists" ]
+  , DefinitionList
+      [ ( [ Strong [ Str "term1" ] ]
+        , [ [ Para [ Str "definition" , Space , Str "1" ]
+            , Para [ Str "continued" ]
+            ]
+          ]
+        )
+      , ( [ Strong [ Str "term2" ] ]
+        , [ [ Para
+                [ Str "definition"
+                , Space
+                , Str "2"
+                , Space
+                , Str "*"
+                , Space
+                , Str "*"
+                , Space
+                , Str "*"
+                , Space
+                , Str "*"
+                , Space
+                , Str "*"
+                ]
+            ]
+          ]
+        )
+      ]
+  , Header
+      1
+      ( "" , [] , [] )
+      [ Str "Special" , Space , Str "Characters" ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "has"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "their"
+      , Space
+      , Str "name."
+      ]
+  , Para [ Str "4" , Space , Str "<" , Space , Str "5." ]
+  , Para [ Str "6" , Space , Str ">" , Space , Str "5." ]
+  , Para [ Str "Backslash:" , Space , Str "\\" ]
+  , Para [ Str "Backtick:" , Space , Str "`" ]
+  , Para [ Str "Asterisk:" , Space , Str "*" ]
+  , Para [ Str "Underscore:" , Space , Str "_" ]
+  , Para
+      [ Str "Left" , Space , Str "brace:" , Space , Str "{" ]
+  , Para
+      [ Str "Right" , Space , Str "brace:" , Space , Str "}" ]
+  , Para
+      [ Str "Left" , Space , Str "bracket:" , Space , Str "[" ]
+  , Para
+      [ Str "Right" , Space , Str "bracket:" , Space , Str "]" ]
+  , Para
+      [ Str "Left" , Space , Str "paren:" , Space , Str "(" ]
+  , Para
+      [ Str "Right" , Space , Str "paren:" , Space , Str ")" ]
+  , Para [ Str "Greater-than:" , Space , Str ">" ]
+  , Para [ Str "Hash:" , Space , Str "#" ]
+  , Para [ Str "Period:" , Space , Str "." ]
+  , Para [ Str "Bang:" , Space , Str "!" ]
+  , Para [ Str "Plus:" , Space , Str "+" ]
+  , Para [ Str "Minus:" , Space , Str "-" ]
+  , Header 1 ( "" , [] , [] ) [ Str "Links" ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "some" , Space , Str "randomsite" ]
+          ( "http://example.com" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "my" , Space , Str "email" , Space , Str "address" ]
+          ( "mailto:me@example.com" , "" )
+      , Str "."
+      ]
+  , Header 1 ( "" , [] , [] ) [ Str "Macros" ]
+  , Para
+      [ Strong [ Str "Me" , Space , Str "Myself" ]
+      , Space
+      , Str "and"
+      , Space
+      , Str "I."
+      , Space
+      , Emph
+          [ Str "The"
+          , Space
+          , Str "author"
+          , Space
+          , Str "is"
+          , Space
+          , Str "John"
+          , Space
+          , Str "Jones."
+          ]
+      , Space
+      , Str "It's"
+      , Space
+      , Str "The"
+      , Space
+      , Strong [ Str "Author" ]
+      , Str "."
+      ]
+  , Header 1 ( "" , [] , [] ) [ Str "Tables" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignRight , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Right" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Left" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Center" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Default" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignRight , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Right" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Left" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Center" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Left" , Space , Emph [ Str "more" ] ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignRight , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Centered" , Space , Str "Header" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Left" , Space , Str "Aligned" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Right" , Space , Str "Aligned" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Default" , Space , Str "aligned" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "First" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "row" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12.0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Example"
+                      , Space
+                      , Str "of"
+                      , Space
+                      , Str "a"
+                      , Space
+                      , Str "row"
+                      , Space
+                      , Str "that"
+                      , Space
+                      , Str "spans"
+                      , Space
+                      , Str "multiple"
+                      , Space
+                      , Str "lines."
+                      ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Second" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "row" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5.0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Here\8217s"
+                      , Space
+                      , Str "another"
+                      , Space
+                      , Str "one."
+                      , Space
+                      , Str "Note"
+                      , Space
+                      , Str "the"
+                      , Space
+                      , Str "blank"
+                      , Space
+                      , Str "line"
+                      , Space
+                      , Str "between"
+                      , Space
+                      , Str "rows."
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Table"
+      , Space
+      , Str "without"
+      , Space
+      , Str "column"
+      , Space
+      , Str "headers:"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignRight , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignRight , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "12" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "123" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignRight , ColWidth 0.5 )
+      , ( AlignLeft , ColWidth 0.5 )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "a" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "b" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "one" ] , Para [ Str "two" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ CodeBlock ( "" , [] , [] ) "some\n   code" ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  ]
diff --git a/test/markdown-citations.native b/test/markdown-citations.native
--- a/test/markdown-citations.native
+++ b/test/markdown-citations.native
@@ -1,17 +1,522 @@
-[Header 1 ("pandoc-with-citeproc-hs",[],[]) [Str "Pandoc",Space,Str "with",Space,Str "citeproc-hs"]
-,BulletList
- [[Para [Cite [Citation {citationId = "nonexistent", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 1, citationHash = 0}] [Str "[@nonexistent]"]]]
- ,[Para [Cite [Citation {citationId = "nonexistent", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 2, citationHash = 0}] [Str "@nonexistent"]]]
- ,[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 3, citationHash = 0}] [Str "@item1"],Space,Str "says",Space,Str "blah."]]
- ,[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Str "p.\160\&30"], citationMode = AuthorInText, citationNoteNum = 4, citationHash = 0}] [Str "@item1",Space,Str "[p.",Space,Str "30]"],Space,Str "says",Space,Str "blah."]]
- ,[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Str "p.\160\&30,",Space,Str "with",Space,Str "suffix"], citationMode = AuthorInText, citationNoteNum = 5, citationHash = 0}] [Str "@item1",Space,Str "[p.",Space,Str "30,",Space,Str "with",Space,Str "suffix]"],Space,Str "says",Space,Str "blah."]]
- ,[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 6, citationHash = 0},Citation {citationId = "item2", citationPrefix = [], citationSuffix = [Space,Str "p.\160\&30"], citationMode = SuppressAuthor, citationNoteNum = 6, citationHash = 0},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [Str "see",Space,Str "also"], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 6, citationHash = 0}] [Str "@item1",Space,Str "[-@item2",Space,Str "p.",Space,Str "30;",Space,Str "see",Space,Str "also",Space,Str "@\1087\1091\1085\1082\1090\&3]"],Space,Str "says",Space,Str "blah."]]
- ,[Para [Str "In",Space,Str "a",Space,Str "note.",Note [Para [Cite [Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [], citationSuffix = [Str "p.\160\&12"], citationMode = AuthorInText, citationNoteNum = 7, citationHash = 0}] [Str "@\1087\1091\1085\1082\1090\&3",Space,Str "[p.",Space,Str "12]"],Space,Str "and",Space,Str "a",Space,Str "citation",Space,Str "without",Space,Str "locators",Space,Cite [Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 7, citationHash = 0}] [Str "[@\1087\1091\1085\1082\1090\&3]"],Str "."]]]]
- ,[Para [Str "A",Space,Str "citation",Space,Str "group",Space,Cite [Citation {citationId = "item1", citationPrefix = [Str "see"], citationSuffix = [Space,Str "chap.\160\&3"], citationMode = NormalCitation, citationNoteNum = 8, citationHash = 0},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [Str "also"], citationSuffix = [Space,Str "p.\160\&34-35"], citationMode = NormalCitation, citationNoteNum = 8, citationHash = 0}] [Str "[see",Space,Str "@item1",Space,Str "chap.",Space,Str "3;",Space,Str "also",Space,Str "@\1087\1091\1085\1082\1090\&3",Space,Str "p.",Space,Str "34-35]"],Str "."]]
- ,[Para [Str "Another",Space,Str "one",Space,Cite [Citation {citationId = "item1", citationPrefix = [Str "see"], citationSuffix = [Space,Str "p.\160\&34-35"], citationMode = NormalCitation, citationNoteNum = 9, citationHash = 0}] [Str "[see",Space,Str "@item1",Space,Str "p.",Space,Str "34-35]"],Str "."]]
- ,[Para [Str "And",Space,Str "another",Space,Str "one",Space,Str "in",Space,Str "a",Space,Str "note.",Note [Para [Str "Some",Space,Str "citations",Space,Cite [Citation {citationId = "item1", citationPrefix = [Str "see"], citationSuffix = [Space,Str "chap.\160\&3"], citationMode = NormalCitation, citationNoteNum = 10, citationHash = 0},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 10, citationHash = 0},Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 10, citationHash = 0}] [Str "[see",Space,Str "@item1",Space,Str "chap.",Space,Str "3;",Space,Str "@\1087\1091\1085\1082\1090\&3;",Space,Str "@item2]"],Str "."]]]]
- ,[Para [Str "Citation",Space,Str "with",Space,Str "a",Space,Str "suffix",Space,Str "and",Space,Str "locator",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Space,Str "pp.\160\&33,",Space,Str "35-37,",Space,Str "and",Space,Str "nowhere",Space,Str "else"], citationMode = NormalCitation, citationNoteNum = 11, citationHash = 0}] [Str "[@item1",Space,Str "pp.",Space,Str "33,",Space,Str "35-37,",Space,Str "and",Space,Str "nowhere",Space,Str "else]"],Str "."]]
- ,[Para [Str "Citation",Space,Str "with",Space,Str "suffix",Space,Str "only",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Space,Str "and",Space,Str "nowhere",Space,Str "else"], citationMode = NormalCitation, citationNoteNum = 12, citationHash = 0}] [Str "[@item1",Space,Str "and",Space,Str "nowhere",Space,Str "else]"],Str "."]]
- ,[Para [Str "Now",Space,Str "some",Space,Str "modifiers.",Note [Para [Str "Like",Space,Str "a",Space,Str "citation",Space,Str "without",Space,Str "author:",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = SuppressAuthor, citationNoteNum = 13, citationHash = 0}] [Str "[-@item1]"],Str ",",Space,Str "and",Space,Str "now",Space,Str "Doe",Space,Str "with",Space,Str "a",Space,Str "locator",Space,Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [Space,Str "p.\160\&44"], citationMode = SuppressAuthor, citationNoteNum = 13, citationHash = 0}] [Str "[-@item2",Space,Str "p.",Space,Str "44]"],Str "."]]]]
- ,[Para [Str "With",Space,Str "some",Space,Str "markup",Space,Cite [Citation {citationId = "item1", citationPrefix = [Emph [Str "see"]], citationSuffix = [Space,Str "p.\160",Strong [Str "32"]], citationMode = NormalCitation, citationNoteNum = 14, citationHash = 0}] [Str "[*see*",Space,Str "@item1",Space,Str "p.",Space,Str "**32**]"],Str "."]]]
-,Header 1 ("references",[],[]) [Str "References"]]
+[ Header
+    1
+    ( "pandoc-with-citeproc-hs" , [] , [] )
+    [ Str "Pandoc"
+    , Space
+    , Str "with"
+    , Space
+    , Str "citeproc-hs"
+    ]
+, BulletList
+    [ [ Para
+          [ Cite
+              [ Citation
+                  { citationId = "nonexistent"
+                  , citationPrefix = []
+                  , citationSuffix = []
+                  , citationMode = NormalCitation
+                  , citationNoteNum = 1
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "[@nonexistent]" ]
+          ]
+      ]
+    , [ Para
+          [ Cite
+              [ Citation
+                  { citationId = "nonexistent"
+                  , citationPrefix = []
+                  , citationSuffix = []
+                  , citationMode = AuthorInText
+                  , citationNoteNum = 2
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "@nonexistent" ]
+          ]
+      ]
+    , [ Para
+          [ Cite
+              [ Citation
+                  { citationId = "item1"
+                  , citationPrefix = []
+                  , citationSuffix = []
+                  , citationMode = AuthorInText
+                  , citationNoteNum = 3
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "@item1" ]
+          , Space
+          , Str "says"
+          , Space
+          , Str "blah."
+          ]
+      ]
+    , [ Para
+          [ Cite
+              [ Citation
+                  { citationId = "item1"
+                  , citationPrefix = []
+                  , citationSuffix = [ Str "p.\160\&30" ]
+                  , citationMode = AuthorInText
+                  , citationNoteNum = 4
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "@item1" , Space , Str "[p." , Space , Str "30]" ]
+          , Space
+          , Str "says"
+          , Space
+          , Str "blah."
+          ]
+      ]
+    , [ Para
+          [ Cite
+              [ Citation
+                  { citationId = "item1"
+                  , citationPrefix = []
+                  , citationSuffix =
+                      [ Str "p.\160\&30,"
+                      , Space
+                      , Str "with"
+                      , Space
+                      , Str "suffix"
+                      ]
+                  , citationMode = AuthorInText
+                  , citationNoteNum = 5
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "@item1"
+              , Space
+              , Str "[p."
+              , Space
+              , Str "30,"
+              , Space
+              , Str "with"
+              , Space
+              , Str "suffix]"
+              ]
+          , Space
+          , Str "says"
+          , Space
+          , Str "blah."
+          ]
+      ]
+    , [ Para
+          [ Cite
+              [ Citation
+                  { citationId = "item1"
+                  , citationPrefix = []
+                  , citationSuffix = []
+                  , citationMode = AuthorInText
+                  , citationNoteNum = 6
+                  , citationHash = 0
+                  }
+              , Citation
+                  { citationId = "item2"
+                  , citationPrefix = []
+                  , citationSuffix = [ Space , Str "p.\160\&30" ]
+                  , citationMode = SuppressAuthor
+                  , citationNoteNum = 6
+                  , citationHash = 0
+                  }
+              , Citation
+                  { citationId = "\1087\1091\1085\1082\1090\&3"
+                  , citationPrefix = [ Str "see" , Space , Str "also" ]
+                  , citationSuffix = []
+                  , citationMode = NormalCitation
+                  , citationNoteNum = 6
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "@item1"
+              , Space
+              , Str "[-@item2"
+              , Space
+              , Str "p."
+              , Space
+              , Str "30;"
+              , Space
+              , Str "see"
+              , Space
+              , Str "also"
+              , Space
+              , Str "@\1087\1091\1085\1082\1090\&3]"
+              ]
+          , Space
+          , Str "says"
+          , Space
+          , Str "blah."
+          ]
+      ]
+    , [ Para
+          [ Str "In"
+          , Space
+          , Str "a"
+          , Space
+          , Str "note."
+          , Note
+              [ Para
+                  [ Cite
+                      [ Citation
+                          { citationId = "\1087\1091\1085\1082\1090\&3"
+                          , citationPrefix = []
+                          , citationSuffix = [ Str "p.\160\&12" ]
+                          , citationMode = AuthorInText
+                          , citationNoteNum = 7
+                          , citationHash = 0
+                          }
+                      ]
+                      [ Str "@\1087\1091\1085\1082\1090\&3"
+                      , Space
+                      , Str "[p."
+                      , Space
+                      , Str "12]"
+                      ]
+                  , Space
+                  , Str "and"
+                  , Space
+                  , Str "a"
+                  , Space
+                  , Str "citation"
+                  , Space
+                  , Str "without"
+                  , Space
+                  , Str "locators"
+                  , Space
+                  , Cite
+                      [ Citation
+                          { citationId = "\1087\1091\1085\1082\1090\&3"
+                          , citationPrefix = []
+                          , citationSuffix = []
+                          , citationMode = NormalCitation
+                          , citationNoteNum = 7
+                          , citationHash = 0
+                          }
+                      ]
+                      [ Str "[@\1087\1091\1085\1082\1090\&3]" ]
+                  , Str "."
+                  ]
+              ]
+          ]
+      ]
+    , [ Para
+          [ Str "A"
+          , Space
+          , Str "citation"
+          , Space
+          , Str "group"
+          , Space
+          , Cite
+              [ Citation
+                  { citationId = "item1"
+                  , citationPrefix = [ Str "see" ]
+                  , citationSuffix = [ Space , Str "chap.\160\&3" ]
+                  , citationMode = NormalCitation
+                  , citationNoteNum = 8
+                  , citationHash = 0
+                  }
+              , Citation
+                  { citationId = "\1087\1091\1085\1082\1090\&3"
+                  , citationPrefix = [ Str "also" ]
+                  , citationSuffix = [ Space , Str "p.\160\&34-35" ]
+                  , citationMode = NormalCitation
+                  , citationNoteNum = 8
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "[see"
+              , Space
+              , Str "@item1"
+              , Space
+              , Str "chap."
+              , Space
+              , Str "3;"
+              , Space
+              , Str "also"
+              , Space
+              , Str "@\1087\1091\1085\1082\1090\&3"
+              , Space
+              , Str "p."
+              , Space
+              , Str "34-35]"
+              ]
+          , Str "."
+          ]
+      ]
+    , [ Para
+          [ Str "Another"
+          , Space
+          , Str "one"
+          , Space
+          , Cite
+              [ Citation
+                  { citationId = "item1"
+                  , citationPrefix = [ Str "see" ]
+                  , citationSuffix = [ Space , Str "p.\160\&34-35" ]
+                  , citationMode = NormalCitation
+                  , citationNoteNum = 9
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "[see"
+              , Space
+              , Str "@item1"
+              , Space
+              , Str "p."
+              , Space
+              , Str "34-35]"
+              ]
+          , Str "."
+          ]
+      ]
+    , [ Para
+          [ Str "And"
+          , Space
+          , Str "another"
+          , Space
+          , Str "one"
+          , Space
+          , Str "in"
+          , Space
+          , Str "a"
+          , Space
+          , Str "note."
+          , Note
+              [ Para
+                  [ Str "Some"
+                  , Space
+                  , Str "citations"
+                  , Space
+                  , Cite
+                      [ Citation
+                          { citationId = "item1"
+                          , citationPrefix = [ Str "see" ]
+                          , citationSuffix =
+                              [ Space , Str "chap.\160\&3" ]
+                          , citationMode = NormalCitation
+                          , citationNoteNum = 10
+                          , citationHash = 0
+                          }
+                      , Citation
+                          { citationId = "\1087\1091\1085\1082\1090\&3"
+                          , citationPrefix = []
+                          , citationSuffix = []
+                          , citationMode = NormalCitation
+                          , citationNoteNum = 10
+                          , citationHash = 0
+                          }
+                      , Citation
+                          { citationId = "item2"
+                          , citationPrefix = []
+                          , citationSuffix = []
+                          , citationMode = NormalCitation
+                          , citationNoteNum = 10
+                          , citationHash = 0
+                          }
+                      ]
+                      [ Str "[see"
+                      , Space
+                      , Str "@item1"
+                      , Space
+                      , Str "chap."
+                      , Space
+                      , Str "3;"
+                      , Space
+                      , Str "@\1087\1091\1085\1082\1090\&3;"
+                      , Space
+                      , Str "@item2]"
+                      ]
+                  , Str "."
+                  ]
+              ]
+          ]
+      ]
+    , [ Para
+          [ Str "Citation"
+          , Space
+          , Str "with"
+          , Space
+          , Str "a"
+          , Space
+          , Str "suffix"
+          , Space
+          , Str "and"
+          , Space
+          , Str "locator"
+          , Space
+          , Cite
+              [ Citation
+                  { citationId = "item1"
+                  , citationPrefix = []
+                  , citationSuffix =
+                      [ Space
+                      , Str "pp.\160\&33,"
+                      , Space
+                      , Str "35-37,"
+                      , Space
+                      , Str "and"
+                      , Space
+                      , Str "nowhere"
+                      , Space
+                      , Str "else"
+                      ]
+                  , citationMode = NormalCitation
+                  , citationNoteNum = 11
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "[@item1"
+              , Space
+              , Str "pp."
+              , Space
+              , Str "33,"
+              , Space
+              , Str "35-37,"
+              , Space
+              , Str "and"
+              , Space
+              , Str "nowhere"
+              , Space
+              , Str "else]"
+              ]
+          , Str "."
+          ]
+      ]
+    , [ Para
+          [ Str "Citation"
+          , Space
+          , Str "with"
+          , Space
+          , Str "suffix"
+          , Space
+          , Str "only"
+          , Space
+          , Cite
+              [ Citation
+                  { citationId = "item1"
+                  , citationPrefix = []
+                  , citationSuffix =
+                      [ Space
+                      , Str "and"
+                      , Space
+                      , Str "nowhere"
+                      , Space
+                      , Str "else"
+                      ]
+                  , citationMode = NormalCitation
+                  , citationNoteNum = 12
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "[@item1"
+              , Space
+              , Str "and"
+              , Space
+              , Str "nowhere"
+              , Space
+              , Str "else]"
+              ]
+          , Str "."
+          ]
+      ]
+    , [ Para
+          [ Str "Now"
+          , Space
+          , Str "some"
+          , Space
+          , Str "modifiers."
+          , Note
+              [ Para
+                  [ Str "Like"
+                  , Space
+                  , Str "a"
+                  , Space
+                  , Str "citation"
+                  , Space
+                  , Str "without"
+                  , Space
+                  , Str "author:"
+                  , Space
+                  , Cite
+                      [ Citation
+                          { citationId = "item1"
+                          , citationPrefix = []
+                          , citationSuffix = []
+                          , citationMode = SuppressAuthor
+                          , citationNoteNum = 13
+                          , citationHash = 0
+                          }
+                      ]
+                      [ Str "[-@item1]" ]
+                  , Str ","
+                  , Space
+                  , Str "and"
+                  , Space
+                  , Str "now"
+                  , Space
+                  , Str "Doe"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "a"
+                  , Space
+                  , Str "locator"
+                  , Space
+                  , Cite
+                      [ Citation
+                          { citationId = "item2"
+                          , citationPrefix = []
+                          , citationSuffix =
+                              [ Space , Str "p.\160\&44" ]
+                          , citationMode = SuppressAuthor
+                          , citationNoteNum = 13
+                          , citationHash = 0
+                          }
+                      ]
+                      [ Str "[-@item2"
+                      , Space
+                      , Str "p."
+                      , Space
+                      , Str "44]"
+                      ]
+                  , Str "."
+                  ]
+              ]
+          ]
+      ]
+    , [ Para
+          [ Str "With"
+          , Space
+          , Str "some"
+          , Space
+          , Str "markup"
+          , Space
+          , Cite
+              [ Citation
+                  { citationId = "item1"
+                  , citationPrefix = [ Emph [ Str "see" ] ]
+                  , citationSuffix =
+                      [ Space , Str "p.\160" , Strong [ Str "32" ] ]
+                  , citationMode = NormalCitation
+                  , citationNoteNum = 14
+                  , citationHash = 0
+                  }
+              ]
+              [ Str "[*see*"
+              , Space
+              , Str "@item1"
+              , Space
+              , Str "p."
+              , Space
+              , Str "**32**]"
+              ]
+          , Str "."
+          ]
+      ]
+    ]
+, Header 1 ( "references" , [] , [] ) [ Str "References" ]
+]
diff --git a/test/markdown-reader-more.native b/test/markdown-reader-more.native
--- a/test/markdown-reader-more.native
+++ b/test/markdown-reader-more.native
@@ -1,311 +1,1344 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "Author",Space,Str "One"],MetaInlines [Str "Author",Space,Str "Two"],MetaInlines [Str "Author",Space,Str "Three"],MetaInlines [Str "Author",Space,Str "Four"]]),("title",MetaInlines [Str "Title",SoftBreak,Str "spanning",Space,Str "multiple",Space,Str "lines"])]})
-[Header 1 ("additional-markdown-reader-tests",[],[]) [Str "Additional",Space,Str "markdown",Space,Str "reader",Space,Str "tests"]
-,Header 2 ("blank-line-before-url-in-link-reference",[],[]) [Str "Blank",Space,Str "line",Space,Str "before",Space,Str "URL",Space,Str "in",Space,Str "link",Space,Str "reference"]
-,Para [Link ("",[],[]) [Str "foo"] ("/url",""),Space,Str "and",Space,Link ("",[],[]) [Str "bar"] ("/url","title")]
-,Header 2 ("raw-context-environments",[],[]) [Str "Raw",Space,Str "ConTeXt",Space,Str "environments"]
-,RawBlock (Format "tex") "\\placeformula \\startformula"
-,Para [Str "L_{1}",Space,Str "=",Space,Str "L_{2}",SoftBreak,RawInline (Format "tex") "\\stopformula"]
-,RawBlock (Format "tex") "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"
-,Header 2 ("raw-latex-environments",[],[]) [Str "Raw",Space,Str "LaTeX",Space,Str "environments"]
-,RawBlock (Format "tex") "\\begin{center}\n\\begin{tikzpicture}[baseline={([yshift=+-.5ex]current bounding box.center)}, level distance=24pt]\n\\Tree [.{S} [.NP John\\index{i} ] [.VP [.V likes ] [.NP himself\\index{i,*j} ]]]\n\\end{tikzpicture}\n\\end{center}"
-,Header 2 ("urls-with-spaces-and-punctuation",[],[]) [Str "URLs",Space,Str "with",Space,Str "spaces",Space,Str "and",Space,Str "punctuation"]
-,Para [Link ("",[],[]) [Str "foo"] ("/bar%20and%20baz",""),SoftBreak,Link ("",[],[]) [Str "foo"] ("/bar%20and%20baz",""),SoftBreak,Link ("",[],[]) [Str "foo"] ("/bar%20and%20baz",""),SoftBreak,Link ("",[],[]) [Str "foo"] ("bar%20baz","title")]
-,Para [Link ("",[],[]) [Str "baz"] ("/foo%20foo",""),Space,Link ("",[],[]) [Str "bam"] ("/foo%20fee",""),Space,Link ("",[],[]) [Str "bork"] ("/foo/zee%20zob","title")]
-,Para [Link ("",[],[]) [Str "Ward\8217s",Space,Str "method."] ("http://en.wikipedia.org/wiki/Ward's_method","")]
-,Header 2 ("horizontal-rules-with-spaces-at-end",[],[]) [Str "Horizontal",Space,Str "rules",Space,Str "with",Space,Str "spaces",Space,Str "at",Space,Str "end"]
-,HorizontalRule
-,HorizontalRule
-,Header 2 ("raw-html-before-header",[],[]) [Str "Raw",Space,Str "HTML",Space,Str "before",Space,Str "header"]
-,Para [RawInline (Format "html") "<a>",RawInline (Format "html") "</a>"]
-,Header 3 ("my-header",[],[]) [Str "my",Space,Str "header"]
-,Header 2 ("in-math",[],[]) [Str "$",Space,Str "in",Space,Str "math"]
-,Para [Math InlineMath "\\$2 + \\$3"]
-,Para [Math InlineMath "x = \\text{the $n$th root of $y$}"]
-,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "math:"]
-,Para [Str "$PATH",Space,Str "90",Space,Str "$PATH"]
-,Header 2 ("commented-out-list-item",[],[]) [Str "Commented-out",Space,Str "list",Space,Str "item"]
-,BulletList
- [[Plain [Str "one",SoftBreak,RawInline (Format "html") "<!--\n- two\n-->"]]
- ,[Plain [Str "three"]]]
-,Header 2 ("indented-code-at-beginning-of-list",[],[]) [Str "Indented",Space,Str "code",Space,Str "at",Space,Str "beginning",Space,Str "of",Space,Str "list"]
-,BulletList
- [[CodeBlock ("",[],[]) "code\ncode"
-  ,OrderedList (1,Decimal,Period)
-   [[CodeBlock ("",[],[]) "code\ncode"]
-   ,[CodeBlock ("",[],[]) "code\ncode"]]
-  ,BulletList
-   [[CodeBlock ("",[],[]) "code\ncode"]
-   ,[Plain [Str "no",Space,Str "code"]]]]]
-,Header 2 ("backslash-newline",[],[]) [Str "Backslash",Space,Str "newline"]
-,Para [Str "hi",LineBreak,Str "there"]
-,Header 2 ("code-spans",[],[]) [Str "Code",Space,Str "spans"]
-,Para [Code ("",[],[]) "hi\\"]
-,Para [Code ("",[],[]) "hi there"]
-,Para [Code ("",[],[]) "hi````there"]
-,Para [Str "`hi"]
-,Para [Str "there`"]
-,Header 2 ("multilingual-urls",[],[]) [Str "Multilingual",Space,Str "URLs"]
-,Para [Link ("",["uri"],[]) [Str "http://\27979.com?\27979=\27979"] ("http://\27979.com?\27979=\27979","")]
-,Para [Link ("",[],[]) [Str "foo"] ("/bar/\27979?x=\27979","title")]
-,Para [Link ("",["email"],[]) [Str "\27979@foo.\27979.baz"] ("mailto:\27979@foo.\27979.baz","")]
-,Header 2 ("numbered-examples",[],[]) [Str "Numbered",Space,Str "examples"]
-,OrderedList (1,Example,TwoParens)
- [[Plain [Str "First",Space,Str "example."]]
- ,[Plain [Str "Second",Space,Str "example."]]]
-,Para [Str "Explanation",Space,Str "of",Space,Str "examples",Space,Str "(2)",Space,Str "and",Space,Str "(3)."]
-,OrderedList (3,Example,TwoParens)
- [[Plain [Str "Third",Space,Str "example."]]]
-,Header 2 ("macros",[],[]) [Str "Macros"]
-,RawBlock (Format "tex") "\\newcommand{\\tuple}[1]{\\langle #1 \\rangle}"
-,Para [Math InlineMath "\\langle x,y \\rangle"]
-,Header 2 ("case-insensitive-references",[],[]) [Str "Case-insensitive",Space,Str "references"]
-,Para [Link ("",[],[]) [Str "Fum"] ("/fum","")]
-,Para [Link ("",[],[]) [Str "FUM"] ("/fum","")]
-,Para [Link ("",[],[]) [Str "bat"] ("/bat","")]
-,Header 2 ("curly-smart-quotes",[],[]) [Str "Curly",Space,Str "smart",Space,Str "quotes"]
-,Para [Quoted DoubleQuote [Str "Hi"]]
-,Para [Quoted SingleQuote [Str "Hi"]]
-,Header 2 ("consecutive-lists",[],[]) [Str "Consecutive",Space,Str "lists"]
-,BulletList
- [[Plain [Str "one"]]
- ,[Plain [Str "two"]]]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "one"]]
- ,[Plain [Str "two"]]]
-,OrderedList (1,LowerAlpha,Period)
- [[Plain [Str "one"]]
- ,[Plain [Str "two"]]]
-,Header 2 ("implicit-header-references",[],[]) [Str "Implicit",Space,Str "header",Space,Str "references"]
-,Header 3 ("my-header-1",[],[]) [Str "My",Space,Str "header"]
-,Header 3 ("my-other-header",[],[]) [Str "My",Space,Str "other",Space,Str "header"]
-,Para [Str "A",Space,Str "link",Space,Str "to",Space,Link ("",[],[]) [Str "My",Space,Str "header"] ("#my-header-1",""),Str "."]
-,Para [Str "Another",Space,Str "link",Space,Str "to",Space,Link ("",[],[]) [Str "it"] ("#my-header-1",""),Str "."]
-,Para [Str "Should",Space,Str "be",Space,Link ("",[],[]) [Str "case",Space,Str "insensitive"] ("#my-header-1",""),Str "."]
-,Para [Str "Link",Space,Str "to",Space,Link ("",[],[]) [Str "Explicit",Space,Str "header",Space,Str "attributes"] ("#foobar",""),Str "."]
-,Para [Str "But",Space,Str "this",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "link",Space,Str "to",Space,Link ("",[],[]) [Str "My",Space,Str "other",Space,Str "header"] ("/foo",""),Str ",",Space,Str "since",Space,Str "the",Space,Str "reference",Space,Str "is",Space,Str "defined."]
-,Header 2 ("foobar",["baz"],[("key","val")]) [Str "Explicit",Space,Str "header",Space,Str "attributes"]
-,BlockQuote
- [Header 2 ("foobar",["baz"],[("key","val")]) [Str "Header",Space,Str "attributes",Space,Str "inside",Space,Str "block",Space,Str "quote"]]
-,Header 2 ("line-blocks",[],[]) [Str "Line",Space,Str "blocks"]
-,LineBlock
- [[Str "But",Space,Str "can",Space,Str "a",Space,Str "bee",Space,Str "be",Space,Str "said",Space,Str "to",Space,Str "be"]
- ,[Str "\160\160\160\160or",Space,Str "not",Space,Str "to",Space,Str "be",Space,Str "an",Space,Str "entire",Space,Str "bee,"]
- ,[Str "\160\160\160\160\160\160\160\160when",Space,Str "half",Space,Str "the",Space,Str "bee",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "bee,"]
- ,[Str "\160\160\160\160\160\160\160\160\160\160\160\160due",Space,Str "to",Space,Str "some",Space,Str "ancient",Space,Str "injury?"]
- ,[]
- ,[Str "Continuation",Space,Str "line"]
- ,[Str "\160\160and",Space,Str "another"]]
-,Header 2 ("grid-tables",[],[]) [Str "Grid",Space,Str "Tables"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.2638888888888889)
- ,(AlignDefault,ColWidth 0.16666666666666666)
- ,(AlignDefault,ColWidth 0.18055555555555555)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "2"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "3"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r2",Space,Str "d"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Headless"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.2638888888888889)
- ,(AlignDefault,ColWidth 0.16666666666666666)
- ,(AlignDefault,ColWidth 0.18055555555555555)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r2",Space,Str "d"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "With",Space,Str "alignments"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidth 0.2638888888888889)
- ,(AlignLeft,ColWidth 0.16666666666666666)
- ,(AlignCenter,ColWidth 0.18055555555555555)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "2"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "3"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r2",Space,Str "d"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Headless",Space,Str "with",Space,Str "alignments"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidth 0.2638888888888889)
- ,(AlignLeft,ColWidth 0.16666666666666666)
- ,(AlignCenter,ColWidth 0.18055555555555555)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r2",Space,Str "d"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Spaces",Space,Str "at",Space,Str "ends",Space,Str "of",Space,Str "lines"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.2638888888888889)
- ,(AlignDefault,ColWidth 0.16666666666666666)
- ,(AlignDefault,ColWidth 0.18055555555555555)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r2",Space,Str "d"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiple",Space,Str "blocks",Space,Str "in",Space,Str "a",Space,Str "cell"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.2638888888888889)
- ,(AlignDefault,ColWidth 0.16666666666666666)
- ,(AlignDefault,ColWidth 0.18055555555555555)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Header 1 ("col-1",[],[]) [Str "col",Space,Str "1"]
-    ,Plain [Str "col",Space,Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Header 1 ("col-2",[],[]) [Str "col",Space,Str "2"]
-    ,Plain [Str "col",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Header 1 ("col-3",[],[]) [Str "col",Space,Str "3"]
-    ,Plain [Str "col",Space,Str "3"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "r1",Space,Str "a"]
-    ,Para [Str "r1",Space,Str "bis"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [BulletList
-     [[Plain [Str "b"]]
-     ,[Plain [Str "b",Space,Str "2"]]
-     ,[Plain [Str "b",Space,Str "2"]]]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c",SoftBreak,Str "c",Space,Str "2",SoftBreak,Str "c",Space,Str "2"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Empty",Space,Str "cells"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 5.555555555555555e-2)
- ,(AlignDefault,ColWidth 5.555555555555555e-2)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]])]
- (TableFoot ("",[],[])
- [])
-,Header 2 ("entities-in-links-and-titles",[],[]) [Str "Entities",Space,Str "in",Space,Str "links",Space,Str "and",Space,Str "titles"]
-,Para [Link ("",[],[]) [Str "link"] ("/\252rl","\246\246!")]
-,Para [Link ("",["uri"],[]) [Str "http://g\246\246gle.com"] ("http://g\246\246gle.com","")]
-,Para [Link ("",["email"],[]) [Str "me@ex\228mple.com"] ("mailto:me@ex\228mple.com","")]
-,Para [Link ("",[],[]) [Str "foobar"] ("/\252rl","\246\246!")]
-,Header 2 ("parentheses-in-urls",[],[]) [Str "Parentheses",Space,Str "in",Space,Str "URLs"]
-,Para [Link ("",[],[]) [Str "link"] ("/hi(there)","")]
-,Para [Link ("",[],[]) [Str "link"] ("/hithere)","")]
-,Para [Link ("",[],[]) [Str "linky"] ("hi_(there_(nested))","")]
-,Header 2 ("backslashes-in-link-references",[],[]) [Str "Backslashes",Space,Str "in",Space,Str "link",Space,Str "references"]
-,Para [Link ("",[],[]) [Str "*",RawInline (Format "tex") "\\a"] ("b","")]
-,Header 2 ("reference-link-fallbacks",[],[]) [Str "Reference",Space,Str "link",Space,Str "fallbacks"]
-,Para [Str "[",Emph [Str "not",Space,Str "a",Space,Str "link"],Str "]",Space,Str "[",Emph [Str "nope"],Str "]\8230"]
-,Header 2 ("reference-link-followed-by-a-citation",[],[]) [Str "Reference",Space,Str "link",Space,Str "followed",Space,Str "by",Space,Str "a",Space,Str "citation"]
-,Para [Str "MapReduce",Space,Str "is",Space,Str "a",Space,Str "paradigm",Space,Str "popularized",Space,Str "by",Space,Link ("",[],[]) [Str "Google"] ("http://google.com",""),Space,Cite [Citation {citationId = "mapreduce", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 2, citationHash = 0}] [Str "[@mapreduce]"],Space,Str "as",Space,Str "its",SoftBreak,Str "most",Space,Str "vocal",Space,Str "proponent."]
-,Header 2 ("empty-reference-links",[],[]) [Str "Empty",Space,Str "reference",Space,Str "links"]
-,Para [Str "bar"]
-,Para [Link ("",[],[]) [Str "foo2"] ("","")]
-,Header 2 ("wrapping-shouldnt-introduce-new-list-items",[],[]) [Str "Wrapping",Space,Str "shouldn\8217t",Space,Str "introduce",Space,Str "new",Space,Str "list",Space,Str "items"]
-,BulletList
- [[Plain [Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "2015."]]]
-,Header 2 ("bracketed-spans",[],[]) [Str "Bracketed",Space,Str "spans"]
-,Para [Span ("id",["class"],[("key","val")]) [Emph [Str "foo"],Space,Str "bar",Space,Str "baz",Space,Link ("",[],[]) [Str "link"] ("url","")]]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author"
+            , MetaList
+                [ MetaInlines [ Str "Author" , Space , Str "One" ]
+                , MetaInlines [ Str "Author" , Space , Str "Two" ]
+                , MetaInlines [ Str "Author" , Space , Str "Three" ]
+                , MetaInlines [ Str "Author" , Space , Str "Four" ]
+                ]
+            )
+          , ( "title"
+            , MetaInlines
+                [ Str "Title"
+                , SoftBreak
+                , Str "spanning"
+                , Space
+                , Str "multiple"
+                , Space
+                , Str "lines"
+                ]
+            )
+          ]
+    }
+  [ Header
+      1
+      ( "additional-markdown-reader-tests" , [] , [] )
+      [ Str "Additional"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "reader"
+      , Space
+      , Str "tests"
+      ]
+  , Header
+      2
+      ( "blank-line-before-url-in-link-reference" , [] , [] )
+      [ Str "Blank"
+      , Space
+      , Str "line"
+      , Space
+      , Str "before"
+      , Space
+      , Str "URL"
+      , Space
+      , Str "in"
+      , Space
+      , Str "link"
+      , Space
+      , Str "reference"
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "foo" ] ( "/url" , "" )
+      , Space
+      , Str "and"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url" , "title" )
+      ]
+  , Header
+      2
+      ( "raw-context-environments" , [] , [] )
+      [ Str "Raw"
+      , Space
+      , Str "ConTeXt"
+      , Space
+      , Str "environments"
+      ]
+  , RawBlock (Format "tex") "\\placeformula \\startformula"
+  , Para
+      [ Str "L_{1}"
+      , Space
+      , Str "="
+      , Space
+      , Str "L_{2}"
+      , SoftBreak
+      , RawInline (Format "tex") "\\stopformula"
+      ]
+  , RawBlock
+      (Format "tex")
+      "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"
+  , Header
+      2
+      ( "raw-latex-environments" , [] , [] )
+      [ Str "Raw"
+      , Space
+      , Str "LaTeX"
+      , Space
+      , Str "environments"
+      ]
+  , RawBlock
+      (Format "tex")
+      "\\begin{center}\n\\begin{tikzpicture}[baseline={([yshift=+-.5ex]current bounding box.center)}, level distance=24pt]\n\\Tree [.{S} [.NP John\\index{i} ] [.VP [.V likes ] [.NP himself\\index{i,*j} ]]]\n\\end{tikzpicture}\n\\end{center}"
+  , Header
+      2
+      ( "urls-with-spaces-and-punctuation" , [] , [] )
+      [ Str "URLs"
+      , Space
+      , Str "with"
+      , Space
+      , Str "spaces"
+      , Space
+      , Str "and"
+      , Space
+      , Str "punctuation"
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] ) [ Str "foo" ] ( "/bar%20and%20baz" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "foo" ] ( "/bar%20and%20baz" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "foo" ] ( "/bar%20and%20baz" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "foo" ] ( "bar%20baz" , "title" )
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "baz" ] ( "/foo%20foo" , "" )
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bam" ] ( "/foo%20fee" , "" )
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "bork" ]
+          ( "/foo/zee%20zob" , "title" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Ward\8217s" , Space , Str "method." ]
+          ( "http://en.wikipedia.org/wiki/Ward's_method" , "" )
+      ]
+  , Header
+      2
+      ( "horizontal-rules-with-spaces-at-end" , [] , [] )
+      [ Str "Horizontal"
+      , Space
+      , Str "rules"
+      , Space
+      , Str "with"
+      , Space
+      , Str "spaces"
+      , Space
+      , Str "at"
+      , Space
+      , Str "end"
+      ]
+  , HorizontalRule
+  , HorizontalRule
+  , Header
+      2
+      ( "raw-html-before-header" , [] , [] )
+      [ Str "Raw"
+      , Space
+      , Str "HTML"
+      , Space
+      , Str "before"
+      , Space
+      , Str "header"
+      ]
+  , Para
+      [ RawInline (Format "html") "<a>"
+      , RawInline (Format "html") "</a>"
+      ]
+  , Header
+      3
+      ( "my-header" , [] , [] )
+      [ Str "my" , Space , Str "header" ]
+  , Header
+      2
+      ( "in-math" , [] , [] )
+      [ Str "$" , Space , Str "in" , Space , Str "math" ]
+  , Para [ Math InlineMath "\\$2 + \\$3" ]
+  , Para
+      [ Math InlineMath "x = \\text{the $n$th root of $y$}" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "math:"
+      ]
+  , Para
+      [ Str "$PATH" , Space , Str "90" , Space , Str "$PATH" ]
+  , Header
+      2
+      ( "commented-out-list-item" , [] , [] )
+      [ Str "Commented-out"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item"
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "one"
+            , SoftBreak
+            , RawInline (Format "html") "<!--\n- two\n-->"
+            ]
+        ]
+      , [ Plain [ Str "three" ] ]
+      ]
+  , Header
+      2
+      ( "indented-code-at-beginning-of-list" , [] , [] )
+      [ Str "Indented"
+      , Space
+      , Str "code"
+      , Space
+      , Str "at"
+      , Space
+      , Str "beginning"
+      , Space
+      , Str "of"
+      , Space
+      , Str "list"
+      ]
+  , BulletList
+      [ [ CodeBlock ( "" , [] , [] ) "code\ncode"
+        , OrderedList
+            ( 1 , Decimal , Period )
+            [ [ CodeBlock ( "" , [] , [] ) "code\ncode" ]
+            , [ CodeBlock ( "" , [] , [] ) "code\ncode" ]
+            ]
+        , BulletList
+            [ [ CodeBlock ( "" , [] , [] ) "code\ncode" ]
+            , [ Plain [ Str "no" , Space , Str "code" ] ]
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "backslash-newline" , [] , [] )
+      [ Str "Backslash" , Space , Str "newline" ]
+  , Para [ Str "hi" , LineBreak , Str "there" ]
+  , Header
+      2
+      ( "code-spans" , [] , [] )
+      [ Str "Code" , Space , Str "spans" ]
+  , Para [ Code ( "" , [] , [] ) "hi\\" ]
+  , Para [ Code ( "" , [] , [] ) "hi there" ]
+  , Para [ Code ( "" , [] , [] ) "hi````there" ]
+  , Para [ Str "`hi" ]
+  , Para [ Str "there`" ]
+  , Header
+      2
+      ( "multilingual-urls" , [] , [] )
+      [ Str "Multilingual" , Space , Str "URLs" ]
+  , Para
+      [ Link
+          ( "" , [ "uri" ] , [] )
+          [ Str "http://\27979.com?\27979=\27979" ]
+          ( "http://\27979.com?\27979=\27979" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "foo" ]
+          ( "/bar/\27979?x=\27979" , "title" )
+      ]
+  , Para
+      [ Link
+          ( "" , [ "email" ] , [] )
+          [ Str "\27979@foo.\27979.baz" ]
+          ( "mailto:\27979@foo.\27979.baz" , "" )
+      ]
+  , Header
+      2
+      ( "numbered-examples" , [] , [] )
+      [ Str "Numbered" , Space , Str "examples" ]
+  , OrderedList
+      ( 1 , Example , TwoParens )
+      [ [ Plain [ Str "First" , Space , Str "example." ] ]
+      , [ Plain [ Str "Second" , Space , Str "example." ] ]
+      ]
+  , Para
+      [ Str "Explanation"
+      , Space
+      , Str "of"
+      , Space
+      , Str "examples"
+      , Space
+      , Str "(2)"
+      , Space
+      , Str "and"
+      , Space
+      , Str "(3)."
+      ]
+  , OrderedList
+      ( 3 , Example , TwoParens )
+      [ [ Plain [ Str "Third" , Space , Str "example." ] ] ]
+  , Header 2 ( "macros" , [] , [] ) [ Str "Macros" ]
+  , RawBlock
+      (Format "tex")
+      "\\newcommand{\\tuple}[1]{\\langle #1 \\rangle}"
+  , Para [ Math InlineMath "\\langle x,y \\rangle" ]
+  , Header
+      2
+      ( "case-insensitive-references" , [] , [] )
+      [ Str "Case-insensitive" , Space , Str "references" ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "Fum" ] ( "/fum" , "" ) ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "FUM" ] ( "/fum" , "" ) ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "bat" ] ( "/bat" , "" ) ]
+  , Header
+      2
+      ( "curly-smart-quotes" , [] , [] )
+      [ Str "Curly" , Space , Str "smart" , Space , Str "quotes" ]
+  , Para [ Quoted DoubleQuote [ Str "Hi" ] ]
+  , Para [ Quoted SingleQuote [ Str "Hi" ] ]
+  , Header
+      2
+      ( "consecutive-lists" , [] , [] )
+      [ Str "Consecutive" , Space , Str "lists" ]
+  , BulletList
+      [ [ Plain [ Str "one" ] ] , [ Plain [ Str "two" ] ] ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "one" ] ] , [ Plain [ Str "two" ] ] ]
+  , OrderedList
+      ( 1 , LowerAlpha , Period )
+      [ [ Plain [ Str "one" ] ] , [ Plain [ Str "two" ] ] ]
+  , Header
+      2
+      ( "implicit-header-references" , [] , [] )
+      [ Str "Implicit"
+      , Space
+      , Str "header"
+      , Space
+      , Str "references"
+      ]
+  , Header
+      3
+      ( "my-header-1" , [] , [] )
+      [ Str "My" , Space , Str "header" ]
+  , Header
+      3
+      ( "my-other-header" , [] , [] )
+      [ Str "My" , Space , Str "other" , Space , Str "header" ]
+  , Para
+      [ Str "A"
+      , Space
+      , Str "link"
+      , Space
+      , Str "to"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "My" , Space , Str "header" ]
+          ( "#my-header-1" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Another"
+      , Space
+      , Str "link"
+      , Space
+      , Str "to"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "it" ] ( "#my-header-1" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Should"
+      , Space
+      , Str "be"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "case" , Space , Str "insensitive" ]
+          ( "#my-header-1" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Link"
+      , Space
+      , Str "to"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "Explicit"
+          , Space
+          , Str "header"
+          , Space
+          , Str "attributes"
+          ]
+          ( "#foobar" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "But"
+      , Space
+      , Str "this"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link"
+      , Space
+      , Str "to"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "My" , Space , Str "other" , Space , Str "header" ]
+          ( "/foo" , "" )
+      , Str ","
+      , Space
+      , Str "since"
+      , Space
+      , Str "the"
+      , Space
+      , Str "reference"
+      , Space
+      , Str "is"
+      , Space
+      , Str "defined."
+      ]
+  , Header
+      2
+      ( "foobar" , [ "baz" ] , [ ( "key" , "val" ) ] )
+      [ Str "Explicit"
+      , Space
+      , Str "header"
+      , Space
+      , Str "attributes"
+      ]
+  , BlockQuote
+      [ Header
+          2
+          ( "foobar" , [ "baz" ] , [ ( "key" , "val" ) ] )
+          [ Str "Header"
+          , Space
+          , Str "attributes"
+          , Space
+          , Str "inside"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote"
+          ]
+      ]
+  , Header
+      2
+      ( "line-blocks" , [] , [] )
+      [ Str "Line" , Space , Str "blocks" ]
+  , LineBlock
+      [ [ Str "But"
+        , Space
+        , Str "can"
+        , Space
+        , Str "a"
+        , Space
+        , Str "bee"
+        , Space
+        , Str "be"
+        , Space
+        , Str "said"
+        , Space
+        , Str "to"
+        , Space
+        , Str "be"
+        ]
+      , [ Str "\160\160\160\160or"
+        , Space
+        , Str "not"
+        , Space
+        , Str "to"
+        , Space
+        , Str "be"
+        , Space
+        , Str "an"
+        , Space
+        , Str "entire"
+        , Space
+        , Str "bee,"
+        ]
+      , [ Str "\160\160\160\160\160\160\160\160when"
+        , Space
+        , Str "half"
+        , Space
+        , Str "the"
+        , Space
+        , Str "bee"
+        , Space
+        , Str "is"
+        , Space
+        , Str "not"
+        , Space
+        , Str "a"
+        , Space
+        , Str "bee,"
+        ]
+      , [ Str
+            "\160\160\160\160\160\160\160\160\160\160\160\160due"
+        , Space
+        , Str "to"
+        , Space
+        , Str "some"
+        , Space
+        , Str "ancient"
+        , Space
+        , Str "injury?"
+        ]
+      , []
+      , [ Str "Continuation" , Space , Str "line" ]
+      , [ Str "\160\160and" , Space , Str "another" ]
+      ]
+  , Header
+      2
+      ( "grid-tables" , [] , [] )
+      [ Str "Grid" , Space , Str "Tables" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidth 0.2638888888888889 )
+      , ( AlignDefault , ColWidth 0.16666666666666666 )
+      , ( AlignDefault , ColWidth 0.18055555555555555 )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "1" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "2" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "3" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "r1"
+                      , Space
+                      , Str "a"
+                      , SoftBreak
+                      , Str "r1"
+                      , Space
+                      , Str "bis"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "b"
+                      , SoftBreak
+                      , Str "b"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "c"
+                      , SoftBreak
+                      , Str "c"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r2" , Space , Str "d" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para [ Str "Headless" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidth 0.2638888888888889 )
+      , ( AlignDefault , ColWidth 0.16666666666666666 )
+      , ( AlignDefault , ColWidth 0.18055555555555555 )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "r1"
+                      , Space
+                      , Str "a"
+                      , SoftBreak
+                      , Str "r1"
+                      , Space
+                      , Str "bis"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "b"
+                      , SoftBreak
+                      , Str "b"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "c"
+                      , SoftBreak
+                      , Str "c"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r2" , Space , Str "d" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para [ Str "With" , Space , Str "alignments" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignRight , ColWidth 0.2638888888888889 )
+      , ( AlignLeft , ColWidth 0.16666666666666666 )
+      , ( AlignCenter , ColWidth 0.18055555555555555 )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "1" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "2" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "3" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "r1"
+                      , Space
+                      , Str "a"
+                      , SoftBreak
+                      , Str "r1"
+                      , Space
+                      , Str "bis"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "b"
+                      , SoftBreak
+                      , Str "b"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "c"
+                      , SoftBreak
+                      , Str "c"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r2" , Space , Str "d" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Headless"
+      , Space
+      , Str "with"
+      , Space
+      , Str "alignments"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignRight , ColWidth 0.2638888888888889 )
+      , ( AlignLeft , ColWidth 0.16666666666666666 )
+      , ( AlignCenter , ColWidth 0.18055555555555555 )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "r1"
+                      , Space
+                      , Str "a"
+                      , SoftBreak
+                      , Str "r1"
+                      , Space
+                      , Str "bis"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "b"
+                      , SoftBreak
+                      , Str "b"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "c"
+                      , SoftBreak
+                      , Str "c"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r2" , Space , Str "d" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Spaces"
+      , Space
+      , Str "at"
+      , Space
+      , Str "ends"
+      , Space
+      , Str "of"
+      , Space
+      , Str "lines"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidth 0.2638888888888889 )
+      , ( AlignDefault , ColWidth 0.16666666666666666 )
+      , ( AlignDefault , ColWidth 0.18055555555555555 )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "r1"
+                      , Space
+                      , Str "a"
+                      , SoftBreak
+                      , Str "r1"
+                      , Space
+                      , Str "bis"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "b"
+                      , SoftBreak
+                      , Str "b"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "c"
+                      , SoftBreak
+                      , Str "c"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r2" , Space , Str "d" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "blocks"
+      , Space
+      , Str "in"
+      , Space
+      , Str "a"
+      , Space
+      , Str "cell"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidth 0.2638888888888889 )
+      , ( AlignDefault , ColWidth 0.16666666666666666 )
+      , ( AlignDefault , ColWidth 0.18055555555555555 )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Header
+                      1
+                      ( "col-1" , [] , [] )
+                      [ Str "col" , Space , Str "1" ]
+                  , Plain [ Str "col" , Space , Str "1" ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Header
+                      1
+                      ( "col-2" , [] , [] )
+                      [ Str "col" , Space , Str "2" ]
+                  , Plain [ Str "col" , Space , Str "2" ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Header
+                      1
+                      ( "col-3" , [] , [] )
+                      [ Str "col" , Space , Str "3" ]
+                  , Plain [ Str "col" , Space , Str "3" ]
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "r1" , Space , Str "a" ]
+                  , Para [ Str "r1" , Space , Str "bis" ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ BulletList
+                      [ [ Plain [ Str "b" ] ]
+                      , [ Plain [ Str "b" , Space , Str "2" ] ]
+                      , [ Plain [ Str "b" , Space , Str "2" ] ]
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "c"
+                      , SoftBreak
+                      , Str "c"
+                      , Space
+                      , Str "2"
+                      , SoftBreak
+                      , Str "c"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para [ Str "Empty" , Space , Str "cells" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidth 5.555555555555555e-2 )
+      , ( AlignDefault , ColWidth 5.555555555555555e-2 )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header
+      2
+      ( "entities-in-links-and-titles" , [] , [] )
+      [ Str "Entities"
+      , Space
+      , Str "in"
+      , Space
+      , Str "links"
+      , Space
+      , Str "and"
+      , Space
+      , Str "titles"
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] ) [ Str "link" ] ( "/\252rl" , "\246\246!" )
+      ]
+  , Para
+      [ Link
+          ( "" , [ "uri" ] , [] )
+          [ Str "http://g\246\246gle.com" ]
+          ( "http://g\246\246gle.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [ "email" ] , [] )
+          [ Str "me@ex\228mple.com" ]
+          ( "mailto:me@ex\228mple.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "foobar" ]
+          ( "/\252rl" , "\246\246!" )
+      ]
+  , Header
+      2
+      ( "parentheses-in-urls" , [] , [] )
+      [ Str "Parentheses"
+      , Space
+      , Str "in"
+      , Space
+      , Str "URLs"
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "link" ] ( "/hi(there)" , "" )
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "link" ] ( "/hithere)" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "linky" ]
+          ( "hi_(there_(nested))" , "" )
+      ]
+  , Header
+      2
+      ( "backslashes-in-link-references" , [] , [] )
+      [ Str "Backslashes"
+      , Space
+      , Str "in"
+      , Space
+      , Str "link"
+      , Space
+      , Str "references"
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "*" , RawInline (Format "tex") "\\a" ]
+          ( "b" , "" )
+      ]
+  , Header
+      2
+      ( "reference-link-fallbacks" , [] , [] )
+      [ Str "Reference"
+      , Space
+      , Str "link"
+      , Space
+      , Str "fallbacks"
+      ]
+  , Para
+      [ Str "["
+      , Emph [ Str "not" , Space , Str "a" , Space , Str "link" ]
+      , Str "]"
+      , Space
+      , Str "["
+      , Emph [ Str "nope" ]
+      , Str "]\8230"
+      ]
+  , Header
+      2
+      ( "reference-link-followed-by-a-citation" , [] , [] )
+      [ Str "Reference"
+      , Space
+      , Str "link"
+      , Space
+      , Str "followed"
+      , Space
+      , Str "by"
+      , Space
+      , Str "a"
+      , Space
+      , Str "citation"
+      ]
+  , Para
+      [ Str "MapReduce"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paradigm"
+      , Space
+      , Str "popularized"
+      , Space
+      , Str "by"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "Google" ]
+          ( "http://google.com" , "" )
+      , Space
+      , Cite
+          [ Citation
+              { citationId = "mapreduce"
+              , citationPrefix = []
+              , citationSuffix = []
+              , citationMode = NormalCitation
+              , citationNoteNum = 2
+              , citationHash = 0
+              }
+          ]
+          [ Str "[@mapreduce]" ]
+      , Space
+      , Str "as"
+      , Space
+      , Str "its"
+      , SoftBreak
+      , Str "most"
+      , Space
+      , Str "vocal"
+      , Space
+      , Str "proponent."
+      ]
+  , Header
+      2
+      ( "empty-reference-links" , [] , [] )
+      [ Str "Empty"
+      , Space
+      , Str "reference"
+      , Space
+      , Str "links"
+      ]
+  , Para [ Str "bar" ]
+  , Para [ Link ( "" , [] , [] ) [ Str "foo2" ] ( "" , "" ) ]
+  , Header
+      2
+      ( "wrapping-shouldnt-introduce-new-list-items" , [] , [] )
+      [ Str "Wrapping"
+      , Space
+      , Str "shouldn\8217t"
+      , Space
+      , Str "introduce"
+      , Space
+      , Str "new"
+      , Space
+      , Str "list"
+      , Space
+      , Str "items"
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "blah"
+            , Space
+            , Str "2015."
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "bracketed-spans" , [] , [] )
+      [ Str "Bracketed" , Space , Str "spans" ]
+  , Para
+      [ Span
+          ( "id" , [ "class" ] , [ ( "key" , "val" ) ] )
+          [ Emph [ Str "foo" ]
+          , Space
+          , Str "bar"
+          , Space
+          , Str "baz"
+          , Space
+          , Link ( "" , [] , [] ) [ Str "link" ] ( "url" , "" )
+          ]
+      ]
+  ]
diff --git a/test/mediawiki-reader.native b/test/mediawiki-reader.native
--- a/test/mediawiki-reader.native
+++ b/test/mediawiki-reader.native
@@ -1,418 +1,1431 @@
-Pandoc (Meta {unMeta = fromList []})
-[Header 1 ("header",[],[]) [Str "header"]
-,Header 2 ("header_level_two",[],[]) [Str "header",Space,Str "level",Space,Str "two"]
-,Header 3 ("header_level_3",[],[]) [Str "header",Space,Str "level",Space,Str "3"]
-,Header 4 ("header_level_four",[],[]) [Str "header",Space,Emph [Str "level"],Space,Str "four"]
-,Header 5 ("header_level_5",[],[]) [Str "header",Space,Str "level",Space,Str "5"]
-,Header 6 ("header_level_6",[],[]) [Str "header",Space,Str "level",Space,Str "6"]
-,Para [Str "=======",Space,Str "not",Space,Str "a",Space,Str "header",Space,Str "========"]
-,Para [Code ("",[],[]) "==\160not\160a\160header\160=="]
-,Header 2 ("emph_and_strong",[],[]) [Str "emph",Space,Str "and",Space,Str "strong"]
-,Para [Emph [Str "emph"],Space,Strong [Str "strong"]]
-,Para [Strong [Emph [Str "strong",Space,Str "and",Space,Str "emph"]]]
-,Para [Strong [Emph [Str "emph",Space,Str "inside"],Space,Str "strong"]]
-,Para [Strong [Str "strong",Space,Str "with",Space,Emph [Str "emph"]]]
-,Para [Emph [Strong [Str "strong",Space,Str "inside"],Space,Str "emph"]]
-,Header 2 ("horizontal_rule",[],[]) [Str "horizontal",Space,Str "rule"]
-,Para [Str "top"]
-,HorizontalRule
-,Para [Str "bottom"]
-,HorizontalRule
-,Header 2 ("nowiki",[],[]) [Str "nowiki"]
-,Para [Str "''not",Space,Str "emph''"]
-,Header 2 ("strikeout",[],[]) [Str "strikeout"]
-,Para [Strikeout [Str "This",Space,Str "is",Space,Emph [Str "struck",Space,Str "out"]]]
-,Header 2 ("entities",[],[]) [Str "entities"]
-,Para [Str "hi",Space,Str "&",Space,Str "low"]
-,Para [Str "hi",Space,Str "&",Space,Str "low"]
-,Para [Str "G\246del"]
-,Para [Str "\777\2730"]
-,Header 2 ("comments",[],[]) [Str "comments"]
-,Para [Str "inline",Space,Str "comment"]
-,Para [Str "between",Space,Str "blocks"]
-,Header 2 ("linebreaks",[],[]) [Str "linebreaks"]
-,Para [Str "hi",LineBreak,Str "there"]
-,Para [Str "hi",LineBreak,Str "there"]
-,Header 2 ("indents",[],[]) [Str ":",Space,Str "indents"]
-,Para [Str "hi"]
-,DefinitionList
- [([],
-   [[Plain [Str "there"]]])]
-,Para [Str "bud"]
-,Para [Str "hi"]
-,DefinitionList
- [([],
-   [[DefinitionList
-     [([],
-       [[Plain [Str "there"]]])]]])]
-,Para [Str "bud"]
-,Header 2 ("p_tags",[],[]) [Str "p",Space,Str "tags"]
-,Para [Str "hi",Space,Str "there"]
-,Para [Str "bud"]
-,Para [Str "another"]
-,Header 2 ("raw_html",[],[]) [Str "raw",Space,Str "html"]
-,Para [Str "hi",Space,RawInline (Format "html") "<span style=\"color:red\">",Emph [Str "there"],RawInline (Format "html") "</span>",Str "."]
-,Para [RawInline (Format "html") "<ins>",Str "inserted",RawInline (Format "html") "</ins>"]
-,RawBlock (Format "html") "<div class=\"special\">"
-,Para [Str "hi",Space,Emph [Str "there"]]
-,RawBlock (Format "html") "</div>"
-,Header 2 ("sup_sub_del",[],[]) [Str "sup,",Space,Str "sub,",Space,Str "del"]
-,Para [Str "H",Subscript [Str "2"],Str "O",Space,Str "base",Superscript [Emph [Str "exponent"]],SoftBreak,Strikeout [Str "hello"]]
-,Header 2 ("inline_code",[],[]) [Str "inline",Space,Str "code"]
-,Para [Code ("",[],[]) "*\8594*",Space,Code ("",[],[]) "typed",Space,Code ("",["haskell"],[]) ">>="]
-,Header 2 ("code_blocks",[],[]) [Str "code",Space,Str "blocks"]
-,CodeBlock ("",[],[]) "case xs of\n     (_:_) -> reverse xs\n     []    -> ['*']"
-,CodeBlock ("",["haskell"],[]) "case xs of\n     (_:_) -> reverse xs\n     []    -> ['*']"
-,CodeBlock ("",["ruby","numberLines"],[("startFrom","100")]) "widgets.each do |w|\n  print w.price\nend"
-,Header 2 ("block_quotes",[],[]) [Str "block",Space,Str "quotes"]
-,Para [Str "Regular",Space,Str "paragraph"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote."]
- ,Para [Str "With",Space,Str "two",Space,Str "paragraphs."]]
-,Para [Str "Nother",Space,Str "paragraph."]
-,Header 2 ("external_links",[],[]) [Str "external",Space,Str "links"]
-,Para [Link ("",[],[]) [Emph [Str "Google"],Space,Str "search",Space,Str "engine"] ("http://google.com","")]
-,Para [Link ("",[],[]) [Str "http://pandoc.org"] ("http://pandoc.org","")]
-,Para [Link ("",[],[]) [Str "1"] ("http://google.com",""),Space,Link ("",[],[]) [Str "2"] ("http://yahoo.com","")]
-,Para [Link ("",[],[]) [Str "email",Space,Str "me"] ("mailto:info@example.org","")]
-,Header 2 ("internal_links",[],[]) [Str "internal",Space,Str "links"]
-,Para [Link ("",[],[]) [Str "Help"] ("Help","wikilink")]
-,Para [Link ("",[],[]) [Str "the",Space,Str "help",Space,Str "page"] ("Help","wikilink")]
-,Para [Link ("",[],[]) [Str "Helpers"] ("Help","wikilink")]
-,Para [Link ("",[],[]) [Str "Help"] ("Help","wikilink"),Str "ers"]
-,Para [Link ("",[],[]) [Str "Contents"] ("Help:Contents","wikilink")]
-,Para [Link ("",[],[]) [Str "#My",Space,Str "anchor"] ("#My_anchor","wikilink")]
-,Para [Link ("",[],[]) [Str "and",Space,Str "text"] ("Page#with_anchor","wikilink")]
-,Header 2 ("images",[],[]) [Str "images"]
-,Para [Image ("",[],[]) [Str "caption"] ("example.jpg","fig:caption")]
-,Para [Image ("",[],[]) [Str "the",Space,Emph [Str "caption"],Space,Str "with",Space,Link ("",[],[]) [Str "external",Space,Str "link"] ("http://google.com","")] ("example.jpg","fig:the caption with external link")]
-,Para [Image ("",[],[("width","30"),("height","40")]) [Str "caption"] ("example.jpg","fig:caption")]
-,Para [Image ("",[],[("width","30")]) [Str "caption"] ("example.jpg","fig:caption")]
-,Para [Image ("",[],[("width","30")]) [Str "caption"] ("example.jpg","fig:caption")]
-,Para [Image ("",[],[]) [Str "example.jpg"] ("example.jpg","fig:example.jpg")]
-,Para [Image ("",[],[]) [Str "example_es.jpg"] ("example_es.jpg","fig:example_es.jpg")]
-,Header 2 ("lists",[],[]) [Str "lists"]
-,BulletList
- [[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
- ,[Plain [Str "with",Space,Str "an",Space,Str "asterisk",Space,Str "(*)."]
-  ,BulletList
-   [[Plain [Str "More",Space,Str "asterisks",Space,Str "gives",Space,Str "deeper"]
-    ,BulletList
-     [[Plain [Str "and",Space,Str "deeper",Space,Str "levels."]]]]]]
- ,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels."]
-  ,BulletList
-   [[BulletList
-     [[Plain [Str "But",Space,Str "jumping",Space,Str "levels",Space,Str "creates",Space,Str "empty",Space,Str "space."]]]]]]]
-,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "ends",Space,Str "the",Space,Str "list."]
-,BulletList
- [[BulletList
-   [[Plain [Str "two"]]]]
- ,[Plain [Str "one"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
- ,[Plain [Str "with",Space,Str "a",Space,Str "number",Space,Str "sign",Space,Str "(#)."]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "More",Space,Str "number",Space,Str "signs",Space,Str "gives",Space,Str "deeper"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "and",Space,Str "deeper"]]
-     ,[Plain [Str "levels."]]]]]]
- ,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels."]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "But",Space,Str "jumping",Space,Str "levels",Space,Str "creates",Space,Str "empty",Space,Str "space."]]]]]]
- ,[Plain [Str "Blank",Space,Str "lines"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "end",Space,Str "the",Space,Str "list",Space,Str "and",Space,Str "start",Space,Str "another."]]]
-,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "also",SoftBreak,Str "ends",Space,Str "the",Space,Str "list."]
-,DefinitionList
- [([Str "item",Space,Str "1"],
-   [[Plain [Str "definition",Space,Str "1"]]])
- ,([Str "item",Space,Str "2"],
-   [[Plain [Str "definition",Space,Str "2-1"]]
-   ,[Plain [Str "definition",Space,Str "2-2"]]])]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "one"]]
- ,[Plain [Str "two"]
-  ,BulletList
-   [[Plain [Str "two",Space,Str "point",Space,Str "one"]]
-   ,[Plain [Str "two",Space,Str "point",Space,Str "two"]]]]
- ,[Plain [Str "three"]
-  ,DefinitionList
-   [([Str "three",Space,Str "item",Space,Str "one"],
-     [[Plain [Str "three",Space,Str "def",Space,Str "one"]]])]]
- ,[Plain [Str "four"]
-  ,DefinitionList
-   [([],
-     [[Plain [Str "four",Space,Str "def",Space,Str "one"]]
-     ,[Plain [Str "this",Space,Str "looks",Space,Str "like",Space,Str "a",Space,Str "continuation"]]
-     ,[Plain [Str "and",Space,Str "is",Space,Str "often",Space,Str "used"]]
-     ,[Plain [Str "instead",LineBreak,Str "of",Space,Str "<br/>"]]])]]
- ,[Plain [RawInline (Format "mediawiki") "{{{template\n|author=John\n|title=My Book\n}}}"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "five",Space,Str "sub",Space,Str "1"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "five",Space,Str "sub",Space,Str "1",Space,Str "sub",Space,Str "1"]]]]
-   ,[Plain [Str "five",Space,Str "sub",Space,Str "2"]]]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "list",Space,Str "item",Space,Emph [Str "emph"]]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "list",Space,Str "item",Space,Str "B1"]]
-   ,[Plain [Str "list",Space,Str "item",Space,Str "B2"]]]
-  ,Para [Str "continuing",Space,Str "list",Space,Str "item",Space,Str "A1"]]
- ,[Plain [Str "list",Space,Str "item",Space,Str "A2"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "abc"]]
- ,[Plain [Str "def"]]
- ,[Plain [Str "ghi"]]]
-,OrderedList (9,DefaultStyle,DefaultDelim)
- [[Plain [Str "Amsterdam"]]
- ,[Plain [Str "Rotterdam"]]
- ,[Plain [Str "The",Space,Str "Hague"]]]
-,Header 2 ("math",[],[]) [Str "math"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Math InlineMath "x=\\frac{y^\\pi}{z}",Str "."]
-,Para [Str "With",Space,Str "spaces:",Space,Math InlineMath "x=\\frac{y^\\pi}{z}",Str "."]
-,Header 2 ("preformatted_blocks",[],[]) [Str "preformatted",Space,Str "blocks"]
-,Para [Code ("",[],[]) "Start\160each\160line\160with\160a\160space.",LineBreak,Code ("",[],[]) "Text\160is\160",Strong [Code ("",[],[]) "preformatted"],Code ("",[],[]) "\160and",LineBreak,Emph [Code ("",[],[]) "markups"],Code ("",[],[]) "\160",Strong [Emph [Code ("",[],[]) "can"]],Code ("",[],[]) "\160be\160done."]
-,Para [Code ("",[],[]) "\160hell\160\160\160\160\160\160yeah"]
-,Para [Code ("",[],[]) "Start\160with\160a\160space\160in\160the\160first\160column,",LineBreak,Code ("",[],[]) "(before\160the\160<nowiki>).",LineBreak,Code ("",[],[]) "",LineBreak,Code ("",[],[]) "Then\160your\160block\160format\160will\160be",LineBreak,Code ("",[],[]) "\160\160\160\160maintained.",LineBreak,Code ("",[],[]) "",LineBreak,Code ("",[],[]) "This\160is\160good\160for\160copying\160in\160code\160blocks:",LineBreak,Code ("",[],[]) "",LineBreak,Code ("",[],[]) "def\160function():",LineBreak,Code ("",[],[]) "\160\160\160\160\"\"\"documentation\160string\"\"\"",LineBreak,Code ("",[],[]) "",LineBreak,Code ("",[],[]) "\160\160\160\160if\160True:",LineBreak,Code ("",[],[]) "\160\160\160\160\160\160\160\160print\160True",LineBreak,Code ("",[],[]) "\160\160\160\160else:",LineBreak,Code ("",[],[]) "\160\160\160\160\160\160\160\160print\160False"]
-,Para [Str "Not"]
-,RawBlock (Format "html") "<hr/>"
-,Para [Str "preformatted"]
-,Para [Str "Don't",Space,Str "need"]
-,Para [Code ("",[],[]) "a\160blank\160line"]
-,Para [Str "around",Space,Str "a",Space,Str "preformatted",Space,Str "block."]
-,Header 2 ("templates",[],[]) [Str "templates"]
-,RawBlock (Format "mediawiki") "{{Welcome}}"
-,RawBlock (Format "mediawiki") "{{Foo:Bar}}"
-,RawBlock (Format "mediawiki") "{{Thankyou|all your effort|Me}}"
-,Para [Str "Written",Space,RawInline (Format "mediawiki") "{{{date}}}",Space,Str "by",Space,RawInline (Format "mediawiki") "{{{name}}}",Str "."]
-,Header 2 ("tables",[],[]) [Str "tables"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Apple"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Bread"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Pie"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Butter"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Ice",Space,Str "cream"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Food",Space,Str "complements"]])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Orange"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Apple"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Bread"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Pie"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Butter"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Ice",Space,Str "cream"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Food",Space,Str "complements"]])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Orange"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Apple"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Bread"]
-    ,Para [Str "and",Space,Str "cheese"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Pie"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "apple"]]
-     ,[Plain [Str "carrot"]]]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Apple"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "more"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Bread"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Pie"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "more"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Butter"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Ice",Space,Str "cream"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "and",Space,Str "more"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidth 0.25)
- ,(AlignRight,ColWidth 0.125)
- ,(AlignCenter,ColWidth 0.125)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "Center"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "left"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "15.00"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "centered"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "more"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "2.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "more"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Apple"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Bread"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Table ("",[],[]) (Caption Nothing
-     [])
-     [(AlignDefault,ColWidthDefault)
-     ,(AlignDefault,ColWidthDefault)]
-     (TableHead ("",[],[])
-     [Row ("",[],[])
-      [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-       [Para [Str "fruit"]]
-      ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-       [Para [Str "topping"]]]])
-     [(TableBody ("",[],[]) (RowHeadColumns 0)
-      []
-      [Row ("",[],[])
-       [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-        [Para [Str "apple"]]
-       ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-        [Para [Str "ice",Space,Str "cream"]]]])]
-     (TableFoot ("",[],[])
-     [])]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Butter"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Ice",Space,Str "cream"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Orange"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Paragraph",Space,Str "after",Space,Str "the",Space,Str "table."]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "fruit"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Para [Str "topping"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "apple"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "ice",Space,Str "cream"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 2 ("notes",[],[]) [Str "notes"]
-,Para [Str "My",Space,Str "note!",Note [Plain [Str "This."]]]
-,Para [Str "URL",Space,Str "note.",Note [Plain [Link ("",[],[]) [Str "http://docs.python.org/library/functions.html#range"] ("http://docs.python.org/library/functions.html#range","")]]]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Header 1 ( "header" , [] , [] ) [ Str "header" ]
+  , Header
+      2
+      ( "header_level_two" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "two" ]
+  , Header
+      3
+      ( "header_level_3" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "3" ]
+  , Header
+      4
+      ( "header_level_four" , [] , [] )
+      [ Str "header"
+      , Space
+      , Emph [ Str "level" ]
+      , Space
+      , Str "four"
+      ]
+  , Header
+      5
+      ( "header_level_5" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "5" ]
+  , Header
+      6
+      ( "header_level_6" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "6" ]
+  , Para
+      [ Str "======="
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header"
+      , Space
+      , Str "========"
+      ]
+  , Para
+      [ Code ( "" , [] , [] ) "==\160not\160a\160header\160==" ]
+  , Header
+      2
+      ( "emph_and_strong" , [] , [] )
+      [ Str "emph" , Space , Str "and" , Space , Str "strong" ]
+  , Para
+      [ Emph [ Str "emph" ] , Space , Strong [ Str "strong" ] ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "strong" , Space , Str "and" , Space , Str "emph" ]
+          ]
+      ]
+  , Para
+      [ Strong
+          [ Emph [ Str "emph" , Space , Str "inside" ]
+          , Space
+          , Str "strong"
+          ]
+      ]
+  , Para
+      [ Strong
+          [ Str "strong"
+          , Space
+          , Str "with"
+          , Space
+          , Emph [ Str "emph" ]
+          ]
+      ]
+  , Para
+      [ Emph
+          [ Strong [ Str "strong" , Space , Str "inside" ]
+          , Space
+          , Str "emph"
+          ]
+      ]
+  , Header
+      2
+      ( "horizontal_rule" , [] , [] )
+      [ Str "horizontal" , Space , Str "rule" ]
+  , Para [ Str "top" ]
+  , HorizontalRule
+  , Para [ Str "bottom" ]
+  , HorizontalRule
+  , Header 2 ( "nowiki" , [] , [] ) [ Str "nowiki" ]
+  , Para [ Str "''not" , Space , Str "emph''" ]
+  , Header 2 ( "strikeout" , [] , [] ) [ Str "strikeout" ]
+  , Para
+      [ Strikeout
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Emph [ Str "struck" , Space , Str "out" ]
+          ]
+      ]
+  , Header 2 ( "entities" , [] , [] ) [ Str "entities" ]
+  , Para [ Str "hi" , Space , Str "&" , Space , Str "low" ]
+  , Para [ Str "hi" , Space , Str "&" , Space , Str "low" ]
+  , Para [ Str "G\246del" ]
+  , Para [ Str "\777\2730" ]
+  , Header 2 ( "comments" , [] , [] ) [ Str "comments" ]
+  , Para [ Str "inline" , Space , Str "comment" ]
+  , Para [ Str "between" , Space , Str "blocks" ]
+  , Header 2 ( "linebreaks" , [] , [] ) [ Str "linebreaks" ]
+  , Para [ Str "hi" , LineBreak , Str "there" ]
+  , Para [ Str "hi" , LineBreak , Str "there" ]
+  , Header
+      2
+      ( "indents" , [] , [] )
+      [ Str ":" , Space , Str "indents" ]
+  , Para [ Str "hi" ]
+  , DefinitionList [ ( [] , [ [ Plain [ Str "there" ] ] ] ) ]
+  , Para [ Str "bud" ]
+  , Para [ Str "hi" ]
+  , DefinitionList
+      [ ( []
+        , [ [ DefinitionList
+                [ ( [] , [ [ Plain [ Str "there" ] ] ] ) ]
+            ]
+          ]
+        )
+      ]
+  , Para [ Str "bud" ]
+  , Header
+      2 ( "p_tags" , [] , [] ) [ Str "p" , Space , Str "tags" ]
+  , Para [ Str "hi" , Space , Str "there" ]
+  , Para [ Str "bud" ]
+  , Para [ Str "another" ]
+  , Header
+      2
+      ( "raw_html" , [] , [] )
+      [ Str "raw" , Space , Str "html" ]
+  , Para
+      [ Str "hi"
+      , Space
+      , RawInline (Format "html") "<span style=\"color:red\">"
+      , Emph [ Str "there" ]
+      , RawInline (Format "html") "</span>"
+      , Str "."
+      ]
+  , Para
+      [ RawInline (Format "html") "<ins>"
+      , Str "inserted"
+      , RawInline (Format "html") "</ins>"
+      ]
+  , RawBlock (Format "html") "<div class=\"special\">"
+  , Para [ Str "hi" , Space , Emph [ Str "there" ] ]
+  , RawBlock (Format "html") "</div>"
+  , Header
+      2
+      ( "sup_sub_del" , [] , [] )
+      [ Str "sup," , Space , Str "sub," , Space , Str "del" ]
+  , Para
+      [ Str "H"
+      , Subscript [ Str "2" ]
+      , Str "O"
+      , Space
+      , Str "base"
+      , Superscript [ Emph [ Str "exponent" ] ]
+      , SoftBreak
+      , Strikeout [ Str "hello" ]
+      ]
+  , Header
+      2
+      ( "inline_code" , [] , [] )
+      [ Str "inline" , Space , Str "code" ]
+  , Para
+      [ Code ( "" , [] , [] ) "*\8594*"
+      , Space
+      , Code ( "" , [] , [] ) "typed"
+      , Space
+      , Code ( "" , [ "haskell" ] , [] ) ">>="
+      ]
+  , Header
+      2
+      ( "code_blocks" , [] , [] )
+      [ Str "code" , Space , Str "blocks" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "case xs of\n     (_:_) -> reverse xs\n     []    -> ['*']"
+  , CodeBlock
+      ( "" , [ "haskell" ] , [] )
+      "case xs of\n     (_:_) -> reverse xs\n     []    -> ['*']"
+  , CodeBlock
+      ( ""
+      , [ "ruby" , "numberLines" ]
+      , [ ( "startFrom" , "100" ) ]
+      )
+      "widgets.each do |w|\n  print w.price\nend"
+  , Header
+      2
+      ( "block_quotes" , [] , [] )
+      [ Str "block" , Space , Str "quotes" ]
+  , Para [ Str "Regular" , Space , Str "paragraph" ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          ]
+      , Para
+          [ Str "With"
+          , Space
+          , Str "two"
+          , Space
+          , Str "paragraphs."
+          ]
+      ]
+  , Para [ Str "Nother" , Space , Str "paragraph." ]
+  , Header
+      2
+      ( "external_links" , [] , [] )
+      [ Str "external" , Space , Str "links" ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Emph [ Str "Google" ]
+          , Space
+          , Str "search"
+          , Space
+          , Str "engine"
+          ]
+          ( "http://google.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "http://pandoc.org" ]
+          ( "http://pandoc.org" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] ) [ Str "1" ] ( "http://google.com" , "" )
+      , Space
+      , Link
+          ( "" , [] , [] ) [ Str "2" ] ( "http://yahoo.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "email" , Space , Str "me" ]
+          ( "mailto:info@example.org" , "" )
+      ]
+  , Header
+      2
+      ( "internal_links" , [] , [] )
+      [ Str "internal" , Space , Str "links" ]
+  , Para
+      [ Link
+          ( "" , [] , [] ) [ Str "Help" ] ( "Help" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "the" , Space , Str "help" , Space , Str "page" ]
+          ( "Help" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] ) [ Str "Helpers" ] ( "Help" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] ) [ Str "Help" ] ( "Help" , "wikilink" )
+      , Str "ers"
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Contents" ]
+          ( "Help:Contents" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "#My" , Space , Str "anchor" ]
+          ( "#My_anchor" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "and" , Space , Str "text" ]
+          ( "Page#with_anchor" , "wikilink" )
+      ]
+  , Header 2 ( "images" , [] , [] ) [ Str "images" ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "caption" ]
+          ( "example.jpg" , "fig:caption" )
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "the"
+          , Space
+          , Emph [ Str "caption" ]
+          , Space
+          , Str "with"
+          , Space
+          , Link
+              ( "" , [] , [] )
+              [ Str "external" , Space , Str "link" ]
+              ( "http://google.com" , "" )
+          ]
+          ( "example.jpg" , "fig:the caption with external link" )
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [ ( "width" , "30" ) , ( "height" , "40" ) ] )
+          [ Str "caption" ]
+          ( "example.jpg" , "fig:caption" )
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [ ( "width" , "30" ) ] )
+          [ Str "caption" ]
+          ( "example.jpg" , "fig:caption" )
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [ ( "width" , "30" ) ] )
+          [ Str "caption" ]
+          ( "example.jpg" , "fig:caption" )
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "example.jpg" ]
+          ( "example.jpg" , "fig:example.jpg" )
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "example_es.jpg" ]
+          ( "example_es.jpg" , "fig:example_es.jpg" )
+      ]
+  , Header 2 ( "lists" , [] , [] ) [ Str "lists" ]
+  , BulletList
+      [ [ Plain
+            [ Str "Start" , Space , Str "each" , Space , Str "line" ]
+        ]
+      , [ Plain
+            [ Str "with"
+            , Space
+            , Str "an"
+            , Space
+            , Str "asterisk"
+            , Space
+            , Str "(*)."
+            ]
+        , BulletList
+            [ [ Plain
+                  [ Str "More"
+                  , Space
+                  , Str "asterisks"
+                  , Space
+                  , Str "gives"
+                  , Space
+                  , Str "deeper"
+                  ]
+              , BulletList
+                  [ [ Plain
+                        [ Str "and"
+                        , Space
+                        , Str "deeper"
+                        , Space
+                        , Str "levels."
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain
+            [ Str "Line"
+            , Space
+            , Str "breaks"
+            , LineBreak
+            , Str "don't"
+            , Space
+            , Str "break"
+            , Space
+            , Str "levels."
+            ]
+        , BulletList
+            [ [ BulletList
+                  [ [ Plain
+                        [ Str "But"
+                        , Space
+                        , Str "jumping"
+                        , Space
+                        , Str "levels"
+                        , Space
+                        , Str "creates"
+                        , Space
+                        , Str "empty"
+                        , Space
+                        , Str "space."
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Any"
+      , Space
+      , Str "other"
+      , Space
+      , Str "start"
+      , Space
+      , Str "ends"
+      , Space
+      , Str "the"
+      , Space
+      , Str "list."
+      ]
+  , BulletList
+      [ [ BulletList [ [ Plain [ Str "two" ] ] ] ]
+      , [ Plain [ Str "one" ] ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Start" , Space , Str "each" , Space , Str "line" ]
+        ]
+      , [ Plain
+            [ Str "with"
+            , Space
+            , Str "a"
+            , Space
+            , Str "number"
+            , Space
+            , Str "sign"
+            , Space
+            , Str "(#)."
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Str "More"
+                  , Space
+                  , Str "number"
+                  , Space
+                  , Str "signs"
+                  , Space
+                  , Str "gives"
+                  , Space
+                  , Str "deeper"
+                  ]
+              , OrderedList
+                  ( 1 , DefaultStyle , DefaultDelim )
+                  [ [ Plain [ Str "and" , Space , Str "deeper" ] ]
+                  , [ Plain [ Str "levels." ] ]
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain
+            [ Str "Line"
+            , Space
+            , Str "breaks"
+            , LineBreak
+            , Str "don't"
+            , Space
+            , Str "break"
+            , Space
+            , Str "levels."
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ OrderedList
+                  ( 1 , DefaultStyle , DefaultDelim )
+                  [ [ Plain
+                        [ Str "But"
+                        , Space
+                        , Str "jumping"
+                        , Space
+                        , Str "levels"
+                        , Space
+                        , Str "creates"
+                        , Space
+                        , Str "empty"
+                        , Space
+                        , Str "space."
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain [ Str "Blank" , Space , Str "lines" ] ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "end"
+            , Space
+            , Str "the"
+            , Space
+            , Str "list"
+            , Space
+            , Str "and"
+            , Space
+            , Str "start"
+            , Space
+            , Str "another."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Any"
+      , Space
+      , Str "other"
+      , Space
+      , Str "start"
+      , Space
+      , Str "also"
+      , SoftBreak
+      , Str "ends"
+      , Space
+      , Str "the"
+      , Space
+      , Str "list."
+      ]
+  , DefinitionList
+      [ ( [ Str "item" , Space , Str "1" ]
+        , [ [ Plain [ Str "definition" , Space , Str "1" ] ] ]
+        )
+      , ( [ Str "item" , Space , Str "2" ]
+        , [ [ Plain [ Str "definition" , Space , Str "2-1" ] ]
+          , [ Plain [ Str "definition" , Space , Str "2-2" ] ]
+          ]
+        )
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "one" ] ]
+      , [ Plain [ Str "two" ]
+        , BulletList
+            [ [ Plain
+                  [ Str "two"
+                  , Space
+                  , Str "point"
+                  , Space
+                  , Str "one"
+                  ]
+              ]
+            , [ Plain
+                  [ Str "two"
+                  , Space
+                  , Str "point"
+                  , Space
+                  , Str "two"
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain [ Str "three" ]
+        , DefinitionList
+            [ ( [ Str "three" , Space , Str "item" , Space , Str "one" ]
+              , [ [ Plain
+                      [ Str "three"
+                      , Space
+                      , Str "def"
+                      , Space
+                      , Str "one"
+                      ]
+                  ]
+                ]
+              )
+            ]
+        ]
+      , [ Plain [ Str "four" ]
+        , DefinitionList
+            [ ( []
+              , [ [ Plain
+                      [ Str "four"
+                      , Space
+                      , Str "def"
+                      , Space
+                      , Str "one"
+                      ]
+                  ]
+                , [ Plain
+                      [ Str "this"
+                      , Space
+                      , Str "looks"
+                      , Space
+                      , Str "like"
+                      , Space
+                      , Str "a"
+                      , Space
+                      , Str "continuation"
+                      ]
+                  ]
+                , [ Plain
+                      [ Str "and"
+                      , Space
+                      , Str "is"
+                      , Space
+                      , Str "often"
+                      , Space
+                      , Str "used"
+                      ]
+                  ]
+                , [ Plain
+                      [ Str "instead"
+                      , LineBreak
+                      , Str "of"
+                      , Space
+                      , Str "<br/>"
+                      ]
+                  ]
+                ]
+              )
+            ]
+        ]
+      , [ Plain
+            [ RawInline
+                (Format "mediawiki")
+                "{{{template\n|author=John\n|title=My Book\n}}}"
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Str "five" , Space , Str "sub" , Space , Str "1" ]
+              , OrderedList
+                  ( 1 , DefaultStyle , DefaultDelim )
+                  [ [ Plain
+                        [ Str "five"
+                        , Space
+                        , Str "sub"
+                        , Space
+                        , Str "1"
+                        , Space
+                        , Str "sub"
+                        , Space
+                        , Str "1"
+                        ]
+                    ]
+                  ]
+              ]
+            , [ Plain
+                  [ Str "five" , Space , Str "sub" , Space , Str "2" ]
+              ]
+            ]
+        ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Emph [ Str "emph" ]
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Str "list" , Space , Str "item" , Space , Str "B1" ]
+              ]
+            , [ Plain
+                  [ Str "list" , Space , Str "item" , Space , Str "B2" ]
+              ]
+            ]
+        , Para
+            [ Str "continuing"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "A1"
+            ]
+        ]
+      , [ Plain
+            [ Str "list" , Space , Str "item" , Space , Str "A2" ]
+        ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "abc" ] ]
+      , [ Plain [ Str "def" ] ]
+      , [ Plain [ Str "ghi" ] ]
+      ]
+  , OrderedList
+      ( 9 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "Amsterdam" ] ]
+      , [ Plain [ Str "Rotterdam" ] ]
+      , [ Plain [ Str "The" , Space , Str "Hague" ] ]
+      ]
+  , Header 2 ( "math" , [] , [] ) [ Str "math" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Math InlineMath "x=\\frac{y^\\pi}{z}"
+      , Str "."
+      ]
+  , Para
+      [ Str "With"
+      , Space
+      , Str "spaces:"
+      , Space
+      , Math InlineMath "x=\\frac{y^\\pi}{z}"
+      , Str "."
+      ]
+  , Header
+      2
+      ( "preformatted_blocks" , [] , [] )
+      [ Str "preformatted" , Space , Str "blocks" ]
+  , Para
+      [ Code
+          ( "" , [] , [] )
+          "Start\160each\160line\160with\160a\160space."
+      , LineBreak
+      , Code ( "" , [] , [] ) "Text\160is\160"
+      , Strong [ Code ( "" , [] , [] ) "preformatted" ]
+      , Code ( "" , [] , [] ) "\160and"
+      , LineBreak
+      , Emph [ Code ( "" , [] , [] ) "markups" ]
+      , Code ( "" , [] , [] ) "\160"
+      , Strong [ Emph [ Code ( "" , [] , [] ) "can" ] ]
+      , Code ( "" , [] , [] ) "\160be\160done."
+      ]
+  , Para
+      [ Code
+          ( "" , [] , [] ) "\160hell\160\160\160\160\160\160yeah"
+      ]
+  , Para
+      [ Code
+          ( "" , [] , [] )
+          "Start\160with\160a\160space\160in\160the\160first\160column,"
+      , LineBreak
+      , Code ( "" , [] , [] ) "(before\160the\160<nowiki>)."
+      , LineBreak
+      , Code ( "" , [] , [] ) ""
+      , LineBreak
+      , Code
+          ( "" , [] , [] )
+          "Then\160your\160block\160format\160will\160be"
+      , LineBreak
+      , Code ( "" , [] , [] ) "\160\160\160\160maintained."
+      , LineBreak
+      , Code ( "" , [] , [] ) ""
+      , LineBreak
+      , Code
+          ( "" , [] , [] )
+          "This\160is\160good\160for\160copying\160in\160code\160blocks:"
+      , LineBreak
+      , Code ( "" , [] , [] ) ""
+      , LineBreak
+      , Code ( "" , [] , [] ) "def\160function():"
+      , LineBreak
+      , Code
+          ( "" , [] , [] )
+          "\160\160\160\160\"\"\"documentation\160string\"\"\""
+      , LineBreak
+      , Code ( "" , [] , [] ) ""
+      , LineBreak
+      , Code ( "" , [] , [] ) "\160\160\160\160if\160True:"
+      , LineBreak
+      , Code
+          ( "" , [] , [] )
+          "\160\160\160\160\160\160\160\160print\160True"
+      , LineBreak
+      , Code ( "" , [] , [] ) "\160\160\160\160else:"
+      , LineBreak
+      , Code
+          ( "" , [] , [] )
+          "\160\160\160\160\160\160\160\160print\160False"
+      ]
+  , Para [ Str "Not" ]
+  , RawBlock (Format "html") "<hr/>"
+  , Para [ Str "preformatted" ]
+  , Para [ Str "Don't" , Space , Str "need" ]
+  , Para [ Code ( "" , [] , [] ) "a\160blank\160line" ]
+  , Para
+      [ Str "around"
+      , Space
+      , Str "a"
+      , Space
+      , Str "preformatted"
+      , Space
+      , Str "block."
+      ]
+  , Header 2 ( "templates" , [] , [] ) [ Str "templates" ]
+  , RawBlock (Format "mediawiki") "{{Welcome}}"
+  , RawBlock (Format "mediawiki") "{{Foo:Bar}}"
+  , RawBlock
+      (Format "mediawiki") "{{Thankyou|all your effort|Me}}"
+  , Para
+      [ Str "Written"
+      , Space
+      , RawInline (Format "mediawiki") "{{{date}}}"
+      , Space
+      , Str "by"
+      , Space
+      , RawInline (Format "mediawiki") "{{{name}}}"
+      , Str "."
+      ]
+  , Header 2 ( "tables" , [] , [] ) [ Str "tables" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Orange" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Apple" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Bread" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Pie" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Butter" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Ice" , Space , Str "cream" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption
+         Nothing
+         [ Plain [ Str "Food" , Space , Str "complements" ] ])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Orange" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Apple" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Bread" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Pie" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Butter" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Ice" , Space , Str "cream" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption
+         Nothing
+         [ Plain [ Str "Food" , Space , Str "complements" ] ])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Orange" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Apple" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Bread" ]
+                  , Para [ Str "and" , Space , Str "cheese" ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Pie" ]
+                  , OrderedList
+                      ( 1 , DefaultStyle , DefaultDelim )
+                      [ [ Plain [ Str "apple" ] ]
+                      , [ Plain [ Str "carrot" ] ]
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Orange" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Apple" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "more" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Bread" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Pie" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "more" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Butter" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Ice" , Space , Str "cream" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "and" , Space , Str "more" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidth 0.25 )
+      , ( AlignRight , ColWidth 0.125 )
+      , ( AlignCenter , ColWidth 0.125 )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Left" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Right" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "Center" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "left" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "15.00" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "centered" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "more" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "2.0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "more" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Orange" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Apple" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Bread" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Table
+                      ( "" , [] , [] )
+                      (Caption Nothing [])
+                      [ ( AlignDefault , ColWidthDefault )
+                      , ( AlignDefault , ColWidthDefault )
+                      ]
+                      (TableHead
+                         ( "" , [] , [] )
+                         [ Row
+                             ( "" , [] , [] )
+                             [ Cell
+                                 ( "" , [] , [] )
+                                 AlignDefault
+                                 (RowSpan 1)
+                                 (ColSpan 1)
+                                 [ Para [ Str "fruit" ] ]
+                             , Cell
+                                 ( "" , [] , [] )
+                                 AlignDefault
+                                 (RowSpan 1)
+                                 (ColSpan 1)
+                                 [ Para [ Str "topping" ] ]
+                             ]
+                         ])
+                      [ TableBody
+                          ( "" , [] , [] )
+                          (RowHeadColumns 0)
+                          []
+                          [ Row
+                              ( "" , [] , [] )
+                              [ Cell
+                                  ( "" , [] , [] )
+                                  AlignDefault
+                                  (RowSpan 1)
+                                  (ColSpan 1)
+                                  [ Para [ Str "apple" ] ]
+                              , Cell
+                                  ( "" , [] , [] )
+                                  AlignDefault
+                                  (RowSpan 1)
+                                  (ColSpan 1)
+                                  [ Para
+                                      [ Str "ice"
+                                      , Space
+                                      , Str "cream"
+                                      ]
+                                  ]
+                              ]
+                          ]
+                      ]
+                      (TableFoot ( "" , [] , [] ) [])
+                  ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Butter" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Ice" , Space , Str "cream" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault ) ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Orange" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Paragraph"
+      , Space
+      , Str "after"
+      , Space
+      , Str "the"
+      , Space
+      , Str "table."
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "fruit" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Para [ Str "topping" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "apple" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "ice" , Space , Str "cream" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header 2 ( "notes" , [] , [] ) [ Str "notes" ]
+  , Para
+      [ Str "My"
+      , Space
+      , Str "note!"
+      , Note [ Plain [ Str "This." ] ]
+      ]
+  , Para
+      [ Str "URL"
+      , Space
+      , Str "note."
+      , Note
+          [ Plain
+              [ Link
+                  ( "" , [] , [] )
+                  [ Str
+                      "http://docs.python.org/library/functions.html#range"
+                  ]
+                  ( "http://docs.python.org/library/functions.html#range"
+                  , ""
+                  )
+              ]
+          ]
+      ]
+  ]
diff --git a/test/opml-reader.native b/test/opml-reader.native
--- a/test/opml-reader.native
+++ b/test/opml-reader.native
@@ -1,66 +1,123 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "Dave",Space,Str "Winer"]]),("date",MetaInlines [Str "Thu,",Space,Str "14",Space,Str "Jul",Space,Str "2005",Space,Str "23:41:05",Space,Str "GMT"]),("title",MetaInlines [Str "States"])]})
-[Header 1 ("",[],[]) [Str "United",Space,Str "States"]
-,Header 2 ("",[],[]) [Str "Far",Space,Str "West"]
-,Header 3 ("",[],[]) [Str "Alaska"]
-,Header 3 ("",[],[]) [Str "California"]
-,Header 3 ("",[],[]) [Str "Hawaii"]
-,Header 3 ("",[],[]) [Strong [Str "Nevada"]]
-,Para [Str "I",Space,Str "lived",Space,Str "here",Space,Emph [Str "once"],Str "."]
-,Para [Str "Loved",Space,Str "it."]
-,Header 4 ("",[],[]) [Link ("",[],[]) [Str "Reno"] ("http://www.reno.gov","")]
-,Header 4 ("",[],[]) [Str "Las",Space,Str "Vegas"]
-,Header 4 ("",[],[]) [Str "Ely"]
-,Header 4 ("",[],[]) [Str "Gerlach"]
-,Header 3 ("",[],[]) [Str "Oregon"]
-,Header 3 ("",[],[]) [Str "Washington"]
-,Header 2 ("",[],[]) [Str "Great",Space,Str "Plains"]
-,Header 3 ("",[],[]) [Str "Kansas"]
-,Header 3 ("",[],[]) [Str "Nebraska"]
-,Header 3 ("",[],[]) [Str "North",Space,Str "Dakota"]
-,Header 3 ("",[],[]) [Str "Oklahoma"]
-,Header 3 ("",[],[]) [Str "South",Space,Str "Dakota"]
-,Header 2 ("",[],[]) [Str "Mid-Atlantic"]
-,Header 3 ("",[],[]) [Str "Delaware"]
-,Header 3 ("",[],[]) [Str "Maryland"]
-,Header 3 ("",[],[]) [Str "New",Space,Str "Jersey"]
-,Header 3 ("",[],[]) [Str "New",Space,Str "York"]
-,Header 3 ("",[],[]) [Str "Pennsylvania"]
-,Header 2 ("",[],[]) [Str "Midwest"]
-,Header 3 ("",[],[]) [Str "Illinois"]
-,Header 3 ("",[],[]) [Str "Indiana"]
-,Header 3 ("",[],[]) [Str "Iowa"]
-,Header 3 ("",[],[]) [Str "Kentucky"]
-,Header 3 ("",[],[]) [Str "Michigan"]
-,Header 3 ("",[],[]) [Str "Minnesota"]
-,Header 3 ("",[],[]) [Str "Missouri"]
-,Header 3 ("",[],[]) [Str "Ohio"]
-,Header 3 ("",[],[]) [Str "West",Space,Str "Virginia"]
-,Header 3 ("",[],[]) [Str "Wisconsin"]
-,Header 2 ("",[],[]) [Str "Mountains"]
-,Header 3 ("",[],[]) [Str "Colorado"]
-,Header 3 ("",[],[]) [Str "Idaho"]
-,Header 3 ("",[],[]) [Str "Montana"]
-,Header 3 ("",[],[]) [Str "Utah"]
-,Header 3 ("",[],[]) [Str "Wyoming"]
-,Header 2 ("",[],[]) [Str "New",Space,Str "England"]
-,Header 3 ("",[],[]) [Str "Connecticut"]
-,Header 3 ("",[],[]) [Str "Maine"]
-,Header 3 ("",[],[]) [Str "Massachusetts"]
-,Header 3 ("",[],[]) [Str "New",Space,Str "Hampshire"]
-,Header 3 ("",[],[]) [Str "Rhode",Space,Str "Island"]
-,Header 3 ("",[],[]) [Str "Vermont"]
-,Header 2 ("",[],[]) [Str "South"]
-,Header 3 ("",[],[]) [Str "Alabama"]
-,Header 3 ("",[],[]) [Str "Arkansas"]
-,Header 3 ("",[],[]) [Str "Florida"]
-,Header 3 ("",[],[]) [Str "Georgia"]
-,Header 3 ("",[],[]) [Str "Louisiana"]
-,Header 3 ("",[],[]) [Str "Mississippi"]
-,Header 3 ("",[],[]) [Str "North",Space,Str "Carolina"]
-,Header 3 ("",[],[]) [Str "South",Space,Str "Carolina"]
-,Header 3 ("",[],[]) [Str "Tennessee"]
-,Header 3 ("",[],[]) [Str "Virginia"]
-,Header 2 ("",[],[]) [Str "Southwest"]
-,Header 3 ("",[],[]) [Str "Arizona"]
-,Header 3 ("",[],[]) [Str "New",Space,Str "Mexico"]
-,Header 3 ("",[],[]) [Str "Texas"]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author"
+            , MetaList
+                [ MetaInlines [ Str "Dave" , Space , Str "Winer" ] ]
+            )
+          , ( "date"
+            , MetaInlines
+                [ Str "Thu,"
+                , Space
+                , Str "14"
+                , Space
+                , Str "Jul"
+                , Space
+                , Str "2005"
+                , Space
+                , Str "23:41:05"
+                , Space
+                , Str "GMT"
+                ]
+            )
+          , ( "title" , MetaInlines [ Str "States" ] )
+          ]
+    }
+  [ Header
+      1 ( "" , [] , [] ) [ Str "United" , Space , Str "States" ]
+  , Header
+      2 ( "" , [] , [] ) [ Str "Far" , Space , Str "West" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Alaska" ]
+  , Header 3 ( "" , [] , [] ) [ Str "California" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Hawaii" ]
+  , Header 3 ( "" , [] , [] ) [ Strong [ Str "Nevada" ] ]
+  , Para
+      [ Str "I"
+      , Space
+      , Str "lived"
+      , Space
+      , Str "here"
+      , Space
+      , Emph [ Str "once" ]
+      , Str "."
+      ]
+  , Para [ Str "Loved" , Space , Str "it." ]
+  , Header
+      4
+      ( "" , [] , [] )
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Reno" ]
+          ( "http://www.reno.gov" , "" )
+      ]
+  , Header
+      4 ( "" , [] , [] ) [ Str "Las" , Space , Str "Vegas" ]
+  , Header 4 ( "" , [] , [] ) [ Str "Ely" ]
+  , Header 4 ( "" , [] , [] ) [ Str "Gerlach" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Oregon" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Washington" ]
+  , Header
+      2 ( "" , [] , [] ) [ Str "Great" , Space , Str "Plains" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Kansas" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Nebraska" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "North" , Space , Str "Dakota" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Oklahoma" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "South" , Space , Str "Dakota" ]
+  , Header 2 ( "" , [] , [] ) [ Str "Mid-Atlantic" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Delaware" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Maryland" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "New" , Space , Str "Jersey" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "New" , Space , Str "York" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Pennsylvania" ]
+  , Header 2 ( "" , [] , [] ) [ Str "Midwest" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Illinois" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Indiana" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Iowa" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Kentucky" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Michigan" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Minnesota" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Missouri" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Ohio" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "West" , Space , Str "Virginia" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Wisconsin" ]
+  , Header 2 ( "" , [] , [] ) [ Str "Mountains" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Colorado" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Idaho" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Montana" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Utah" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Wyoming" ]
+  , Header
+      2 ( "" , [] , [] ) [ Str "New" , Space , Str "England" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Connecticut" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Maine" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Massachusetts" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "New" , Space , Str "Hampshire" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "Rhode" , Space , Str "Island" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Vermont" ]
+  , Header 2 ( "" , [] , [] ) [ Str "South" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Alabama" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Arkansas" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Florida" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Georgia" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Louisiana" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Mississippi" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "North" , Space , Str "Carolina" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "South" , Space , Str "Carolina" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Tennessee" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Virginia" ]
+  , Header 2 ( "" , [] , [] ) [ Str "Southwest" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Arizona" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "New" , Space , Str "Mexico" ]
+  , Header 3 ( "" , [] , [] ) [ Str "Texas" ]
+  ]
diff --git a/test/org-select-tags.native b/test/org-select-tags.native
--- a/test/org-select-tags.native
+++ b/test/org-select-tags.native
@@ -1,7 +1,103 @@
-Pandoc (Meta {unMeta = fromList []})
-[Header 1 ("will-appear-because-it-is-the-ancestor-of-something-tagged-yes",[],[]) [Str "Will",Space,Str "appear",Space,Str "because",Space,Str "it",Space,Str "is",Space,Str "the",Space,Str "ancestor",Space,Str "of",Space,Str "something",Space,Str "tagged",Space,Str "\"yes\""]
-,Header 2 ("will-appear",[],[]) [Str "Will",Space,Str "appear",Space,Span ("",["tag"],[("tag-name","yes")]) [SmallCaps [Str "yes"]]]
-,Header 3 ("will-appear-since-the-entire-subtree-of-something-selected-will-appear",[],[]) [Str "Will",Space,Str "appear",Space,Str "since",Space,Str "the",Space,Str "entire",Space,Str "subtree",Space,Str "of",Space,Str "something",Space,Str "selected",Space,Str "will",Space,Str "appear"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Para [Str "Will",Space,Str "appear"]]]
-,Header 2 ("will-appear-because-it-is-the-ancestor-of-something-listed-in-select-tags",[],[]) [Str "Will",Space,Str "appear",Space,Str "because",Space,Str "it",Space,Str "is",Space,Str "the",Space,Str "ancestor",Space,Str "of",Space,Str "something",Space,Str "listed",Space,Str "in",Space,Str "SELECT-TAGS"]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Header
+      1
+      ( "will-appear-because-it-is-the-ancestor-of-something-tagged-yes"
+      , []
+      , []
+      )
+      [ Str "Will"
+      , Space
+      , Str "appear"
+      , Space
+      , Str "because"
+      , Space
+      , Str "it"
+      , Space
+      , Str "is"
+      , Space
+      , Str "the"
+      , Space
+      , Str "ancestor"
+      , Space
+      , Str "of"
+      , Space
+      , Str "something"
+      , Space
+      , Str "tagged"
+      , Space
+      , Str "\"yes\""
+      ]
+  , Header
+      2
+      ( "will-appear" , [] , [] )
+      [ Str "Will"
+      , Space
+      , Str "appear"
+      , Space
+      , Span
+          ( "" , [ "tag" ] , [ ( "tag-name" , "yes" ) ] )
+          [ SmallCaps [ Str "yes" ] ]
+      ]
+  , Header
+      3
+      ( "will-appear-since-the-entire-subtree-of-something-selected-will-appear"
+      , []
+      , []
+      )
+      [ Str "Will"
+      , Space
+      , Str "appear"
+      , Space
+      , Str "since"
+      , Space
+      , Str "the"
+      , Space
+      , Str "entire"
+      , Space
+      , Str "subtree"
+      , Space
+      , Str "of"
+      , Space
+      , Str "something"
+      , Space
+      , Str "selected"
+      , Space
+      , Str "will"
+      , Space
+      , Str "appear"
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Para [ Str "Will" , Space , Str "appear" ] ] ]
+  , Header
+      2
+      ( "will-appear-because-it-is-the-ancestor-of-something-listed-in-select-tags"
+      , []
+      , []
+      )
+      [ Str "Will"
+      , Space
+      , Str "appear"
+      , Space
+      , Str "because"
+      , Space
+      , Str "it"
+      , Space
+      , Str "is"
+      , Space
+      , Str "the"
+      , Space
+      , Str "ancestor"
+      , Space
+      , Str "of"
+      , Space
+      , Str "something"
+      , Space
+      , Str "listed"
+      , Space
+      , Str "in"
+      , Space
+      , Str "SELECT-TAGS"
+      ]
+  ]
diff --git a/test/pipe-tables.native b/test/pipe-tables.native
--- a/test/pipe-tables.native
+++ b/test/pipe-tables.native
@@ -1,326 +1,927 @@
-[Para [Str "Simplest",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default2"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default3"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Headerless",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Table",Space,Str "without",Space,Str "sides:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Fruit"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Quantity"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "apple"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "17"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "pear"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "302"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "One-column:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "hi"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "lo"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Header-less",Space,Str "one-column:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "hi"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Indented",Space,Str "left",Space,Str "column:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Number",Space,Str "of",Space,Str "siblings"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Salary"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "33"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "44"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Long",Space,Str "pipe",Space,Str "table",Space,Str "with",Space,Str "relative",Space,Str "widths:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.15517241379310345)
- ,(AlignDefault,ColWidth 0.1724137931034483)
- ,(AlignDefault,ColWidth 0.6724137931034483)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default2"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default3"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "this",Space,Str "is",Space,Str "a",Space,Str "table",Space,Str "cell"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "and",Space,Str "this",Space,Str "is",Space,Str "a",Space,Str "really",Space,Str "long",Space,Str "table",Space,Str "cell",Space,Str "that",Space,Str "will",Space,Str "probably",Space,Str "need",Space,Str "wrapping"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Pipe",Space,Str "table",Space,Str "with",Space,Str "no",Space,Str "body:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Header"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Pipe",Space,Str "table",Space,Str "with",Space,Str "tricky",Space,Str "cell",Space,Str "contents",Space,Str "(see",Space,Str "#2765):"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "IP_gene8-_1st"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "IP_gene8+_1st"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "IP_gene8-_1st"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1.0000000"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "0.4357325"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "IP_gene8+_1st"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "0.4357325"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1.0000000"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "foo",Code ("",[],[]) "bar|baz"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "and|escaped"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3.0000000"]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Para
+    [ Str "Simplest"
+    , Space
+    , Str "table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default1" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default2" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default3" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Simple"
+    , Space
+    , Str "table"
+    , Space
+    , Str "with"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption
+       Nothing
+       [ Plain
+           [ Str "Demonstration"
+           , Space
+           , Str "of"
+           , Space
+           , Str "simple"
+           , Space
+           , Str "table"
+           , Space
+           , Str "syntax."
+           ]
+       ])
+    [ ( AlignRight , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Center" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Simple"
+    , Space
+    , Str "table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignRight , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Center" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Headerless"
+    , Space
+    , Str "table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignRight , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Table" , Space , Str "without" , Space , Str "sides:" ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignRight , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Fruit" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Quantity" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "apple" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "5" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "orange" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "17" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "pear" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "302" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para [ Str "One-column:" ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault ) ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "hi" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "lo" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para [ Str "Header-less" , Space , Str "one-column:" ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignCenter , ColWidthDefault ) ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "hi" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Indented" , Space , Str "left" , Space , Str "column:" ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignRight , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain
+                   [ Str "Number" , Space , Str "of" , Space , Str "siblings" ]
+               ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Salary" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "3" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "33" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "4" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "44" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Long"
+    , Space
+    , Str "pipe"
+    , Space
+    , Str "table"
+    , Space
+    , Str "with"
+    , Space
+    , Str "relative"
+    , Space
+    , Str "widths:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidth 0.15517241379310345 )
+    , ( AlignDefault , ColWidth 0.1724137931034483 )
+    , ( AlignDefault , ColWidth 0.6724137931034483 )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default1" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default2" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default3" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "this"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "table"
+                    , Space
+                    , Str "cell"
+                    ]
+                ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "and"
+                    , Space
+                    , Str "this"
+                    , Space
+                    , Str "is"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "really"
+                    , Space
+                    , Str "long"
+                    , Space
+                    , Str "table"
+                    , Space
+                    , Str "cell"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "will"
+                    , Space
+                    , Str "probably"
+                    , Space
+                    , Str "need"
+                    , Space
+                    , Str "wrapping"
+                    ]
+                ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Pipe"
+    , Space
+    , Str "table"
+    , Space
+    , Str "with"
+    , Space
+    , Str "no"
+    , Space
+    , Str "body:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault ) ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Header" ] ]
+           ]
+       ])
+    [ TableBody ( "" , [] , [] ) (RowHeadColumns 0) [] [] ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Pipe"
+    , Space
+    , Str "table"
+    , Space
+    , Str "with"
+    , Space
+    , Str "tricky"
+    , Space
+    , Str "cell"
+    , Space
+    , Str "contents"
+    , Space
+    , Str "(see"
+    , Space
+    , Str "#2765):"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignLeft , ColWidthDefault )
+    , ( AlignRight , ColWidthDefault )
+    , ( AlignRight , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "IP_gene8-_1st" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "IP_gene8+_1st" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "IP_gene8-_1st" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1.0000000" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "0.4357325" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "IP_gene8+_1st" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "0.4357325" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1.0000000" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "foo" , Code ( "" , [] , [] ) "bar|baz" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "and|escaped" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "3.0000000" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
diff --git a/test/pptx/background-image/input.native b/test/pptx/background-image/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/background-image/input.native
@@ -0,0 +1,17 @@
+[Header 1 ("section-header-with-background-image",[],[("background-image","movie.jpg")]) [Str "Section",Space,Str "Header",Space,Str "(with",Space,Str "background",Space,Str "image)"]
+,Header 2 ("slide-1",[],[("background-image","lalune.jpg")]) [Str "Slide",Space,Str "1"]
+,Para [Str "This",Space,Str "slide",Space,Str "has",Space,Str "a",Space,Str "moon",Space,Str "background."]
+,Header 2 ("slide-2",[],[("background-image","movie.jpg")]) [Str "Slide",Space,Str "2"]
+,Para [Str "This",Space,Str "slide",Space,Str "has",Space,Str "a",Space,Str "movie",Space,Str "background."]
+,Header 2 ("slide-3",[],[("background-image","movie.jpg")]) [Str "Slide",Space,Str "3"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "Background",Space,Str "images",Space,Str "work",Space,Str "in",Space,Str "two-column",Space,Str "layout."]]
+ ,Div ("",["column"],[])
+  [Para [Str "hello"]]]
+,Header 2 ("slide-4",[],[("background-image","movie.jpg")]) [Str "Slide",Space,Str "4"]
+,Para [Str "You",Space,Str "can",Space,Str "have",Space,Str "images",Space,Str "on",Space,Str "slides",Space,Str "that",Space,Str "have",Space,Str "background",Space,Str "images:"]
+,Para [Image ("",[],[]) [Str "An",Space,Str "image"] ("lalune.jpg","fig:")]
+,Header 2 ("section",[],[("background-image","lalune.jpg")]) []
+,Div ("",["notes"],[])
+ [Para [Str "Blank",Space,Str "slides",Space,Str "can",Space,Str "have",Space,Str "background",Space,Str "images."]]]
diff --git a/test/pptx/background-image/output.pptx b/test/pptx/background-image/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/background-image/output.pptx differ
diff --git a/test/pptx/background-image/templated.pptx b/test/pptx/background-image/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/background-image/templated.pptx differ
diff --git a/test/pptx/blanks/just-speaker-notes/input.native b/test/pptx/blanks/just-speaker-notes/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/blanks/just-speaker-notes/input.native
@@ -0,0 +1,7 @@
+[Header 1 ("first-slide",[],[]) [Str "First",Space,Str "slide"]
+,Para [Str "Nothing",Space,Str "to",Space,Str "see",Space,Str "here"]
+,Header 1 ("section",[],[]) []
+,Div ("",["notes"],[])
+ [Para [Str "Some",Space,Str "notes",Space,Str "here:",Space,Str "this",Space,Str "first",Space,Str "slide",Space,Str "should",Space,Str "use",Space,Str "the",Space,Str "Blank",Space,Str "template"]]
+,Header 1 ("third-slide",[],[]) [Str "Third",Space,Str "slide"]
+,Para [Str "The",Space,Str "second",Space,Str "slide",Space,Str "should",Space,Str "be",Space,Str "blank"]]
diff --git a/test/pptx/blanks/just-speaker-notes/output.pptx b/test/pptx/blanks/just-speaker-notes/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/blanks/just-speaker-notes/output.pptx differ
diff --git a/test/pptx/blanks/just-speaker-notes/templated.pptx b/test/pptx/blanks/just-speaker-notes/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/blanks/just-speaker-notes/templated.pptx differ
diff --git a/test/pptx/blanks/nbsp-in-body/input.native b/test/pptx/blanks/nbsp-in-body/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/blanks/nbsp-in-body/input.native
@@ -0,0 +1,6 @@
+[Header 1 ("first-slide",[],[]) [Str "First",Space,Str "slide"]
+,Para [Str "Uninteresting,",Space,Str "normal"]
+,Header 1 ("section",[],[]) []
+,Para [Str "\160"]
+,Header 1 ("third-slide",[],[]) [Str "Third",Space,Str "slide"]
+,Para [Str "Was",Space,Str "the",Space,Str "previous",Space,Str "one",Space,Str "blank?"]]
diff --git a/test/pptx/blanks/nbsp-in-body/output.pptx b/test/pptx/blanks/nbsp-in-body/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/blanks/nbsp-in-body/output.pptx differ
diff --git a/test/pptx/blanks/nbsp-in-body/templated.pptx b/test/pptx/blanks/nbsp-in-body/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/blanks/nbsp-in-body/templated.pptx differ
diff --git a/test/pptx/blanks/nbsp-in-heading/input.native b/test/pptx/blanks/nbsp-in-heading/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/blanks/nbsp-in-heading/input.native
@@ -0,0 +1,5 @@
+[Header 1 ("first-slide",[],[]) [Str "First",Space,Str "slide"]
+,Para [Str "Uninteresting,",Space,Str "normal"]
+,Header 1 ("section",[],[]) [Str "\160"]
+,Header 1 ("third-slide",[],[]) [Str "Third",Space,Str "slide"]
+,Para [Str "Was",Space,Str "the",Space,Str "previous",Space,Str "one",Space,Str "blank?"]]
diff --git a/test/pptx/blanks/nbsp-in-heading/output.pptx b/test/pptx/blanks/nbsp-in-heading/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/blanks/nbsp-in-heading/output.pptx differ
diff --git a/test/pptx/blanks/nbsp-in-heading/templated.pptx b/test/pptx/blanks/nbsp-in-heading/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/blanks/nbsp-in-heading/templated.pptx differ
diff --git a/test/pptx/code-custom.pptx b/test/pptx/code-custom.pptx
deleted file mode 100644
Binary files a/test/pptx/code-custom.pptx and /dev/null differ
diff --git a/test/pptx/code-custom/output.pptx b/test/pptx/code-custom/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/code-custom/output.pptx differ
diff --git a/test/pptx/code-custom/templated.pptx b/test/pptx/code-custom/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/code-custom/templated.pptx differ
diff --git a/test/pptx/code-custom_deleted_layouts.pptx b/test/pptx/code-custom_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/code-custom_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/code-custom_moved_layouts.pptx b/test/pptx/code-custom_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/code-custom_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/code-custom_templated.pptx b/test/pptx/code-custom_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/code-custom_templated.pptx and /dev/null differ
diff --git a/test/pptx/code.native b/test/pptx/code.native
deleted file mode 100644
--- a/test/pptx/code.native
+++ /dev/null
@@ -1,21 +0,0 @@
-[Header 1 ("header-with-inline-code",[],[]) [Str "Header",Space,Str "with",Space,Code ("",[],[]) "inline code"]
-,CodeBlock ("",[],[]) "Code at level 0"
-,BulletList
- [[Para [Str "Bullet",Space,Str "item",Space,Str "with",Space,Code ("",[],[]) "inline code"]
-  ,CodeBlock ("",[],[]) "Code block at level 1"
-  ,BulletList
-   [[Para [Str "with",Space,Code ("",[],[]) "nested"]
-    ,CodeBlock ("",[],[]) "lvl2\nlvl2\nlvl2"
-    ,Header 2 ("second-heading-level-with-code",[],[]) [Str "Second",Space,Str "heading",Space,Str "level",Space,Str "with",Space,Code ("",[],[]) "code"]]]]]
-,Header 1 ("syntax-highlighting",[],[]) [Str "Syntax",Space,Str "highlighting"]
-,CodeBlock ("",["haskell"],[]) "id :: a -> a\nid x = x"
-,BulletList
- [[Para [Str "Nested"]
-  ,CodeBlock ("",["haskell"],[]) "g :: Int -> Int\ng x = x * 3"]]
-,Header 1 ("two-column-slide",[],[]) [Str "Two",Space,Str "column",Space,Str "slide"]
-,Div ("",["columns"],[])
- [Div ("",["column"],[("width","50%")])
-  [BulletList
-   [[Plain [Str "A",Space,Str "total",Space,Str "alternative",Space,Str "for",Space,Code ("",[],[]) "head"]]]]
- ,Div ("",["column"],[("width","50%")])
-  [CodeBlock ("",[],[]) "safeHead :: [a] -> Maybe a\nsafeHead [] = Nothing\nsafeHead (x:_) = Just x"]]]
diff --git a/test/pptx/code.pptx b/test/pptx/code.pptx
deleted file mode 100644
Binary files a/test/pptx/code.pptx and /dev/null differ
diff --git a/test/pptx/code/input.native b/test/pptx/code/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/code/input.native
@@ -0,0 +1,21 @@
+[Header 1 ("header-with-inline-code",[],[]) [Str "Header",Space,Str "with",Space,Code ("",[],[]) "inline code"]
+,CodeBlock ("",[],[]) "Code at level 0"
+,BulletList
+ [[Para [Str "Bullet",Space,Str "item",Space,Str "with",Space,Code ("",[],[]) "inline code"]
+  ,CodeBlock ("",[],[]) "Code block at level 1"
+  ,BulletList
+   [[Para [Str "with",Space,Code ("",[],[]) "nested"]
+    ,CodeBlock ("",[],[]) "lvl2\nlvl2\nlvl2"
+    ,Header 2 ("second-heading-level-with-code",[],[]) [Str "Second",Space,Str "heading",Space,Str "level",Space,Str "with",Space,Code ("",[],[]) "code"]]]]]
+,Header 1 ("syntax-highlighting",[],[]) [Str "Syntax",Space,Str "highlighting"]
+,CodeBlock ("",["haskell"],[]) "id :: a -> a\nid x = x"
+,BulletList
+ [[Para [Str "Nested"]
+  ,CodeBlock ("",["haskell"],[]) "g :: Int -> Int\ng x = x * 3"]]
+,Header 1 ("two-column-slide",[],[]) [Str "Two",Space,Str "column",Space,Str "slide"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[("width","50%")])
+  [BulletList
+   [[Plain [Str "A",Space,Str "total",Space,Str "alternative",Space,Str "for",Space,Code ("",[],[]) "head"]]]]
+ ,Div ("",["column"],[("width","50%")])
+  [CodeBlock ("",[],[]) "safeHead :: [a] -> Maybe a\nsafeHead [] = Nothing\nsafeHead (x:_) = Just x"]]]
diff --git a/test/pptx/code/output.pptx b/test/pptx/code/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/code/output.pptx differ
diff --git a/test/pptx/code/templated.pptx b/test/pptx/code/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/code/templated.pptx differ
diff --git a/test/pptx/code_deleted_layouts.pptx b/test/pptx/code_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/code_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/code_moved_layouts.pptx b/test/pptx/code_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/code_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/code_templated.pptx b/test/pptx/code_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/code_templated.pptx and /dev/null differ
diff --git a/test/pptx/comparison/both-columns/input.native b/test/pptx/comparison/both-columns/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/comparison/both-columns/input.native
@@ -0,0 +1,23 @@
+[Header 1 ("a-slide",[],[]) [Str "A",Space,Str "slide"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "A",Space,Str "paragraph",Space,Str "here"]
+  ,Table ("",[],[]) (Caption Nothing
+   [])
+   [(AlignDefault,ColWidth 0.125)
+   ,(AlignDefault,ColWidth 0.125)]
+   (TableHead ("",[],[])
+   [])
+   [(TableBody ("",[],[]) (RowHeadColumns 0)
+    []
+    [Row ("",[],[])
+     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "plus"]]
+     ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "a",Space,Str "table"]]]])]
+   (TableFoot ("",[],[])
+   [])
+  ,Para [Str "Then",Space,Str "some",Space,Str "more",Space,Str "text"]]
+ ,Div ("",["column"],[])
+  [Para [Str "A",Space,Str "paragraph",Space,Str "here"]
+  ,Para [Image ("",[],[]) [Str "Plus",Space,Str "an",Space,Str "image"] ("lalune.jpg","fig:")]]]]
diff --git a/test/pptx/comparison/both-columns/output.pptx b/test/pptx/comparison/both-columns/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/comparison/both-columns/output.pptx differ
diff --git a/test/pptx/comparison/both-columns/templated.pptx b/test/pptx/comparison/both-columns/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/comparison/both-columns/templated.pptx differ
diff --git a/test/pptx/comparison/extra-image/input.native b/test/pptx/comparison/extra-image/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/comparison/extra-image/input.native
@@ -0,0 +1,24 @@
+[Header 1 ("a-slide",[],[]) [Str "A",Space,Str "slide"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "A",Space,Str "paragraph",Space,Str "here"]
+  ,Table ("",[],[]) (Caption Nothing
+   [])
+   [(AlignDefault,ColWidth 0.125)
+   ,(AlignDefault,ColWidth 0.125)]
+   (TableHead ("",[],[])
+   [])
+   [(TableBody ("",[],[]) (RowHeadColumns 0)
+    []
+    [Row ("",[],[])
+     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "plus"]]
+     ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "a",Space,Str "table"]]]])]
+   (TableFoot ("",[],[])
+   [])
+  ,Para [Str "Then",Space,Str "some",Space,Str "more",Space,Str "text"]]
+ ,Div ("",["column"],[])
+  [Para [Str "A",Space,Str "paragraph",Space,Str "here"]
+  ,Para [Image ("",[],[]) [Str "Plus",Space,Str "an",Space,Str "image"] ("lalune.jpg","fig:")]
+  ,Para [Image ("",[],[]) [Str "And",Space,Str "another",Space,Str "image"] ("lalune.jpg","fig:")]]]]
diff --git a/test/pptx/comparison/extra-image/output.pptx b/test/pptx/comparison/extra-image/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/comparison/extra-image/output.pptx differ
diff --git a/test/pptx/comparison/extra-image/templated.pptx b/test/pptx/comparison/extra-image/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/comparison/extra-image/templated.pptx differ
diff --git a/test/pptx/comparison/extra-text/input.native b/test/pptx/comparison/extra-text/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/comparison/extra-text/input.native
@@ -0,0 +1,23 @@
+[Header 1 ("a-slide",[],[]) [Str "A",Space,Str "slide"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "A",Space,Str "paragraph",Space,Str "here"]
+  ,Table ("",[],[]) (Caption Nothing
+   [])
+   [(AlignDefault,ColWidth 0.125)
+   ,(AlignDefault,ColWidth 0.125)]
+   (TableHead ("",[],[])
+   [])
+   [(TableBody ("",[],[]) (RowHeadColumns 0)
+    []
+    [Row ("",[],[])
+     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "plus"]]
+     ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "a",Space,Str "table"]]]])]
+   (TableFoot ("",[],[])
+   [])
+  ,Para [Str "Then",Space,Str "some",Space,Str "more",Space,Str "text"]]
+ ,Div ("",["column"],[])
+  [Para [Str "A",Space,Str "paragraph",Space,Str "here"]
+  ,Para [Image ("",[],[]) [Str "Plus",Space,Str "an",Space,Str "image"] ("lalune.jpg","fig:")]]]]
diff --git a/test/pptx/comparison/extra-text/output.pptx b/test/pptx/comparison/extra-text/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/comparison/extra-text/output.pptx differ
diff --git a/test/pptx/comparison/extra-text/templated.pptx b/test/pptx/comparison/extra-text/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/comparison/extra-text/templated.pptx differ
diff --git a/test/pptx/comparison/non-text-first/input.native b/test/pptx/comparison/non-text-first/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/comparison/non-text-first/input.native
@@ -0,0 +1,21 @@
+[Header 1 ("a-slide",[],[]) [Str "A",Space,Str "slide"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Table ("",[],[]) (Caption Nothing
+   [])
+   [(AlignDefault,ColWidth 0.125)
+   ,(AlignDefault,ColWidth 0.125)]
+   (TableHead ("",[],[])
+   [])
+   [(TableBody ("",[],[]) (RowHeadColumns 0)
+    []
+    [Row ("",[],[])
+     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "a"]]
+     ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "table"]]]])]
+   (TableFoot ("",[],[])
+   [])
+  ,Para [Str "Plus",Space,Str "a",Space,Str "paragraph",Space,Str "here"]]
+ ,Div ("",["column"],[])
+  [Para [Image ("",[],[]) [Str "Just",Space,Str "an",Space,Str "image",Space,Str "on",Space,Str "this",Space,Str "side"] ("lalune.jpg","fig:")]]]]
diff --git a/test/pptx/comparison/non-text-first/output.pptx b/test/pptx/comparison/non-text-first/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/comparison/non-text-first/output.pptx differ
diff --git a/test/pptx/comparison/non-text-first/templated.pptx b/test/pptx/comparison/non-text-first/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/comparison/non-text-first/templated.pptx differ
diff --git a/test/pptx/comparison/one-column/input.native b/test/pptx/comparison/one-column/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/comparison/one-column/input.native
@@ -0,0 +1,21 @@
+[Header 1 ("a-slide",[],[]) [Str "A",Space,Str "slide"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "A",Space,Str "paragraph",Space,Str "here"]
+  ,Table ("",[],[]) (Caption Nothing
+   [])
+   [(AlignDefault,ColWidth 0.125)
+   ,(AlignDefault,ColWidth 0.125)]
+   (TableHead ("",[],[])
+   [])
+   [(TableBody ("",[],[]) (RowHeadColumns 0)
+    []
+    [Row ("",[],[])
+     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "plus"]]
+     ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "a",Space,Str "table"]]]])]
+   (TableFoot ("",[],[])
+   [])]
+ ,Div ("",["column"],[])
+  [Para [Str "Only",Space,Str "a",Space,Str "paragraph",Space,Str "here"]]]]
diff --git a/test/pptx/comparison/one-column/output.pptx b/test/pptx/comparison/one-column/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/comparison/one-column/output.pptx differ
diff --git a/test/pptx/comparison/one-column/templated.pptx b/test/pptx/comparison/one-column/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/comparison/one-column/templated.pptx differ
diff --git a/test/pptx/content-with-caption/heading-text-image/input.native b/test/pptx/content-with-caption/heading-text-image/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/content-with-caption/heading-text-image/input.native
@@ -0,0 +1,3 @@
+[Header 1 ("a-slide",[],[]) [Str "A",Space,Str "slide"]
+,Para [Str "Some",Space,Str "text",Space,Str "here"]
+,Para [Image ("",[],[]) [Str "Followed",Space,Str "by",Space,Str "a",Space,Str "picture"] ("lalune.jpg","fig:")]]
diff --git a/test/pptx/content-with-caption/heading-text-image/output.pptx b/test/pptx/content-with-caption/heading-text-image/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/content-with-caption/heading-text-image/output.pptx differ
diff --git a/test/pptx/content-with-caption/heading-text-image/templated.pptx b/test/pptx/content-with-caption/heading-text-image/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/content-with-caption/heading-text-image/templated.pptx differ
diff --git a/test/pptx/content-with-caption/image-text/input.native b/test/pptx/content-with-caption/image-text/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/content-with-caption/image-text/input.native
@@ -0,0 +1,2 @@
+[Para [Image ("",[],[]) [Str "The",Space,Str "picture",Space,Str "first"] ("lalune.jpg","fig:")]
+,Para [Str "Then",Space,Str "some",Space,Str "text",Space,Str "here"]]
diff --git a/test/pptx/content-with-caption/image-text/output.pptx b/test/pptx/content-with-caption/image-text/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/content-with-caption/image-text/output.pptx differ
diff --git a/test/pptx/content-with-caption/image-text/templated.pptx b/test/pptx/content-with-caption/image-text/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/content-with-caption/image-text/templated.pptx differ
diff --git a/test/pptx/content-with-caption/text-image/input.native b/test/pptx/content-with-caption/text-image/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/content-with-caption/text-image/input.native
@@ -0,0 +1,2 @@
+[Para [Str "Some",Space,Str "text",Space,Str "here"]
+,Para [Image ("",[],[]) [Str "Followed",Space,Str "by",Space,Str "a",Space,Str "picture"] ("lalune.jpg","fig:")]]
diff --git a/test/pptx/content-with-caption/text-image/output.pptx b/test/pptx/content-with-caption/text-image/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/content-with-caption/text-image/output.pptx differ
diff --git a/test/pptx/content-with-caption/text-image/templated.pptx b/test/pptx/content-with-caption/text-image/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/content-with-caption/text-image/templated.pptx differ
diff --git a/test/pptx/document-properties-short-desc.native b/test/pptx/document-properties-short-desc.native
deleted file mode 100644
--- a/test/pptx/document-properties-short-desc.native
+++ /dev/null
@@ -1,2 +0,0 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "A.",Space,Str "M."]]),("description",MetaInlines [Str "Short",Space,RawInline (Format "html") "<i>",Str "description",RawInline (Format "html") "</i>",Space,Str "&."]),("keywords",MetaList [MetaInlines [Str "keyword",Space,Str "1"],MetaInlines [Str "keyword",Space,Str "2"]]),("subject",MetaInlines [Str "This",Space,Str "is",Space,Str "the",Space,Str "subject"]),("title",MetaInlines [Str "Testing",Space,Str "custom",Space,Str "properties"])]})
-[Para [Str "Testing",Space,Str "document",Space,Str "properties"]]
diff --git a/test/pptx/document-properties-short-desc.pptx b/test/pptx/document-properties-short-desc.pptx
deleted file mode 100644
Binary files a/test/pptx/document-properties-short-desc.pptx and /dev/null differ
diff --git a/test/pptx/document-properties-short-desc/input.native b/test/pptx/document-properties-short-desc/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/document-properties-short-desc/input.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "A.",Space,Str "M."]]),("description",MetaInlines [Str "Short",Space,RawInline (Format "html") "<i>",Str "description",RawInline (Format "html") "</i>",Space,Str "&."]),("keywords",MetaList [MetaInlines [Str "keyword",Space,Str "1"],MetaInlines [Str "keyword",Space,Str "2"]]),("subject",MetaInlines [Str "This",Space,Str "is",Space,Str "the",Space,Str "subject"]),("title",MetaInlines [Str "Testing",Space,Str "custom",Space,Str "properties"])]})
+[Para [Str "Testing",Space,Str "document",Space,Str "properties"]]
diff --git a/test/pptx/document-properties-short-desc/output.pptx b/test/pptx/document-properties-short-desc/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/document-properties-short-desc/output.pptx differ
diff --git a/test/pptx/document-properties-short-desc/templated.pptx b/test/pptx/document-properties-short-desc/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/document-properties-short-desc/templated.pptx differ
diff --git a/test/pptx/document-properties-short-desc_deleted_layouts.pptx b/test/pptx/document-properties-short-desc_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/document-properties-short-desc_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/document-properties-short-desc_moved_layouts.pptx b/test/pptx/document-properties-short-desc_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/document-properties-short-desc_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/document-properties-short-desc_templated.pptx b/test/pptx/document-properties-short-desc_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/document-properties-short-desc_templated.pptx and /dev/null differ
diff --git a/test/pptx/document-properties.native b/test/pptx/document-properties.native
deleted file mode 100644
--- a/test/pptx/document-properties.native
+++ /dev/null
@@ -1,2 +0,0 @@
-Pandoc (Meta {unMeta = fromList [("Company",MetaInlines [Str "My",Space,Str "Company"]),("Second Custom Property",MetaInlines [Str "Second",Space,Str "custom",Space,Str "property",Space,Str "value"]),("abstract",MetaBlocks [Plain [Str "Quite",Space,Str "a",Space,Str "long",Space,Str "description",SoftBreak,Str "spanning",Space,Str "several",Space,Str "lines"]]),("author",MetaList [MetaInlines [Str "A.",Space,Str "M."]]),("category",MetaInlines [Str "My",Space,Str "Category"]),("custom1",MetaInlines [Str "First",Space,Str "custom",Space,Str "property",Space,Str "value"]),("custom3",MetaInlines [Str "Escaping",Space,Str "amp",Space,Str "&",Space,Str "."]),("custom4",MetaInlines [Str "Escaping",Space,Str "LT,GT",Space,Str "<",Space,Str "asdf",Space,Str ">",Space,Str "<"]),("custom5",MetaInlines [Str "Escaping",Space,Str "html",Space,RawInline (Format "html") "<i>",Str "asdf",RawInline (Format "html") "</i>"]),("custom6",MetaInlines [Str "Escaping",Space,Emph [Str "MD"],Space,Str "\225",Space,Str "a"]),("custom9",MetaInlines [Str "Extended",Space,Str "chars:",Space,Str "\8364",Space,Str "\225",Space,Str "\233",Space,Str "\237",Space,Str "\243",Space,Str "\250",Space,Str "$"]),("description",MetaBlocks [Para [Str "Long",Space,Str "description",Space,Str "spanning",SoftBreak,Str "several",Space,Str "lines."],Plain [Str "This",Space,Str "is",Space,Str "\225",Space,Str "second",Space,RawInline (Format "html") "<i>",Str "line",RawInline (Format "html") "</i>",Str "."]]),("keywords",MetaList [MetaInlines [Str "keyword",Space,Str "1"],MetaInlines [Str "keyword",Space,Str "2"]]),("lang",MetaInlines [Str "en-US"]),("nested-custom",MetaList [MetaMap (fromList [("custom 7",MetaInlines [Str "Nested",Space,Str "Custom",Space,Str "value",Space,Str "7"])]),MetaMap (fromList [("custom 8",MetaInlines [Str "Nested",Space,Str "Custom",Space,Str "value",Space,Str "8"])])]),("subject",MetaInlines [Str "This",Space,Str "is",Space,Str "the",Space,Str "subject"]),("subtitle",MetaInlines [Str "This",Space,Str "is",Space,Str "a",Space,Str "subtitle"]),("title",MetaInlines [Str "Testing",Space,Str "custom",Space,Str "properties"])]})
-[Para [Str "Testing",Space,Str "document",Space,Str "properties"]]
diff --git a/test/pptx/document-properties.pptx b/test/pptx/document-properties.pptx
deleted file mode 100644
Binary files a/test/pptx/document-properties.pptx and /dev/null differ
diff --git a/test/pptx/document-properties/input.native b/test/pptx/document-properties/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/document-properties/input.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("Company",MetaInlines [Str "My",Space,Str "Company"]),("Second Custom Property",MetaInlines [Str "Second",Space,Str "custom",Space,Str "property",Space,Str "value"]),("abstract",MetaBlocks [Plain [Str "Quite",Space,Str "a",Space,Str "long",Space,Str "description",SoftBreak,Str "spanning",Space,Str "several",Space,Str "lines"]]),("author",MetaList [MetaInlines [Str "A.",Space,Str "M."]]),("category",MetaInlines [Str "My",Space,Str "Category"]),("custom1",MetaInlines [Str "First",Space,Str "custom",Space,Str "property",Space,Str "value"]),("custom3",MetaInlines [Str "Escaping",Space,Str "amp",Space,Str "&",Space,Str "."]),("custom4",MetaInlines [Str "Escaping",Space,Str "LT,GT",Space,Str "<",Space,Str "asdf",Space,Str ">",Space,Str "<"]),("custom5",MetaInlines [Str "Escaping",Space,Str "html",Space,RawInline (Format "html") "<i>",Str "asdf",RawInline (Format "html") "</i>"]),("custom6",MetaInlines [Str "Escaping",Space,Emph [Str "MD"],Space,Str "\225",Space,Str "a"]),("custom9",MetaInlines [Str "Extended",Space,Str "chars:",Space,Str "\8364",Space,Str "\225",Space,Str "\233",Space,Str "\237",Space,Str "\243",Space,Str "\250",Space,Str "$"]),("description",MetaBlocks [Para [Str "Long",Space,Str "description",Space,Str "spanning",SoftBreak,Str "several",Space,Str "lines."],Plain [Str "This",Space,Str "is",Space,Str "\225",Space,Str "second",Space,RawInline (Format "html") "<i>",Str "line",RawInline (Format "html") "</i>",Str "."]]),("keywords",MetaList [MetaInlines [Str "keyword",Space,Str "1"],MetaInlines [Str "keyword",Space,Str "2"]]),("lang",MetaInlines [Str "en-US"]),("nested-custom",MetaList [MetaMap (fromList [("custom 7",MetaInlines [Str "Nested",Space,Str "Custom",Space,Str "value",Space,Str "7"])]),MetaMap (fromList [("custom 8",MetaInlines [Str "Nested",Space,Str "Custom",Space,Str "value",Space,Str "8"])])]),("subject",MetaInlines [Str "This",Space,Str "is",Space,Str "the",Space,Str "subject"]),("subtitle",MetaInlines [Str "This",Space,Str "is",Space,Str "a",Space,Str "subtitle"]),("title",MetaInlines [Str "Testing",Space,Str "custom",Space,Str "properties"])]})
+[Para [Str "Testing",Space,Str "document",Space,Str "properties"]]
diff --git a/test/pptx/document-properties/output.pptx b/test/pptx/document-properties/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/document-properties/output.pptx differ
diff --git a/test/pptx/document-properties/templated.pptx b/test/pptx/document-properties/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/document-properties/templated.pptx differ
diff --git a/test/pptx/document-properties_deleted_layouts.pptx b/test/pptx/document-properties_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/document-properties_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/document-properties_moved_layouts.pptx b/test/pptx/document-properties_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/document-properties_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/document-properties_templated.pptx b/test/pptx/document-properties_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/document-properties_templated.pptx and /dev/null differ
diff --git a/test/pptx/endnotes-toc/output.pptx b/test/pptx/endnotes-toc/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/endnotes-toc/output.pptx differ
diff --git a/test/pptx/endnotes-toc/templated.pptx b/test/pptx/endnotes-toc/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/endnotes-toc/templated.pptx differ
diff --git a/test/pptx/endnotes.native b/test/pptx/endnotes.native
deleted file mode 100644
--- a/test/pptx/endnotes.native
+++ /dev/null
@@ -1,2 +0,0 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Str "Here",Space,Str "is",Space,Str "one",Space,Str "note.",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "note."]],Space,Str "And",Space,Str "one",Space,Str "more",Space,Str "note.",Note [Para [Str "And",Space,Str "another",Space,Str "note."]]]]
diff --git a/test/pptx/endnotes.pptx b/test/pptx/endnotes.pptx
deleted file mode 100644
Binary files a/test/pptx/endnotes.pptx and /dev/null differ
diff --git a/test/pptx/endnotes/input.native b/test/pptx/endnotes/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/endnotes/input.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList []})
+[Para [Str "Here",Space,Str "is",Space,Str "one",Space,Str "note.",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "note."]],Space,Str "And",Space,Str "one",Space,Str "more",Space,Str "note.",Note [Para [Str "And",Space,Str "another",Space,Str "note."]]]]
diff --git a/test/pptx/endnotes/output.pptx b/test/pptx/endnotes/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/endnotes/output.pptx differ
diff --git a/test/pptx/endnotes/templated.pptx b/test/pptx/endnotes/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/endnotes/templated.pptx differ
diff --git a/test/pptx/endnotes_deleted_layouts.pptx b/test/pptx/endnotes_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/endnotes_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/endnotes_moved_layouts.pptx b/test/pptx/endnotes_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/endnotes_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/endnotes_templated.pptx b/test/pptx/endnotes_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/endnotes_templated.pptx and /dev/null differ
diff --git a/test/pptx/endnotes_toc.pptx b/test/pptx/endnotes_toc.pptx
deleted file mode 100644
Binary files a/test/pptx/endnotes_toc.pptx and /dev/null differ
diff --git a/test/pptx/endnotes_toc_deleted_layouts.pptx b/test/pptx/endnotes_toc_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/endnotes_toc_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/endnotes_toc_moved_layouts.pptx b/test/pptx/endnotes_toc_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/endnotes_toc_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/endnotes_toc_templated.pptx b/test/pptx/endnotes_toc_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/endnotes_toc_templated.pptx and /dev/null differ
diff --git a/test/pptx/footer/basic/output.pptx b/test/pptx/footer/basic/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/footer/basic/output.pptx differ
diff --git a/test/pptx/footer/basic/reference.pptx b/test/pptx/footer/basic/reference.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/footer/basic/reference.pptx differ
diff --git a/test/pptx/footer/fixed-date/output.pptx b/test/pptx/footer/fixed-date/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/footer/fixed-date/output.pptx differ
diff --git a/test/pptx/footer/fixed-date/reference.pptx b/test/pptx/footer/fixed-date/reference.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/footer/fixed-date/reference.pptx differ
diff --git a/test/pptx/footer/higher-slide-number/output.pptx b/test/pptx/footer/higher-slide-number/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/footer/higher-slide-number/output.pptx differ
diff --git a/test/pptx/footer/higher-slide-number/reference.pptx b/test/pptx/footer/higher-slide-number/reference.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/footer/higher-slide-number/reference.pptx differ
diff --git a/test/pptx/footer/input.native b/test/pptx/footer/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/footer/input.native
@@ -0,0 +1,66 @@
+Pandoc (Meta {unMeta = fromList [("author",MetaInlines [Str "Me"]),("date",MetaInlines [Str "14/09/1995"]),("title",MetaInlines [Str "Slides"])]})
+[Header 2 ("slide-1",[],[]) [Str "Slide",Space,Str "1"]
+,Para [Str "Hello",Space,Str "there"]
+,Header 1 ("layouts",[],[]) [Str "Layouts"]
+,Header 2 ("slide-3",[],[]) [Str "Slide",Space,Str "3"]
+,Para [Str "Does",Space,Str "it",Space,Str "work",Space,Str "on",Space,Str "other",Space,Str "layouts?"]
+,Table ("",[],[]) (Caption Nothing
+ [])
+ [(AlignDefault,ColWidth 5.555555555555555e-2)
+ ,(AlignDefault,ColWidth 5.555555555555555e-2)]
+ (TableHead ("",[],[])
+ [])
+ [(TableBody ("",[],[]) (RowHeadColumns 0)
+  []
+  [Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "2"]]]])]
+ (TableFoot ("",[],[])
+ [])
+,Header 2 ("slide-4",[],[]) [Str "Slide",Space,Str "4"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "hello",Space,Str "hello"]]
+ ,Div ("",["column"],[])
+  [Para [Str "goood",Space,Str "bye"]]]
+,Header 2 ("slide-5",[],[]) [Str "Slide",Space,Str "5"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "Hello",Space,Str "there"]
+  ,Table ("",[],[]) (Caption Nothing
+   [])
+   [(AlignDefault,ColWidth 5.555555555555555e-2)
+   ,(AlignDefault,ColWidth 5.555555555555555e-2)]
+   (TableHead ("",[],[])
+   [])
+   [(TableBody ("",[],[]) (RowHeadColumns 0)
+    []
+    [Row ("",[],[])
+     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "1"]]
+     ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "2"]]]])]
+   (TableFoot ("",[],[])
+   [])]
+ ,Div ("",["column"],[])
+  [Para [Str "oh",Space,Str "wait"]
+  ,Table ("",[],[]) (Caption Nothing
+   [])
+   [(AlignDefault,ColWidth 5.555555555555555e-2)
+   ,(AlignDefault,ColWidth 5.555555555555555e-2)]
+   (TableHead ("",[],[])
+   [])
+   [(TableBody ("",[],[]) (RowHeadColumns 0)
+    []
+    [Row ("",[],[])
+     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "1"]]
+     ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "2"]]]])]
+   (TableFoot ("",[],[])
+   [])]]
+,Header 2 ("section",[],[]) []
+,Div ("",["notes"],[])
+ [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "blank",Space,Str "slide:",Space,Str "does",Space,Str "it",Space,Str "have",Space,Str "a",Space,Str "footer?"]]]
diff --git a/test/pptx/footer/no-title-slide/output.pptx b/test/pptx/footer/no-title-slide/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/footer/no-title-slide/output.pptx differ
diff --git a/test/pptx/footer/no-title-slide/reference.pptx b/test/pptx/footer/no-title-slide/reference.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/footer/no-title-slide/reference.pptx differ
diff --git a/test/pptx/images.native b/test/pptx/images.native
deleted file mode 100644
--- a/test/pptx/images.native
+++ /dev/null
@@ -1,5 +0,0 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Image ("",[],[]) [] ("lalune.jpg","")]
-,Para [Image ("",[],[]) [Str "The",Space,Str "Moon"] ("lalune.jpg","fig:")]
-,Header 1 ("one-more",[],[]) [Str "One",Space,Str "More"]
-,Para [Image ("",[],[]) [Str "The",Space,Str "Moon"] ("lalune.jpg","fig:")]]
diff --git a/test/pptx/images.pptx b/test/pptx/images.pptx
deleted file mode 100644
Binary files a/test/pptx/images.pptx and /dev/null differ
diff --git a/test/pptx/images/input.native b/test/pptx/images/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/images/input.native
@@ -0,0 +1,5 @@
+Pandoc (Meta {unMeta = fromList []})
+[Para [Image ("",[],[]) [] ("lalune.jpg","")]
+,Para [Image ("",[],[]) [Str "The",Space,Str "Moon"] ("lalune.jpg","fig:")]
+,Header 1 ("one-more",[],[]) [Str "One",Space,Str "More"]
+,Para [Image ("",[],[]) [Str "The",Space,Str "Moon"] ("lalune.jpg","fig:")]]
diff --git a/test/pptx/images/output.pptx b/test/pptx/images/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/images/output.pptx differ
diff --git a/test/pptx/images/templated.pptx b/test/pptx/images/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/images/templated.pptx differ
diff --git a/test/pptx/images_deleted_layouts.pptx b/test/pptx/images_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/images_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/images_moved_layouts.pptx b/test/pptx/images_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/images_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/images_templated.pptx b/test/pptx/images_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/images_templated.pptx and /dev/null differ
diff --git a/test/pptx/incremental-lists/with-flag/input.native b/test/pptx/incremental-lists/with-flag/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/incremental-lists/with-flag/input.native
@@ -0,0 +1,139 @@
+[Header 1 ("slide-1-content",[],[]) [Str "Slide",Space,Str "1",Space,Str "(Content)"]
+,BulletList
+ [[Plain [Str "These"]]
+ ,[Plain [Str "bullets"]]
+ ,[Plain [Str "should"]]
+ ,[Plain [Str "be"]]
+ ,[Plain [Str "incremental"]]]
+,Header 1 ("slide-2-content",[],[]) [Str "Slide",Space,Str "2",Space,Str "(Content)"]
+,BulletList
+ [[Para [Str "as"]]
+ ,[Para [Str "should"]]
+ ,[Para [Str "these"]]]
+,Header 1 ("slide-3-content",[],[]) [Str "Slide",Space,Str "3",Space,Str "(Content)"]
+,Para [Str "Even",Space,Str "with",Space,Str "some",Space,Str "text",Space,Str "first,",Space,Str "these",Space,Str "should:"]
+,BulletList
+ [[Plain [Str "also"]]
+ ,[Plain [Str "be"]]
+ ,[Plain [Str "incremental"]]]
+,Header 1 ("slide-4-content",[],[]) [Str "Slide",Space,Str "4",Space,Str "(Content)"]
+,OrderedList (1,Decimal,Period)
+ [[Plain [Str "These"]]
+ ,[Plain [Str "are"]]
+ ,[Plain [Str "incremental"]]]
+,Para [Str "But",Space,Str "this",Space,Str "text",Space,Str "isn\8217t"]
+,BulletList
+ [[Plain [Str "But"]]
+ ,[Plain [Str "these"]]
+ ,[Plain [Str "are"]]]
+,Header 1 ("slide-5-two-content",[],[]) [Str "Slide",Space,Str "5",Space,Str "(Two",Space,Str "Content)"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "Incremental",Space,Str "on",Space,Str "the",Space,Str "left:"]
+  ,BulletList
+   [[Plain [Str "one"]]
+   ,[Plain [Str "by"]]
+   ,[Plain [Str "one"]]]
+  ,Para [Str "With",Space,Str "something",Space,Str "below"]]
+ ,Div ("",["column"],[])
+  [Para [Str "Incremental",Space,Str "on",Space,Str "the",Space,Str "right:"]
+  ,BulletList
+   [[Plain [Str "one"]]
+   ,[Plain [Str "by"]]
+   ,[Plain [Str "one"]]]
+  ,Para [Str "With",Space,Str "something",Space,Str "else",Space,Str "below"]]]
+,Header 1 ("slide-6-two-content-right",[],[]) [Str "Slide",Space,Str "6",Space,Str "(Two",Space,Str "Content",Space,Str "Right)"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Image ("",[],[]) [Str "an",Space,Str "image"] ("lalune.jpg","fig:")]]
+ ,Div ("",["column"],[])
+  [BulletList
+   [[Plain [Str "An"]]
+   ,[Plain [Str "Incremental"]]
+   ,[Plain [Str "List"]]]]]
+,Header 1 ("slide-7-content-with-caption",[],[]) [Str "Slide",Space,Str "7",Space,Str "(Content",Space,Str "with",Space,Str "Caption)"]
+,Para [Str "First,",Space,Str "we",Space,Str "have",Space,Str "some",Space,Str "incremental",Space,Str "bullets:"]
+,BulletList
+ [[Plain [Str "one"]]
+ ,[Plain [Str "two"]]
+ ,[Plain [Str "three"]]]
+,Para [Str "Then,",Space,Str "a",Space,Str "picture:"]
+,Para [Image ("",[],[]) [Str "An",Space,Str "image"] ("./lalune.jpg","fig:")]
+,Header 1 ("slide-8-comparison",[],[]) [Str "Slide",Space,Str "8",Space,Str "(Comparison)"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [BulletList
+   [[Plain [Str "one"]]
+   ,[Plain [Str "two"]]
+   ,[Plain [Str "three"]]]
+  ,Para [Image ("",[],[]) [Str "An",Space,Str "image"] ("./lalune.jpg","fig:")]]
+ ,Div ("",["column"],[])
+  [OrderedList (1,Decimal,Period)
+   [[Plain [Str "one"]]
+   ,[Plain [Str "two"]]
+   ,[Plain [Str "three"]]]
+  ,Table ("",[],[]) (Caption Nothing
+   [])
+   [(AlignDefault,ColWidth 5.555555555555555e-2)]
+   (TableHead ("",[],[])
+   [Row ("",[],[])
+    [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+     [Plain [Str "1"]]]])
+   [(TableBody ("",[],[]) (RowHeadColumns 0)
+    []
+    [Row ("",[],[])
+     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "2"]]]])]
+   (TableFoot ("",[],[])
+   [])]]
+,Header 1 ("slide-9-content",[],[]) [Str "Slide",Space,Str "9",Space,Str "(Content)"]
+,Div ("",["nonincremental"],[])
+ [BulletList
+  [[Plain [Str "these"]]
+  ,[Plain [Str "are"]]
+  ,[Plain [Str "not"]]
+  ,[Plain [Str "incremental"]]]]
+,BulletList
+ [[Plain [Str "these"]]
+ ,[Plain [Str "are"]]]
+,Header 1 ("slide-10-content",[],[]) [Str "Slide",Space,Str "10",Space,Str "(Content)"]
+,Div ("",["incremental","nonincremental"],[])
+ [BulletList
+  [[Plain [Str "these"]]
+  ,[Plain [Str "are"]]
+  ,[Plain [Str "incremental"]]
+  ,[Plain [Str "(the",Space,Str "incremental",Space,Str "class",Space,Str "wins)"]]]]
+,Header 1 ("slide-11-content",[],[]) [Str "Slide",Space,Str "11",Space,Str "(Content)"]
+,Para [Str "These",Space,Str "bullets",Space,Str "are",Space,Str "not",Space,Str "incremental:"]
+,BlockQuote
+ [BulletList
+  [[Plain [Str "one"]]
+  ,[Plain [Str "two"]]
+  ,[Plain [Str "three"]]]]
+,Para [Str "These",Space,Str "are:"]
+,Div ("",["nonincremental"],[])
+ [BlockQuote
+  [BulletList
+   [[Plain [Str "one"]]
+   ,[Plain [Str "two"]]
+   ,[Plain [Str "three"]]]]]
+,Para [Str "These",Space,Str "are",Space,Str "not:"]
+,BlockQuote
+ [Div ("",["nonincremental"],[])
+  [BulletList
+   [[Plain [Str "one"]]
+   ,[Plain [Str "two"]]
+   ,[Plain [Str "three"]]]]]
+,Header 1 ("slide-12-content",[],[]) [Str "Slide",Space,Str "12",Space,Str "(Content)"]
+,Div ("",["nonincremental"],[])
+ [Div ("",["incremental"],[])
+  [BulletList
+   [[Plain [Str "these"]]
+   ,[Plain [Str "are"]]
+   ,[Plain [Str "incremental"]]]]]
+,Div ("",["incremental"],[])
+ [Div ("",["nonincremental"],[])
+  [BulletList
+   [[Plain [Str "these"]]
+   ,[Plain [Str "are"]]
+   ,[Plain [Str "not"]]]]]]
diff --git a/test/pptx/incremental-lists/with-flag/output.pptx b/test/pptx/incremental-lists/with-flag/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/incremental-lists/with-flag/output.pptx differ
diff --git a/test/pptx/incremental-lists/with-flag/templated.pptx b/test/pptx/incremental-lists/with-flag/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/incremental-lists/with-flag/templated.pptx differ
diff --git a/test/pptx/incremental-lists/without-flag/input.native b/test/pptx/incremental-lists/without-flag/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/incremental-lists/without-flag/input.native
@@ -0,0 +1,137 @@
+[Header 1 ("slide-1-content",[],[]) [Str "Slide",Space,Str "1",Space,Str "(Content)"]
+,Div ("",["incremental"],[])
+ [BulletList
+  [[Plain [Str "These"]]
+  ,[Plain [Str "bullets"]]
+  ,[Plain [Str "should"]]
+  ,[Plain [Str "be"]]
+  ,[Plain [Str "incremental"]]]]
+,Header 1 ("slide-2-content",[],[]) [Str "Slide",Space,Str "2",Space,Str "(Content)"]
+,BulletList
+ [[Plain [Str "These"]]
+ ,[Plain [Str "are"]]
+ ,[Plain [Str "not"]]]
+,Header 1 ("slide-3-content",[],[]) [Str "Slide",Space,Str "3",Space,Str "(Content)"]
+,Para [Str "Even",Space,Str "with",Space,Str "some",Space,Str "text",Space,Str "first,",Space,Str "these",Space,Str "should:"]
+,Div ("",["incremental"],[])
+ [BulletList
+  [[Plain [Str "also"]]
+  ,[Plain [Str "be"]]
+  ,[Plain [Str "incremental"]]]]
+,Header 1 ("slide-4-content",[],[]) [Str "Slide",Space,Str "4",Space,Str "(Content)"]
+,Div ("",["incremental"],[])
+ [OrderedList (1,Decimal,Period)
+  [[Plain [Str "These"]]
+  ,[Plain [Str "are"]]
+  ,[Plain [Str "incremental"]]]]
+,Para [Str "But",Space,Str "this",Space,Str "text",Space,Str "isn\8217t"]
+,Header 1 ("slide-5-two-content",[],[]) [Str "Slide",Space,Str "5",Space,Str "(Two",Space,Str "Content)"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "Incremental",Space,Str "on",Space,Str "the",Space,Str "left:"]
+  ,Div ("",["incremental"],[])
+   [BulletList
+    [[Plain [Str "one"]]
+    ,[Plain [Str "by"]]
+    ,[Plain [Str "one"]]]]
+  ,Para [Str "With",Space,Str "something",Space,Str "below"]]
+ ,Div ("",["column"],[])
+  [Para [Str "Incremental",Space,Str "on",Space,Str "the",Space,Str "right:"]
+  ,Div ("",["incremental"],[])
+   [BulletList
+    [[Plain [Str "one"]]
+    ,[Plain [Str "by"]]
+    ,[Plain [Str "one"]]]]
+  ,BulletList
+   [[Plain [Str "already"]]
+   ,[Plain [Str "here"]]
+   ,[Plain [Str "though"]]]]]
+,Header 1 ("slide-6-two-content-right",[],[]) [Str "Slide",Space,Str "6",Space,Str "(Two",Space,Str "Content",Space,Str "Right)"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Image ("",[],[]) [Str "an",Space,Str "image"] ("lalune.jpg","fig:")]]
+ ,Div ("",["column"],[])
+  [Div ("",["incremental"],[])
+   [BulletList
+    [[Plain [Str "An"]]
+    ,[Plain [Str "Incremental"]]
+    ,[Plain [Str "List"]]]]]]
+,Header 1 ("slide-7-content-with-caption",[],[]) [Str "Slide",Space,Str "7",Space,Str "(Content",Space,Str "with",Space,Str "Caption)"]
+,Para [Str "First,",Space,Str "we",Space,Str "have",Space,Str "some",Space,Str "incremental",Space,Str "bullets:"]
+,Div ("",["incremental"],[])
+ [BulletList
+  [[Plain [Str "one"]]
+  ,[Plain [Str "two"]]
+  ,[Plain [Str "three"]]]]
+,Para [Str "Then,",Space,Str "a",Space,Str "picture:"]
+,Para [Image ("",[],[]) [Str "An",Space,Str "image"] ("./lalune.jpg","fig:")]
+,Header 1 ("slide-8-comparison",[],[]) [Str "Slide",Space,Str "8",Space,Str "(Comparison)"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Div ("",["incremental"],[])
+   [BulletList
+    [[Plain [Str "one"]]
+    ,[Plain [Str "two"]]
+    ,[Plain [Str "three"]]]]
+  ,Para [Image ("",[],[]) [Str "An",Space,Str "image"] ("./lalune.jpg","fig:")]]
+ ,Div ("",["column"],[])
+  [Div ("",["incremental"],[])
+   [OrderedList (1,Decimal,Period)
+    [[Plain [Str "one"]]
+    ,[Plain [Str "two"]]
+    ,[Plain [Str "three"]]]]
+  ,Table ("",[],[]) (Caption Nothing
+   [])
+   [(AlignDefault,ColWidth 5.555555555555555e-2)]
+   (TableHead ("",[],[])
+   [Row ("",[],[])
+    [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+     [Plain [Str "1"]]]])
+   [(TableBody ("",[],[]) (RowHeadColumns 0)
+    []
+    [Row ("",[],[])
+     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+      [Plain [Str "2"]]]])]
+   (TableFoot ("",[],[])
+   [])]]
+,Header 1 ("slide-10-content",[],[]) [Str "Slide",Space,Str "10",Space,Str "(Content)"]
+,Div ("",["incremental","nonincremental"],[])
+ [BulletList
+  [[Plain [Str "these"]]
+  ,[Plain [Str "are"]]
+  ,[Plain [Str "incremental"]]
+  ,[Plain [Str "(the",Space,Str "incremental",Space,Str "class",Space,Str "wins)"]]]]
+,Header 1 ("slide-11-content",[],[]) [Str "Slide",Space,Str "11",Space,Str "(Content)"]
+,Para [Str "These",Space,Str "bullets",Space,Str "are",Space,Str "incremental:"]
+,BlockQuote
+ [BulletList
+  [[Plain [Str "one"]]
+  ,[Plain [Str "two"]]
+  ,[Plain [Str "three"]]]]
+,Para [Str "These",Space,Str "are",Space,Str "not:"]
+,Div ("",["incremental"],[])
+ [BlockQuote
+  [BulletList
+   [[Plain [Str "one"]]
+   ,[Plain [Str "two"]]
+   ,[Plain [Str "three"]]]]]
+,Para [Str "These",Space,Str "are:"]
+,BlockQuote
+ [Div ("",["incremental"],[])
+  [BulletList
+   [[Plain [Str "one"]]
+   ,[Plain [Str "two"]]
+   ,[Plain [Str "three"]]]]]
+,Header 1 ("slide-12-content",[],[]) [Str "Slide",Space,Str "12",Space,Str "(Content)"]
+,Div ("",["nonincremental"],[])
+ [Div ("",["incremental"],[])
+  [BulletList
+   [[Plain [Str "these"]]
+   ,[Plain [Str "are"]]
+   ,[Plain [Str "incremental"]]]]]
+,Div ("",["incremental"],[])
+ [Div ("",["nonincremental"],[])
+  [BulletList
+   [[Plain [Str "these"]]
+   ,[Plain [Str "are"]]
+   ,[Plain [Str "not"]]]]]]
diff --git a/test/pptx/incremental-lists/without-flag/output.pptx b/test/pptx/incremental-lists/without-flag/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/incremental-lists/without-flag/output.pptx differ
diff --git a/test/pptx/incremental-lists/without-flag/templated.pptx b/test/pptx/incremental-lists/without-flag/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/incremental-lists/without-flag/templated.pptx differ
diff --git a/test/pptx/inline-formatting/input.native b/test/pptx/inline-formatting/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/inline-formatting/input.native
@@ -0,0 +1,5 @@
+[Para [Str "Here",Space,Str "are",Space,Str "examples",Space,Str "of",Space,Emph [Str "italics"],Str ",",Space,Strong [Str "bold"],Str ",",Space,Str "and",Space,Strong [Emph [Str "bold",Space,Str "italics"]],Str "."]
+,Para [Str "Here",Space,Str "is",Space,Strikeout [Str "strook-three"],Space,Str "strike-through",Space,Str "and",Space,SmallCaps [Str "small",Space,Str "caps"],Str "."]
+,Para [Str "Here",Space,Str "is",Space,Span ("",["underline"],[]) [Str "some",Space,Emph [Str "underlined"],Space,Strong [Str "text"]],Str "."]
+,Para [Str "We",Space,Str "can",Space,Str "also",Space,Str "do",Space,Str "subscripts",Space,Str "(H",Subscript [Str "2"],Str "0)",Space,Str "and",Space,Str "super",Superscript [Str "script"],Str "."]
+,RawBlock (Format "html") "<!-- Comments don't show up. -->"]
diff --git a/test/pptx/inline-formatting/output.pptx b/test/pptx/inline-formatting/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/inline-formatting/output.pptx differ
diff --git a/test/pptx/inline-formatting/templated.pptx b/test/pptx/inline-formatting/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/inline-formatting/templated.pptx differ
diff --git a/test/pptx/inline_formatting.native b/test/pptx/inline_formatting.native
deleted file mode 100644
--- a/test/pptx/inline_formatting.native
+++ /dev/null
@@ -1,5 +0,0 @@
-[Para [Str "Here",Space,Str "are",Space,Str "examples",Space,Str "of",Space,Emph [Str "italics"],Str ",",Space,Strong [Str "bold"],Str ",",Space,Str "and",Space,Strong [Emph [Str "bold",Space,Str "italics"]],Str "."]
-,Para [Str "Here",Space,Str "is",Space,Strikeout [Str "strook-three"],Space,Str "strike-through",Space,Str "and",Space,SmallCaps [Str "small",Space,Str "caps"],Str "."]
-,Para [Str "Here",Space,Str "is",Space,Span ("",["underline"],[]) [Str "some",Space,Emph [Str "underlined"],Space,Strong [Str "text"]],Str "."]
-,Para [Str "We",Space,Str "can",Space,Str "also",Space,Str "do",Space,Str "subscripts",Space,Str "(H",Subscript [Str "2"],Str "0)",Space,Str "and",Space,Str "super",Superscript [Str "script"],Str "."]
-,RawBlock (Format "html") "<!-- Comments don't show up. -->"]
diff --git a/test/pptx/inline_formatting.pptx b/test/pptx/inline_formatting.pptx
deleted file mode 100644
Binary files a/test/pptx/inline_formatting.pptx and /dev/null differ
diff --git a/test/pptx/inline_formatting_deleted_layouts.pptx b/test/pptx/inline_formatting_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/inline_formatting_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/inline_formatting_moved_layouts.pptx b/test/pptx/inline_formatting_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/inline_formatting_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/inline_formatting_templated.pptx b/test/pptx/inline_formatting_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/inline_formatting_templated.pptx and /dev/null differ
diff --git a/test/pptx/list-level/input.native b/test/pptx/list-level/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/list-level/input.native
@@ -0,0 +1,20 @@
+[Header 1 ("slide",[],[]) [Str "Slide"]
+,BulletList
+ [[Para [Str "Top-level"]
+  ,Para [Str "With",Space,Str "continuation",Space,Str "paragraph"]]
+ ,[Para [Str "Then:"]
+  ,BulletList
+   [[Plain [Str "nested"]]
+   ,[Plain [Str "list"]]
+   ,[Plain [Str "items"]]]]]
+,Header 1 ("slide-1",[],[]) [Str "Slide"]
+,Para [Str "Paragraph."]
+,OrderedList (1,Decimal,Period)
+ [[Para [Str "Top-level"]
+  ,Para [Str "Continuation"]
+  ,OrderedList (1,Decimal,Period)
+   [[Para [Str "Sub-list"]
+    ,Para [Str "With",Space,Str "Continuation"]]
+   ,[Para [Str "(still",Space,Str "sub-list)"]]]]
+ ,[Para [Str "(back",Space,Str "to",Space,Str "top-level)"]]]
+,Para [Str "Paragraph."]]
diff --git a/test/pptx/list-level/output.pptx b/test/pptx/list-level/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/list-level/output.pptx differ
diff --git a/test/pptx/list-level/templated.pptx b/test/pptx/list-level/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/list-level/templated.pptx differ
diff --git a/test/pptx/lists.native b/test/pptx/lists.native
deleted file mode 100644
--- a/test/pptx/lists.native
+++ /dev/null
@@ -1,18 +0,0 @@
-[Header 1 ("lists",[],[]) [Str "Lists"]
-,BulletList
- [[Para [Str "Bulleted",Space,Str "bulleted",Space,Str "lists."]]
- ,[Para [Str "And",Space,Str "go",Space,Str "to",Space,Str "arbitrary",Space,Str "depth."]
-  ,BulletList
-   [[Para [Str "Like",Space,Str "this"]
-    ,BulletList
-     [[Plain [Str "Or",Space,Str "this"]]]]
-   ,[Para [Str "Back",Space,Str "to",Space,Str "here."]]]]]
-,Header 1 ("lists-continued",[],[]) [Str "Lists",Space,Str "(continued)"]
-,Para [Str "Lists",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "numbered:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "Tomatoes"]]
- ,[Para [Str "Potatoes",Space,Str "of",Space,Str "various",Space,Str "sorts"]
-  ,OrderedList (1,LowerAlpha,Period)
-   [[Para [Str "sweet",Space,Str "potatoes"]]
-   ,[Para [Str "russet",Space,Str "potates"]]]]
- ,[Para [Str "Tornadoes,",Space,Str "for",Space,Str "the",Space,Str "rhyme."]]]]
diff --git a/test/pptx/lists.pptx b/test/pptx/lists.pptx
deleted file mode 100644
Binary files a/test/pptx/lists.pptx and /dev/null differ
diff --git a/test/pptx/lists/input.native b/test/pptx/lists/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/lists/input.native
@@ -0,0 +1,18 @@
+[Header 1 ("lists",[],[]) [Str "Lists"]
+,BulletList
+ [[Para [Str "Bulleted",Space,Str "bulleted",Space,Str "lists."]]
+ ,[Para [Str "And",Space,Str "go",Space,Str "to",Space,Str "arbitrary",Space,Str "depth."]
+  ,BulletList
+   [[Para [Str "Like",Space,Str "this"]
+    ,BulletList
+     [[Plain [Str "Or",Space,Str "this"]]]]
+   ,[Para [Str "Back",Space,Str "to",Space,Str "here."]]]]]
+,Header 1 ("lists-continued",[],[]) [Str "Lists",Space,Str "(continued)"]
+,Para [Str "Lists",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "numbered:"]
+,OrderedList (1,Decimal,Period)
+ [[Para [Str "Tomatoes"]]
+ ,[Para [Str "Potatoes",Space,Str "of",Space,Str "various",Space,Str "sorts"]
+  ,OrderedList (1,LowerAlpha,Period)
+   [[Para [Str "sweet",Space,Str "potatoes"]]
+   ,[Para [Str "russet",Space,Str "potates"]]]]
+ ,[Para [Str "Tornadoes,",Space,Str "for",Space,Str "the",Space,Str "rhyme."]]]]
diff --git a/test/pptx/lists/output.pptx b/test/pptx/lists/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/lists/output.pptx differ
diff --git a/test/pptx/lists/templated.pptx b/test/pptx/lists/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/lists/templated.pptx differ
diff --git a/test/pptx/lists_deleted_layouts.pptx b/test/pptx/lists_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/lists_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/lists_moved_layouts.pptx b/test/pptx/lists_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/lists_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/lists_templated.pptx b/test/pptx/lists_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/lists_templated.pptx and /dev/null differ
diff --git a/test/pptx/raw-ooxml/input.native b/test/pptx/raw-ooxml/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/raw-ooxml/input.native
@@ -0,0 +1,3 @@
+[Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "text,",Space,Str "written",Space,Str "as",Space,Str "a",Space,Str "raw",Space,Str "inline:",Space,RawInline (Format "openxml") "<a:r><a:rPr /><a:t>Here are examples of </a:t></a:r><a:r><a:rPr i=\"1\" /><a:t>italics</a:t></a:r><a:r><a:rPr /><a:t>, </a:t></a:r><a:r><a:rPr b=\"1\" /><a:t>bold</a:t></a:r>"]
+,HorizontalRule
+,RawBlock (Format "openxml") "<p:sp>\n        <p:nvSpPr>\n          <p:cNvPr id=\"3\" name=\"Content Placeholder 2\" />\n          <p:cNvSpPr>\n            <a:spLocks noGrp=\"1\" />\n          </p:cNvSpPr>\n          <p:nvPr>\n            <p:ph idx=\"1\" />\n          </p:nvPr>\n        </p:nvSpPr>\n        <p:spPr />\n        <p:txBody>\n          <a:bodyPr />\n          <a:lstStyle />\n          <a:p>\n            <a:pPr lvl=\"1\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Bulleted bulleted lists.</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"1\" />\n            <a:r>\n              <a:rPr />\n              <a:t>And go to arbitrary depth.</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"2\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Like this</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"3\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Or this</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"2\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Back to here.</a:t>\n            </a:r>\n          </a:p>\n        </p:txBody>\n      </p:sp>"]
diff --git a/test/pptx/raw-ooxml/output.pptx b/test/pptx/raw-ooxml/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/raw-ooxml/output.pptx differ
diff --git a/test/pptx/raw-ooxml/templated.pptx b/test/pptx/raw-ooxml/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/raw-ooxml/templated.pptx differ
diff --git a/test/pptx/raw_ooxml.native b/test/pptx/raw_ooxml.native
deleted file mode 100644
--- a/test/pptx/raw_ooxml.native
+++ /dev/null
@@ -1,3 +0,0 @@
-[Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "text,",Space,Str "written",Space,Str "as",Space,Str "a",Space,Str "raw",Space,Str "inline:",Space,RawInline (Format "openxml") "<a:r><a:rPr /><a:t>Here are examples of </a:t></a:r><a:r><a:rPr i=\"1\" /><a:t>italics</a:t></a:r><a:r><a:rPr /><a:t>, </a:t></a:r><a:r><a:rPr b=\"1\" /><a:t>bold</a:t></a:r>"]
-,HorizontalRule
-,RawBlock (Format "openxml") "<p:sp>\n        <p:nvSpPr>\n          <p:cNvPr id=\"3\" name=\"Content Placeholder 2\" />\n          <p:cNvSpPr>\n            <a:spLocks noGrp=\"1\" />\n          </p:cNvSpPr>\n          <p:nvPr>\n            <p:ph idx=\"1\" />\n          </p:nvPr>\n        </p:nvSpPr>\n        <p:spPr />\n        <p:txBody>\n          <a:bodyPr />\n          <a:lstStyle />\n          <a:p>\n            <a:pPr lvl=\"1\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Bulleted bulleted lists.</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"1\" />\n            <a:r>\n              <a:rPr />\n              <a:t>And go to arbitrary depth.</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"2\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Like this</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"3\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Or this</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"2\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Back to here.</a:t>\n            </a:r>\n          </a:p>\n        </p:txBody>\n      </p:sp>"]
diff --git a/test/pptx/raw_ooxml.pptx b/test/pptx/raw_ooxml.pptx
deleted file mode 100644
Binary files a/test/pptx/raw_ooxml.pptx and /dev/null differ
diff --git a/test/pptx/raw_ooxml_deleted_layouts.pptx b/test/pptx/raw_ooxml_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/raw_ooxml_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/raw_ooxml_moved_layouts.pptx b/test/pptx/raw_ooxml_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/raw_ooxml_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/raw_ooxml_templated.pptx b/test/pptx/raw_ooxml_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/raw_ooxml_templated.pptx and /dev/null differ
diff --git a/test/pptx/reference-deleted-layouts.pptx b/test/pptx/reference-deleted-layouts.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/reference-deleted-layouts.pptx differ
diff --git a/test/pptx/reference-depth.pptx b/test/pptx/reference-depth.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/reference-depth.pptx differ
diff --git a/test/pptx/reference-moved-layouts.pptx b/test/pptx/reference-moved-layouts.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/reference-moved-layouts.pptx differ
diff --git a/test/pptx/reference_deleted_layouts.pptx b/test/pptx/reference_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/reference_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/reference_depth.pptx b/test/pptx/reference_depth.pptx
deleted file mode 100644
Binary files a/test/pptx/reference_depth.pptx and /dev/null differ
diff --git a/test/pptx/reference_moved_layouts.pptx b/test/pptx/reference_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/reference_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/remove-empty-slides/input.native b/test/pptx/remove-empty-slides/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/remove-empty-slides/input.native
@@ -0,0 +1,5 @@
+[Para [Str "Content"]
+,Para [Image ("",[],[]) [] ("lalune.jpg",""),Space,RawInline (Format "html") "<!--  -->"]
+,HorizontalRule
+,HorizontalRule
+,Para [Str "More",Space,Str "content"]]
diff --git a/test/pptx/remove-empty-slides/output.pptx b/test/pptx/remove-empty-slides/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/remove-empty-slides/output.pptx differ
diff --git a/test/pptx/remove-empty-slides/templated.pptx b/test/pptx/remove-empty-slides/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/remove-empty-slides/templated.pptx differ
diff --git a/test/pptx/remove_empty_slides.native b/test/pptx/remove_empty_slides.native
deleted file mode 100644
--- a/test/pptx/remove_empty_slides.native
+++ /dev/null
@@ -1,5 +0,0 @@
-[Para [Str "Content"]
-,Para [Image ("",[],[]) [] ("lalune.jpg",""),Space,RawInline (Format "html") "<!--  -->"]
-,HorizontalRule
-,HorizontalRule
-,Para [Str "More",Space,Str "content"]]
diff --git a/test/pptx/remove_empty_slides.pptx b/test/pptx/remove_empty_slides.pptx
deleted file mode 100644
Binary files a/test/pptx/remove_empty_slides.pptx and /dev/null differ
diff --git a/test/pptx/remove_empty_slides_deleted_layouts.pptx b/test/pptx/remove_empty_slides_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/remove_empty_slides_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/remove_empty_slides_moved_layouts.pptx b/test/pptx/remove_empty_slides_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/remove_empty_slides_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/remove_empty_slides_templated.pptx b/test/pptx/remove_empty_slides_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/remove_empty_slides_templated.pptx and /dev/null differ
diff --git a/test/pptx/slide-breaks-slide-level-1/output.pptx b/test/pptx/slide-breaks-slide-level-1/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-breaks-slide-level-1/output.pptx differ
diff --git a/test/pptx/slide-breaks-slide-level-1/templated.pptx b/test/pptx/slide-breaks-slide-level-1/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-breaks-slide-level-1/templated.pptx differ
diff --git a/test/pptx/slide-breaks-toc/output.pptx b/test/pptx/slide-breaks-toc/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-breaks-toc/output.pptx differ
diff --git a/test/pptx/slide-breaks-toc/templated.pptx b/test/pptx/slide-breaks-toc/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-breaks-toc/templated.pptx differ
diff --git a/test/pptx/slide-breaks/input.native b/test/pptx/slide-breaks/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/slide-breaks/input.native
@@ -0,0 +1,7 @@
+Pandoc (Meta {unMeta = fromList []})
+[Para [Str "Break",Space,Str "with",Space,Str "a",Space,Str "new",Space,Str "section-level",Space,Str "header"]
+,Header 1 ("below-section-level",[],[]) [Str "Below",Space,Str "section-level"]
+,Header 2 ("section-level",[],[]) [Str "Section-level"]
+,Para [Str "Third",Space,Str "slide",Space,Str "(with",Space,Str "a",Space,Str "section-level",Space,Str "of",Space,Str "2)"]
+,HorizontalRule
+,Para [Str "This",Space,Str "is",Space,Str "another",Space,Str "slide."]]
diff --git a/test/pptx/slide-breaks/output.pptx b/test/pptx/slide-breaks/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-breaks/output.pptx differ
diff --git a/test/pptx/slide-breaks/templated.pptx b/test/pptx/slide-breaks/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-breaks/templated.pptx differ
diff --git a/test/pptx/slide-level-0/h1-h2-with-table/input.native b/test/pptx/slide-level-0/h1-h2-with-table/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/slide-level-0/h1-h2-with-table/input.native
@@ -0,0 +1,14 @@
+[Header 1 ("hello",[],[]) [Str "Hello"]
+,Header 2 ("there",[],[]) [Str "There"]
+,Table ("",[],[]) (Caption Nothing
+ [])
+ [(AlignDefault,ColWidth 5.555555555555555e-2)]
+ (TableHead ("",[],[])
+ [])
+ [(TableBody ("",[],[]) (RowHeadColumns 0)
+  []
+  [Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]]])]
+ (TableFoot ("",[],[])
+ [])]
diff --git a/test/pptx/slide-level-0/h1-h2-with-table/output.pptx b/test/pptx/slide-level-0/h1-h2-with-table/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-level-0/h1-h2-with-table/output.pptx differ
diff --git a/test/pptx/slide-level-0/h1-h2-with-table/templated.pptx b/test/pptx/slide-level-0/h1-h2-with-table/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-level-0/h1-h2-with-table/templated.pptx differ
diff --git a/test/pptx/slide-level-0/h1-with-image/input.native b/test/pptx/slide-level-0/h1-with-image/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/slide-level-0/h1-with-image/input.native
@@ -0,0 +1,2 @@
+[Header 1 ("hello",[],[]) [Str "Hello"]
+,Para [Image ("",[],[]) [Str "An",Space,Str "image"] ("lalune.jpg","fig:")]]
diff --git a/test/pptx/slide-level-0/h1-with-image/output.pptx b/test/pptx/slide-level-0/h1-with-image/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-level-0/h1-with-image/output.pptx differ
diff --git a/test/pptx/slide-level-0/h1-with-image/templated.pptx b/test/pptx/slide-level-0/h1-with-image/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-level-0/h1-with-image/templated.pptx differ
diff --git a/test/pptx/slide-level-0/h1-with-table/input.native b/test/pptx/slide-level-0/h1-with-table/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/slide-level-0/h1-with-table/input.native
@@ -0,0 +1,13 @@
+[Header 1 ("hello",[],[]) [Str "Hello"]
+,Table ("",[],[]) (Caption Nothing
+ [])
+ [(AlignDefault,ColWidth 5.555555555555555e-2)]
+ (TableHead ("",[],[])
+ [])
+ [(TableBody ("",[],[]) (RowHeadColumns 0)
+  []
+  [Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]]])]
+ (TableFoot ("",[],[])
+ [])]
diff --git a/test/pptx/slide-level-0/h1-with-table/output.pptx b/test/pptx/slide-level-0/h1-with-table/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-level-0/h1-with-table/output.pptx differ
diff --git a/test/pptx/slide-level-0/h1-with-table/templated.pptx b/test/pptx/slide-level-0/h1-with-table/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-level-0/h1-with-table/templated.pptx differ
diff --git a/test/pptx/slide-level-0/h2-with-image/input.native b/test/pptx/slide-level-0/h2-with-image/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/slide-level-0/h2-with-image/input.native
@@ -0,0 +1,2 @@
+[Header 2 ("hello",[],[]) [Str "Hello"]
+,Para [Image ("",[],[]) [Str "An",Space,Str "image"] ("lalune.jpg","fig:")]]
diff --git a/test/pptx/slide-level-0/h2-with-image/output.pptx b/test/pptx/slide-level-0/h2-with-image/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-level-0/h2-with-image/output.pptx differ
diff --git a/test/pptx/slide-level-0/h2-with-image/templated.pptx b/test/pptx/slide-level-0/h2-with-image/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/slide-level-0/h2-with-image/templated.pptx differ
diff --git a/test/pptx/slide_breaks.native b/test/pptx/slide_breaks.native
deleted file mode 100644
--- a/test/pptx/slide_breaks.native
+++ /dev/null
@@ -1,7 +0,0 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Str "Break",Space,Str "with",Space,Str "a",Space,Str "new",Space,Str "section-level",Space,Str "header"]
-,Header 1 ("below-section-level",[],[]) [Str "Below",Space,Str "section-level"]
-,Header 2 ("section-level",[],[]) [Str "Section-level"]
-,Para [Str "Third",Space,Str "slide",Space,Str "(with",Space,Str "a",Space,Str "section-level",Space,Str "of",Space,Str "2)"]
-,HorizontalRule
-,Para [Str "This",Space,Str "is",Space,Str "another",Space,Str "slide."]]
diff --git a/test/pptx/slide_breaks.pptx b/test/pptx/slide_breaks.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_deleted_layouts.pptx b/test/pptx/slide_breaks_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_moved_layouts.pptx b/test/pptx/slide_breaks_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_slide_level_1.pptx b/test/pptx/slide_breaks_slide_level_1.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_slide_level_1.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_slide_level_1_deleted_layouts.pptx b/test/pptx/slide_breaks_slide_level_1_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_slide_level_1_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_slide_level_1_moved_layouts.pptx b/test/pptx/slide_breaks_slide_level_1_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_slide_level_1_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_slide_level_1_templated.pptx b/test/pptx/slide_breaks_slide_level_1_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_slide_level_1_templated.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_templated.pptx b/test/pptx/slide_breaks_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_templated.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_toc.pptx b/test/pptx/slide_breaks_toc.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_toc.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_toc_deleted_layouts.pptx b/test/pptx/slide_breaks_toc_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_toc_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_toc_moved_layouts.pptx b/test/pptx/slide_breaks_toc_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_toc_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/slide_breaks_toc_templated.pptx b/test/pptx/slide_breaks_toc_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/slide_breaks_toc_templated.pptx and /dev/null differ
diff --git a/test/pptx/speaker-notes-after-metadata/input.native b/test/pptx/speaker-notes-after-metadata/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/speaker-notes-after-metadata/input.native
@@ -0,0 +1,5 @@
+Pandoc (Meta {unMeta = fromList [("author",MetaInlines [Str "Jesse",Space,Str "Rosenthal"]),("title",MetaInlines [Str "Testing"])]})
+[Div ("",["notes"],[])
+ [Para [Str "Some",Space,Str "speaker",Space,Str "notes"]]
+,Header 1 ("a-header",[],[]) [Str "A",Space,Str "header"]
+,Para [Str "And",Space,Str "a",Space,Str "new",Space,Str "slide."]]
diff --git a/test/pptx/speaker-notes-after-metadata/output.pptx b/test/pptx/speaker-notes-after-metadata/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/speaker-notes-after-metadata/output.pptx differ
diff --git a/test/pptx/speaker-notes-after-metadata/templated.pptx b/test/pptx/speaker-notes-after-metadata/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/speaker-notes-after-metadata/templated.pptx differ
diff --git a/test/pptx/speaker-notes-afterheader/input.native b/test/pptx/speaker-notes-afterheader/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/speaker-notes-afterheader/input.native
@@ -0,0 +1,3 @@
+[Header 1 ("here-is-a-single-header",[],[]) [Str "Here",Space,Str "is",Space,Str "a",Space,Str "single",Space,Str "header"]
+,Div ("",["notes"],[])
+ [Para [Str "and",Space,Str "here",Space,Str "are",Space,Str "some",Space,Str "notes"]]]
diff --git a/test/pptx/speaker-notes-afterheader/output.pptx b/test/pptx/speaker-notes-afterheader/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/speaker-notes-afterheader/output.pptx differ
diff --git a/test/pptx/speaker-notes-afterheader/templated.pptx b/test/pptx/speaker-notes-afterheader/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/speaker-notes-afterheader/templated.pptx differ
diff --git a/test/pptx/speaker-notes-afterseps/input.native b/test/pptx/speaker-notes-afterseps/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/speaker-notes-afterseps/input.native
@@ -0,0 +1,63 @@
+[Para [Image ("",[],[]) [Str "The",Space,Str "moon"] ("lalune.jpg","fig:")]
+,Div ("",["notes"],[])
+ [Para [Str "chicken",Space,Str "and",Space,Str "dumplings"]]
+,Table ("",[],[]) (Caption Nothing
+ [Para [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax,",Space,Str "with",Space,Str "alignment"]])
+ [(AlignRight,ColWidthDefault)
+ ,(AlignLeft,ColWidthDefault)
+ ,(AlignCenter,ColWidthDefault)
+ ,(AlignDefault,ColWidthDefault)]
+ (TableHead ("",[],[])
+ [Row ("",[],[])
+  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Right"]]
+  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Left"]]
+  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Center"]]
+  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Default"]]]])
+ [(TableBody ("",[],[]) (RowHeadColumns 0)
+  []
+  [Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]]
+  ,Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]]
+  ,Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]]])]
+ (TableFoot ("",[],[])
+ [])
+,Div ("",["notes"],[])
+ [Para [Str "foo",Space,Str "bar"]]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [BulletList
+   [[Para [Str "some",Space,Str "stuff"]]
+   ,[Para [Str "some",Space,Str "more",Space,Str "stuff"]]]
+  ,Div ("",["notes"],[])
+   [Para [Str "Some",Space,Str "notes",Space,Str "inside",Space,Str "a",Space,Str "column"]]]
+ ,Div ("",["column"],[])
+  [Para [Str "Some",Space,Str "other",Space,Emph [Str "stuff"]]]]
+,Div ("",["notes"],[])
+ [Para [Str "Some",Space,Str "notes",Space,Str "outside",Space,Str "the",Space,Str "column"]]]
diff --git a/test/pptx/speaker-notes-afterseps/output.pptx b/test/pptx/speaker-notes-afterseps/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/speaker-notes-afterseps/output.pptx differ
diff --git a/test/pptx/speaker-notes-afterseps/templated.pptx b/test/pptx/speaker-notes-afterseps/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/speaker-notes-afterseps/templated.pptx differ
diff --git a/test/pptx/speaker-notes/input.native b/test/pptx/speaker-notes/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/speaker-notes/input.native
@@ -0,0 +1,17 @@
+[Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "slide."]
+,Div ("",["notes"],[])
+ [Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "note."]
+ ,Para [Str "Here",Space,Str "is",Space,Emph [Str "some"],Space,Strong [Str "other"],Space,Str "formatting."]]
+,HorizontalRule
+,Para [Str "A",Space,Str "page",Space,Str "with",Space,Str "no",Space,Str "speaker",Space,Str "notes"]
+,HorizontalRule
+,Div ("",["notes"],[])
+ [Para [Str "The",Space,Str "first",Space,Str "note",Space,Str "div"]]
+,Para [Str "A",Space,Str "page",Space,Str "with",Space,Str "two",Space,Str "notes."]
+,Div ("",["notes"],[])
+ [Para [Str "The",Space,Str "second",Space,Str "note",Space,Str "div"]]
+,HorizontalRule
+,Para [Str "Strip",Space,Str "links",Space,Str "and",Space,Str "footnotes."]
+,Div ("",["notes"],[])
+ [Para [Str "No",Space,Link ("",[],[]) [Str "link"] ("https://www.google.com",""),Space,Str "here."]
+ ,Para [Str "No",Space,Str "note",Space,Str "here.",Note [Para [Str "You\8217ll",Space,Str "never",Space,Str "read",Space,Str "this"]]]]]
diff --git a/test/pptx/speaker-notes/output.pptx b/test/pptx/speaker-notes/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/speaker-notes/output.pptx differ
diff --git a/test/pptx/speaker-notes/templated.pptx b/test/pptx/speaker-notes/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/speaker-notes/templated.pptx differ
diff --git a/test/pptx/speaker_notes.native b/test/pptx/speaker_notes.native
deleted file mode 100644
--- a/test/pptx/speaker_notes.native
+++ /dev/null
@@ -1,17 +0,0 @@
-[Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "slide."]
-,Div ("",["notes"],[])
- [Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "note."]
- ,Para [Str "Here",Space,Str "is",Space,Emph [Str "some"],Space,Strong [Str "other"],Space,Str "formatting."]]
-,HorizontalRule
-,Para [Str "A",Space,Str "page",Space,Str "with",Space,Str "no",Space,Str "speaker",Space,Str "notes"]
-,HorizontalRule
-,Div ("",["notes"],[])
- [Para [Str "The",Space,Str "first",Space,Str "note",Space,Str "div"]]
-,Para [Str "A",Space,Str "page",Space,Str "with",Space,Str "two",Space,Str "notes."]
-,Div ("",["notes"],[])
- [Para [Str "The",Space,Str "second",Space,Str "note",Space,Str "div"]]
-,HorizontalRule
-,Para [Str "Strip",Space,Str "links",Space,Str "and",Space,Str "footnotes."]
-,Div ("",["notes"],[])
- [Para [Str "No",Space,Link ("",[],[]) [Str "link"] ("https://www.google.com",""),Space,Str "here."]
- ,Para [Str "No",Space,Str "note",Space,Str "here.",Note [Para [Str "You\8217ll",Space,Str "never",Space,Str "read",Space,Str "this"]]]]]
diff --git a/test/pptx/speaker_notes.pptx b/test/pptx/speaker_notes.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_after_metadata.native b/test/pptx/speaker_notes_after_metadata.native
deleted file mode 100644
--- a/test/pptx/speaker_notes_after_metadata.native
+++ /dev/null
@@ -1,5 +0,0 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaInlines [Str "Jesse",Space,Str "Rosenthal"]),("title",MetaInlines [Str "Testing"])]})
-[Div ("",["notes"],[])
- [Para [Str "Some",Space,Str "speaker",Space,Str "notes"]]
-,Header 1 ("a-header",[],[]) [Str "A",Space,Str "header"]
-,Para [Str "And",Space,Str "a",Space,Str "new",Space,Str "slide."]]
diff --git a/test/pptx/speaker_notes_after_metadata.pptx b/test/pptx/speaker_notes_after_metadata.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_after_metadata.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_after_metadata_deleted_layouts.pptx b/test/pptx/speaker_notes_after_metadata_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_after_metadata_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_after_metadata_moved_layouts.pptx b/test/pptx/speaker_notes_after_metadata_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_after_metadata_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_after_metadata_templated.pptx b/test/pptx/speaker_notes_after_metadata_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_after_metadata_templated.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_afterheader.native b/test/pptx/speaker_notes_afterheader.native
deleted file mode 100644
--- a/test/pptx/speaker_notes_afterheader.native
+++ /dev/null
@@ -1,3 +0,0 @@
-[Header 1 ("here-is-a-single-header",[],[]) [Str "Here",Space,Str "is",Space,Str "a",Space,Str "single",Space,Str "header"]
-,Div ("",["notes"],[])
- [Para [Str "and",Space,Str "here",Space,Str "are",Space,Str "some",Space,Str "notes"]]]
diff --git a/test/pptx/speaker_notes_afterheader.pptx b/test/pptx/speaker_notes_afterheader.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_afterheader.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_afterheader_deleted_layouts.pptx b/test/pptx/speaker_notes_afterheader_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_afterheader_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_afterheader_moved_layouts.pptx b/test/pptx/speaker_notes_afterheader_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_afterheader_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_afterheader_templated.pptx b/test/pptx/speaker_notes_afterheader_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_afterheader_templated.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_afterseps.native b/test/pptx/speaker_notes_afterseps.native
deleted file mode 100644
--- a/test/pptx/speaker_notes_afterseps.native
+++ /dev/null
@@ -1,63 +0,0 @@
-[Para [Image ("",[],[]) [Str "The",Space,Str "moon"] ("lalune.jpg","fig:")]
-,Div ("",["notes"],[])
- [Para [Str "chicken",Space,Str "and",Space,Str "dumplings"]]
-,Table ("",[],[]) (Caption Nothing
- [Para [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax,",Space,Str "with",Space,Str "alignment"]])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Div ("",["notes"],[])
- [Para [Str "foo",Space,Str "bar"]]
-,Div ("",["columns"],[])
- [Div ("",["column"],[])
-  [BulletList
-   [[Para [Str "some",Space,Str "stuff"]]
-   ,[Para [Str "some",Space,Str "more",Space,Str "stuff"]]]
-  ,Div ("",["notes"],[])
-   [Para [Str "Some",Space,Str "notes",Space,Str "inside",Space,Str "a",Space,Str "column"]]]
- ,Div ("",["column"],[])
-  [Para [Str "Some",Space,Str "other",Space,Emph [Str "stuff"]]]]
-,Div ("",["notes"],[])
- [Para [Str "Some",Space,Str "notes",Space,Str "outside",Space,Str "the",Space,Str "column"]]]
diff --git a/test/pptx/speaker_notes_afterseps.pptx b/test/pptx/speaker_notes_afterseps.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_afterseps.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_afterseps_deleted_layouts.pptx b/test/pptx/speaker_notes_afterseps_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_afterseps_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_afterseps_moved_layouts.pptx b/test/pptx/speaker_notes_afterseps_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_afterseps_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_afterseps_templated.pptx b/test/pptx/speaker_notes_afterseps_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_afterseps_templated.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_deleted_layouts.pptx b/test/pptx/speaker_notes_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_moved_layouts.pptx b/test/pptx/speaker_notes_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/speaker_notes_templated.pptx b/test/pptx/speaker_notes_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/speaker_notes_templated.pptx and /dev/null differ
diff --git a/test/pptx/start-numbering-at/input.native b/test/pptx/start-numbering-at/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/start-numbering-at/input.native
@@ -0,0 +1,9 @@
+[Header 2 ("example-numbering-mwe",[],[]) [Str "Example",Space,Str "numbering",Space,Str "MWE"]
+,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "slide",Space,Str "with",Space,Str "examples",Space,Str "in",Space,Str "(1)",Space,Str "and",Space,Str "(2)"]
+,OrderedList (1,Example,TwoParens)
+ [[Plain [Str "First"]]
+ ,[Plain [Str "Second"]]]
+,Header 2 ("a-second-slide",[],[]) [Str "A",Space,Str "second",Space,Str "slide"]
+,Para [Str "This",Space,Str "second",Space,Str "slide",Space,Str "has",Space,Str "a",Space,Str "third",Space,Str "example",Space,Str "in",Space,Str "(3)."]
+,OrderedList (3,Example,TwoParens)
+ [[Plain [Str "Third"]]]]
diff --git a/test/pptx/start-numbering-at/output.pptx b/test/pptx/start-numbering-at/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/start-numbering-at/output.pptx differ
diff --git a/test/pptx/start-numbering-at/templated.pptx b/test/pptx/start-numbering-at/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/start-numbering-at/templated.pptx differ
diff --git a/test/pptx/start_numbering_at.native b/test/pptx/start_numbering_at.native
deleted file mode 100644
--- a/test/pptx/start_numbering_at.native
+++ /dev/null
@@ -1,9 +0,0 @@
-[Header 2 ("example-numbering-mwe",[],[]) [Str "Example",Space,Str "numbering",Space,Str "MWE"]
-,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "slide",Space,Str "with",Space,Str "examples",Space,Str "in",Space,Str "(1)",Space,Str "and",Space,Str "(2)"]
-,OrderedList (1,Example,TwoParens)
- [[Plain [Str "First"]]
- ,[Plain [Str "Second"]]]
-,Header 2 ("a-second-slide",[],[]) [Str "A",Space,Str "second",Space,Str "slide"]
-,Para [Str "This",Space,Str "second",Space,Str "slide",Space,Str "has",Space,Str "a",Space,Str "third",Space,Str "example",Space,Str "in",Space,Str "(3)."]
-,OrderedList (3,Example,TwoParens)
- [[Plain [Str "Third"]]]]
diff --git a/test/pptx/start_numbering_at.pptx b/test/pptx/start_numbering_at.pptx
deleted file mode 100644
Binary files a/test/pptx/start_numbering_at.pptx and /dev/null differ
diff --git a/test/pptx/start_numbering_at_deleted_layouts.pptx b/test/pptx/start_numbering_at_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/start_numbering_at_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/start_numbering_at_moved_layouts.pptx b/test/pptx/start_numbering_at_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/start_numbering_at_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/start_numbering_at_templated.pptx b/test/pptx/start_numbering_at_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/start_numbering_at_templated.pptx and /dev/null differ
diff --git a/test/pptx/tables.native b/test/pptx/tables.native
deleted file mode 100644
--- a/test/pptx/tables.native
+++ /dev/null
@@ -1,95 +0,0 @@
-[Header 2 ("a-table-with-a-caption",[],[]) [Str "A",Space,Str "Table,",Space,Str "with",Space,Str "a",Space,Str "caption"]
-,Table ("",[],[]) (Caption Nothing
- [Para [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax,",Space,Str "with",Space,Str "alignment"]])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])]
diff --git a/test/pptx/tables.pptx b/test/pptx/tables.pptx
deleted file mode 100644
Binary files a/test/pptx/tables.pptx and /dev/null differ
diff --git a/test/pptx/tables/input.native b/test/pptx/tables/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/tables/input.native
@@ -0,0 +1,95 @@
+[Header 2 ("a-table-with-a-caption",[],[]) [Str "A",Space,Str "Table,",Space,Str "with",Space,Str "a",Space,Str "caption"]
+,Table ("",[],[]) (Caption Nothing
+ [Para [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax,",Space,Str "with",Space,Str "alignment"]])
+ [(AlignRight,ColWidthDefault)
+ ,(AlignLeft,ColWidthDefault)
+ ,(AlignCenter,ColWidthDefault)
+ ,(AlignDefault,ColWidthDefault)]
+ (TableHead ("",[],[])
+ [Row ("",[],[])
+  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Right"]]
+  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Left"]]
+  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Center"]]
+  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Default"]]]])
+ [(TableBody ("",[],[]) (RowHeadColumns 0)
+  []
+  [Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]]
+  ,Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]]
+  ,Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]]])]
+ (TableFoot ("",[],[])
+ [])
+,Table ("",[],[]) (Caption Nothing
+ [])
+ [(AlignRight,ColWidthDefault)
+ ,(AlignLeft,ColWidthDefault)
+ ,(AlignCenter,ColWidthDefault)
+ ,(AlignDefault,ColWidthDefault)]
+ (TableHead ("",[],[])
+ [Row ("",[],[])
+  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Right"]]
+  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Left"]]
+  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Center"]]
+  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+   [Plain [Str "Default"]]]])
+ [(TableBody ("",[],[]) (RowHeadColumns 0)
+  []
+  [Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "12"]]]
+  ,Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "123"]]]
+  ,Row ("",[],[])
+   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]
+   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
+    [Plain [Str "1"]]]])]
+ (TableFoot ("",[],[])
+ [])]
diff --git a/test/pptx/tables/output.pptx b/test/pptx/tables/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/tables/output.pptx differ
diff --git a/test/pptx/tables/templated.pptx b/test/pptx/tables/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/tables/templated.pptx differ
diff --git a/test/pptx/tables_deleted_layouts.pptx b/test/pptx/tables_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/tables_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/tables_moved_layouts.pptx b/test/pptx/tables_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/tables_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/tables_templated.pptx b/test/pptx/tables_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/tables_templated.pptx and /dev/null differ
diff --git a/test/pptx/two-column/all-text/input.native b/test/pptx/two-column/all-text/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/two-column/all-text/input.native
@@ -0,0 +1,9 @@
+Pandoc (Meta {unMeta = fromList []})
+[Header 1 ("two-column-layout",[],[]) [Str "Two-Column",Space,Str "Layout"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "One",Space,Str "paragraph."]
+  ,Para [Str "Another",Space,Str "paragraph."]]
+ ,Div ("",["column"],[])
+  [Para [Str "Second",Space,Str "column",Space,Str "paragraph."]
+  ,Para [Str "Another",Space,Str "second",Space,Str "paragraph."]]]]
diff --git a/test/pptx/two-column/all-text/output.pptx b/test/pptx/two-column/all-text/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/two-column/all-text/output.pptx differ
diff --git a/test/pptx/two-column/all-text/templated.pptx b/test/pptx/two-column/all-text/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/two-column/all-text/templated.pptx differ
diff --git a/test/pptx/two-column/text-and-image/input.native b/test/pptx/two-column/text-and-image/input.native
new file mode 100644
--- /dev/null
+++ b/test/pptx/two-column/text-and-image/input.native
@@ -0,0 +1,12 @@
+[Header 1 ("slide-1",[],[]) [Str "Slide",Space,Str "1"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Image ("",[],[]) [Str "an",Space,Str "image"] ("lalune.jpg","fig:")]]
+ ,Div ("",["column"],[])
+  [Para [Str "This",Space,Str "should",Space,Str "use",Space,Str "Two",Space,Str "Content,",Space,Emph [Str "not"],Space,Str "Comparison!"]]]
+,Header 1 ("slide-2",[],[]) [Str "Slide",Space,Str "2"]
+,Div ("",["columns"],[])
+ [Div ("",["column"],[])
+  [Para [Str "This",Space,Str "should",Space,Str "also",Space,Str "use",Space,Str "Two",Space,Str "Content"]]
+ ,Div ("",["column"],[])
+  [Para [Image ("",[],[]) [Str "an",Space,Str "image"] ("lalune.jpg","fig:")]]]]
diff --git a/test/pptx/two-column/text-and-image/output.pptx b/test/pptx/two-column/text-and-image/output.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/two-column/text-and-image/output.pptx differ
diff --git a/test/pptx/two-column/text-and-image/templated.pptx b/test/pptx/two-column/text-and-image/templated.pptx
new file mode 100644
Binary files /dev/null and b/test/pptx/two-column/text-and-image/templated.pptx differ
diff --git a/test/pptx/two_column.native b/test/pptx/two_column.native
deleted file mode 100644
--- a/test/pptx/two_column.native
+++ /dev/null
@@ -1,9 +0,0 @@
-Pandoc (Meta {unMeta = fromList []})
-[Header 1 ("two-column-layout",[],[]) [Str "Two-Column",Space,Str "Layout"]
-,Div ("",["columns"],[])
- [Div ("",["column"],[])
-  [Para [Str "One",Space,Str "paragraph."]
-  ,Para [Str "Another",Space,Str "paragraph."]]
- ,Div ("",["column"],[])
-  [Para [Str "Second",Space,Str "column",Space,Str "paragraph."]
-  ,Para [Str "Another",Space,Str "second",Space,Str "paragraph."]]]]
diff --git a/test/pptx/two_column.pptx b/test/pptx/two_column.pptx
deleted file mode 100644
Binary files a/test/pptx/two_column.pptx and /dev/null differ
diff --git a/test/pptx/two_column_deleted_layouts.pptx b/test/pptx/two_column_deleted_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/two_column_deleted_layouts.pptx and /dev/null differ
diff --git a/test/pptx/two_column_moved_layouts.pptx b/test/pptx/two_column_moved_layouts.pptx
deleted file mode 100644
Binary files a/test/pptx/two_column_moved_layouts.pptx and /dev/null differ
diff --git a/test/pptx/two_column_templated.pptx b/test/pptx/two_column_templated.pptx
deleted file mode 100644
Binary files a/test/pptx/two_column_templated.pptx and /dev/null differ
diff --git a/test/rst-reader.native b/test/rst-reader.native
--- a/test/rst-reader.native
+++ b/test/rst-reader.native
@@ -1,443 +1,1725 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Space,Str "MacFarlane"],MetaInlines [Str "Anonymous"]]),("date",MetaInlines [Str "July",Space,Str "17,",Space,Str "2006"]),("revision",MetaBlocks [Para [Str "3"]]),("subtitle",MetaInlines [Str "Subtitle"]),("title",MetaInlines [Str "Pandoc",Space,Str "Test",Space,Str "Suite"])]})
-[Header 1 ("level-one-header",[],[]) [Str "Level",Space,Str "one",Space,Str "header"]
-,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",SoftBreak,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
-,Header 2 ("level-two-header",[],[]) [Str "Level",Space,Str "two",Space,Str "header"]
-,Header 3 ("level-three",[],[]) [Str "Level",Space,Str "three"]
-,Header 4 ("level-four-with-emphasis",[],[]) [Str "Level",Space,Str "four",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 5 ("level-five",[],[]) [Str "Level",Space,Str "five"]
-,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
-,Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",SoftBreak,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",SoftBreak,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",SoftBreak,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",SoftBreak,Str "list",Space,Str "item."]
-,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",SoftBreak,Str "*",Space,Str "criminey."]
-,Para [Str "Horizontal",Space,Str "rule:"]
-,HorizontalRule
-,Para [Str "Another:"]
-,HorizontalRule
-,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "block",Space,Str "quote:"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",SoftBreak,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
-,Para [Str "Here\8217s",Space,Str "another,",Space,Str "differently",Space,Str "indented:"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",SoftBreak,Str "It\8217s",Space,Str "indented",Space,Str "with",Space,Str "a",Space,Str "tab."]
- ,Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- ,CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"
- ,Para [Str "List",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- ,OrderedList (1,Decimal,Period)
-  [[Plain [Str "item",Space,Str "one"]]
-  ,[Plain [Str "item",Space,Str "two"]]]
- ,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
- ,BlockQuote
-  [Para [Str "nested"]
-  ,BlockQuote
-   [Para [Str "nested"]]]]
-,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}"
-,CodeBlock ("",[],[]) "this code block is indented by one tab"
-,Para [Str "And:"]
-,CodeBlock ("",[],[]) "this block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
-,Para [Str "And:"]
-,CodeBlock ("",["python"],[]) "def my_function(x):\n    return x + 1"
-,Para [Str "If",Space,Str "we",Space,Str "use",Space,Str "the",Space,Str "highlight",Space,Str "directive,",Space,Str "we",Space,Str "can",Space,Str "specify",Space,Str "a",Space,Str "default",Space,Str "language",SoftBreak,Str "for",Space,Str "literate",Space,Str "blocks."]
-,CodeBlock ("",["haskell"],[]) "-- this code is in haskell\ndata Tree = Leaf | Node Tree Tree"
-,CodeBlock ("",["haskell"],[]) "-- this code is in haskell too\ndata Nat = Zero | Succ Nat"
-,CodeBlock ("",["javascript"],[]) "-- this code is in javascript\nlet f = (x, y) => x + y"
-,Header 1 ("lists",[],[]) [Str "Lists"]
-,Header 2 ("unordered",[],[]) [Str "Unordered"]
-,Para [Str "Asterisks",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "asterisk",Space,Str "1"]]
- ,[Plain [Str "asterisk",Space,Str "2"]]
- ,[Plain [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Asterisks",Space,Str "loose:"]
-,BulletList
- [[Plain [Str "asterisk",Space,Str "1"]]
- ,[Plain [Str "asterisk",Space,Str "2"]]
- ,[Plain [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "Plus",Space,Str "1"]]
- ,[Plain [Str "Plus",Space,Str "2"]]
- ,[Plain [Str "Plus",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "loose:"]
-,BulletList
- [[Plain [Str "Plus",Space,Str "1"]]
- ,[Plain [Str "Plus",Space,Str "2"]]
- ,[Plain [Str "Plus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "Minus",Space,Str "1"]]
- ,[Plain [Str "Minus",Space,Str "2"]]
- ,[Plain [Str "Minus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "loose:"]
-,BulletList
- [[Plain [Str "Minus",Space,Str "1"]]
- ,[Plain [Str "Minus",Space,Str "2"]]
- ,[Plain [Str "Minus",Space,Str "3"]]]
-,Header 2 ("ordered",[],[]) [Str "Ordered"]
-,Para [Str "Tight:"]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "First"]]
- ,[Plain [Str "Second"]]
- ,[Plain [Str "Third"]]]
-,Para [Str "and:"]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "One"]]
- ,[Plain [Str "Two"]]
- ,[Plain [Str "Three"]]]
-,Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "First"]]
- ,[Plain [Str "Second"]]
- ,[Plain [Str "Third"]]]
-,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "One"]]
- ,[Plain [Str "Two"]]
- ,[Plain [Str "Three"]]]
-,Para [Str "Multiple",Space,Str "paragraphs:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
-  ,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",SoftBreak,Str "back."]]
- ,[Para [Str "Item",Space,Str "2."]]
- ,[Para [Str "Item",Space,Str "3."]]]
-,Para [Str "Nested:"]
-,BulletList
- [[Plain [Str "Tab"]
-  ,BulletList
-   [[Plain [Str "Tab"]
-    ,BulletList
-     [[Plain [Str "Tab"]]]]]]]
-,Para [Str "Here\8217s",Space,Str "another:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BlockQuote
-   [BulletList
-    [[Plain [Str "Fee"]]
-    ,[Plain [Str "Fie"]]
-    ,[Plain [Str "Foe"]]]]]
- ,[Para [Str "Third"]]]
-,Header 2 ("fancy-list-markers",[],[]) [Str "Fancy",Space,Str "list",Space,Str "markers"]
-,OrderedList (2,Decimal,TwoParens)
- [[Para [Str "begins",Space,Str "with",Space,Str "2"]]
- ,[Para [Str "and",Space,Str "now",Space,Str "3"]
-  ,Para [Str "with",Space,Str "a",Space,Str "continuation"]
-  ,OrderedList (4,LowerRoman,Period)
-   [[Plain [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",Space,Str "starting",Space,Str "with",Space,Str "4"]]
-   ,[Plain [Str "more",Space,Str "items"]
-    ,OrderedList (1,UpperAlpha,TwoParens)
-     [[Plain [Str "a",Space,Str "subsublist"]]
-     ,[Plain [Str "a",Space,Str "subsublist"]]]]]]]
-,Para [Str "Nesting:"]
-,OrderedList (1,UpperAlpha,Period)
- [[Plain [Str "Upper",Space,Str "Alpha"]
-  ,OrderedList (1,UpperRoman,Period)
-   [[Plain [Str "Upper",Space,Str "Roman."]
-    ,OrderedList (6,Decimal,TwoParens)
-     [[Plain [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
-      ,OrderedList (3,LowerAlpha,OneParen)
-       [[Plain [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
-,Para [Str "Autonumbering:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Autonumber."]]
- ,[Plain [Str "More."]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "Nested."]]]]]
-,Para [Str "Autonumbering",Space,Str "with",Space,Str "explicit",Space,Str "start:"]
-,OrderedList (4,LowerAlpha,TwoParens)
- [[Plain [Str "item",Space,Str "1"]]
- ,[Plain [Str "item",Space,Str "2"]]]
-,Header 2 ("definition",[],[]) [Str "Definition"]
-,DefinitionList
- [([Str "term",Space,Str "1"],
-   [[Para [Str "Definition",Space,Str "1."]]])
- ,([Str "term",Space,Str "2"],
-   [[Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "1."]
-    ,Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "2."]]])
- ,([Str "term",Space,Str "with",Space,Emph [Str "emphasis"]],
-   [[Para [Str "Definition",Space,Str "3."]]])]
-,Header 1 ("field-lists",[],[]) [Str "Field",Space,Str "Lists"]
-,BlockQuote
- [DefinitionList
-  [([Str "address"],
-    [[Para [Str "61",Space,Str "Main",Space,Str "St."]]])
-  ,([Str "city"],
-    [[Para [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",SoftBreak,Str "USA"]]])
-  ,([Str "phone"],
-    [[Para [Str "123-4567"]]])]]
-,DefinitionList
- [([Str "address"],
-   [[Para [Str "61",Space,Str "Main",Space,Str "St."]]])
- ,([Str "city"],
-   [[Para [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",SoftBreak,Str "USA"]]])
- ,([Str "phone"],
-   [[Para [Str "123-4567"]]])]
-,Header 1 ("html-blocks",[],[]) [Str "HTML",Space,Str "Blocks"]
-,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
-,RawBlock (Format "html") "<div>foo</div>"
-,Para [Str "Now,",Space,Str "nested:"]
-,RawBlock (Format "html") "<div>\n    <div>\n        <div>\n            foo\n        </div>\n    </div>\n</div>"
-,Header 1 ("latex-block",[],[]) [Str "LaTeX",Space,Str "Block"]
-,RawBlock (Format "latex") "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog    & 2      \\\\\nCat    & 1      \\\\ \\hline\n\\end{tabular}"
-,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ".",Space,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str "."]
-,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",Space,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",Space,Code ("",[],[]) "<html>",Str "."]
-,Para [Str "This",Space,Str "is",Subscript [Str "subscripted"],Space,Str "and",Space,Str "this",Space,Str "is",Space,Superscript [Str "superscripted"],Str "."]
-,Header 1 ("special-characters",[],[]) [Str "Special",Space,Str "Characters"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
-,BulletList
- [[Plain [Str "I",Space,Str "hat:",Space,Str "\206"]]
- ,[Plain [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
- ,[Plain [Str "section:",Space,Str "\167"]]
- ,[Plain [Str "set",Space,Str "membership:",Space,Str "\8712"]]
- ,[Plain [Str "copyright:",Space,Str "\169"]]]
-,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
-,Para [Str "This",Space,Str "&",Space,Str "that."]
-,Para [Str "4",Space,Str "<",Space,Str "5."]
-,Para [Str "6",Space,Str ">",Space,Str "5."]
-,Para [Str "Backslash:",Space,Str "\\"]
-,Para [Str "Backtick:",Space,Str "`"]
-,Para [Str "Asterisk:",Space,Str "*"]
-,Para [Str "Underscore:",Space,Str "_"]
-,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
-,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
-,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
-,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
-,Para [Str "Left",Space,Str "paren:",Space,Str "("]
-,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
-,Para [Str "Greater-than:",Space,Str ">"]
-,Para [Str "Hash:",Space,Str "#"]
-,Para [Str "Period:",Space,Str "."]
-,Para [Str "Bang:",Space,Str "!"]
-,Para [Str "Plus:",Space,Str "+"]
-,Para [Str "Minus:",Space,Str "-"]
-,Header 1 ("links",[],[]) [Str "Links"]
-,Para [Str "Explicit:",Space,Str "a",Space,Link ("",[],[]) [Str "URL"] ("/url/",""),Str "."]
-,Para [Str "Explicit",Space,Str "with",Space,Str "no",Space,Str "label:",Space,Link ("",[],[]) [Str "foo"] ("foo",""),Str "."]
-,Para [Str "Two",Space,Str "anonymous",Space,Str "links:",Space,Link ("",[],[]) [Str "the",Space,Str "first"] ("/url1/",""),Space,Str "and",Space,Link ("",[],[]) [Str "the",Space,Str "second"] ("/url2/","")]
-,Para [Str "Reference",Space,Str "links:",Space,Link ("",[],[]) [Str "link1"] ("/url1/",""),Space,Str "and",Space,Link ("",[],[]) [Str "link2"] ("/url2/",""),Space,Str "and",Space,Link ("",[],[]) [Str "link1"] ("/url1/",""),Space,Str "again."]
-,Para [Str "Another",Space,Link ("",[],[]) [Str "style",Space,Str "of",Space,Str "reference",Space,Str "link"] ("/url1/",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "a",Space,Link ("",[],[]) [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link ("",[],[]) [Str "AT&T"] ("/url/",""),Str "."]
-,Para [Str "Autolinks:",Space,Link ("",[],[]) [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2",""),Space,Str "and",Space,Link ("",[],[]) [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net",""),Str "."]
-,Para [Str "But",Space,Str "not",Space,Str "here:"]
-,CodeBlock ("",[],[]) "http://example.com/"
-,Header 1 ("images",[],[]) [Str "Images"]
-,Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
-,Para [Image ("",[],[]) [Str "image"] ("lalune.jpg","")]
-,Para [Image ("",[],[("height","2343px")]) [Str "Voyage dans la Lune"] ("lalune.jpg","")]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image ("",[],[]) [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
-,Para [Str "And",Space,Str "an",Space,Link ("",[],[]) [Image ("",[],[]) [Str "A movie"] ("movie.jpg","")] ("/url",""),Str "."]
-,Header 1 ("comments",[],[]) [Str "Comments"]
-,Para [Str "First",Space,Str "paragraph"]
-,Para [Str "Another",Space,Str "paragraph"]
-,Para [Str "A",Space,Str "third",Space,Str "paragraph"]
-,Header 1 ("line-blocks",[],[]) [Str "Line",Space,Str "blocks"]
-,LineBlock
- [[Str "But",Space,Str "can",Space,Str "a",Space,Str "bee",Space,Str "be",Space,Str "said",Space,Str "to",Space,Str "be"]
- ,[Str "\160\160\160\160or",Space,Str "not",Space,Str "to",Space,Str "be",Space,Str "an",Space,Str "entire",Space,Str "bee,"]
- ,[Str "\160\160\160\160\160\160\160\160when",Space,Str "half",Space,Str "the",Space,Str "bee",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "bee,"]
- ,[Str "\160\160\160\160\160\160\160\160\160\160\160\160due",Space,Str "to",Space,Str "some",Space,Str "ancient",Space,Str "injury?"]
- ,[]
- ,[Str "Continuation",Space,Str "line"]
- ,[Str "\160\160and",Space,Str "another"]]
-,Header 1 ("simple-tables",[],[]) [Str "Simple",Space,Str "Tables"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "2"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "3"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r1",Space,Str "a"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r2",Space,Str "d"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Headless"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r1",Space,Str "a"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r2",Space,Str "d"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 1 ("grid-tables",[],[]) [Str "Grid",Space,Str "Tables"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.2375)
- ,(AlignDefault,ColWidth 0.15)
- ,(AlignDefault,ColWidth 0.1625)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "2"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "col",Space,Str "3"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r2",Space,Str "d"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Headless"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.2375)
- ,(AlignDefault,ColWidth 0.15)
- ,(AlignDefault,ColWidth 0.1625)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r2",Space,Str "d"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Spaces",Space,Str "at",Space,Str "ends",Space,Str "of",Space,Str "lines"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.2375)
- ,(AlignDefault,ColWidth 0.15)
- ,(AlignDefault,ColWidth 0.1625)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "r2",Space,Str "d"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiple",Space,Str "blocks",Space,Str "in",Space,Str "a",Space,Str "cell"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.2375)
- ,(AlignDefault,ColWidth 0.15)
- ,(AlignDefault,ColWidth 0.1625)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "r1",Space,Str "a"]
-    ,Para [Str "r1",Space,Str "bis"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [BulletList
-     [[Plain [Str "b"]]
-     ,[Plain [Str "b",Space,Str "2"]]
-     ,[Plain [Str "b",Space,Str "2"]]]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c",SoftBreak,Str "c",Space,Str "2",SoftBreak,Str "c",Space,Str "2"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
-,Para [Note [Para [Str "Note",Space,Str "with",Space,Str "one",Space,Str "line."]]]
-,Para [Note [Para [Str "Note",Space,Str "with",SoftBreak,Str "continuation",Space,Str "line."]]]
-,Para [Note [Para [Str "Note",Space,Str "with"],Para [Str "continuation",Space,Str "block."]]]
-,Para [Note [Para [Str "Note",Space,Str "with",SoftBreak,Str "continuation",Space,Str "line"],Para [Str "and",Space,Str "a",Space,Str "second",Space,Str "para."]]]
-,Para [Str "Not",Space,Str "in",Space,Str "note."]
-,Header 1 ("math",[],[]) [Str "Math"]
-,Para [Str "Some",Space,Str "inline",Space,Str "math",Space,Math InlineMath "E=mc^2",Str ".",Space,Str "Now",Space,Str "some",SoftBreak,Str "display",Space,Str "math:"]
-,Para [Math DisplayMath "E=mc^2"]
-,Para [Math DisplayMath "E = mc^2"]
-,Para [Math DisplayMath "E = mc^2",Math DisplayMath "\\alpha = \\beta"]
-,Para [Math DisplayMath "\\begin{aligned}\nE &= mc^2\\\\\nF &= \\pi E\n\\end{aligned}",Math DisplayMath "F &= \\gamma \\alpha^2"]
-,Para [Str "All",Space,Str "done."]
-,Header 1 ("default-role",[],[]) [Str "Default-Role"]
-,Para [Str "Try",Space,Str "changing",Space,Str "the",Space,Str "default",Space,Str "role",Space,Str "to",Space,Str "a",Space,Str "few",Space,Str "different",Space,Str "things."]
-,Header 2 ("doesnt-break-title-parsing",[],[]) [Str "Doesn\8217t",Space,Str "Break",Space,Str "Title",Space,Str "Parsing"]
-,Para [Str "Inline",Space,Str "math:",Space,Math InlineMath "E=mc^2",Space,Str "or",Space,Math InlineMath "E=mc^2",Space,Str "or",Space,Math InlineMath "E=mc^2",Str ".",SoftBreak,Str "Other",Space,Str "roles:",Space,Superscript [Str "super"],Str ",",Space,Subscript [Str "sub"],Str "."]
-,Para [Math DisplayMath "\\alpha = beta",Math DisplayMath "E = mc^2"]
-,Para [Str "Some",Space,Superscript [Str "of"],Space,Str "these",Space,Superscript [Str "words"],Space,Str "are",Space,Str "in",Space,Superscript [Str "superscript"],Str "."]
-,Para [Str "Reset",Space,Str "default-role",Space,Str "to",Space,Str "the",Space,Str "default",Space,Str "default."]
-,Para [Str "And",Space,Str "now",Space,Span ("",["title-ref"],[]) [Str "some-invalid-string-3231231"],Space,Str "is",Space,Str "nonsense."]
-,Para [Str "And",Space,Str "now",Space,Str "with",Space,RawInline (Format "html") "<b>inline</b> <span id=\"test\">HTML</span>",Str "."]
-,Para [Str "And",Space,Str "some",Space,Str "inline",Space,Str "haskell",Space,Code ("",["haskell"],[]) "fmap id [1,2..10]",Str "."]
-,Para [Str "Indirect",Space,Str "python",Space,Str "role",Space,Code ("",["py","python","indirect"],[]) "[x*x for x in [1,2,3,4,5]]",Str "."]
-,Para [Str "Different",Space,Str "indirect",Space,Str "C",Space,Code ("",["c","different-indirect"],[]) "int x = 15;",Str "."]
-,Header 2 ("literal-symbols",[],[]) [Str "Literal",Space,Str "symbols"]
-,Para [Str "2*2",Space,Str "=",Space,Str "4*1"]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author"
+            , MetaList
+                [ MetaInlines [ Str "John" , Space , Str "MacFarlane" ]
+                , MetaInlines [ Str "Anonymous" ]
+                ]
+            )
+          , ( "date"
+            , MetaInlines
+                [ Str "July" , Space , Str "17," , Space , Str "2006" ]
+            )
+          , ( "revision" , MetaBlocks [ Para [ Str "3" ] ] )
+          , ( "subtitle" , MetaInlines [ Str "Subtitle" ] )
+          , ( "title"
+            , MetaInlines
+                [ Str "Pandoc" , Space , Str "Test" , Space , Str "Suite" ]
+            )
+          ]
+    }
+  [ Header
+      1
+      ( "level-one-header" , [] , [] )
+      [ Str "Level" , Space , Str "one" , Space , Str "header" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "set"
+      , Space
+      , Str "of"
+      , Space
+      , Str "tests"
+      , Space
+      , Str "for"
+      , Space
+      , Str "pandoc."
+      , Space
+      , Str "Most"
+      , Space
+      , Str "of"
+      , Space
+      , Str "them"
+      , Space
+      , Str "are"
+      , Space
+      , Str "adapted"
+      , Space
+      , Str "from"
+      , SoftBreak
+      , Str "John"
+      , Space
+      , Str "Gruber\8217s"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "test"
+      , Space
+      , Str "suite."
+      ]
+  , Header
+      2
+      ( "level-two-header" , [] , [] )
+      [ Str "Level" , Space , Str "two" , Space , Str "header" ]
+  , Header
+      3 ( "level-three" , [] , [] ) [ Str "Level" , Space , Str "three" ]
+  , Header
+      4
+      ( "level-four-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "four"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      5 ( "level-five" , [] , [] ) [ Str "Level" , Space , Str "five" ]
+  , Header 1 ( "paragraphs" , [] , [] ) [ Str "Paragraphs" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "regular"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "In"
+      , Space
+      , Str "Markdown"
+      , Space
+      , Str "1.0.0"
+      , Space
+      , Str "and"
+      , Space
+      , Str "earlier."
+      , Space
+      , Str "Version"
+      , SoftBreak
+      , Str "8."
+      , Space
+      , Str "This"
+      , Space
+      , Str "line"
+      , Space
+      , Str "turns"
+      , Space
+      , Str "into"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      , SoftBreak
+      , Str "Because"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard-wrapped"
+      , Space
+      , Str "line"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "middle"
+      , Space
+      , Str "of"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "looked"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , SoftBreak
+      , Str "list"
+      , Space
+      , Str "item."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "one"
+      , Space
+      , Str "with"
+      , Space
+      , Str "a"
+      , Space
+      , Str "bullet."
+      , SoftBreak
+      , Str "*"
+      , Space
+      , Str "criminey."
+      ]
+  , Para [ Str "Horizontal" , Space , Str "rule:" ]
+  , HorizontalRule
+  , Para [ Str "Another:" ]
+  , HorizontalRule
+  , Header
+      1
+      ( "block-quotes" , [] , [] )
+      [ Str "Block" , Space , Str "Quotes" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "block"
+      , Space
+      , Str "quote:"
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          , SoftBreak
+          , Str "It"
+          , Space
+          , Str "is"
+          , Space
+          , Str "pretty"
+          , Space
+          , Str "short."
+          ]
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "another,"
+      , Space
+      , Str "differently"
+      , Space
+      , Str "indented:"
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          , SoftBreak
+          , Str "It\8217s"
+          , Space
+          , Str "indented"
+          , Space
+          , Str "with"
+          , Space
+          , Str "a"
+          , Space
+          , Str "tab."
+          ]
+      , Para
+          [ Str "Code"
+          , Space
+          , Str "in"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote:"
+          ]
+      , CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      , Para
+          [ Str "List"
+          , Space
+          , Str "in"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote:"
+          ]
+      , OrderedList
+          ( 1 , Decimal , Period )
+          [ [ Plain [ Str "item" , Space , Str "one" ] ]
+          , [ Plain [ Str "item" , Space , Str "two" ] ]
+          ]
+      , Para
+          [ Str "Nested" , Space , Str "block" , Space , Str "quotes:" ]
+      , BlockQuote
+          [ Para [ Str "nested" ] , BlockQuote [ Para [ Str "nested" ] ] ]
+      ]
+  , Header
+      1 ( "code-blocks" , [] , [] ) [ Str "Code" , Space , Str "Blocks" ]
+  , Para [ Str "Code:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}"
+  , CodeBlock
+      ( "" , [] , [] ) "this code block is indented by one tab"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "this block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [ "python" ] , [] ) "def my_function(x):\n    return x + 1"
+  , Para
+      [ Str "If"
+      , Space
+      , Str "we"
+      , Space
+      , Str "use"
+      , Space
+      , Str "the"
+      , Space
+      , Str "highlight"
+      , Space
+      , Str "directive,"
+      , Space
+      , Str "we"
+      , Space
+      , Str "can"
+      , Space
+      , Str "specify"
+      , Space
+      , Str "a"
+      , Space
+      , Str "default"
+      , Space
+      , Str "language"
+      , SoftBreak
+      , Str "for"
+      , Space
+      , Str "literate"
+      , Space
+      , Str "blocks."
+      ]
+  , CodeBlock
+      ( "" , [ "haskell" ] , [] )
+      "-- this code is in haskell\ndata Tree = Leaf | Node Tree Tree"
+  , CodeBlock
+      ( "" , [ "haskell" ] , [] )
+      "-- this code is in haskell too\ndata Nat = Zero | Succ Nat"
+  , CodeBlock
+      ( "" , [ "javascript" ] , [] )
+      "-- this code is in javascript\nlet f = (x, y) => x + y"
+  , Header 1 ( "lists" , [] , [] ) [ Str "Lists" ]
+  , Header 2 ( "unordered" , [] , [] ) [ Str "Unordered" ]
+  , Para [ Str "Asterisks" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Asterisks" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Plain [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "Plus" , Space , Str "1" ] ]
+      , [ Plain [ Str "Plus" , Space , Str "2" ] ]
+      , [ Plain [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Plain [ Str "Plus" , Space , Str "1" ] ]
+      , [ Plain [ Str "Plus" , Space , Str "2" ] ]
+      , [ Plain [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "Minus" , Space , Str "1" ] ]
+      , [ Plain [ Str "Minus" , Space , Str "2" ] ]
+      , [ Plain [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Plain [ Str "Minus" , Space , Str "1" ] ]
+      , [ Plain [ Str "Minus" , Space , Str "2" ] ]
+      , [ Plain [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Header 2 ( "ordered" , [] , [] ) [ Str "Ordered" ]
+  , Para [ Str "Tight:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "First" ] ]
+      , [ Plain [ Str "Second" ] ]
+      , [ Plain [ Str "Third" ] ]
+      ]
+  , Para [ Str "and:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "One" ] ]
+      , [ Plain [ Str "Two" ] ]
+      , [ Plain [ Str "Three" ] ]
+      ]
+  , Para [ Str "Loose" , Space , Str "using" , Space , Str "tabs:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "First" ] ]
+      , [ Plain [ Str "Second" ] ]
+      , [ Plain [ Str "Third" ] ]
+      ]
+  , Para [ Str "and" , Space , Str "using" , Space , Str "spaces:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "One" ] ]
+      , [ Plain [ Str "Two" ] ]
+      , [ Plain [ Str "Three" ] ]
+      ]
+  , Para [ Str "Multiple" , Space , Str "paragraphs:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para
+            [ Str "Item"
+            , Space
+            , Str "1,"
+            , Space
+            , Str "graf"
+            , Space
+            , Str "one."
+            ]
+        , Para
+            [ Str "Item"
+            , Space
+            , Str "1."
+            , Space
+            , Str "graf"
+            , Space
+            , Str "two."
+            , Space
+            , Str "The"
+            , Space
+            , Str "quick"
+            , Space
+            , Str "brown"
+            , Space
+            , Str "fox"
+            , Space
+            , Str "jumped"
+            , Space
+            , Str "over"
+            , Space
+            , Str "the"
+            , Space
+            , Str "lazy"
+            , Space
+            , Str "dog\8217s"
+            , SoftBreak
+            , Str "back."
+            ]
+        ]
+      , [ Para [ Str "Item" , Space , Str "2." ] ]
+      , [ Para [ Str "Item" , Space , Str "3." ] ]
+      ]
+  , Para [ Str "Nested:" ]
+  , BulletList
+      [ [ Plain [ Str "Tab" ]
+        , BulletList
+            [ [ Plain [ Str "Tab" ] , BulletList [ [ Plain [ Str "Tab" ] ] ] ]
+            ]
+        ]
+      ]
+  , Para [ Str "Here\8217s" , Space , Str "another:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BlockQuote
+            [ BulletList
+                [ [ Plain [ Str "Fee" ] ]
+                , [ Plain [ Str "Fie" ] ]
+                , [ Plain [ Str "Foe" ] ]
+                ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Header
+      2
+      ( "fancy-list-markers" , [] , [] )
+      [ Str "Fancy" , Space , Str "list" , Space , Str "markers" ]
+  , OrderedList
+      ( 2 , Decimal , TwoParens )
+      [ [ Para [ Str "begins" , Space , Str "with" , Space , Str "2" ] ]
+      , [ Para [ Str "and" , Space , Str "now" , Space , Str "3" ]
+        , Para
+            [ Str "with" , Space , Str "a" , Space , Str "continuation" ]
+        , OrderedList
+            ( 4 , LowerRoman , Period )
+            [ [ Plain
+                  [ Str "sublist"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "roman"
+                  , Space
+                  , Str "numerals,"
+                  , Space
+                  , Str "starting"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "4"
+                  ]
+              ]
+            , [ Plain [ Str "more" , Space , Str "items" ]
+              , OrderedList
+                  ( 1 , UpperAlpha , TwoParens )
+                  [ [ Plain [ Str "a" , Space , Str "subsublist" ] ]
+                  , [ Plain [ Str "a" , Space , Str "subsublist" ] ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Nesting:" ]
+  , OrderedList
+      ( 1 , UpperAlpha , Period )
+      [ [ Plain [ Str "Upper" , Space , Str "Alpha" ]
+        , OrderedList
+            ( 1 , UpperRoman , Period )
+            [ [ Plain [ Str "Upper" , Space , Str "Roman." ]
+              , OrderedList
+                  ( 6 , Decimal , TwoParens )
+                  [ [ Plain
+                        [ Str "Decimal"
+                        , Space
+                        , Str "start"
+                        , Space
+                        , Str "with"
+                        , Space
+                        , Str "6"
+                        ]
+                    , OrderedList
+                        ( 3 , LowerAlpha , OneParen )
+                        [ [ Plain
+                              [ Str "Lower"
+                              , Space
+                              , Str "alpha"
+                              , Space
+                              , Str "with"
+                              , Space
+                              , Str "paren"
+                              ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Autonumbering:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "Autonumber." ] ]
+      , [ Plain [ Str "More." ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim ) [ [ Plain [ Str "Nested." ] ] ]
+        ]
+      ]
+  , Para
+      [ Str "Autonumbering"
+      , Space
+      , Str "with"
+      , Space
+      , Str "explicit"
+      , Space
+      , Str "start:"
+      ]
+  , OrderedList
+      ( 4 , LowerAlpha , TwoParens )
+      [ [ Plain [ Str "item" , Space , Str "1" ] ]
+      , [ Plain [ Str "item" , Space , Str "2" ] ]
+      ]
+  , Header 2 ( "definition" , [] , [] ) [ Str "Definition" ]
+  , DefinitionList
+      [ ( [ Str "term" , Space , Str "1" ]
+        , [ [ Para [ Str "Definition" , Space , Str "1." ] ] ]
+        )
+      , ( [ Str "term" , Space , Str "2" ]
+        , [ [ Para
+                [ Str "Definition"
+                , Space
+                , Str "2,"
+                , Space
+                , Str "paragraph"
+                , Space
+                , Str "1."
+                ]
+            , Para
+                [ Str "Definition"
+                , Space
+                , Str "2,"
+                , Space
+                , Str "paragraph"
+                , Space
+                , Str "2."
+                ]
+            ]
+          ]
+        )
+      , ( [ Str "term"
+          , Space
+          , Str "with"
+          , Space
+          , Emph [ Str "emphasis" ]
+          ]
+        , [ [ Para [ Str "Definition" , Space , Str "3." ] ] ]
+        )
+      ]
+  , Header
+      1 ( "field-lists" , [] , [] ) [ Str "Field" , Space , Str "Lists" ]
+  , BlockQuote
+      [ DefinitionList
+          [ ( [ Str "address" ]
+            , [ [ Para [ Str "61" , Space , Str "Main" , Space , Str "St." ] ]
+              ]
+            )
+          , ( [ Str "city" ]
+            , [ [ Para
+                    [ Emph [ Str "Nowhere" ]
+                    , Str ","
+                    , Space
+                    , Str "MA,"
+                    , SoftBreak
+                    , Str "USA"
+                    ]
+                ]
+              ]
+            )
+          , ( [ Str "phone" ] , [ [ Para [ Str "123-4567" ] ] ] )
+          ]
+      ]
+  , DefinitionList
+      [ ( [ Str "address" ]
+        , [ [ Para [ Str "61" , Space , Str "Main" , Space , Str "St." ] ]
+          ]
+        )
+      , ( [ Str "city" ]
+        , [ [ Para
+                [ Emph [ Str "Nowhere" ]
+                , Str ","
+                , Space
+                , Str "MA,"
+                , SoftBreak
+                , Str "USA"
+                ]
+            ]
+          ]
+        )
+      , ( [ Str "phone" ] , [ [ Para [ Str "123-4567" ] ] ] )
+      ]
+  , Header
+      1 ( "html-blocks" , [] , [] ) [ Str "HTML" , Space , Str "Blocks" ]
+  , Para
+      [ Str "Simple"
+      , Space
+      , Str "block"
+      , Space
+      , Str "on"
+      , Space
+      , Str "one"
+      , Space
+      , Str "line:"
+      ]
+  , RawBlock (Format "html") "<div>foo</div>"
+  , Para [ Str "Now," , Space , Str "nested:" ]
+  , RawBlock
+      (Format "html")
+      "<div>\n    <div>\n        <div>\n            foo\n        </div>\n    </div>\n</div>"
+  , Header
+      1 ( "latex-block" , [] , [] ) [ Str "LaTeX" , Space , Str "Block" ]
+  , RawBlock
+      (Format "latex")
+      "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog    & 2      \\\\\nCat    & 1      \\\\ \\hline\n\\end{tabular}"
+  , Header
+      1
+      ( "inline-markup" , [] , [] )
+      [ Str "Inline" , Space , Str "Markup" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      , Str "."
+      , Space
+      , Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "code:"
+      , Space
+      , Code ( "" , [] , [] ) ">"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "<html>"
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Subscript [ Str "subscripted" ]
+      , Space
+      , Str "and"
+      , Space
+      , Str "this"
+      , Space
+      , Str "is"
+      , Space
+      , Superscript [ Str "superscripted" ]
+      , Str "."
+      ]
+  , Header
+      1
+      ( "special-characters" , [] , [] )
+      [ Str "Special" , Space , Str "Characters" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "unicode:"
+      ]
+  , BulletList
+      [ [ Plain [ Str "I" , Space , Str "hat:" , Space , Str "\206" ] ]
+      , [ Plain [ Str "o" , Space , Str "umlaut:" , Space , Str "\246" ]
+        ]
+      , [ Plain [ Str "section:" , Space , Str "\167" ] ]
+      , [ Plain
+            [ Str "set" , Space , Str "membership:" , Space , Str "\8712" ]
+        ]
+      , [ Plain [ Str "copyright:" , Space , Str "\169" ] ]
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "has"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "their"
+      , Space
+      , Str "name."
+      ]
+  , Para [ Str "This" , Space , Str "&" , Space , Str "that." ]
+  , Para [ Str "4" , Space , Str "<" , Space , Str "5." ]
+  , Para [ Str "6" , Space , Str ">" , Space , Str "5." ]
+  , Para [ Str "Backslash:" , Space , Str "\\" ]
+  , Para [ Str "Backtick:" , Space , Str "`" ]
+  , Para [ Str "Asterisk:" , Space , Str "*" ]
+  , Para [ Str "Underscore:" , Space , Str "_" ]
+  , Para [ Str "Left" , Space , Str "brace:" , Space , Str "{" ]
+  , Para [ Str "Right" , Space , Str "brace:" , Space , Str "}" ]
+  , Para [ Str "Left" , Space , Str "bracket:" , Space , Str "[" ]
+  , Para [ Str "Right" , Space , Str "bracket:" , Space , Str "]" ]
+  , Para [ Str "Left" , Space , Str "paren:" , Space , Str "(" ]
+  , Para [ Str "Right" , Space , Str "paren:" , Space , Str ")" ]
+  , Para [ Str "Greater-than:" , Space , Str ">" ]
+  , Para [ Str "Hash:" , Space , Str "#" ]
+  , Para [ Str "Period:" , Space , Str "." ]
+  , Para [ Str "Bang:" , Space , Str "!" ]
+  , Para [ Str "Plus:" , Space , Str "+" ]
+  , Para [ Str "Minus:" , Space , Str "-" ]
+  , Header 1 ( "links" , [] , [] ) [ Str "Links" ]
+  , Para
+      [ Str "Explicit:"
+      , Space
+      , Str "a"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "URL" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Explicit"
+      , Space
+      , Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "label:"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "foo" ] ( "foo" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Two"
+      , Space
+      , Str "anonymous"
+      , Space
+      , Str "links:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "the" , Space , Str "first" ]
+          ( "/url1/" , "" )
+      , Space
+      , Str "and"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "the" , Space , Str "second" ]
+          ( "/url2/" , "" )
+      ]
+  , Para
+      [ Str "Reference"
+      , Space
+      , Str "links:"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "link1" ] ( "/url1/" , "" )
+      , Space
+      , Str "and"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "link2" ] ( "/url2/" , "" )
+      , Space
+      , Str "and"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "link1" ] ( "/url1/" , "" )
+      , Space
+      , Str "again."
+      ]
+  , Para
+      [ Str "Another"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "style"
+          , Space
+          , Str "of"
+          , Space
+          , Str "reference"
+          , Space
+          , Str "link"
+          ]
+          ( "/url1/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "link"
+          , Space
+          , Str "with"
+          , Space
+          , Str "an"
+          , Space
+          , Str "ampersand"
+          , Space
+          , Str "in"
+          , Space
+          , Str "the"
+          , Space
+          , Str "URL"
+          ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Str "amersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "link"
+      , Space
+      , Str "text:"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "AT&T" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Autolinks:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://example.com/?foo=1&bar=2" ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Space
+      , Str "and"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "nobody@nowhere.net" ]
+          ( "mailto:nobody@nowhere.net" , "" )
+      , Str "."
+      ]
+  , Para [ Str "But" , Space , Str "not" , Space , Str "here:" ]
+  , CodeBlock ( "" , [] , [] ) "http://example.com/"
+  , Header 1 ( "images" , [] , [] ) [ Str "Images" ]
+  , Para
+      [ Str "From"
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Str "Voyage"
+          , Space
+          , Str "dans"
+          , Space
+          , Str "la"
+          , Space
+          , Str "Lune"
+          ]
+      , Space
+      , Str "by"
+      , Space
+      , Str "Georges"
+      , Space
+      , Str "Melies"
+      , Space
+      , Str "(1902):"
+      ]
+  , Para
+      [ Image ( "" , [] , [] ) [ Str "image" ] ( "lalune.jpg" , "" ) ]
+  , Para
+      [ Image
+          ( "" , [] , [ ( "height" , "2343px" ) ] )
+          [ Str "Voyage dans la Lune" ]
+          ( "lalune.jpg" , "" )
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "movie"
+      , Space
+      , Image ( "" , [] , [] ) [ Str "movie" ] ( "movie.jpg" , "" )
+      , Space
+      , Str "icon."
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Image ( "" , [] , [] ) [ Str "A movie" ] ( "movie.jpg" , "" ) ]
+          ( "/url" , "" )
+      , Str "."
+      ]
+  , Header 1 ( "comments" , [] , [] ) [ Str "Comments" ]
+  , Para [ Str "First" , Space , Str "paragraph" ]
+  , Para [ Str "Another" , Space , Str "paragraph" ]
+  , Para [ Str "A" , Space , Str "third" , Space , Str "paragraph" ]
+  , Header
+      1 ( "line-blocks" , [] , [] ) [ Str "Line" , Space , Str "blocks" ]
+  , LineBlock
+      [ [ Str "But"
+        , Space
+        , Str "can"
+        , Space
+        , Str "a"
+        , Space
+        , Str "bee"
+        , Space
+        , Str "be"
+        , Space
+        , Str "said"
+        , Space
+        , Str "to"
+        , Space
+        , Str "be"
+        ]
+      , [ Str "\160\160\160\160or"
+        , Space
+        , Str "not"
+        , Space
+        , Str "to"
+        , Space
+        , Str "be"
+        , Space
+        , Str "an"
+        , Space
+        , Str "entire"
+        , Space
+        , Str "bee,"
+        ]
+      , [ Str "\160\160\160\160\160\160\160\160when"
+        , Space
+        , Str "half"
+        , Space
+        , Str "the"
+        , Space
+        , Str "bee"
+        , Space
+        , Str "is"
+        , Space
+        , Str "not"
+        , Space
+        , Str "a"
+        , Space
+        , Str "bee,"
+        ]
+      , [ Str "\160\160\160\160\160\160\160\160\160\160\160\160due"
+        , Space
+        , Str "to"
+        , Space
+        , Str "some"
+        , Space
+        , Str "ancient"
+        , Space
+        , Str "injury?"
+        ]
+      , []
+      , [ Str "Continuation" , Space , Str "line" ]
+      , [ Str "\160\160and" , Space , Str "another" ]
+      ]
+  , Header
+      1
+      ( "simple-tables" , [] , [] )
+      [ Str "Simple" , Space , Str "Tables" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "1" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "2" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "3" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r1" , Space , Str "a" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "b" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "c" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r2" , Space , Str "d" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para [ Str "Headless" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+             , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+             , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r1" , Space , Str "a" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "b" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "c" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r2" , Space , Str "d" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header
+      1 ( "grid-tables" , [] , [] ) [ Str "Grid" , Space , Str "Tables" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidth 0.2375 )
+      , ( AlignDefault , ColWidth 0.15 )
+      , ( AlignDefault , ColWidth 0.1625 )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "1" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "2" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "col" , Space , Str "3" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "r1"
+                      , Space
+                      , Str "a"
+                      , SoftBreak
+                      , Str "r1"
+                      , Space
+                      , Str "bis"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "b" , SoftBreak , Str "b" , Space , Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "c" , SoftBreak , Str "c" , Space , Str "2" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r2" , Space , Str "d" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para [ Str "Headless" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidth 0.2375 )
+      , ( AlignDefault , ColWidth 0.15 )
+      , ( AlignDefault , ColWidth 0.1625 )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "r1"
+                      , Space
+                      , Str "a"
+                      , SoftBreak
+                      , Str "r1"
+                      , Space
+                      , Str "bis"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "b" , SoftBreak , Str "b" , Space , Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "c" , SoftBreak , Str "c" , Space , Str "2" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r2" , Space , Str "d" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Spaces"
+      , Space
+      , Str "at"
+      , Space
+      , Str "ends"
+      , Space
+      , Str "of"
+      , Space
+      , Str "lines"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidth 0.2375 )
+      , ( AlignDefault , ColWidth 0.15 )
+      , ( AlignDefault , ColWidth 0.1625 )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "r1"
+                      , Space
+                      , Str "a"
+                      , SoftBreak
+                      , Str "r1"
+                      , Space
+                      , Str "bis"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "b" , SoftBreak , Str "b" , Space , Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "c" , SoftBreak , Str "c" , Space , Str "2" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "r2" , Space , Str "d" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "blocks"
+      , Space
+      , Str "in"
+      , Space
+      , Str "a"
+      , Space
+      , Str "cell"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidth 0.2375 )
+      , ( AlignDefault , ColWidth 0.15 )
+      , ( AlignDefault , ColWidth 0.1625 )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "r1" , Space , Str "a" ]
+                  , Para [ Str "r1" , Space , Str "bis" ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ BulletList
+                      [ [ Plain [ Str "b" ] ]
+                      , [ Plain [ Str "b" , Space , Str "2" ] ]
+                      , [ Plain [ Str "b" , Space , Str "2" ] ]
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "c"
+                      , SoftBreak
+                      , Str "c"
+                      , Space
+                      , Str "2"
+                      , SoftBreak
+                      , Str "c"
+                      , Space
+                      , Str "2"
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header 1 ( "footnotes" , [] , [] ) [ Str "Footnotes" ]
+  , Para
+      [ Note
+          [ Para
+              [ Str "Note"
+              , Space
+              , Str "with"
+              , Space
+              , Str "one"
+              , Space
+              , Str "line."
+              ]
+          ]
+      ]
+  , Para
+      [ Note
+          [ Para
+              [ Str "Note"
+              , Space
+              , Str "with"
+              , SoftBreak
+              , Str "continuation"
+              , Space
+              , Str "line."
+              ]
+          ]
+      ]
+  , Para
+      [ Note
+          [ Para [ Str "Note" , Space , Str "with" ]
+          , Para [ Str "continuation" , Space , Str "block." ]
+          ]
+      ]
+  , Para
+      [ Note
+          [ Para
+              [ Str "Note"
+              , Space
+              , Str "with"
+              , SoftBreak
+              , Str "continuation"
+              , Space
+              , Str "line"
+              ]
+          , Para
+              [ Str "and"
+              , Space
+              , Str "a"
+              , Space
+              , Str "second"
+              , Space
+              , Str "para."
+              ]
+          ]
+      ]
+  , Para [ Str "Not" , Space , Str "in" , Space , Str "note." ]
+  , Header 1 ( "math" , [] , [] ) [ Str "Math" ]
+  , Para
+      [ Str "Some"
+      , Space
+      , Str "inline"
+      , Space
+      , Str "math"
+      , Space
+      , Math InlineMath "E=mc^2"
+      , Str "."
+      , Space
+      , Str "Now"
+      , Space
+      , Str "some"
+      , SoftBreak
+      , Str "display"
+      , Space
+      , Str "math:"
+      ]
+  , Para [ Math DisplayMath "E=mc^2" ]
+  , Para [ Math DisplayMath "E = mc^2" ]
+  , Para
+      [ Math DisplayMath "E = mc^2"
+      , Math DisplayMath "\\alpha = \\beta"
+      ]
+  , Para
+      [ Math
+          DisplayMath
+          "\\begin{aligned}\nE &= mc^2\\\\\nF &= \\pi E\n\\end{aligned}"
+      , Math DisplayMath "F &= \\gamma \\alpha^2"
+      ]
+  , Para [ Str "All" , Space , Str "done." ]
+  , Header 1 ( "default-role" , [] , [] ) [ Str "Default-Role" ]
+  , Para
+      [ Str "Try"
+      , Space
+      , Str "changing"
+      , Space
+      , Str "the"
+      , Space
+      , Str "default"
+      , Space
+      , Str "role"
+      , Space
+      , Str "to"
+      , Space
+      , Str "a"
+      , Space
+      , Str "few"
+      , Space
+      , Str "different"
+      , Space
+      , Str "things."
+      ]
+  , Header
+      2
+      ( "doesnt-break-title-parsing" , [] , [] )
+      [ Str "Doesn\8217t"
+      , Space
+      , Str "Break"
+      , Space
+      , Str "Title"
+      , Space
+      , Str "Parsing"
+      ]
+  , Para
+      [ Str "Inline"
+      , Space
+      , Str "math:"
+      , Space
+      , Math InlineMath "E=mc^2"
+      , Space
+      , Str "or"
+      , Space
+      , Math InlineMath "E=mc^2"
+      , Space
+      , Str "or"
+      , Space
+      , Math InlineMath "E=mc^2"
+      , Str "."
+      , SoftBreak
+      , Str "Other"
+      , Space
+      , Str "roles:"
+      , Space
+      , Superscript [ Str "super" ]
+      , Str ","
+      , Space
+      , Subscript [ Str "sub" ]
+      , Str "."
+      ]
+  , Para
+      [ Math DisplayMath "\\alpha = beta" , Math DisplayMath "E = mc^2" ]
+  , Para
+      [ Str "Some"
+      , Space
+      , Superscript [ Str "of" ]
+      , Space
+      , Str "these"
+      , Space
+      , Superscript [ Str "words" ]
+      , Space
+      , Str "are"
+      , Space
+      , Str "in"
+      , Space
+      , Superscript [ Str "superscript" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Reset"
+      , Space
+      , Str "default-role"
+      , Space
+      , Str "to"
+      , Space
+      , Str "the"
+      , Space
+      , Str "default"
+      , Space
+      , Str "default."
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "now"
+      , Space
+      , Span
+          ( "" , [ "title-ref" ] , [] ) [ Str "some-invalid-string-3231231" ]
+      , Space
+      , Str "is"
+      , Space
+      , Str "nonsense."
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "now"
+      , Space
+      , Str "with"
+      , Space
+      , RawInline
+          (Format "html") "<b>inline</b> <span id=\"test\">HTML</span>"
+      , Str "."
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "some"
+      , Space
+      , Str "inline"
+      , Space
+      , Str "haskell"
+      , Space
+      , Code ( "" , [ "haskell" ] , [] ) "fmap id [1,2..10]"
+      , Str "."
+      ]
+  , Para
+      [ Str "Indirect"
+      , Space
+      , Str "python"
+      , Space
+      , Str "role"
+      , Space
+      , Code
+          ( "" , [ "py" , "python" , "indirect" ] , [] )
+          "[x*x for x in [1,2,3,4,5]]"
+      , Str "."
+      ]
+  , Para
+      [ Str "Different"
+      , Space
+      , Str "indirect"
+      , Space
+      , Str "C"
+      , Space
+      , Code ( "" , [ "c" , "different-indirect" ] , [] ) "int x = 15;"
+      , Str "."
+      ]
+  , Header
+      2
+      ( "literal-symbols" , [] , [] )
+      [ Str "Literal" , Space , Str "symbols" ]
+  , Para [ Str "2*2" , Space , Str "=" , Space , Str "4*1" ]
+  ]
diff --git a/test/rtf/accent.native b/test/rtf/accent.native
--- a/test/rtf/accent.native
+++ b/test/rtf/accent.native
@@ -1,2 +1,18 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Str "le",Space,Str "caf\233",Space,Str "o\249",Space,Str "on",Space,Str "ne",Space,Str "fume",Space,Str "pas"]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Para
+      [ Str "le"
+      , Space
+      , Str "caf\233"
+      , Space
+      , Str "o\249"
+      , Space
+      , Str "on"
+      , Space
+      , Str "ne"
+      , Space
+      , Str "fume"
+      , Space
+      , Str "pas"
+      ]
+  ]
diff --git a/test/rtf/bookmark.native b/test/rtf/bookmark.native
--- a/test/rtf/bookmark.native
+++ b/test/rtf/bookmark.native
@@ -1,3 +1,11 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Span ("bookmark_1",[],[]) [],Str "Bookmark_1"]
-,Para [Link ("",[],[]) [Str "click",Space,Str "me"] ("#bookmark_1","")]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Para
+      [ Span ( "bookmark_1" , [] , [] ) [ Str "Bookmark_1" ] ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "click" , Space , Str "me" ]
+          ( "#bookmark_1" , "" )
+      ]
+  ]
diff --git a/test/rtf/footnote.native b/test/rtf/footnote.native
--- a/test/rtf/footnote.native
+++ b/test/rtf/footnote.native
@@ -1,2 +1,130 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Str "Mead's",Space,Str "landmark",Space,Str "study",Space,Str "has",Space,Str "been",Space,Str "amply",Space,Str "annotated.",Note [Para [Str "See",Space,Str "Sahlins,",Space,Str "Bateson,",Space,Str "and",Space,Str "Geertz",Space,Str "for",Space,Str "a",Space,Str "complete",Space,Str "bibliography."]],Space,Str "It",Space,Str "was",Space,Str "her",Space,Str "work",Space,Str "in",Space,Str "America",Space,Str "during",Space,Str "the",Space,Str "Second",Space,Str "World",Space,Str "War,",Space,Str "however,",Space,Str "that",Space,Str "forms",Space,Str "the",Space,Str "basis",Space,Str "for",Space,Str "the",Space,Str "paper.",Space,Str "As",Space,Str "others",Space,Str "have",Space,Str "noted,",Note [Para [Str "A",Space,Str "complete",Space,Str "bibliography",Space,Str "will",Space,Str "be",Space,Str "found",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "this",Space,Str "chapter."]],Space,Str "this",Space,Str "period",Space,Str "was",Space,Str "a",Space,Str "turning",Space,Str "point",Space,Str "for",Space,Str "Margaret",Space,Str "Mead."]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Para
+      [ Str "Mead's"
+      , Space
+      , Str "landmark"
+      , Space
+      , Str "study"
+      , Space
+      , Str "has"
+      , Space
+      , Str "been"
+      , Space
+      , Str "amply"
+      , Space
+      , Str "annotated."
+      , Note
+          [ Para
+              [ Str "See"
+              , Space
+              , Str "Sahlins,"
+              , Space
+              , Str "Bateson,"
+              , Space
+              , Str "and"
+              , Space
+              , Str "Geertz"
+              , Space
+              , Str "for"
+              , Space
+              , Str "a"
+              , Space
+              , Str "complete"
+              , Space
+              , Str "bibliography."
+              ]
+          ]
+      , Space
+      , Str "It"
+      , Space
+      , Str "was"
+      , Space
+      , Str "her"
+      , Space
+      , Str "work"
+      , Space
+      , Str "in"
+      , Space
+      , Str "America"
+      , Space
+      , Str "during"
+      , Space
+      , Str "the"
+      , Space
+      , Str "Second"
+      , Space
+      , Str "World"
+      , Space
+      , Str "War,"
+      , Space
+      , Str "however,"
+      , Space
+      , Str "that"
+      , Space
+      , Str "forms"
+      , Space
+      , Str "the"
+      , Space
+      , Str "basis"
+      , Space
+      , Str "for"
+      , Space
+      , Str "the"
+      , Space
+      , Str "paper."
+      , Space
+      , Str "As"
+      , Space
+      , Str "others"
+      , Space
+      , Str "have"
+      , Space
+      , Str "noted,"
+      , Note
+          [ Para
+              [ Str "A"
+              , Space
+              , Str "complete"
+              , Space
+              , Str "bibliography"
+              , Space
+              , Str "will"
+              , Space
+              , Str "be"
+              , Space
+              , Str "found"
+              , Space
+              , Str "at"
+              , Space
+              , Str "the"
+              , Space
+              , Str "end"
+              , Space
+              , Str "of"
+              , Space
+              , Str "this"
+              , Space
+              , Str "chapter."
+              ]
+          ]
+      , Space
+      , Str "this"
+      , Space
+      , Str "period"
+      , Space
+      , Str "was"
+      , Space
+      , Str "a"
+      , Space
+      , Str "turning"
+      , Space
+      , Str "point"
+      , Space
+      , Str "for"
+      , Space
+      , Str "Margaret"
+      , Space
+      , Str "Mead."
+      ]
+  ]
diff --git a/test/rtf/formatting.native b/test/rtf/formatting.native
--- a/test/rtf/formatting.native
+++ b/test/rtf/formatting.native
@@ -1,10 +1,45 @@
-Pandoc (Meta {unMeta = fromList [("operator",MetaInlines [Str "John",Space,Str "MacFarlane"])]})
-[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "test",Space,Str "of",Space,Str "FORMATTING.",Space,Str "This",Space,Str "is",Space,Str "hidden:",Space,Str "."]
-,Para [SmallCaps [Str "Small",Space,Str "Caps"]]
-,Para [Strong [Str "bold"]]
-,Para [Emph [Str "italics"]]
-,Para [Strong [Str "bold",Space,Emph [Str "and",Space,Str "italics"]]]
-,Para [Underline [Str "underlined"]]
-,Para [Strikeout [Str "strikeout"]]
-,Para [Str "x",Superscript [Str "superscript"]]
-,Para [Str "x",Subscript [Str "subscript"]]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "operator"
+            , MetaInlines [ Str "John" , Space , Str "MacFarlane" ]
+            )
+          ]
+    }
+  [ Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "test"
+      , Space
+      , Str "of"
+      , Space
+      , Str "FORMATTING."
+      , Space
+      , Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "hidden:"
+      , Space
+      , Str "."
+      ]
+  , Para [ SmallCaps [ Str "Small" , Space , Str "Caps" ] ]
+  , Para [ Strong [ Str "bold" ] ]
+  , Para [ Emph [ Str "italics" ] ]
+  , Para
+      [ Strong
+          [ Str "bold"
+          , Space
+          , Emph [ Str "and" , Space , Str "italics" ]
+          ]
+      ]
+  , Para [ Underline [ Str "underlined" ] ]
+  , Para [ Strikeout [ Str "strikeout" ] ]
+  , Para [ Str "x" , Superscript [ Str "superscript" ] ]
+  , Para [ Str "x" , Subscript [ Str "subscript" ] ]
+  ]
diff --git a/test/rtf/heading.native b/test/rtf/heading.native
--- a/test/rtf/heading.native
+++ b/test/rtf/heading.native
@@ -1,5 +1,10 @@
-Pandoc (Meta {unMeta = fromList []})
-[Header 1 ("",[],[]) [Str "Heading",Space,Str "1"]
-,Header 2 ("",[],[]) [Str "Heading",Space,Str "2"]
-,Header 3 ("",[],[]) [Str "Heading",Space,Str "3"]
-,Para [Str "Paragraph"]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Header
+      1 ( "" , [] , [] ) [ Str "Heading" , Space , Str "1" ]
+  , Header
+      2 ( "" , [] , [] ) [ Str "Heading" , Space , Str "2" ]
+  , Header
+      3 ( "" , [] , [] ) [ Str "Heading" , Space , Str "3" ]
+  , Para [ Str "Paragraph" ]
+  ]
diff --git a/test/rtf/image.native b/test/rtf/image.native
--- a/test/rtf/image.native
+++ b/test/rtf/image.native
@@ -1,2 +1,12 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Image ("",[],[("width","2.0in"),("height","2.0in")]) [Str "image"] ("f9d88c3dbe18f6a7f5670e994a947d51216cdf0e.jpg","")]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Para
+      [ Image
+          ( ""
+          , []
+          , [ ( "width" , "2.0in" ) , ( "height" , "2.0in" ) ]
+          )
+          [ Str "image" ]
+          ( "f9d88c3dbe18f6a7f5670e994a947d51216cdf0e.jpg" , "" )
+      ]
+  ]
diff --git a/test/rtf/link.native b/test/rtf/link.native
--- a/test/rtf/link.native
+++ b/test/rtf/link.native
@@ -1,2 +1,9 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Link ("",[],[]) [Str "pandoc"] ("http://pandoc.org","")]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "pandoc" ]
+          ( "http://pandoc.org" , "" )
+      ]
+  ]
diff --git a/test/rtf/list_complex.native b/test/rtf/list_complex.native
--- a/test/rtf/list_complex.native
+++ b/test/rtf/list_complex.native
@@ -1,24 +1,64 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaInlines [Str "Cynthia",Space,Str "Johnson"]),("operator",MetaInlines [Str "John",Space,Str "MacFarlane"]),("title",MetaInlines [Str "Text",Space,Str "before",Space,Str "list"])]})
-[OrderedList (1,Decimal,Period)
- [[Para [Str "One"]]
- ,[Para [Str "Two"]
-  ,OrderedList (1,LowerAlpha,Period)
-   [[Para [Str "Three"]]
-   ,[Para [Str "Four"]
-    ,OrderedList (1,LowerRoman,Period)
-     [[Para [Str "Five"]]
-     ,[Para [Str "Six"]
-      ,OrderedList (1,UpperAlpha,Period)
-       [[Para [Str "Seven"]]
-       ,[Para [Str "Eight"]
-        ,OrderedList (1,UpperRoman,Period)
-         [[Para [Str "Nine"]]
-         ,[Para [Str "Ten"]
-          ,BulletList
-           [[Para [Str "Eleven"]]
-           ,[Para [Str "Twelve"]]]]]]]]]]]]]
-,Para [Str "Out",Space,Str "of",Space,Str "list!"]
-,Para [Str "Start",Space,Str "with"]
-,OrderedList (7,Decimal,Period)
- [[Para [Str "Seven",Space,Str "Start"]]
- ,[Para [Str "Eight",Space,Str "Continue"]]]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author"
+            , MetaInlines [ Str "Cynthia" , Space , Str "Johnson" ]
+            )
+          , ( "operator"
+            , MetaInlines [ Str "John" , Space , Str "MacFarlane" ]
+            )
+          , ( "title"
+            , MetaInlines
+                [ Str "Text"
+                , Space
+                , Str "before"
+                , Space
+                , Str "list"
+                ]
+            )
+          ]
+    }
+  [ OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "One" ] ]
+      , [ Para [ Str "Two" ]
+        , OrderedList
+            ( 1 , LowerAlpha , Period )
+            [ [ Para [ Str "Three" ] ]
+            , [ Para [ Str "Four" ]
+              , OrderedList
+                  ( 1 , LowerRoman , Period )
+                  [ [ Para [ Str "Five" ] ]
+                  , [ Para [ Str "Six" ]
+                    , OrderedList
+                        ( 1 , UpperAlpha , Period )
+                        [ [ Para [ Str "Seven" ] ]
+                        , [ Para [ Str "Eight" ]
+                          , OrderedList
+                              ( 1 , UpperRoman , Period )
+                              [ [ Para [ Str "Nine" ] ]
+                              , [ Para [ Str "Ten" ]
+                                , BulletList
+                                    [ [ Para [ Str "Eleven" ] ]
+                                    , [ Para [ Str "Twelve" ] ]
+                                    ]
+                                ]
+                              ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Out" , Space , Str "of" , Space , Str "list!" ]
+  , Para [ Str "Start" , Space , Str "with" ]
+  , OrderedList
+      ( 7 , Decimal , Period )
+      [ [ Para [ Str "Seven" , Space , Str "Start" ] ]
+      , [ Para [ Str "Eight" , Space , Str "Continue" ] ]
+      ]
+  ]
diff --git a/test/rtf/list_simple.native b/test/rtf/list_simple.native
--- a/test/rtf/list_simple.native
+++ b/test/rtf/list_simple.native
@@ -1,8 +1,10 @@
-Pandoc (Meta {unMeta = fromList []})
-[BulletList
- [[Para [Str "one"]]
- ,[Para [Str "two"]
-  ,BulletList
-   [[Para [Str "sub"]]]]]
-,BulletList
- [[Para [Str "new",Space,Str "list"]]]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ BulletList
+      [ [ Para [ Str "one" ] ]
+      , [ Para [ Str "two" ]
+        , BulletList [ [ Para [ Str "sub" ] ] ]
+        ]
+      ]
+  , BulletList [ [ Para [ Str "new" , Space , Str "list" ] ] ]
+  ]
diff --git a/test/rtf/table_error_codes.native b/test/rtf/table_error_codes.native
--- a/test/rtf/table_error_codes.native
+++ b/test/rtf/table_error_codes.native
@@ -1,146 +1,422 @@
-Pandoc (Meta {unMeta = fromList []})
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Code"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "Error"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocFailOnWarningError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocAppError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocTemplateError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "6"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocOptionError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "21"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocUnknownReaderError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "22"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocUnknownWriterError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "23"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocUnsupportedExtensionError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "24"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocCiteprocError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "31"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocEpubSubdirectoryError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "43"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocPDFError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "44"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocXMLError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "47"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocPDFProgramNotFoundError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "61"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocHttpError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "62"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocShouldNeverHappenError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "63"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocSomeError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "64"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocParseError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "65"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocParsecError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "66"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocMakePDFError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "67"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocSyntaxMapError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "83"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocFilterError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "91"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocMacroLoop"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "92"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocUTF8DecodingError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "93"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocIpynbDecodingError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "94"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocUnsupportedCharsetError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "97"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocCouldNotFindDataFileError"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "99"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "PandocResourceNotFound"]]]])]
- (TableFoot ("",[],[])
- [])]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Code" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "Error" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "3" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocFailOnWarningError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocAppError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocTemplateError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "6" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocOptionError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "21" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocUnknownReaderError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "22" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocUnknownWriterError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "23" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocUnsupportedExtensionError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "24" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocCiteprocError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "31" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocEpubSubdirectoryError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "43" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocPDFError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "44" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocXMLError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "47" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocPDFProgramNotFoundError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "61" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocHttpError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "62" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocShouldNeverHappenError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "63" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocSomeError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "64" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocParseError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "65" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocParsecError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "66" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocMakePDFError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "67" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocSyntaxMapError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "83" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocFilterError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "91" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocMacroLoop" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "92" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocUTF8DecodingError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "93" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocIpynbDecodingError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "94" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocUnsupportedCharsetError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "97" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocCouldNotFindDataFileError" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "99" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "PandocResourceNotFound" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  ]
diff --git a/test/rtf/table_simple.native b/test/rtf/table_simple.native
--- a/test/rtf/table_simple.native
+++ b/test/rtf/table_simple.native
@@ -1,31 +1,73 @@
-Pandoc (Meta {unMeta = fromList []})
-[Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "A"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "B"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "C"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "D"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "E"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "F"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "G"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Para [Str "H"]]]])]
- (TableFoot ("",[],[])
- [])]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "A" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "B" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "C" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "D" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "E" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "F" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "G" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Para [ Str "H" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  ]
diff --git a/test/rtf/unicode.native b/test/rtf/unicode.native
--- a/test/rtf/unicode.native
+++ b/test/rtf/unicode.native
@@ -1,2 +1,3 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Str "\8220hi\8221\8216hi\8217\61623\945\228"]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Para [ Str "\8220hi\8221\8216hi\8217\61623\945\228" ] ]
diff --git a/test/tables-rstsubset.native b/test/tables-rstsubset.native
--- a/test/tables-rstsubset.native
+++ b/test/tables-rstsubset.native
@@ -1,301 +1,973 @@
-[Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces:"]
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Here\8217s",Space,Str "the",Space,Str "caption.",Space,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."]])
- [(AlignDefault,ColWidth 0.1375)
- ,(AlignDefault,ColWidth 0.125)
- ,(AlignDefault,ColWidth 0.15)
- ,(AlignDefault,ColWidth 0.3375)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Centered",SoftBreak,Str "Header"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left",SoftBreak,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right",SoftBreak,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default",Space,Str "aligned"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "First"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",SoftBreak,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Second"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.1375)
- ,(AlignDefault,ColWidth 0.125)
- ,(AlignDefault,ColWidth 0.15)
- ,(AlignDefault,ColWidth 0.3375)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Centered",SoftBreak,Str "Header"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left",SoftBreak,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right",SoftBreak,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default",Space,Str "aligned"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "First"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",SoftBreak,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Second"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidth 0.1375)
- ,(AlignDefault,ColWidth 0.125)
- ,(AlignDefault,ColWidth 0.15)
- ,(AlignDefault,ColWidth 0.3375)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "First"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",SoftBreak,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Second"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Para
+    [ Str "Simple"
+    , Space
+    , Str "table"
+    , Space
+    , Str "with"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption
+       Nothing
+       [ Plain
+           [ Str "Demonstration"
+           , Space
+           , Str "of"
+           , Space
+           , Str "simple"
+           , Space
+           , Str "table"
+           , Space
+           , Str "syntax."
+           ]
+       ])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Center" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Simple"
+    , Space
+    , Str "table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Center" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Simple"
+    , Space
+    , Str "table"
+    , Space
+    , Str "indented"
+    , Space
+    , Str "two"
+    , Space
+    , Str "spaces:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption
+       Nothing
+       [ Plain
+           [ Str "Demonstration"
+           , Space
+           , Str "of"
+           , Space
+           , Str "simple"
+           , Space
+           , Str "table"
+           , Space
+           , Str "syntax."
+           ]
+       ])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Center" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Multiline"
+    , Space
+    , Str "table"
+    , Space
+    , Str "with"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption
+       Nothing
+       [ Plain
+           [ Str "Here\8217s"
+           , Space
+           , Str "the"
+           , Space
+           , Str "caption."
+           , Space
+           , Str "It"
+           , Space
+           , Str "may"
+           , Space
+           , Str "span"
+           , Space
+           , Str "multiple"
+           , Space
+           , Str "lines."
+           ]
+       ])
+    [ ( AlignDefault , ColWidth 0.15 )
+    , ( AlignDefault , ColWidth 0.1375 )
+    , ( AlignDefault , ColWidth 0.1625 )
+    , ( AlignDefault , ColWidth 0.35 )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Centered" , SoftBreak , Str "Header" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" , SoftBreak , Str "Aligned" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" , SoftBreak , Str "Aligned" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" , Space , Str "aligned" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "First" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Example"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "row"
+                    , Space
+                    , Str "that"
+                    , SoftBreak
+                    , Str "spans"
+                    , Space
+                    , Str "multiple"
+                    , Space
+                    , Str "lines."
+                    ]
+                ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Second" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "5.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Here\8217s"
+                    , Space
+                    , Str "another"
+                    , Space
+                    , Str "one."
+                    , Space
+                    , Str "Note"
+                    , SoftBreak
+                    , Str "the"
+                    , Space
+                    , Str "blank"
+                    , Space
+                    , Str "line"
+                    , Space
+                    , Str "between"
+                    , SoftBreak
+                    , Str "rows."
+                    ]
+                ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Multiline"
+    , Space
+    , Str "table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidth 0.15 )
+    , ( AlignDefault , ColWidth 0.1375 )
+    , ( AlignDefault , ColWidth 0.1625 )
+    , ( AlignDefault , ColWidth 0.35 )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Centered" , SoftBreak , Str "Header" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" , SoftBreak , Str "Aligned" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" , SoftBreak , Str "Aligned" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" , Space , Str "aligned" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "First" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Example"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "row"
+                    , Space
+                    , Str "that"
+                    , SoftBreak
+                    , Str "spans"
+                    , Space
+                    , Str "multiple"
+                    , Space
+                    , Str "lines."
+                    ]
+                ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Second" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "5.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Here\8217s"
+                    , Space
+                    , Str "another"
+                    , Space
+                    , Str "one."
+                    , Space
+                    , Str "Note"
+                    , SoftBreak
+                    , Str "the"
+                    , Space
+                    , Str "blank"
+                    , Space
+                    , Str "line"
+                    , Space
+                    , Str "between"
+                    , SoftBreak
+                    , Str "rows."
+                    ]
+                ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "column"
+    , Space
+    , Str "headers:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+           , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+           , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+           , Cell ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Multiline"
+    , Space
+    , Str "table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "column"
+    , Space
+    , Str "headers:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignDefault , ColWidth 0.15 )
+    , ( AlignDefault , ColWidth 0.1375 )
+    , ( AlignDefault , ColWidth 0.1625 )
+    , ( AlignDefault , ColWidth 0.35 )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "First" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Example"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "row"
+                    , Space
+                    , Str "that"
+                    , SoftBreak
+                    , Str "spans"
+                    , Space
+                    , Str "multiple"
+                    , Space
+                    , Str "lines."
+                    ]
+                ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Second" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "5.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Here\8217s"
+                    , Space
+                    , Str "another"
+                    , Space
+                    , Str "one."
+                    , Space
+                    , Str "Note"
+                    , SoftBreak
+                    , Str "the"
+                    , Space
+                    , Str "blank"
+                    , Space
+                    , Str "line"
+                    , Space
+                    , Str "between"
+                    , SoftBreak
+                    , Str "rows."
+                    ]
+                ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
diff --git a/test/tables.haddock b/test/tables.haddock
--- a/test/tables.haddock
+++ b/test/tables.haddock
@@ -40,33 +40,33 @@
 
 Multiline table with caption:
 
-+----------+---------+-----------+--------------------------+
-| Centered | Left    | Right     | Default aligned          |
-| Header   | Aligned | Aligned   |                          |
-+==========+=========+===========+==========================+
-| First    | row     | 12.0      | Example of a row that    |
-|          |         |           | spans multiple lines.    |
-+----------+---------+-----------+--------------------------+
-| Second   | row     | 5.0       | Here’s another one. Note |
-|          |         |           | the blank line between   |
-|          |         |           | rows.                    |
-+----------+---------+-----------+--------------------------+
++-----------+----------+------------+---------------------------+
+| Centered  | Left     | Right      | Default aligned           |
+| Header    | Aligned  | Aligned    |                           |
++===========+==========+============+===========================+
+| First     | row      | 12.0       | Example of a row that     |
+|           |          |            | spans multiple lines.     |
++-----------+----------+------------+---------------------------+
+| Second    | row      | 5.0        | Here’s another one. Note  |
+|           |          |            | the blank line between    |
+|           |          |            | rows.                     |
++-----------+----------+------------+---------------------------+
 
 Here’s the caption. It may span multiple lines.
 
 Multiline table without caption:
 
-+----------+---------+-----------+--------------------------+
-| Centered | Left    | Right     | Default aligned          |
-| Header   | Aligned | Aligned   |                          |
-+==========+=========+===========+==========================+
-| First    | row     | 12.0      | Example of a row that    |
-|          |         |           | spans multiple lines.    |
-+----------+---------+-----------+--------------------------+
-| Second   | row     | 5.0       | Here’s another one. Note |
-|          |         |           | the blank line between   |
-|          |         |           | rows.                    |
-+----------+---------+-----------+--------------------------+
++-----------+----------+------------+---------------------------+
+| Centered  | Left     | Right      | Default aligned           |
+| Header    | Aligned  | Aligned    |                           |
++===========+==========+============+===========================+
+| First     | row      | 12.0       | Example of a row that     |
+|           |          |            | spans multiple lines.     |
++-----------+----------+------------+---------------------------+
+| Second    | row      | 5.0        | Here’s another one. Note  |
+|           |          |            | the blank line between    |
+|           |          |            | rows.                     |
++-----------+----------+------------+---------------------------+
 
 Table without column headers:
 
@@ -80,11 +80,11 @@
 
 Multiline table without column headers:
 
-+----------+---------+-----------+--------------------------+
-| First    | row     | 12.0      | Example of a row that    |
-|          |         |           | spans multiple lines.    |
-+----------+---------+-----------+--------------------------+
-| Second   | row     | 5.0       | Here’s another one. Note |
-|          |         |           | the blank line between   |
-|          |         |           | rows.                    |
-+----------+---------+-----------+--------------------------+
++-----------+----------+------------+---------------------------+
+| First     | row      | 12.0       | Example of a row that     |
+|           |          |            | spans multiple lines.     |
++-----------+----------+------------+---------------------------+
+| Second    | row      | 5.0        | Here’s another one. Note  |
+|           |          |            | the blank line between    |
+|           |          |            | rows.                     |
++-----------+----------+------------+---------------------------+
diff --git a/test/tables.markdown b/test/tables.markdown
--- a/test/tables.markdown
+++ b/test/tables.markdown
@@ -28,33 +28,33 @@
 
 Multiline table with caption:
 
-  --------------------------------------------------------------
+  ---------------------------------------------------------------
    Centered   Left              Right Default aligned
     Header    Aligned         Aligned 
-  ----------- ---------- ------------ --------------------------
-     First    row                12.0 Example of a row that
-                                      spans multiple lines.
+  ----------- ---------- ------------ ---------------------------
+     First    row                12.0 Example of a row that spans
+                                      multiple lines.
 
     Second    row                 5.0 Here's another one. Note
                                       the blank line between
                                       rows.
-  --------------------------------------------------------------
+  ---------------------------------------------------------------
 
   : Here's the caption. It may span multiple lines.
 
 Multiline table without caption:
 
-  --------------------------------------------------------------
+  ---------------------------------------------------------------
    Centered   Left              Right Default aligned
     Header    Aligned         Aligned 
-  ----------- ---------- ------------ --------------------------
-     First    row                12.0 Example of a row that
-                                      spans multiple lines.
+  ----------- ---------- ------------ ---------------------------
+     First    row                12.0 Example of a row that spans
+                                      multiple lines.
 
     Second    row                 5.0 Here's another one. Note
                                       the blank line between
                                       rows.
-  --------------------------------------------------------------
+  ---------------------------------------------------------------
 
 Table without column headers:
 
@@ -66,11 +66,11 @@
 
 Multiline table without column headers:
 
-  ----------- ---------- ------------ --------------------------
-     First    row                12.0 Example of a row that
-                                      spans multiple lines.
+  ----------- ---------- ------------ ---------------------------
+     First    row                12.0 Example of a row that spans
+                                      multiple lines.
 
     Second    row                 5.0 Here's another one. Note
                                       the blank line between
                                       rows.
-  ----------- ---------- ------------ --------------------------
+  ----------- ---------- ------------ ---------------------------
diff --git a/test/tables.muse b/test/tables.muse
--- a/test/tables.muse
+++ b/test/tables.muse
@@ -23,24 +23,24 @@
 
 Multiline table with caption:
 
-+----------+---------+-----------+--------------------------+
-| First    | row     | 12.0      | Example of a row that    |
-|          |         |           | spans multiple lines.    |
-+----------+---------+-----------+--------------------------+
-| Second   | row     | 5.0       | Here’s another one. Note |
-|          |         |           | the blank line between   |
-|          |         |           | rows.                    |
-+----------+---------+-----------+--------------------------+
++-----------+----------+------------+---------------------------+
+| First     | row      | 12.0       | Example of a row that     |
+|           |          |            | spans multiple lines.     |
++-----------+----------+------------+---------------------------+
+| Second    | row      | 5.0        | Here’s another one. Note  |
+|           |          |            | the blank line between    |
+|           |          |            | rows.                     |
++-----------+----------+------------+---------------------------+
 Multiline table without caption:
 
-+----------+---------+-----------+--------------------------+
-| First    | row     | 12.0      | Example of a row that    |
-|          |         |           | spans multiple lines.    |
-+----------+---------+-----------+--------------------------+
-| Second   | row     | 5.0       | Here’s another one. Note |
-|          |         |           | the blank line between   |
-|          |         |           | rows.                    |
-+----------+---------+-----------+--------------------------+
++-----------+----------+------------+---------------------------+
+| First     | row      | 12.0       | Example of a row that     |
+|           |          |            | spans multiple lines.     |
++-----------+----------+------------+---------------------------+
+| Second    | row      | 5.0        | Here’s another one. Note  |
+|           |          |            | the blank line between    |
+|           |          |            | rows.                     |
++-----------+----------+------------+---------------------------+
 Table without column headers:
 
  12  | 12  | 12  | 12
@@ -49,11 +49,11 @@
 
 Multiline table without column headers:
 
-+----------+---------+-----------+--------------------------+
-| First    | row     | 12.0      | Example of a row that    |
-|          |         |           | spans multiple lines.    |
-+----------+---------+-----------+--------------------------+
-| Second   | row     | 5.0       | Here’s another one. Note |
-|          |         |           | the blank line between   |
-|          |         |           | rows.                    |
-+----------+---------+-----------+--------------------------+
++-----------+----------+------------+---------------------------+
+| First     | row      | 12.0       | Example of a row that     |
+|           |          |            | spans multiple lines.     |
++-----------+----------+------------+---------------------------+
+| Second    | row      | 5.0        | Here’s another one. Note  |
+|           |          |            | the blank line between    |
+|           |          |            | rows.                     |
++-----------+----------+------------+---------------------------+
diff --git a/test/tables.native b/test/tables.native
--- a/test/tables.native
+++ b/test/tables.native
@@ -1,293 +1,964 @@
-[Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces:"]
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Center"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [Plain [Str "Here\8217s",Space,Str "the",Space,Str "caption.",SoftBreak,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."]])
- [(AlignCenter,ColWidth 0.15)
- ,(AlignLeft,ColWidth 0.1375)
- ,(AlignRight,ColWidth 0.1625)
- ,(AlignLeft,ColWidth 0.35)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Centered",SoftBreak,Str "Header"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left",SoftBreak,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right",SoftBreak,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default",Space,Str "aligned"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "First"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",SoftBreak,Str "multiple",Space,Str "lines."]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Second"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidth 0.15)
- ,(AlignLeft,ColWidth 0.1375)
- ,(AlignRight,ColWidth 0.1625)
- ,(AlignLeft,ColWidth 0.35)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Centered",SoftBreak,Str "Header"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Left",SoftBreak,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Right",SoftBreak,Str "Aligned"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Default",Space,Str "aligned"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "First"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",SoftBreak,Str "multiple",Space,Str "lines."]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Second"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "123"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidth 0.15)
- ,(AlignLeft,ColWidth 0.1375)
- ,(AlignRight,ColWidth 0.1625)
- ,(AlignDefault,ColWidth 0.35)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "First"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "12.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",SoftBreak,Str "multiple",Space,Str "lines."]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Second"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "row"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5.0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]])]
- (TableFoot ("",[],[])
- [])]
+[ Para
+    [ Str "Simple"
+    , Space
+    , Str "table"
+    , Space
+    , Str "with"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption
+       Nothing
+       [ Plain
+           [ Str "Demonstration"
+           , Space
+           , Str "of"
+           , Space
+           , Str "simple"
+           , Space
+           , Str "table"
+           , Space
+           , Str "syntax."
+           ]
+       ])
+    [ ( AlignRight , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Center" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Simple"
+    , Space
+    , Str "table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignRight , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Center" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Simple"
+    , Space
+    , Str "table"
+    , Space
+    , Str "indented"
+    , Space
+    , Str "two"
+    , Space
+    , Str "spaces:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption
+       Nothing
+       [ Plain
+           [ Str "Demonstration"
+           , Space
+           , Str "of"
+           , Space
+           , Str "simple"
+           , Space
+           , Str "table"
+           , Space
+           , Str "syntax."
+           ]
+       ])
+    [ ( AlignRight , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    , ( AlignDefault , ColWidthDefault )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Center" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Multiline"
+    , Space
+    , Str "table"
+    , Space
+    , Str "with"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption
+       Nothing
+       [ Plain
+           [ Str "Here\8217s"
+           , Space
+           , Str "the"
+           , Space
+           , Str "caption."
+           , SoftBreak
+           , Str "It"
+           , Space
+           , Str "may"
+           , Space
+           , Str "span"
+           , Space
+           , Str "multiple"
+           , Space
+           , Str "lines."
+           ]
+       ])
+    [ ( AlignCenter , ColWidth 0.15 )
+    , ( AlignLeft , ColWidth 0.1375 )
+    , ( AlignRight , ColWidth 0.1625 )
+    , ( AlignLeft , ColWidth 0.35 )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Centered" , SoftBreak , Str "Header" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" , SoftBreak , Str "Aligned" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" , SoftBreak , Str "Aligned" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" , Space , Str "aligned" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "First" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Example"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "row"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "spans"
+                    , SoftBreak
+                    , Str "multiple"
+                    , Space
+                    , Str "lines."
+                    ]
+                ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Second" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "5.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Here\8217s"
+                    , Space
+                    , Str "another"
+                    , Space
+                    , Str "one."
+                    , Space
+                    , Str "Note"
+                    , SoftBreak
+                    , Str "the"
+                    , Space
+                    , Str "blank"
+                    , Space
+                    , Str "line"
+                    , Space
+                    , Str "between"
+                    , Space
+                    , Str "rows."
+                    ]
+                ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Multiline"
+    , Space
+    , Str "table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "caption:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignCenter , ColWidth 0.15 )
+    , ( AlignLeft , ColWidth 0.1375 )
+    , ( AlignRight , ColWidth 0.1625 )
+    , ( AlignLeft , ColWidth 0.35 )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Centered" , SoftBreak , Str "Header" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Left" , SoftBreak , Str "Aligned" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Right" , SoftBreak , Str "Aligned" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "Default" , Space , Str "aligned" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "First" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Example"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "row"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "spans"
+                    , SoftBreak
+                    , Str "multiple"
+                    , Space
+                    , Str "lines."
+                    ]
+                ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Second" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "5.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Here\8217s"
+                    , Space
+                    , Str "another"
+                    , Space
+                    , Str "one."
+                    , Space
+                    , Str "Note"
+                    , SoftBreak
+                    , Str "the"
+                    , Space
+                    , Str "blank"
+                    , Space
+                    , Str "line"
+                    , Space
+                    , Str "between"
+                    , Space
+                    , Str "rows."
+                    ]
+                ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "column"
+    , Space
+    , Str "headers:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignRight , ColWidthDefault )
+    , ( AlignLeft , ColWidthDefault )
+    , ( AlignCenter , ColWidthDefault )
+    , ( AlignRight , ColWidthDefault )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "123" ] ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "1" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+, Para
+    [ Str "Multiline"
+    , Space
+    , Str "table"
+    , Space
+    , Str "without"
+    , Space
+    , Str "column"
+    , Space
+    , Str "headers:"
+    ]
+, Table
+    ( "" , [] , [] )
+    (Caption Nothing [])
+    [ ( AlignCenter , ColWidth 0.15 )
+    , ( AlignLeft , ColWidth 0.1375 )
+    , ( AlignRight , ColWidth 0.1625 )
+    , ( AlignDefault , ColWidth 0.35 )
+    ]
+    (TableHead ( "" , [] , [] ) [])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "First" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "12.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Example"
+                    , Space
+                    , Str "of"
+                    , Space
+                    , Str "a"
+                    , Space
+                    , Str "row"
+                    , Space
+                    , Str "that"
+                    , Space
+                    , Str "spans"
+                    , SoftBreak
+                    , Str "multiple"
+                    , Space
+                    , Str "lines."
+                    ]
+                ]
+            ]
+        , Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "Second" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "row" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "5.0" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain
+                    [ Str "Here\8217s"
+                    , Space
+                    , Str "another"
+                    , Space
+                    , Str "one."
+                    , Space
+                    , Str "Note"
+                    , SoftBreak
+                    , Str "the"
+                    , Space
+                    , Str "blank"
+                    , Space
+                    , Str "line"
+                    , Space
+                    , Str "between"
+                    , Space
+                    , Str "rows."
+                    ]
+                ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
diff --git a/test/tables.opendocument b/test/tables.opendocument
--- a/test/tables.opendocument
+++ b/test/tables.opendocument
@@ -201,8 +201,8 @@
 </table:table>
 <text:p text:style-name="First_20_paragraph">Multiline table with
 caption:</text:p>
-<text:p text:style-name="TableCaption">Here’s the caption. It may span
-multiple lines.</text:p>
+<text:p text:style-name="TableCaption">Here’s the caption. It may span multiple
+lines.</text:p>
 <table:table table:name="Table4" table:style-name="Table4">
   <table:table-column table:style-name="Table4.A" />
   <table:table-column table:style-name="Table4.B" />
diff --git a/test/tables.plain b/test/tables.plain
--- a/test/tables.plain
+++ b/test/tables.plain
@@ -28,33 +28,33 @@
 
 Multiline table with caption:
 
-  --------------------------------------------------------------
+  ---------------------------------------------------------------
    Centered   Left              Right Default aligned
     Header    Aligned         Aligned 
-  ----------- ---------- ------------ --------------------------
-     First    row                12.0 Example of a row that
-                                      spans multiple lines.
+  ----------- ---------- ------------ ---------------------------
+     First    row                12.0 Example of a row that spans
+                                      multiple lines.
 
     Second    row                 5.0 Here’s another one. Note
                                       the blank line between
                                       rows.
-  --------------------------------------------------------------
+  ---------------------------------------------------------------
 
   : Here’s the caption. It may span multiple lines.
 
 Multiline table without caption:
 
-  --------------------------------------------------------------
+  ---------------------------------------------------------------
    Centered   Left              Right Default aligned
     Header    Aligned         Aligned 
-  ----------- ---------- ------------ --------------------------
-     First    row                12.0 Example of a row that
-                                      spans multiple lines.
+  ----------- ---------- ------------ ---------------------------
+     First    row                12.0 Example of a row that spans
+                                      multiple lines.
 
     Second    row                 5.0 Here’s another one. Note
                                       the blank line between
                                       rows.
-  --------------------------------------------------------------
+  ---------------------------------------------------------------
 
 Table without column headers:
 
@@ -66,11 +66,11 @@
 
 Multiline table without column headers:
 
-  ----------- ---------- ------------ --------------------------
-     First    row                12.0 Example of a row that
-                                      spans multiple lines.
+  ----------- ---------- ------------ ---------------------------
+     First    row                12.0 Example of a row that spans
+                                      multiple lines.
 
     Second    row                 5.0 Here’s another one. Note
                                       the blank line between
                                       rows.
-  ----------- ---------- ------------ --------------------------
+  ----------- ---------- ------------ ---------------------------
diff --git a/test/tables.rst b/test/tables.rst
--- a/test/tables.rst
+++ b/test/tables.rst
@@ -36,31 +36,31 @@
 
 .. table:: Here’s the caption. It may span multiple lines.
 
-   +----------+---------+-----------+--------------------------+
-   | Centered | Left    | Right     | Default aligned          |
-   | Header   | Aligned | Aligned   |                          |
-   +==========+=========+===========+==========================+
-   | First    | row     | 12.0      | Example of a row that    |
-   |          |         |           | spans multiple lines.    |
-   +----------+---------+-----------+--------------------------+
-   | Second   | row     | 5.0       | Here’s another one. Note |
-   |          |         |           | the blank line between   |
-   |          |         |           | rows.                    |
-   +----------+---------+-----------+--------------------------+
+   +-----------+----------+------------+---------------------------+
+   | Centered  | Left     | Right      | Default aligned           |
+   | Header    | Aligned  | Aligned    |                           |
+   +===========+==========+============+===========================+
+   | First     | row      | 12.0       | Example of a row that     |
+   |           |          |            | spans multiple lines.     |
+   +-----------+----------+------------+---------------------------+
+   | Second    | row      | 5.0        | Here’s another one. Note  |
+   |           |          |            | the blank line between    |
+   |           |          |            | rows.                     |
+   +-----------+----------+------------+---------------------------+
 
 Multiline table without caption:
 
-+----------+---------+-----------+--------------------------+
-| Centered | Left    | Right     | Default aligned          |
-| Header   | Aligned | Aligned   |                          |
-+==========+=========+===========+==========================+
-| First    | row     | 12.0      | Example of a row that    |
-|          |         |           | spans multiple lines.    |
-+----------+---------+-----------+--------------------------+
-| Second   | row     | 5.0       | Here’s another one. Note |
-|          |         |           | the blank line between   |
-|          |         |           | rows.                    |
-+----------+---------+-----------+--------------------------+
++-----------+----------+------------+---------------------------+
+| Centered  | Left     | Right      | Default aligned           |
+| Header    | Aligned  | Aligned    |                           |
++===========+==========+============+===========================+
+| First     | row      | 12.0       | Example of a row that     |
+|           |          |            | spans multiple lines.     |
++-----------+----------+------------+---------------------------+
+| Second    | row      | 5.0        | Here’s another one. Note  |
+|           |          |            | the blank line between    |
+|           |          |            | rows.                     |
++-----------+----------+------------+---------------------------+
 
 Table without column headers:
 
@@ -72,11 +72,11 @@
 
 Multiline table without column headers:
 
-+----------+---------+-----------+--------------------------+
-| First    | row     | 12.0      | Example of a row that    |
-|          |         |           | spans multiple lines.    |
-+----------+---------+-----------+--------------------------+
-| Second   | row     | 5.0       | Here’s another one. Note |
-|          |         |           | the blank line between   |
-|          |         |           | rows.                    |
-+----------+---------+-----------+--------------------------+
++-----------+----------+------------+---------------------------+
+| First     | row      | 12.0       | Example of a row that     |
+|           |          |            | spans multiple lines.     |
++-----------+----------+------------+---------------------------+
+| Second    | row      | 5.0        | Here’s another one. Note  |
+|           |          |            | the blank line between    |
+|           |          |            | rows.                     |
++-----------+----------+------------+---------------------------+
diff --git a/test/tables/planets.latex b/test/tables/planets.latex
--- a/test/tables/planets.latex
+++ b/test/tables/planets.latex
@@ -18,13 +18,13 @@
 & & Earth & 5.97 & 12,756 & 5514 & 9.8 & 24.0 & 149.6 & 15 & 1 & Our world \\
 & & Mars & 0.642 & 6,792 & 3933 & 3.7 & 24.7 & 227.9 & -65 & 2 & The red
 planet \\
-\multirow{4}{*}{Jovian planets} & \multirow{2}{*}{Gas giants} & Jupiter & 1898
-& 142,984 & 1326 & 23.1 & 9.9 & 778.6 & -110 & 67 & The largest planet \\
+\multirow{4}{*}{Jovian planets} & \multirow{2}{*}{Gas giants} & Jupiter & 1898 &
+142,984 & 1326 & 23.1 & 9.9 & 778.6 & -110 & 67 & The largest planet \\
 & & Saturn & 568 & 120,536 & 687 & 9.0 & 10.7 & 1433.5 & -140 & 62 & \\
 & \multirow{2}{*}{Ice giants} & Uranus & 86.8 & 51,118 & 1271 & 8.7 & 17.2 &
 2872.5 & -195 & 27 & \\
 & & Neptune & 102 & 49,528 & 1638 & 11.0 & 16.1 & 4495.1 & -200 & 14 & \\
-\multicolumn{2}{c}{Dwarf planets} & Pluto & 0.0146 & 2,370 & 2095 & 0.7 &
-153.3 & 5906.4 & -225 & 5 & Declassified as a planet in 2006. \\
+\multicolumn{2}{c}{Dwarf planets} & Pluto & 0.0146 & 2,370 & 2095 & 0.7 & 153.3
+& 5906.4 & -225 & 5 & Declassified as a planet in 2006. \\
 \bottomrule
 \end{longtable}
diff --git a/test/testsuite.native b/test/testsuite.native
--- a/test/testsuite.native
+++ b/test/testsuite.native
@@ -1,409 +1,2234 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Space,Str "MacFarlane"],MetaInlines [Str "Anonymous"]]),("date",MetaInlines [Str "July",Space,Str "17,",Space,Str "2006"]),("title",MetaInlines [Str "Pandoc",Space,Str "Test",Space,Str "Suite"])]})
-[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",SoftBreak,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
-,HorizontalRule
-,Header 1 ("headers",[],[]) [Str "Headers"]
-,Header 2 ("level-2-with-an-embedded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link ("",[],[]) [Str "embedded",Space,Str "link"] ("/url","")]
-,Header 3 ("level-3-with-emphasis",[],[]) [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 4 ("level-4",[],[]) [Str "Level",Space,Str "4"]
-,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
-,Header 1 ("level-1",[],[]) [Str "Level",Space,Str "1"]
-,Header 2 ("level-2-with-emphasis",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 3 ("level-3",[],[]) [Str "Level",Space,Str "3"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,Header 2 ("level-2",[],[]) [Str "Level",Space,Str "2"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,HorizontalRule
-,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
-,Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",SoftBreak,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",SoftBreak,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",SoftBreak,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",SoftBreak,Str "list",Space,Str "item."]
-,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",SoftBreak,Str "*",Space,Str "criminey."]
-,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."]
-,HorizontalRule
-,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
-,Para [Str "E-mail",Space,Str "style:"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",SoftBreak,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
-,BlockQuote
- [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- ,CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"
- ,Para [Str "A",Space,Str "list:"]
- ,OrderedList (1,Decimal,Period)
-  [[Plain [Str "item",Space,Str "one"]]
-  ,[Plain [Str "item",Space,Str "two"]]]
- ,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
- ,BlockQuote
-  [Para [Str "nested"]]
- ,BlockQuote
-  [Para [Str "nested"]]]
-,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",SoftBreak,Str ">",Space,Str "1."]
-,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
-,HorizontalRule
-,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
-,Para [Str "And:"]
-,CodeBlock ("",[],[]) "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
-,HorizontalRule
-,Header 1 ("lists",[],[]) [Str "Lists"]
-,Header 2 ("unordered",[],[]) [Str "Unordered"]
-,Para [Str "Asterisks",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "asterisk",Space,Str "1"]]
- ,[Plain [Str "asterisk",Space,Str "2"]]
- ,[Plain [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Asterisks",Space,Str "loose:"]
-,BulletList
- [[Para [Str "asterisk",Space,Str "1"]]
- ,[Para [Str "asterisk",Space,Str "2"]]
- ,[Para [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "Plus",Space,Str "1"]]
- ,[Plain [Str "Plus",Space,Str "2"]]
- ,[Plain [Str "Plus",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Plus",Space,Str "1"]]
- ,[Para [Str "Plus",Space,Str "2"]]
- ,[Para [Str "Plus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "Minus",Space,Str "1"]]
- ,[Plain [Str "Minus",Space,Str "2"]]
- ,[Plain [Str "Minus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Minus",Space,Str "1"]]
- ,[Para [Str "Minus",Space,Str "2"]]
- ,[Para [Str "Minus",Space,Str "3"]]]
-,Header 2 ("ordered",[],[]) [Str "Ordered"]
-,Para [Str "Tight:"]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "First"]]
- ,[Plain [Str "Second"]]
- ,[Plain [Str "Third"]]]
-,Para [Str "and:"]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "One"]]
- ,[Plain [Str "Two"]]
- ,[Plain [Str "Three"]]]
-,Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second"]]
- ,[Para [Str "Third"]]]
-,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "One"]]
- ,[Para [Str "Two"]]
- ,[Para [Str "Three"]]]
-,Para [Str "Multiple",Space,Str "paragraphs:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
-  ,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",SoftBreak,Str "back."]]
- ,[Para [Str "Item",Space,Str "2."]]
- ,[Para [Str "Item",Space,Str "3."]]]
-,Header 2 ("nested",[],[]) [Str "Nested"]
-,BulletList
- [[Plain [Str "Tab"]
-  ,BulletList
-   [[Plain [Str "Tab"]
-    ,BulletList
-     [[Plain [Str "Tab"]]]]]]]
-,Para [Str "Here\8217s",Space,Str "another:"]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "First"]]
- ,[Plain [Str "Second:"]
-  ,BulletList
-   [[Plain [Str "Fee"]]
-   ,[Plain [Str "Fie"]]
-   ,[Plain [Str "Foe"]]]]
- ,[Plain [Str "Third"]]]
-,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Plain [Str "Fee"]]
-   ,[Plain [Str "Fie"]]
-   ,[Plain [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Header 2 ("tabs-and-spaces",[],[]) [Str "Tabs",Space,Str "and",Space,Str "spaces"]
-,BulletList
- [[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",SoftBreak,Str "indented",Space,Str "with",Space,Str "tabs"]]
- ,[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",SoftBreak,Str "indented",Space,Str "with",Space,Str "spaces"]
-  ,BulletList
-   [[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",SoftBreak,Str "indented",Space,Str "with",Space,Str "tabs"]]
-   ,[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",SoftBreak,Str "indented",Space,Str "with",Space,Str "spaces"]]]]]
-,Header 2 ("fancy-list-markers",[],[]) [Str "Fancy",Space,Str "list",Space,Str "markers"]
-,OrderedList (2,Decimal,TwoParens)
- [[Para [Str "begins",Space,Str "with",Space,Str "2"]]
- ,[Para [Str "and",Space,Str "now",Space,Str "3"]
-  ,Para [Str "with",Space,Str "a",Space,Str "continuation"]
-  ,OrderedList (4,LowerRoman,Period)
-   [[Plain [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",SoftBreak,Str "starting",Space,Str "with",Space,Str "4"]]
-   ,[Plain [Str "more",Space,Str "items"]
-    ,OrderedList (1,UpperAlpha,TwoParens)
-     [[Plain [Str "a",Space,Str "subsublist"]]
-     ,[Plain [Str "a",Space,Str "subsublist"]]]]]]]
-,Para [Str "Nesting:"]
-,OrderedList (1,UpperAlpha,Period)
- [[Plain [Str "Upper",Space,Str "Alpha"]
-  ,OrderedList (1,UpperRoman,Period)
-   [[Plain [Str "Upper",Space,Str "Roman."]
-    ,OrderedList (6,Decimal,TwoParens)
-     [[Plain [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
-      ,OrderedList (3,LowerAlpha,OneParen)
-       [[Plain [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
-,Para [Str "Autonumbering:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Autonumber."]]
- ,[Plain [Str "More."]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "Nested."]]]]]
-,Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item:"]
-,Para [Str "M.A.\160\&2007"]
-,Para [Str "B.",Space,Str "Williams"]
-,HorizontalRule
-,Header 1 ("definition-lists",[],[]) [Str "Definition",Space,Str "Lists"]
-,Para [Str "Tight",Space,Str "using",Space,Str "spaces:"]
-,DefinitionList
- [([Str "apple"],
-   [[Plain [Str "red",Space,Str "fruit"]]])
- ,([Str "orange"],
-   [[Plain [Str "orange",Space,Str "fruit"]]])
- ,([Str "banana"],
-   [[Plain [Str "yellow",Space,Str "fruit"]]])]
-,Para [Str "Tight",Space,Str "using",Space,Str "tabs:"]
-,DefinitionList
- [([Str "apple"],
-   [[Plain [Str "red",Space,Str "fruit"]]])
- ,([Str "orange"],
-   [[Plain [Str "orange",Space,Str "fruit"]]])
- ,([Str "banana"],
-   [[Plain [Str "yellow",Space,Str "fruit"]]])]
-,Para [Str "Loose:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]]])
- ,([Str "banana"],
-   [[Para [Str "yellow",Space,Str "fruit"]]])]
-,Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics:"]
-,DefinitionList
- [([Emph [Str "apple"]],
-   [[Para [Str "red",Space,Str "fruit"]
-    ,Para [Str "contains",Space,Str "seeds,",SoftBreak,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"]]])
- ,([Emph [Str "orange"]],
-   [[Para [Str "orange",Space,Str "fruit"]
-    ,CodeBlock ("",[],[]) "{ orange code block }"
-    ,BlockQuote
-     [Para [Str "orange",Space,Str "block",Space,Str "quote"]]]])]
-,Para [Str "Multiple",Space,Str "definitions,",Space,Str "tight:"]
-,DefinitionList
- [([Str "apple"],
-   [[Plain [Str "red",Space,Str "fruit"]]
-   ,[Plain [Str "computer"]]])
- ,([Str "orange"],
-   [[Plain [Str "orange",Space,Str "fruit"]]
-   ,[Plain [Str "bank"]]])]
-,Para [Str "Multiple",Space,Str "definitions,",Space,Str "loose:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]
-   ,[Para [Str "computer"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]]
-   ,[Para [Str "bank"]]])]
-,Para [Str "Blank",Space,Str "line",Space,Str "after",Space,Str "term,",Space,Str "indented",Space,Str "marker,",Space,Str "alternate",Space,Str "markers:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]
-   ,[Para [Str "computer"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]
-    ,OrderedList (1,Decimal,Period)
-     [[Plain [Str "sublist"]]
-     ,[Plain [Str "sublist"]]]]])]
-,Header 1 ("html-blocks",[],[]) [Str "HTML",Space,Str "Blocks"]
-,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
-,Div ("",[],[])
- [Plain [Str "foo"]]
-,Para [Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"]
-,Div ("",[],[])
- [Div ("",[],[])
-  [Div ("",[],[])
-   [Para [Str "foo"]]]
- ,Div ("",[],[])
-  [Plain [Str "bar"]]]
-,Para [Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"]
-,RawBlock (Format "html") "<table>"
-,RawBlock (Format "html") "<tr>"
-,RawBlock (Format "html") "<td>"
-,Plain [Str "This",Space,Str "is",Space,Emph [Str "emphasized"]]
-,RawBlock (Format "html") "</td>"
-,RawBlock (Format "html") "<td>"
-,Plain [Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"]]
-,RawBlock (Format "html") "</td>"
-,RawBlock (Format "html") "</tr>"
-,RawBlock (Format "html") "</table>"
-,RawBlock (Format "html") "<script type=\"text/javascript\">document.write('This *should not* be interpreted as markdown');</script>"
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "simple",Space,Str "block:"]
-,Div ("",[],[])
- [Para [Str "foo"]]
-,Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
-,CodeBlock ("",[],[]) "<div>\n    foo\n</div>"
-,Para [Str "As",Space,Str "should",Space,Str "this:"]
-,CodeBlock ("",[],[]) "<div>foo</div>"
-,Para [Str "Now,",Space,Str "nested:"]
-,Div ("",[],[])
- [Div ("",[],[])
-  [Div ("",[],[])
-   [Plain [Str "foo"]]]]
-,Para [Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"]
-,RawBlock (Format "html") "<!-- Comment -->"
-,Para [Str "Multiline:"]
-,RawBlock (Format "html") "<!--\nBlah\nBlah\n-->"
-,RawBlock (Format "html") "<!--\n    This is another comment.\n-->"
-,Para [Str "Code",Space,Str "block:"]
-,CodeBlock ("",[],[]) "<!-- Comment -->"
-,Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"]
-,RawBlock (Format "html") "<!-- foo -->"
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "<hr />"
-,Para [Str "Hr\8217s:"]
-,RawBlock (Format "html") "<hr>"
-,RawBlock (Format "html") "<hr />"
-,RawBlock (Format "html") "<hr />"
-,RawBlock (Format "html") "<hr>"
-,RawBlock (Format "html") "<hr />"
-,RawBlock (Format "html") "<hr />"
-,RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\" />"
-,RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\" />"
-,RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\">"
-,HorizontalRule
-,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
-,Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
-,Para [Str "An",Space,Emph [Link ("",[],[]) [Str "emphasized",Space,Str "link"] ("/url","")],Str "."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",Space,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",Space,Code ("",[],[]) "<html>",Str "."]
-,Para [Strikeout [Str "This",Space,Str "is",Space,Emph [Str "strikeout"],Str "."]]
-,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello\160there"],Str "."]
-,Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",Space,Str "H",Subscript [Str "many\160of\160them"],Str "O."]
-,Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts,",SoftBreak,Str "because",Space,Str "of",Space,Str "the",Space,Str "unescaped",Space,Str "spaces:",Space,Str "a^b",Space,Str "c^d,",Space,Str "a~b",Space,Str "c~d."]
-,HorizontalRule
-,Header 1 ("smart-quotes-ellipses-dashes",[],[]) [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
-,Para [Quoted DoubleQuote [Str "Hello,"],Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Quoted DoubleQuote [Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",Space,Str "name."]]
-,Para [Quoted SingleQuote [Str "A"],Str ",",Space,Quoted SingleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted SingleQuote [Str "C"],Space,Str "are",Space,Str "letters."]
-,Para [Quoted SingleQuote [Str "Oak,"],Space,Quoted SingleQuote [Str "elm,"],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",SoftBreak,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine."]]
-,Para [Quoted SingleQuote [Str "He",Space,Str "said,",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",SoftBreak,Str "70\8217s?"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Quoted SingleQuote [Code ("",[],[]) "code"],Space,Str "and",Space,Str "a",Space,Quoted DoubleQuote [Link ("",[],[]) [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."]
-,Para [Str "Some",Space,Str "dashes:",Space,Str "one\8212two",Space,Str "\8212",Space,Str "three\8212four",Space,Str "\8212",Space,Str "five."]
-,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5\8211\&7,",Space,Str "255\8211\&66,",Space,Str "1987\8211\&1999."]
-,Para [Str "Ellipses\8230and\8230and\8230."]
-,HorizontalRule
-,Header 1 ("latex",[],[]) [Str "LaTeX"]
-,BulletList
- [[Plain [RawInline (Format "tex") "\\cite[22-23]{smith.1899}"]]
- ,[Plain [Math InlineMath "2+2=4"]]
- ,[Plain [Math InlineMath "x \\in y"]]
- ,[Plain [Math InlineMath "\\alpha \\wedge \\omega"]]
- ,[Plain [Math InlineMath "223"]]
- ,[Plain [Math InlineMath "p",Str "-Tree"]]
- ,[Plain [Str "Here\8217s",Space,Str "some",Space,Str "display",Space,Str "math:",SoftBreak,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]]
- ,[Plain [Str "Here\8217s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]]
-,Para [Str "These",Space,Str "shouldn\8217t",Space,Str "be",Space,Str "math:"]
-,BulletList
- [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
- ,[Plain [Str "$22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$34,000.",SoftBreak,Str "(It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized.)"]]
- ,[Plain [Str "Shoes",Space,Str "($20)",Space,Str "and",Space,Str "socks",Space,Str "($5)."]]
- ,[Plain [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23$."]]]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
-,RawBlock (Format "tex") "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog    & 2      \\\\\nCat    & 1      \\\\ \\hline\n\\end{tabular}"
-,HorizontalRule
-,Header 1 ("special-characters",[],[]) [Str "Special",Space,Str "Characters"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
-,BulletList
- [[Plain [Str "I",Space,Str "hat:",Space,Str "\206"]]
- ,[Plain [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
- ,[Plain [Str "section:",Space,Str "\167"]]
- ,[Plain [Str "set",Space,Str "membership:",Space,Str "\8712"]]
- ,[Plain [Str "copyright:",Space,Str "\169"]]]
-,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
-,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
-,Para [Str "This",Space,Str "&",Space,Str "that."]
-,Para [Str "4",Space,Str "<",Space,Str "5."]
-,Para [Str "6",Space,Str ">",Space,Str "5."]
-,Para [Str "Backslash:",Space,Str "\\"]
-,Para [Str "Backtick:",Space,Str "`"]
-,Para [Str "Asterisk:",Space,Str "*"]
-,Para [Str "Underscore:",Space,Str "_"]
-,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
-,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
-,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
-,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
-,Para [Str "Left",Space,Str "paren:",Space,Str "("]
-,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
-,Para [Str "Greater-than:",Space,Str ">"]
-,Para [Str "Hash:",Space,Str "#"]
-,Para [Str "Period:",Space,Str "."]
-,Para [Str "Bang:",Space,Str "!"]
-,Para [Str "Plus:",Space,Str "+"]
-,Para [Str "Minus:",Space,Str "-"]
-,HorizontalRule
-,Header 1 ("links",[],[]) [Str "Links"]
-,Header 2 ("explicit",[],[]) [Str "Explicit"]
-,Para [Str "Just",Space,Str "a",Space,Link ("",[],[]) [Str "URL"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by two spaces"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by a tab"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with \"quotes\" in it")]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with single quotes")]
-,Para [Link ("",[],[]) [Str "with_underscore"] ("/url/with_underscore","")]
-,Para [Link ("",[],[]) [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
-,Para [Link ("",[],[]) [Str "Empty"] ("",""),Str "."]
-,Header 2 ("reference",[],[]) [Str "Reference"]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "With",Space,Link ("",[],[]) [Str "embedded",Space,Str "[brackets]"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "once"] ("/url",""),Str "."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "twice"] ("/url",""),Str "."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "thrice"] ("/url",""),Str "."]
-,Para [Str "This",Space,Str "should",Space,Str "[not][]",Space,Str "be",Space,Str "a",Space,Str "link."]
-,CodeBlock ("",[],[]) "[not]: /url"
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."]
-,Header 2 ("with-ampersands",[],[]) [Str "With",Space,Str "ampersands"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Link ("",[],[]) [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link ("",[],[]) [Str "AT&T"] ("http://att.com/","AT&T"),Str "."]
-,Para [Str "Here\8217s",Space,Str "an",Space,Link ("",[],[]) [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "an",Space,Link ("",[],[]) [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."]
-,Header 2 ("autolinks",[],[]) [Str "Autolinks"]
-,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link ("",["uri"],[]) [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
-,BulletList
- [[Plain [Str "In",Space,Str "a",Space,Str "list?"]]
- ,[Plain [Link ("",["uri"],[]) [Str "http://example.com/"] ("http://example.com/","")]]
- ,[Plain [Str "It",Space,Str "should."]]]
-,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Link ("",["email"],[]) [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
-,BlockQuote
- [Para [Str "Blockquoted:",Space,Link ("",["uri"],[]) [Str "http://example.com/"] ("http://example.com/","")]]
-,Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code ("",[],[]) "<http://example.com/>"]
-,CodeBlock ("",[],[]) "or here: <http://example.com/>"
-,HorizontalRule
-,Header 1 ("images",[],[]) [Str "Images"]
-,Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
-,Para [Image ("",[],[]) [Str "lalune"] ("lalune.jpg","fig:Voyage dans la Lune")]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image ("",[],[]) [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
-,HorizontalRule
-,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",SoftBreak,Str "reference.",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],Space,Str "and",Space,Str "another.",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",SoftBreak,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",SoftBreak,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock ("",[],[]) "  { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",SoftBreak,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],SoftBreak,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",SoftBreak,Str "contains",Space,Str "a",Space,Str "space.[^my",Space,Str "note]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note.",Note [Para [Str "This",SoftBreak,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",SoftBreak,Link ("",[],[]) [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",SoftBreak,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
-,BlockQuote
- [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]]]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "And",Space,Str "in",Space,Str "list",Space,Str "items.",Note [Para [Str "In",Space,Str "list."]]]]]
-,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented."]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author"
+            , MetaList
+                [ MetaInlines [ Str "John" , Space , Str "MacFarlane" ]
+                , MetaInlines [ Str "Anonymous" ]
+                ]
+            )
+          , ( "date"
+            , MetaInlines
+                [ Str "July" , Space , Str "17," , Space , Str "2006" ]
+            )
+          , ( "title"
+            , MetaInlines
+                [ Str "Pandoc"
+                , Space
+                , Str "Test"
+                , Space
+                , Str "Suite"
+                ]
+            )
+          ]
+    }
+  [ Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "set"
+      , Space
+      , Str "of"
+      , Space
+      , Str "tests"
+      , Space
+      , Str "for"
+      , Space
+      , Str "pandoc."
+      , Space
+      , Str "Most"
+      , Space
+      , Str "of"
+      , Space
+      , Str "them"
+      , Space
+      , Str "are"
+      , Space
+      , Str "adapted"
+      , Space
+      , Str "from"
+      , SoftBreak
+      , Str "John"
+      , Space
+      , Str "Gruber\8217s"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "test"
+      , Space
+      , Str "suite."
+      ]
+  , HorizontalRule
+  , Header 1 ( "headers" , [] , [] ) [ Str "Headers" ]
+  , Header
+      2
+      ( "level-2-with-an-embedded-link" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "link" ]
+          ( "/url" , "" )
+      ]
+  , Header
+      3
+      ( "level-3-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "3"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      4 ( "level-4" , [] , [] ) [ Str "Level" , Space , Str "4" ]
+  , Header
+      5 ( "level-5" , [] , [] ) [ Str "Level" , Space , Str "5" ]
+  , Header
+      1 ( "level-1" , [] , [] ) [ Str "Level" , Space , Str "1" ]
+  , Header
+      2
+      ( "level-2-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      3 ( "level-3" , [] , [] ) [ Str "Level" , Space , Str "3" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , Header
+      2 ( "level-2" , [] , [] ) [ Str "Level" , Space , Str "2" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , HorizontalRule
+  , Header 1 ( "paragraphs" , [] , [] ) [ Str "Paragraphs" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "regular"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "In"
+      , Space
+      , Str "Markdown"
+      , Space
+      , Str "1.0.0"
+      , Space
+      , Str "and"
+      , Space
+      , Str "earlier."
+      , Space
+      , Str "Version"
+      , SoftBreak
+      , Str "8."
+      , Space
+      , Str "This"
+      , Space
+      , Str "line"
+      , Space
+      , Str "turns"
+      , Space
+      , Str "into"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      , SoftBreak
+      , Str "Because"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard-wrapped"
+      , Space
+      , Str "line"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "middle"
+      , Space
+      , Str "of"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "looked"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , SoftBreak
+      , Str "list"
+      , Space
+      , Str "item."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "one"
+      , Space
+      , Str "with"
+      , Space
+      , Str "a"
+      , Space
+      , Str "bullet."
+      , SoftBreak
+      , Str "*"
+      , Space
+      , Str "criminey."
+      ]
+  , Para
+      [ Str "There"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard"
+      , Space
+      , Str "line"
+      , Space
+      , Str "break"
+      , LineBreak
+      , Str "here."
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "block-quotes" , [] , [] )
+      [ Str "Block" , Space , Str "Quotes" ]
+  , Para [ Str "E-mail" , Space , Str "style:" ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          , SoftBreak
+          , Str "It"
+          , Space
+          , Str "is"
+          , Space
+          , Str "pretty"
+          , Space
+          , Str "short."
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Code"
+          , Space
+          , Str "in"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote:"
+          ]
+      , CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      , Para [ Str "A" , Space , Str "list:" ]
+      , OrderedList
+          ( 1 , Decimal , Period )
+          [ [ Plain [ Str "item" , Space , Str "one" ] ]
+          , [ Plain [ Str "item" , Space , Str "two" ] ]
+          ]
+      , Para
+          [ Str "Nested"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quotes:"
+          ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "block"
+      , Space
+      , Str "quote:"
+      , Space
+      , Str "2"
+      , SoftBreak
+      , Str ">"
+      , Space
+      , Str "1."
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "a"
+      , Space
+      , Str "following"
+      , Space
+      , Str "paragraph."
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "code-blocks" , [] , [] )
+      [ Str "Code" , Space , Str "Blocks" ]
+  , Para [ Str "Code:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
+  , HorizontalRule
+  , Header 1 ( "lists" , [] , [] ) [ Str "Lists" ]
+  , Header 2 ( "unordered" , [] , [] ) [ Str "Unordered" ]
+  , Para [ Str "Asterisks" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Asterisks" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "Plus" , Space , Str "1" ] ]
+      , [ Plain [ Str "Plus" , Space , Str "2" ] ]
+      , [ Plain [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Plus" , Space , Str "1" ] ]
+      , [ Para [ Str "Plus" , Space , Str "2" ] ]
+      , [ Para [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "Minus" , Space , Str "1" ] ]
+      , [ Plain [ Str "Minus" , Space , Str "2" ] ]
+      , [ Plain [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Minus" , Space , Str "1" ] ]
+      , [ Para [ Str "Minus" , Space , Str "2" ] ]
+      , [ Para [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Header 2 ( "ordered" , [] , [] ) [ Str "Ordered" ]
+  , Para [ Str "Tight:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "First" ] ]
+      , [ Plain [ Str "Second" ] ]
+      , [ Plain [ Str "Third" ] ]
+      ]
+  , Para [ Str "and:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "One" ] ]
+      , [ Plain [ Str "Two" ] ]
+      , [ Plain [ Str "Three" ] ]
+      ]
+  , Para
+      [ Str "Loose" , Space , Str "using" , Space , Str "tabs:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second" ] ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "and" , Space , Str "using" , Space , Str "spaces:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "One" ] ]
+      , [ Para [ Str "Two" ] ]
+      , [ Para [ Str "Three" ] ]
+      ]
+  , Para [ Str "Multiple" , Space , Str "paragraphs:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para
+            [ Str "Item"
+            , Space
+            , Str "1,"
+            , Space
+            , Str "graf"
+            , Space
+            , Str "one."
+            ]
+        , Para
+            [ Str "Item"
+            , Space
+            , Str "1."
+            , Space
+            , Str "graf"
+            , Space
+            , Str "two."
+            , Space
+            , Str "The"
+            , Space
+            , Str "quick"
+            , Space
+            , Str "brown"
+            , Space
+            , Str "fox"
+            , Space
+            , Str "jumped"
+            , Space
+            , Str "over"
+            , Space
+            , Str "the"
+            , Space
+            , Str "lazy"
+            , Space
+            , Str "dog\8217s"
+            , SoftBreak
+            , Str "back."
+            ]
+        ]
+      , [ Para [ Str "Item" , Space , Str "2." ] ]
+      , [ Para [ Str "Item" , Space , Str "3." ] ]
+      ]
+  , Header 2 ( "nested" , [] , [] ) [ Str "Nested" ]
+  , BulletList
+      [ [ Plain [ Str "Tab" ]
+        , BulletList
+            [ [ Plain [ Str "Tab" ]
+              , BulletList [ [ Plain [ Str "Tab" ] ] ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Here\8217s" , Space , Str "another:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "First" ] ]
+      , [ Plain [ Str "Second:" ]
+        , BulletList
+            [ [ Plain [ Str "Fee" ] ]
+            , [ Plain [ Str "Fie" ] ]
+            , [ Plain [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Plain [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "Same"
+      , Space
+      , Str "thing"
+      , Space
+      , Str "but"
+      , Space
+      , Str "with"
+      , Space
+      , Str "paragraphs:"
+      ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Plain [ Str "Fee" ] ]
+            , [ Plain [ Str "Fie" ] ]
+            , [ Plain [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Header
+      2
+      ( "tabs-and-spaces" , [] , [] )
+      [ Str "Tabs" , Space , Str "and" , Space , Str "spaces" ]
+  , BulletList
+      [ [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , SoftBreak
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "tabs"
+            ]
+        ]
+      , [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , SoftBreak
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "spaces"
+            ]
+        , BulletList
+            [ [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , SoftBreak
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "tabs"
+                  ]
+              ]
+            , [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , SoftBreak
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "spaces"
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "fancy-list-markers" , [] , [] )
+      [ Str "Fancy" , Space , Str "list" , Space , Str "markers" ]
+  , OrderedList
+      ( 2 , Decimal , TwoParens )
+      [ [ Para
+            [ Str "begins" , Space , Str "with" , Space , Str "2" ]
+        ]
+      , [ Para [ Str "and" , Space , Str "now" , Space , Str "3" ]
+        , Para
+            [ Str "with"
+            , Space
+            , Str "a"
+            , Space
+            , Str "continuation"
+            ]
+        , OrderedList
+            ( 4 , LowerRoman , Period )
+            [ [ Plain
+                  [ Str "sublist"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "roman"
+                  , Space
+                  , Str "numerals,"
+                  , SoftBreak
+                  , Str "starting"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "4"
+                  ]
+              ]
+            , [ Plain [ Str "more" , Space , Str "items" ]
+              , OrderedList
+                  ( 1 , UpperAlpha , TwoParens )
+                  [ [ Plain [ Str "a" , Space , Str "subsublist" ] ]
+                  , [ Plain [ Str "a" , Space , Str "subsublist" ] ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Nesting:" ]
+  , OrderedList
+      ( 1 , UpperAlpha , Period )
+      [ [ Plain [ Str "Upper" , Space , Str "Alpha" ]
+        , OrderedList
+            ( 1 , UpperRoman , Period )
+            [ [ Plain [ Str "Upper" , Space , Str "Roman." ]
+              , OrderedList
+                  ( 6 , Decimal , TwoParens )
+                  [ [ Plain
+                        [ Str "Decimal"
+                        , Space
+                        , Str "start"
+                        , Space
+                        , Str "with"
+                        , Space
+                        , Str "6"
+                        ]
+                    , OrderedList
+                        ( 3 , LowerAlpha , OneParen )
+                        [ [ Plain
+                              [ Str "Lower"
+                              , Space
+                              , Str "alpha"
+                              , Space
+                              , Str "with"
+                              , Space
+                              , Str "paren"
+                              ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Autonumbering:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "Autonumber." ] ]
+      , [ Plain [ Str "More." ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain [ Str "Nested." ] ] ]
+        ]
+      ]
+  , Para
+      [ Str "Should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item:"
+      ]
+  , Para [ Str "M.A.\160\&2007" ]
+  , Para [ Str "B." , Space , Str "Williams" ]
+  , HorizontalRule
+  , Header
+      1
+      ( "definition-lists" , [] , [] )
+      [ Str "Definition" , Space , Str "Lists" ]
+  , Para
+      [ Str "Tight"
+      , Space
+      , Str "using"
+      , Space
+      , Str "spaces:"
+      ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Plain [ Str "red" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Plain [ Str "orange" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "banana" ]
+        , [ [ Plain [ Str "yellow" , Space , Str "fruit" ] ] ]
+        )
+      ]
+  , Para
+      [ Str "Tight" , Space , Str "using" , Space , Str "tabs:" ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Plain [ Str "red" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Plain [ Str "orange" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "banana" ]
+        , [ [ Plain [ Str "yellow" , Space , Str "fruit" ] ] ]
+        )
+      ]
+  , Para [ Str "Loose:" ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "banana" ]
+        , [ [ Para [ Str "yellow" , Space , Str "fruit" ] ] ]
+        )
+      ]
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "blocks"
+      , Space
+      , Str "with"
+      , Space
+      , Str "italics:"
+      ]
+  , DefinitionList
+      [ ( [ Emph [ Str "apple" ] ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ]
+            , Para
+                [ Str "contains"
+                , Space
+                , Str "seeds,"
+                , SoftBreak
+                , Str "crisp,"
+                , Space
+                , Str "pleasant"
+                , Space
+                , Str "to"
+                , Space
+                , Str "taste"
+                ]
+            ]
+          ]
+        )
+      , ( [ Emph [ Str "orange" ] ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ]
+            , CodeBlock ( "" , [] , [] ) "{ orange code block }"
+            , BlockQuote
+                [ Para
+                    [ Str "orange"
+                    , Space
+                    , Str "block"
+                    , Space
+                    , Str "quote"
+                    ]
+                ]
+            ]
+          ]
+        )
+      ]
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "definitions,"
+      , Space
+      , Str "tight:"
+      ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Plain [ Str "red" , Space , Str "fruit" ] ]
+          , [ Plain [ Str "computer" ] ]
+          ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Plain [ Str "orange" , Space , Str "fruit" ] ]
+          , [ Plain [ Str "bank" ] ]
+          ]
+        )
+      ]
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "definitions,"
+      , Space
+      , Str "loose:"
+      ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ]
+          , [ Para [ Str "computer" ] ]
+          ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ] ]
+          , [ Para [ Str "bank" ] ]
+          ]
+        )
+      ]
+  , Para
+      [ Str "Blank"
+      , Space
+      , Str "line"
+      , Space
+      , Str "after"
+      , Space
+      , Str "term,"
+      , Space
+      , Str "indented"
+      , Space
+      , Str "marker,"
+      , Space
+      , Str "alternate"
+      , Space
+      , Str "markers:"
+      ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ]
+          , [ Para [ Str "computer" ] ]
+          ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ]
+            , OrderedList
+                ( 1 , Decimal , Period )
+                [ [ Plain [ Str "sublist" ] ]
+                , [ Plain [ Str "sublist" ] ]
+                ]
+            ]
+          ]
+        )
+      ]
+  , Header
+      1
+      ( "html-blocks" , [] , [] )
+      [ Str "HTML" , Space , Str "Blocks" ]
+  , Para
+      [ Str "Simple"
+      , Space
+      , Str "block"
+      , Space
+      , Str "on"
+      , Space
+      , Str "one"
+      , Space
+      , Str "line:"
+      ]
+  , Div ( "" , [] , [] ) [ Plain [ Str "foo" ] ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "nested"
+      , Space
+      , Str "without"
+      , Space
+      , Str "indentation:"
+      ]
+  , Div
+      ( "" , [] , [] )
+      [ Div
+          ( "" , [] , [] )
+          [ Div ( "" , [] , [] ) [ Para [ Str "foo" ] ] ]
+      , Div ( "" , [] , [] ) [ Plain [ Str "bar" ] ]
+      ]
+  , Para
+      [ Str "Interpreted"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "in"
+      , Space
+      , Str "a"
+      , Space
+      , Str "table:"
+      ]
+  , RawBlock (Format "html") "<table>"
+  , RawBlock (Format "html") "<tr>"
+  , RawBlock (Format "html") "<td>"
+  , Plain
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      ]
+  , RawBlock (Format "html") "</td>"
+  , RawBlock (Format "html") "<td>"
+  , Plain
+      [ Str "And"
+      , Space
+      , Str "this"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      ]
+  , RawBlock (Format "html") "</td>"
+  , RawBlock (Format "html") "</tr>"
+  , RawBlock (Format "html") "</table>"
+  , RawBlock
+      (Format "html")
+      "<script type=\"text/javascript\">document.write('This *should not* be interpreted as markdown');</script>"
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "simple"
+      , Space
+      , Str "block:"
+      ]
+  , Div ( "" , [] , [] ) [ Para [ Str "foo" ] ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "code"
+      , Space
+      , Str "block,"
+      , Space
+      , Str "though:"
+      ]
+  , CodeBlock ( "" , [] , [] ) "<div>\n    foo\n</div>"
+  , Para
+      [ Str "As" , Space , Str "should" , Space , Str "this:" ]
+  , CodeBlock ( "" , [] , [] ) "<div>foo</div>"
+  , Para [ Str "Now," , Space , Str "nested:" ]
+  , Div
+      ( "" , [] , [] )
+      [ Div
+          ( "" , [] , [] )
+          [ Div ( "" , [] , [] ) [ Plain [ Str "foo" ] ] ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "just"
+      , Space
+      , Str "be"
+      , Space
+      , Str "an"
+      , Space
+      , Str "HTML"
+      , Space
+      , Str "comment:"
+      ]
+  , RawBlock (Format "html") "<!-- Comment -->"
+  , Para [ Str "Multiline:" ]
+  , RawBlock (Format "html") "<!--\nBlah\nBlah\n-->"
+  , RawBlock
+      (Format "html") "<!--\n    This is another comment.\n-->"
+  , Para [ Str "Code" , Space , Str "block:" ]
+  , CodeBlock ( "" , [] , [] ) "<!-- Comment -->"
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "plain"
+      , Space
+      , Str "comment,"
+      , Space
+      , Str "with"
+      , Space
+      , Str "trailing"
+      , Space
+      , Str "spaces"
+      , Space
+      , Str "on"
+      , Space
+      , Str "the"
+      , Space
+      , Str "line:"
+      ]
+  , RawBlock (Format "html") "<!-- foo -->"
+  , Para [ Str "Code:" ]
+  , CodeBlock ( "" , [] , [] ) "<hr />"
+  , Para [ Str "Hr\8217s:" ]
+  , RawBlock (Format "html") "<hr>"
+  , RawBlock (Format "html") "<hr />"
+  , RawBlock (Format "html") "<hr />"
+  , RawBlock (Format "html") "<hr>"
+  , RawBlock (Format "html") "<hr />"
+  , RawBlock (Format "html") "<hr />"
+  , RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\" />"
+  , RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\" />"
+  , RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\">"
+  , HorizontalRule
+  , Header
+      1
+      ( "inline-markup" , [] , [] )
+      [ Str "Inline" , Space , Str "Markup" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Emph [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Strong [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Emph
+          [ Link
+              ( "" , [] , [] )
+              [ Str "emphasized" , Space , Str "link" ]
+              ( "/url" , "" )
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "code:"
+      , Space
+      , Code ( "" , [] , [] ) ">"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "<html>"
+      , Str "."
+      ]
+  , Para
+      [ Strikeout
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Emph [ Str "strikeout" ]
+          , Str "."
+          ]
+      ]
+  , Para
+      [ Str "Superscripts:"
+      , Space
+      , Str "a"
+      , Superscript [ Str "bc" ]
+      , Str "d"
+      , Space
+      , Str "a"
+      , Superscript [ Emph [ Str "hello" ] ]
+      , Space
+      , Str "a"
+      , Superscript [ Str "hello\160there" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Subscripts:"
+      , Space
+      , Str "H"
+      , Subscript [ Str "2" ]
+      , Str "O,"
+      , Space
+      , Str "H"
+      , Subscript [ Str "23" ]
+      , Str "O,"
+      , Space
+      , Str "H"
+      , Subscript [ Str "many\160of\160them" ]
+      , Str "O."
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "superscripts"
+      , Space
+      , Str "or"
+      , Space
+      , Str "subscripts,"
+      , SoftBreak
+      , Str "because"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "unescaped"
+      , Space
+      , Str "spaces:"
+      , Space
+      , Str "a^b"
+      , Space
+      , Str "c^d,"
+      , Space
+      , Str "a~b"
+      , Space
+      , Str "c~d."
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "smart-quotes-ellipses-dashes" , [] , [] )
+      [ Str "Smart"
+      , Space
+      , Str "quotes,"
+      , Space
+      , Str "ellipses,"
+      , Space
+      , Str "dashes"
+      ]
+  , Para
+      [ Quoted DoubleQuote [ Str "Hello," ]
+      , Space
+      , Str "said"
+      , Space
+      , Str "the"
+      , Space
+      , Str "spider."
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Quoted SingleQuote [ Str "Shelob" ]
+          , Space
+          , Str "is"
+          , Space
+          , Str "my"
+          , Space
+          , Str "name."
+          ]
+      ]
+  , Para
+      [ Quoted SingleQuote [ Str "A" ]
+      , Str ","
+      , Space
+      , Quoted SingleQuote [ Str "B" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Quoted SingleQuote [ Str "C" ]
+      , Space
+      , Str "are"
+      , Space
+      , Str "letters."
+      ]
+  , Para
+      [ Quoted SingleQuote [ Str "Oak," ]
+      , Space
+      , Quoted SingleQuote [ Str "elm," ]
+      , Space
+      , Str "and"
+      , Space
+      , Quoted SingleQuote [ Str "beech" ]
+      , Space
+      , Str "are"
+      , Space
+      , Str "names"
+      , Space
+      , Str "of"
+      , Space
+      , Str "trees."
+      , SoftBreak
+      , Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Quoted SingleQuote [ Str "pine." ]
+      ]
+  , Para
+      [ Quoted
+          SingleQuote
+          [ Str "He"
+          , Space
+          , Str "said,"
+          , Space
+          , Quoted
+              DoubleQuote
+              [ Str "I"
+              , Space
+              , Str "want"
+              , Space
+              , Str "to"
+              , Space
+              , Str "go."
+              ]
+          ]
+      , Space
+      , Str "Were"
+      , Space
+      , Str "you"
+      , Space
+      , Str "alive"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "70\8217s?"
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "quoted"
+      , Space
+      , Quoted SingleQuote [ Code ( "" , [] , [] ) "code" ]
+      , Space
+      , Str "and"
+      , Space
+      , Str "a"
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Link
+              ( "" , [] , [] )
+              [ Str "quoted" , Space , Str "link" ]
+              ( "http://example.com/?foo=1&bar=2" , "" )
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Some"
+      , Space
+      , Str "dashes:"
+      , Space
+      , Str "one\8212two"
+      , Space
+      , Str "\8212"
+      , Space
+      , Str "three\8212four"
+      , Space
+      , Str "\8212"
+      , Space
+      , Str "five."
+      ]
+  , Para
+      [ Str "Dashes"
+      , Space
+      , Str "between"
+      , Space
+      , Str "numbers:"
+      , Space
+      , Str "5\8211\&7,"
+      , Space
+      , Str "255\8211\&66,"
+      , Space
+      , Str "1987\8211\&1999."
+      ]
+  , Para [ Str "Ellipses\8230and\8230and\8230." ]
+  , HorizontalRule
+  , Header 1 ( "latex" , [] , [] ) [ Str "LaTeX" ]
+  , BulletList
+      [ [ Plain
+            [ RawInline (Format "tex") "\\cite[22-23]{smith.1899}" ]
+        ]
+      , [ Plain [ Math InlineMath "2+2=4" ] ]
+      , [ Plain [ Math InlineMath "x \\in y" ] ]
+      , [ Plain [ Math InlineMath "\\alpha \\wedge \\omega" ] ]
+      , [ Plain [ Math InlineMath "223" ] ]
+      , [ Plain [ Math InlineMath "p" , Str "-Tree" ] ]
+      , [ Plain
+            [ Str "Here\8217s"
+            , Space
+            , Str "some"
+            , Space
+            , Str "display"
+            , Space
+            , Str "math:"
+            , SoftBreak
+            , Math
+                DisplayMath
+                "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"
+            ]
+        ]
+      , [ Plain
+            [ Str "Here\8217s"
+            , Space
+            , Str "one"
+            , Space
+            , Str "that"
+            , Space
+            , Str "has"
+            , Space
+            , Str "a"
+            , Space
+            , Str "line"
+            , Space
+            , Str "break"
+            , Space
+            , Str "in"
+            , Space
+            , Str "it:"
+            , Space
+            , Math InlineMath "\\alpha + \\omega \\times x^2"
+            , Str "."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "shouldn\8217t"
+      , Space
+      , Str "be"
+      , Space
+      , Str "math:"
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "To"
+            , Space
+            , Str "get"
+            , Space
+            , Str "the"
+            , Space
+            , Str "famous"
+            , Space
+            , Str "equation,"
+            , Space
+            , Str "write"
+            , Space
+            , Code ( "" , [] , [] ) "$e = mc^2$"
+            , Str "."
+            ]
+        ]
+      , [ Plain
+            [ Str "$22,000"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Emph [ Str "lot" ]
+            , Space
+            , Str "of"
+            , Space
+            , Str "money."
+            , Space
+            , Str "So"
+            , Space
+            , Str "is"
+            , Space
+            , Str "$34,000."
+            , SoftBreak
+            , Str "(It"
+            , Space
+            , Str "worked"
+            , Space
+            , Str "if"
+            , Space
+            , Quoted DoubleQuote [ Str "lot" ]
+            , Space
+            , Str "is"
+            , Space
+            , Str "emphasized.)"
+            ]
+        ]
+      , [ Plain
+            [ Str "Shoes"
+            , Space
+            , Str "($20)"
+            , Space
+            , Str "and"
+            , Space
+            , Str "socks"
+            , Space
+            , Str "($5)."
+            ]
+        ]
+      , [ Plain
+            [ Str "Escaped"
+            , Space
+            , Code ( "" , [] , [] ) "$"
+            , Str ":"
+            , Space
+            , Str "$73"
+            , Space
+            , Emph
+                [ Str "this"
+                , Space
+                , Str "should"
+                , Space
+                , Str "be"
+                , Space
+                , Str "emphasized"
+                ]
+            , Space
+            , Str "23$."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "LaTeX"
+      , Space
+      , Str "table:"
+      ]
+  , RawBlock
+      (Format "tex")
+      "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog    & 2      \\\\\nCat    & 1      \\\\ \\hline\n\\end{tabular}"
+  , HorizontalRule
+  , Header
+      1
+      ( "special-characters" , [] , [] )
+      [ Str "Special" , Space , Str "Characters" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "unicode:"
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "I" , Space , Str "hat:" , Space , Str "\206" ]
+        ]
+      , [ Plain
+            [ Str "o" , Space , Str "umlaut:" , Space , Str "\246" ]
+        ]
+      , [ Plain [ Str "section:" , Space , Str "\167" ] ]
+      , [ Plain
+            [ Str "set"
+            , Space
+            , Str "membership:"
+            , Space
+            , Str "\8712"
+            ]
+        ]
+      , [ Plain [ Str "copyright:" , Space , Str "\169" ] ]
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "has"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "their"
+      , Space
+      , Str "name."
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "is"
+      , Space
+      , Str "another"
+      , Space
+      , Str "way"
+      , Space
+      , Str "to"
+      , Space
+      , Str "write"
+      , Space
+      , Str "it."
+      ]
+  , Para
+      [ Str "This" , Space , Str "&" , Space , Str "that." ]
+  , Para [ Str "4" , Space , Str "<" , Space , Str "5." ]
+  , Para [ Str "6" , Space , Str ">" , Space , Str "5." ]
+  , Para [ Str "Backslash:" , Space , Str "\\" ]
+  , Para [ Str "Backtick:" , Space , Str "`" ]
+  , Para [ Str "Asterisk:" , Space , Str "*" ]
+  , Para [ Str "Underscore:" , Space , Str "_" ]
+  , Para
+      [ Str "Left" , Space , Str "brace:" , Space , Str "{" ]
+  , Para
+      [ Str "Right" , Space , Str "brace:" , Space , Str "}" ]
+  , Para
+      [ Str "Left" , Space , Str "bracket:" , Space , Str "[" ]
+  , Para
+      [ Str "Right" , Space , Str "bracket:" , Space , Str "]" ]
+  , Para
+      [ Str "Left" , Space , Str "paren:" , Space , Str "(" ]
+  , Para
+      [ Str "Right" , Space , Str "paren:" , Space , Str ")" ]
+  , Para [ Str "Greater-than:" , Space , Str ">" ]
+  , Para [ Str "Hash:" , Space , Str "#" ]
+  , Para [ Str "Period:" , Space , Str "." ]
+  , Para [ Str "Bang:" , Space , Str "!" ]
+  , Para [ Str "Plus:" , Space , Str "+" ]
+  , Para [ Str "Minus:" , Space , Str "-" ]
+  , HorizontalRule
+  , Header 1 ( "links" , [] , [] ) [ Str "Links" ]
+  , Header 2 ( "explicit" , [] , [] ) [ Str "Explicit" ]
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "a"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "URL" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title preceded by two spaces" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title preceded by a tab" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title with \"quotes\" in it" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title with single quotes" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "with_underscore" ]
+          ( "/url/with_underscore" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Email" , Space , Str "link" ]
+          ( "mailto:nobody@nowhere.net" , "" )
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "Empty" ] ( "" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "reference" , [] , [] ) [ Str "Reference" ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "With"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "[brackets]" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "b" ] ( "/url/" , "" )
+      , Space
+      , Str "by"
+      , Space
+      , Str "itself"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "once" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "twice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "thrice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "[not][]"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , CodeBlock ( "" , [] , [] ) "[not]: /url"
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "bar" ]
+          ( "/url/" , "Title with \"quotes\" inside" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "biz" ]
+          ( "/url/" , "Title with \"quote\" inside" )
+      , Str "."
+      ]
+  , Header
+      2
+      ( "with-ampersands" , [] , [] )
+      [ Str "With" , Space , Str "ampersands" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "link"
+          , Space
+          , Str "with"
+          , Space
+          , Str "an"
+          , Space
+          , Str "ampersand"
+          , Space
+          , Str "in"
+          , Space
+          , Str "the"
+          , Space
+          , Str "URL"
+          ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Str "amersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "link"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "AT&T" ]
+          ( "http://att.com/" , "AT&T" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline" , Space , Str "link" ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline"
+          , Space
+          , Str "link"
+          , Space
+          , Str "in"
+          , Space
+          , Str "pointy"
+          , Space
+          , Str "braces"
+          ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "autolinks" , [] , [] ) [ Str "Autolinks" ]
+  , Para
+      [ Str "With"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand:"
+      , Space
+      , Link
+          ( "" , [ "uri" ] , [] )
+          [ Str "http://example.com/?foo=1&bar=2" ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "In" , Space , Str "a" , Space , Str "list?" ]
+        ]
+      , [ Plain
+            [ Link
+                ( "" , [ "uri" ] , [] )
+                [ Str "http://example.com/" ]
+                ( "http://example.com/" , "" )
+            ]
+        ]
+      , [ Plain [ Str "It" , Space , Str "should." ] ]
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Str "e-mail"
+      , Space
+      , Str "address:"
+      , Space
+      , Link
+          ( "" , [ "email" ] , [] )
+          [ Str "nobody@nowhere.net" ]
+          ( "mailto:nobody@nowhere.net" , "" )
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Blockquoted:"
+          , Space
+          , Link
+              ( "" , [ "uri" ] , [] )
+              [ Str "http://example.com/" ]
+              ( "http://example.com/" , "" )
+          ]
+      ]
+  , Para
+      [ Str "Auto-links"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "occur"
+      , Space
+      , Str "here:"
+      , Space
+      , Code ( "" , [] , [] ) "<http://example.com/>"
+      ]
+  , CodeBlock
+      ( "" , [] , [] ) "or here: <http://example.com/>"
+  , HorizontalRule
+  , Header 1 ( "images" , [] , [] ) [ Str "Images" ]
+  , Para
+      [ Str "From"
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Str "Voyage"
+          , Space
+          , Str "dans"
+          , Space
+          , Str "la"
+          , Space
+          , Str "Lune"
+          ]
+      , Space
+      , Str "by"
+      , Space
+      , Str "Georges"
+      , Space
+      , Str "Melies"
+      , Space
+      , Str "(1902):"
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "lalune" ]
+          ( "lalune.jpg" , "fig:Voyage dans la Lune" )
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "movie"
+      , Space
+      , Image
+          ( "" , [] , [] ) [ Str "movie" ] ( "movie.jpg" , "" )
+      , Space
+      , Str "icon."
+      ]
+  , HorizontalRule
+  , Header 1 ( "footnotes" , [] , [] ) [ Str "Footnotes" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference,"
+      , Note
+          [ Para
+              [ Str "Here"
+              , Space
+              , Str "is"
+              , Space
+              , Str "the"
+              , Space
+              , Str "footnote."
+              , Space
+              , Str "It"
+              , Space
+              , Str "can"
+              , Space
+              , Str "go"
+              , Space
+              , Str "anywhere"
+              , Space
+              , Str "after"
+              , Space
+              , Str "the"
+              , Space
+              , Str "footnote"
+              , SoftBreak
+              , Str "reference."
+              , Space
+              , Str "It"
+              , Space
+              , Str "need"
+              , Space
+              , Str "not"
+              , Space
+              , Str "be"
+              , Space
+              , Str "placed"
+              , Space
+              , Str "at"
+              , Space
+              , Str "the"
+              , Space
+              , Str "end"
+              , Space
+              , Str "of"
+              , Space
+              , Str "the"
+              , Space
+              , Str "document."
+              ]
+          ]
+      , Space
+      , Str "and"
+      , Space
+      , Str "another."
+      , Note
+          [ Para
+              [ Str "Here\8217s"
+              , Space
+              , Str "the"
+              , Space
+              , Str "long"
+              , Space
+              , Str "note."
+              , Space
+              , Str "This"
+              , Space
+              , Str "one"
+              , Space
+              , Str "contains"
+              , Space
+              , Str "multiple"
+              , SoftBreak
+              , Str "blocks."
+              ]
+          , Para
+              [ Str "Subsequent"
+              , Space
+              , Str "blocks"
+              , Space
+              , Str "are"
+              , Space
+              , Str "indented"
+              , Space
+              , Str "to"
+              , Space
+              , Str "show"
+              , Space
+              , Str "that"
+              , Space
+              , Str "they"
+              , Space
+              , Str "belong"
+              , Space
+              , Str "to"
+              , Space
+              , Str "the"
+              , SoftBreak
+              , Str "footnote"
+              , Space
+              , Str "(as"
+              , Space
+              , Str "with"
+              , Space
+              , Str "list"
+              , Space
+              , Str "items)."
+              ]
+          , CodeBlock ( "" , [] , [] ) "  { <code> }"
+          , Para
+              [ Str "If"
+              , Space
+              , Str "you"
+              , Space
+              , Str "want,"
+              , Space
+              , Str "you"
+              , Space
+              , Str "can"
+              , Space
+              , Str "indent"
+              , Space
+              , Str "every"
+              , Space
+              , Str "line,"
+              , Space
+              , Str "but"
+              , Space
+              , Str "you"
+              , Space
+              , Str "can"
+              , Space
+              , Str "also"
+              , Space
+              , Str "be"
+              , SoftBreak
+              , Str "lazy"
+              , Space
+              , Str "and"
+              , Space
+              , Str "just"
+              , Space
+              , Str "indent"
+              , Space
+              , Str "the"
+              , Space
+              , Str "first"
+              , Space
+              , Str "line"
+              , Space
+              , Str "of"
+              , Space
+              , Str "each"
+              , Space
+              , Str "block."
+              ]
+          ]
+      , SoftBreak
+      , Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Emph [ Str "not" ]
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference,"
+      , Space
+      , Str "because"
+      , Space
+      , Str "it"
+      , SoftBreak
+      , Str "contains"
+      , Space
+      , Str "a"
+      , Space
+      , Str "space.[^my"
+      , Space
+      , Str "note]"
+      , Space
+      , Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "an"
+      , Space
+      , Str "inline"
+      , Space
+      , Str "note."
+      , Note
+          [ Para
+              [ Str "This"
+              , SoftBreak
+              , Str "is"
+              , Space
+              , Emph [ Str "easier" ]
+              , Space
+              , Str "to"
+              , Space
+              , Str "type."
+              , Space
+              , Str "Inline"
+              , Space
+              , Str "notes"
+              , Space
+              , Str "may"
+              , Space
+              , Str "contain"
+              , SoftBreak
+              , Link
+                  ( "" , [] , [] )
+                  [ Str "links" ]
+                  ( "http://google.com" , "" )
+              , Space
+              , Str "and"
+              , Space
+              , Code ( "" , [] , [] ) "]"
+              , Space
+              , Str "verbatim"
+              , Space
+              , Str "characters,"
+              , SoftBreak
+              , Str "as"
+              , Space
+              , Str "well"
+              , Space
+              , Str "as"
+              , Space
+              , Str "[bracketed"
+              , Space
+              , Str "text]."
+              ]
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Notes"
+          , Space
+          , Str "can"
+          , Space
+          , Str "go"
+          , Space
+          , Str "in"
+          , Space
+          , Str "quotes."
+          , Note [ Para [ Str "In" , Space , Str "quote." ] ]
+          ]
+      ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain
+            [ Str "And"
+            , Space
+            , Str "in"
+            , Space
+            , Str "list"
+            , Space
+            , Str "items."
+            , Note [ Para [ Str "In" , Space , Str "list." ] ]
+            ]
+        ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "part"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "note,"
+      , Space
+      , Str "as"
+      , Space
+      , Str "it"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "indented."
+      ]
+  ]
diff --git a/test/textile-reader.native b/test/textile-reader.native
--- a/test/textile-reader.native
+++ b/test/textile-reader.native
@@ -1,243 +1,1260 @@
-Pandoc (Meta {unMeta = fromList []})
-[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Space,Str "Textile",Space,Str "Reader.",Space,Str "Part",Space,Str "of",Space,Str "it",Space,Str "comes",LineBreak,Str "from",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
-,HorizontalRule
-,Header 1 ("headers",[],[]) [Str "Headers"]
-,Header 2 ("level-2-with-an-embedded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link ("",[],[]) [Str "embedded",Space,Str "link"] ("http://www.example.com","")]
-,Header 3 ("level-3-with-emphasis",[],[]) [Str "Level",Space,Str "3",Space,Str "with",Space,Strong [Str "emphasis"]]
-,Header 4 ("level-4",[],[]) [Str "Level",Space,Str "4"]
-,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
-,Header 6 ("level-6",[],[]) [Str "Level",Space,Str "6"]
-,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
-,Para [Str "Line",Space,Str "breaks",Space,Str "are",Space,Str "preserved",Space,Str "in",Space,Str "textile,",Space,Str "so",Space,Str "you",Space,Str "can",Space,Str "not",Space,Str "wrap",Space,Str "your",Space,Str "very",LineBreak,Str "long",Space,Str "paragraph",Space,Str "with",Space,Str "your",Space,Str "favourite",Space,Str "text",Space,Str "editor",Space,Str "and",Space,Str "have",Space,Str "it",Space,Str "rendered",LineBreak,Str "with",Space,Str "no",Space,Str "break."]
-,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet."]
-,BulletList
- [[Plain [Str "criminey."]]]
-,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "paragraph",Space,Str "break",Space,Str "between",Space,Str "here"]
-,Para [Str "and",Space,Str "here."]
-,Para [Str "pandoc",Space,Str "converts",Space,Str "textile."]
-,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "famous",Space,Str "quote",Space,Str "from",Space,Str "somebody.",Space,Str "He",Space,Str "had",Space,Str "a",Space,Str "lot",Space,Str "of",Space,Str "things",Space,Str "to",LineBreak,Str "say,",Space,Str "so",Space,Str "the",Space,Str "text",Space,Str "is",Space,Str "really",Space,Str "really",Space,Str "long",Space,Str "and",Space,Str "spans",Space,Str "on",Space,Str "multiple",Space,Str "lines."]]
-,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
-,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "    ---- (should be four hyphens)\n\n    sub status {\n        print \"working\";\n    }\n\n    this code block is indented by one tab"
-,Para [Str "And:"]
-,CodeBlock ("",[],[]) "        this code block is indented by two tabs\n\n    These should not be escaped:  \\$ \\\\ \\> \\[ \\{"
-,CodeBlock ("",[],[]) "Code block with .bc\n        continued\n    @</\\"
-,CodeBlock ("",[],[]) "extended code block\n\n        continued"
-,Para [Str "ended",Space,Str "by",Space,Str "paragraph"]
-,Para [Str "Inline",Space,Str "code:",Space,Code ("",[],[]) "<tt>",Str ",",Space,Code ("",[],[]) "@",Str "."]
-,Header 1 ("notextile",[],[]) [Str "Notextile"]
-,Para [Str "A",Space,Str "block",Space,Str "of",Space,Str "text",Space,Str "can",Space,Str "be",Space,Str "protected",Space,Str "with",Space,Str "notextile",Space,Str ":"]
-,Para [Str "\nNo *bold* and\n* no bullet\n"]
-,Para [Str "and",Space,Str "inlines",Space,Str "can",Space,Str "be",Space,Str "protected",Space,Str "with",Space,Str "double *equals (=)* markup."]
-,Header 1 ("lists",[],[]) [Str "Lists"]
-,Header 2 ("unordered",[],[]) [Str "Unordered"]
-,Para [Str "Asterisks",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "asterisk",Space,Str "1"]]
- ,[Plain [Str "asterisk",Space,Str "2"]]
- ,[Plain [Str "asterisk",Space,Str "3"]]]
-,Para [Str "With",Space,Str "line",Space,Str "breaks:"]
-,BulletList
- [[Plain [Str "asterisk",Space,Str "1",LineBreak,Str "newline"]]
- ,[Plain [Str "asterisk",Space,Str "2"]]]
-,Header 2 ("ordered",[],[]) [Str "Ordered"]
-,Para [Str "Tight:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "First"]]
- ,[Plain [Str "Second"]]
- ,[Plain [Str "Third"]]]
-,Header 2 ("nested",[],[]) [Str "Nested"]
-,BulletList
- [[Plain [Str "ui",Space,Str "1"]
-  ,BulletList
-   [[Plain [Str "ui",Space,Str "1.1"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "oi",Space,Str "1.1.1"]]
-     ,[Plain [Str "oi",Space,Str "1.1.2"]]]]
-   ,[Plain [Str "ui",Space,Str "1.2"]]]]
- ,[Plain [Str "ui",Space,Str "2"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "oi",Space,Str "2.1"]
-    ,BulletList
-     [[Plain [Str "ui",Space,Str "2.1.1"]]
-     ,[Plain [Str "ui",Space,Str "2.1.2"]]]]]]]
-,Header 2 ("issue-1500",[],[]) [Str "Issue",Space,Str "#1500"]
-,BulletList
- [[Plain [Str "one"]]
- ,[Plain [Str "two",LineBreak,Str "->",Space,Str "and",Space,Str "more"]]]
-,Header 2 ("issue-1513",[],[]) [Str "Issue",Space,Str "#1513"]
-,Para [Str "List:"]
-,BulletList
- [[Plain [Str "one"]]
- ,[Plain [Str "two"]]]
-,Header 2 ("definition-list",[],[]) [Str "Definition",Space,Str "List"]
-,DefinitionList
- [([Str "coffee"],
-   [[Plain [Str "Hot",Space,Str "and",Space,Str "black"]]])
- ,([Str "tea"],
-   [[Plain [Str "Also",Space,Str "hot,",Space,Str "but",Space,Str "a",Space,Str "little",Space,Str "less",Space,Str "black"]]])
- ,([Str "milk"],
-   [[Para [Str "Nourishing",Space,Str "beverage",Space,Str "for",Space,Str "baby",Space,Str "cows."]
-    ,Para [Str "Cold",Space,Str "drink",Space,Str "that",Space,Str "goes",Space,Str "great",Space,Str "with",Space,Str "cookies."]]])
- ,([Str "beer"],
-   [[Plain [Str "fresh",Space,Str "and",Space,Str "bitter"]]])]
-,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str ".",LineBreak,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str ".",LineBreak,Str "This",Space,Str "is",Space,Underline [Str "inserted"],Str ",",Space,Str "and",Space,Str "this",Space,Str "is",Space,Strikeout [Str "deleted"],Str ".",LineBreak,Str "Hyphenated-words-are-ok,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "strange_underscore_notation.",LineBreak,Str "A",Space,Link ("",[],[]) [Strong [Str "strong",Space,Str "link"]] ("http://www.foobar.com",""),Str "."]
-,Para [Emph [Strong [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]],LineBreak,Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Space,Str "and",Space,Emph [Strong [Str "that",Space,Str "one"]],Str ".",LineBreak,Strikeout [Str "This",Space,Str "is",Space,Str "strikeout",Space,Str "and",Space,Strong [Str "strong"]]]
-,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Space,Superscript [Strong [Str "hello"]],Space,Str "a",Superscript [Str "hello",Space,Str "there"],Str ".",LineBreak,Str "Subscripts:",Space,Subscript [Str "here"],Space,Str "H",Space,Subscript [Str "2"],Str "O,",Space,Str "H",Space,Subscript [Str "23"],Str "O,",Space,Str "H",Space,Subscript [Str "many",Space,Str "of",Space,Str "them"],Str "O."]
-,Para [Str "Dashes",Space,Str ":",Space,Str "How",Space,Str "cool",Space,Str "\8212",Space,Str "automatic",Space,Str "dashes."]
-,Para [Str "Ellipses",Space,Str ":",Space,Str "He",Space,Str "thought",Space,Str "and",Space,Str "thought",Space,Str "\8230",Space,Str "and",Space,Str "then",Space,Str "thought",Space,Str "some",Space,Str "more."]
-,Para [Str "Quotes",Space,Str "and",Space,Str "apostrophes",Space,Str ":",Space,Quoted DoubleQuote [Str "I\8217d",Space,Str "like",Space,Str "to",Space,Str "thank",Space,Str "you"],Space,Str "for",Space,Str "example."]
-,Header 1 ("links",[],[]) [Str "Links"]
-,Header 2 ("explicit",[],[]) [Str "Explicit"]
-,Para [Str "Just",Space,Str "a",Space,Link ("",[],[]) [Str "url"] ("http://www.url.com","")]
-,Para [Link ("",[],[]) [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
-,Para [Quoted DoubleQuote [Str "not",Space,Str "a",Space,Str "link"],Str ":",Space,Str "foo"]
-,Para [Str "Automatic",Space,Str "linking",Space,Str "to",Space,Link ("",[],[]) [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]
-,Para [Link ("",[],[]) [Str "Example"] ("http://www.example.com/",""),Str ":",Space,Str "Example",Space,Str "of",Space,Str "a",Space,Str "link",Space,Str "followed",Space,Str "by",Space,Str "a",Space,Str "colon."]
-,Para [Str "A",Space,Str "link",Link ("",[],[]) [Str "with",Space,Str "brackets"] ("http://www.example.com",""),Str "and",Space,Str "no",Space,Str "spaces."]
-,Header 1 ("tables",[],[]) [Str "Tables"]
-,Para [Str "Textile",Space,Str "allows",Space,Str "tables",Space,Str "with",Space,Str "and",Space,Str "without",Space,Str "headers",Space,Str ":"]
-,Header 2 ("without-headers",[],[]) [Str "Without",Space,Str "headers"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "name"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "age"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "sex"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "joan"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "24"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "archie"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "29"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "m"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "bella"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "45"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "and",Space,Str "some",Space,Str "text",Space,Str "following",Space,Str "\8230"]
-,Header 2 ("with-headers",[],[]) [Str "With",Space,Str "headers"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "name"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "age"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "sex"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "joan"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "24"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "archie"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "29"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "m"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "bella"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "45"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 1 ("images",[],[]) [Str "Images"]
-,Para [Str "Textile",Space,Str "inline",Space,Str "image",Space,Str "syntax,",Space,Str "like",LineBreak,Str "here",Space,Image ("",[],[]) [Str "this is the alt text"] ("this_is_an_image.png","this is the alt text"),LineBreak,Str "and",Space,Str "here",Space,Image ("",[],[]) [Str ""] ("this_is_an_image.png",""),Str "."]
-,Header 1 ("attributes",[],[]) [Str "Attributes"]
-,Header 2 ("ident",["bar","foo"],[("style","color:red;"),("lang","en")]) [Str "HTML",Space,Str "and",Space,Str "CSS",Space,Str "attributes",Space,Str "are",Space,Str "parsed",Space,Str "in",Space,Str "headers."]
-,Header 2 ("centered",[],[("style","text-align:center;")]) [Str "Centered"]
-,Header 2 ("right",[],[("style","text-align:right;")]) [Str "Right"]
-,Header 2 ("justified",[],[("lang","en"),("style","color:blue;text-align:justify;")]) [Str "Justified"]
-,Para [Str "as",Space,Str "well",Space,Str "as",Space,Strong [Span ("",["foo"],[]) [Str "inline",Space,Str "attributes"]],Space,Str "of",Space,Span ("",[],[("style","color:red;")]) [Str "all",Space,Str "kind"]]
-,Para [Str "and",Space,Str "paragraph",Space,Str "attributes,",Space,Str "and",Space,Str "table",Space,Str "attributes."]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "name"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "age"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "sex"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "joan"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "24"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Emph [Str "(class#id)",Space,Str "emph"]]
-,Para [Emph [Str "(no",Space,Str "class#id)",Space,Str "emph"]]
-,Header 1 ("entities",[],[]) [Str "Entities"]
-,Para [Str "*",LineBreak,Str "&"]
-,Header 1 ("raw-html",[],[]) [Str "Raw",Space,Str "HTML"]
-,Para [Str "However,",Space,RawInline (Format "html") "<strong>",Space,Str "raw",Space,Str "HTML",Space,Str "inlines",Space,RawInline (Format "html") "</strong>",Space,Str "are",Space,Str "accepted,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str ":"]
-,RawBlock (Format "html") "<div class=\"foobar\">"
-,Para [Str "any",Space,Strong [Str "Raw",Space,Str "HTML",Space,Str "Block"],Space,Str "with",Space,Str "bold"]
-,RawBlock (Format "html") "</div>"
-,Para [Str "Html",Space,Str "blocks",Space,Str "can"]
-,RawBlock (Format "html") "<div>"
-,Para [Str "interrupt",Space,Str "paragraphs"]
-,RawBlock (Format "html") "</div>"
-,Para [Str "as",Space,Str "well."]
-,Para [Str "Can",Space,Str "you",Space,Str "prove",Space,Str "that",Space,Str "2",Space,Str "<",Space,Str "3",Space,Str "?"]
-,Header 1 ("acronyms-and-marks",[],[]) [Str "Acronyms",Space,Str "and",Space,Str "marks"]
-,Para [Str "PBS (Public Broadcasting System)"]
-,Para [Str "Hi\8482"]
-,Para [Str "Hi",Space,Str "\8482"]
-,Para [Str "\174",Space,Str "Hi\174"]
-,Para [Str "Hi\169\&2008",Space,Str "\169",Space,Str "2008"]
-,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
-,Para [Str "A",Space,Str "note.",Note [Para [Str "The",Space,Str "note",LineBreak,Str "is",Space,Str "here!"]],Space,Str "Another",Space,Str "note",Note [Para [Str "Other",Space,Str "note."]],Str "."]
-,Header 1 ("comment-blocks",[],[]) [Str "Comment",Space,Str "blocks"]
-,Para [Str "not",Space,Str "a",Space,Str "comment."]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "set"
+      , Space
+      , Str "of"
+      , Space
+      , Str "tests"
+      , Space
+      , Str "for"
+      , Space
+      , Str "pandoc"
+      , Space
+      , Str "Textile"
+      , Space
+      , Str "Reader."
+      , Space
+      , Str "Part"
+      , Space
+      , Str "of"
+      , Space
+      , Str "it"
+      , Space
+      , Str "comes"
+      , LineBreak
+      , Str "from"
+      , Space
+      , Str "John"
+      , Space
+      , Str "Gruber\8217s"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "test"
+      , Space
+      , Str "suite."
+      ]
+  , HorizontalRule
+  , Header 1 ( "headers" , [] , [] ) [ Str "Headers" ]
+  , Header
+      2
+      ( "level-2-with-an-embedded-link" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "link" ]
+          ( "http://www.example.com" , "" )
+      ]
+  , Header
+      3
+      ( "level-3-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "3"
+      , Space
+      , Str "with"
+      , Space
+      , Strong [ Str "emphasis" ]
+      ]
+  , Header
+      4 ( "level-4" , [] , [] ) [ Str "Level" , Space , Str "4" ]
+  , Header
+      5 ( "level-5" , [] , [] ) [ Str "Level" , Space , Str "5" ]
+  , Header
+      6 ( "level-6" , [] , [] ) [ Str "Level" , Space , Str "6" ]
+  , Header 1 ( "paragraphs" , [] , [] ) [ Str "Paragraphs" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "regular"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "Line"
+      , Space
+      , Str "breaks"
+      , Space
+      , Str "are"
+      , Space
+      , Str "preserved"
+      , Space
+      , Str "in"
+      , Space
+      , Str "textile,"
+      , Space
+      , Str "so"
+      , Space
+      , Str "you"
+      , Space
+      , Str "can"
+      , Space
+      , Str "not"
+      , Space
+      , Str "wrap"
+      , Space
+      , Str "your"
+      , Space
+      , Str "very"
+      , LineBreak
+      , Str "long"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "with"
+      , Space
+      , Str "your"
+      , Space
+      , Str "favourite"
+      , Space
+      , Str "text"
+      , Space
+      , Str "editor"
+      , Space
+      , Str "and"
+      , Space
+      , Str "have"
+      , Space
+      , Str "it"
+      , Space
+      , Str "rendered"
+      , LineBreak
+      , Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "break."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "one"
+      , Space
+      , Str "with"
+      , Space
+      , Str "a"
+      , Space
+      , Str "bullet."
+      ]
+  , BulletList [ [ Plain [ Str "criminey." ] ] ]
+  , Para
+      [ Str "There"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "break"
+      , Space
+      , Str "between"
+      , Space
+      , Str "here"
+      ]
+  , Para [ Str "and" , Space , Str "here." ]
+  , Para
+      [ Str "pandoc"
+      , Space
+      , Str "converts"
+      , Space
+      , Str "textile."
+      ]
+  , Header
+      1
+      ( "block-quotes" , [] , [] )
+      [ Str "Block" , Space , Str "Quotes" ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "famous"
+          , Space
+          , Str "quote"
+          , Space
+          , Str "from"
+          , Space
+          , Str "somebody."
+          , Space
+          , Str "He"
+          , Space
+          , Str "had"
+          , Space
+          , Str "a"
+          , Space
+          , Str "lot"
+          , Space
+          , Str "of"
+          , Space
+          , Str "things"
+          , Space
+          , Str "to"
+          , LineBreak
+          , Str "say,"
+          , Space
+          , Str "so"
+          , Space
+          , Str "the"
+          , Space
+          , Str "text"
+          , Space
+          , Str "is"
+          , Space
+          , Str "really"
+          , Space
+          , Str "really"
+          , Space
+          , Str "long"
+          , Space
+          , Str "and"
+          , Space
+          , Str "spans"
+          , Space
+          , Str "on"
+          , Space
+          , Str "multiple"
+          , Space
+          , Str "lines."
+          ]
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "a"
+      , Space
+      , Str "following"
+      , Space
+      , Str "paragraph."
+      ]
+  , Header
+      1
+      ( "code-blocks" , [] , [] )
+      [ Str "Code" , Space , Str "Blocks" ]
+  , Para [ Str "Code:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "    ---- (should be four hyphens)\n\n    sub status {\n        print \"working\";\n    }\n\n    this code block is indented by one tab"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "        this code block is indented by two tabs\n\n    These should not be escaped:  \\$ \\\\ \\> \\[ \\{"
+  , CodeBlock
+      ( "" , [] , [] )
+      "Code block with .bc\n        continued\n    @</\\"
+  , CodeBlock
+      ( "" , [] , [] ) "extended code block\n\n        continued"
+  , Para
+      [ Str "ended" , Space , Str "by" , Space , Str "paragraph" ]
+  , Para
+      [ Str "Inline"
+      , Space
+      , Str "code:"
+      , Space
+      , Code ( "" , [] , [] ) "<tt>"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "@"
+      , Str "."
+      ]
+  , Header 1 ( "notextile" , [] , [] ) [ Str "Notextile" ]
+  , Para
+      [ Str "A"
+      , Space
+      , Str "block"
+      , Space
+      , Str "of"
+      , Space
+      , Str "text"
+      , Space
+      , Str "can"
+      , Space
+      , Str "be"
+      , Space
+      , Str "protected"
+      , Space
+      , Str "with"
+      , Space
+      , Str "notextile"
+      , Space
+      , Str ":"
+      ]
+  , Para [ Str "\nNo *bold* and\n* no bullet\n" ]
+  , Para
+      [ Str "and"
+      , Space
+      , Str "inlines"
+      , Space
+      , Str "can"
+      , Space
+      , Str "be"
+      , Space
+      , Str "protected"
+      , Space
+      , Str "with"
+      , Space
+      , Str "double *equals (=)* markup."
+      ]
+  , Header 1 ( "lists" , [] , [] ) [ Str "Lists" ]
+  , Header 2 ( "unordered" , [] , [] ) [ Str "Unordered" ]
+  , Para [ Str "Asterisks" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para
+      [ Str "With" , Space , Str "line" , Space , Str "breaks:" ]
+  , BulletList
+      [ [ Plain
+            [ Str "asterisk"
+            , Space
+            , Str "1"
+            , LineBreak
+            , Str "newline"
+            ]
+        ]
+      , [ Plain [ Str "asterisk" , Space , Str "2" ] ]
+      ]
+  , Header 2 ( "ordered" , [] , [] ) [ Str "Ordered" ]
+  , Para [ Str "Tight:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "First" ] ]
+      , [ Plain [ Str "Second" ] ]
+      , [ Plain [ Str "Third" ] ]
+      ]
+  , Header 2 ( "nested" , [] , [] ) [ Str "Nested" ]
+  , BulletList
+      [ [ Plain [ Str "ui" , Space , Str "1" ]
+        , BulletList
+            [ [ Plain [ Str "ui" , Space , Str "1.1" ]
+              , OrderedList
+                  ( 1 , DefaultStyle , DefaultDelim )
+                  [ [ Plain [ Str "oi" , Space , Str "1.1.1" ] ]
+                  , [ Plain [ Str "oi" , Space , Str "1.1.2" ] ]
+                  ]
+              ]
+            , [ Plain [ Str "ui" , Space , Str "1.2" ] ]
+            ]
+        ]
+      , [ Plain [ Str "ui" , Space , Str "2" ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain [ Str "oi" , Space , Str "2.1" ]
+              , BulletList
+                  [ [ Plain [ Str "ui" , Space , Str "2.1.1" ] ]
+                  , [ Plain [ Str "ui" , Space , Str "2.1.2" ] ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "issue-1500" , [] , [] )
+      [ Str "Issue" , Space , Str "#1500" ]
+  , BulletList
+      [ [ Plain [ Str "one" ] ]
+      , [ Plain
+            [ Str "two"
+            , LineBreak
+            , Str "->"
+            , Space
+            , Str "and"
+            , Space
+            , Str "more"
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "issue-1513" , [] , [] )
+      [ Str "Issue" , Space , Str "#1513" ]
+  , Para [ Str "List:" ]
+  , BulletList
+      [ [ Plain [ Str "one" ] ] , [ Plain [ Str "two" ] ] ]
+  , Header
+      2
+      ( "definition-list" , [] , [] )
+      [ Str "Definition" , Space , Str "List" ]
+  , DefinitionList
+      [ ( [ Str "coffee" ]
+        , [ [ Plain
+                [ Str "Hot" , Space , Str "and" , Space , Str "black" ]
+            ]
+          ]
+        )
+      , ( [ Str "tea" ]
+        , [ [ Plain
+                [ Str "Also"
+                , Space
+                , Str "hot,"
+                , Space
+                , Str "but"
+                , Space
+                , Str "a"
+                , Space
+                , Str "little"
+                , Space
+                , Str "less"
+                , Space
+                , Str "black"
+                ]
+            ]
+          ]
+        )
+      , ( [ Str "milk" ]
+        , [ [ Para
+                [ Str "Nourishing"
+                , Space
+                , Str "beverage"
+                , Space
+                , Str "for"
+                , Space
+                , Str "baby"
+                , Space
+                , Str "cows."
+                ]
+            , Para
+                [ Str "Cold"
+                , Space
+                , Str "drink"
+                , Space
+                , Str "that"
+                , Space
+                , Str "goes"
+                , Space
+                , Str "great"
+                , Space
+                , Str "with"
+                , Space
+                , Str "cookies."
+                ]
+            ]
+          ]
+        )
+      , ( [ Str "beer" ]
+        , [ [ Plain
+                [ Str "fresh"
+                , Space
+                , Str "and"
+                , Space
+                , Str "bitter"
+                ]
+            ]
+          ]
+        )
+      ]
+  , Header
+      1
+      ( "inline-markup" , [] , [] )
+      [ Str "Inline" , Space , Str "Markup" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Emph [ Str "is" , Space , Str "this" ]
+      , Str "."
+      , LineBreak
+      , Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Strong [ Str "is" , Space , Str "this" ]
+      , Str "."
+      , LineBreak
+      , Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Underline [ Str "inserted" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "this"
+      , Space
+      , Str "is"
+      , Space
+      , Strikeout [ Str "deleted" ]
+      , Str "."
+      , LineBreak
+      , Str "Hyphenated-words-are-ok,"
+      , Space
+      , Str "as"
+      , Space
+      , Str "well"
+      , Space
+      , Str "as"
+      , Space
+      , Str "strange_underscore_notation."
+      , LineBreak
+      , Str "A"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Strong [ Str "strong" , Space , Str "link" ] ]
+          ( "http://www.foobar.com" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Emph
+          [ Strong
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      , LineBreak
+      , Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word"
+      , Space
+      , Str "and"
+      , Space
+      , Emph [ Strong [ Str "that" , Space , Str "one" ] ]
+      , Str "."
+      , LineBreak
+      , Strikeout
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "strikeout"
+          , Space
+          , Str "and"
+          , Space
+          , Strong [ Str "strong" ]
+          ]
+      ]
+  , Para
+      [ Str "Superscripts:"
+      , Space
+      , Str "a"
+      , Superscript [ Str "bc" ]
+      , Str "d"
+      , Space
+      , Str "a"
+      , Space
+      , Superscript [ Strong [ Str "hello" ] ]
+      , Space
+      , Str "a"
+      , Superscript [ Str "hello" , Space , Str "there" ]
+      , Str "."
+      , LineBreak
+      , Str "Subscripts:"
+      , Space
+      , Subscript [ Str "here" ]
+      , Space
+      , Str "H"
+      , Space
+      , Subscript [ Str "2" ]
+      , Str "O,"
+      , Space
+      , Str "H"
+      , Space
+      , Subscript [ Str "23" ]
+      , Str "O,"
+      , Space
+      , Str "H"
+      , Space
+      , Subscript
+          [ Str "many" , Space , Str "of" , Space , Str "them" ]
+      , Str "O."
+      ]
+  , Para
+      [ Str "Dashes"
+      , Space
+      , Str ":"
+      , Space
+      , Str "How"
+      , Space
+      , Str "cool"
+      , Space
+      , Str "\8212"
+      , Space
+      , Str "automatic"
+      , Space
+      , Str "dashes."
+      ]
+  , Para
+      [ Str "Ellipses"
+      , Space
+      , Str ":"
+      , Space
+      , Str "He"
+      , Space
+      , Str "thought"
+      , Space
+      , Str "and"
+      , Space
+      , Str "thought"
+      , Space
+      , Str "\8230"
+      , Space
+      , Str "and"
+      , Space
+      , Str "then"
+      , Space
+      , Str "thought"
+      , Space
+      , Str "some"
+      , Space
+      , Str "more."
+      ]
+  , Para
+      [ Str "Quotes"
+      , Space
+      , Str "and"
+      , Space
+      , Str "apostrophes"
+      , Space
+      , Str ":"
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Str "I\8217d"
+          , Space
+          , Str "like"
+          , Space
+          , Str "to"
+          , Space
+          , Str "thank"
+          , Space
+          , Str "you"
+          ]
+      , Space
+      , Str "for"
+      , Space
+      , Str "example."
+      ]
+  , Header 1 ( "links" , [] , [] ) [ Str "Links" ]
+  , Header 2 ( "explicit" , [] , [] ) [ Str "Explicit" ]
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "a"
+      , Space
+      , Link
+          ( "" , [] , [] ) [ Str "url" ] ( "http://www.url.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Email" , Space , Str "link" ]
+          ( "mailto:nobody@nowhere.net" , "" )
+      ]
+  , Para
+      [ Quoted
+          DoubleQuote
+          [ Str "not" , Space , Str "a" , Space , Str "link" ]
+      , Str ":"
+      , Space
+      , Str "foo"
+      ]
+  , Para
+      [ Str "Automatic"
+      , Space
+      , Str "linking"
+      , Space
+      , Str "to"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.example.com" ]
+          ( "http://www.example.com" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Example" ]
+          ( "http://www.example.com/" , "" )
+      , Str ":"
+      , Space
+      , Str "Example"
+      , Space
+      , Str "of"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link"
+      , Space
+      , Str "followed"
+      , Space
+      , Str "by"
+      , Space
+      , Str "a"
+      , Space
+      , Str "colon."
+      ]
+  , Para
+      [ Str "A"
+      , Space
+      , Str "link"
+      , Link
+          ( "" , [] , [] )
+          [ Str "with" , Space , Str "brackets" ]
+          ( "http://www.example.com" , "" )
+      , Str "and"
+      , Space
+      , Str "no"
+      , Space
+      , Str "spaces."
+      ]
+  , Header 1 ( "tables" , [] , [] ) [ Str "Tables" ]
+  , Para
+      [ Str "Textile"
+      , Space
+      , Str "allows"
+      , Space
+      , Str "tables"
+      , Space
+      , Str "with"
+      , Space
+      , Str "and"
+      , Space
+      , Str "without"
+      , Space
+      , Str "headers"
+      , Space
+      , Str ":"
+      ]
+  , Header
+      2
+      ( "without-headers" , [] , [] )
+      [ Str "Without" , Space , Str "headers" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "name" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "age" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "sex" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "joan" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "24" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "archie" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "29" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "m" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "bella" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "45" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "and"
+      , Space
+      , Str "some"
+      , Space
+      , Str "text"
+      , Space
+      , Str "following"
+      , Space
+      , Str "\8230"
+      ]
+  , Header
+      2
+      ( "with-headers" , [] , [] )
+      [ Str "With" , Space , Str "headers" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "name" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "age" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "sex" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "joan" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "24" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "archie" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "29" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "m" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "bella" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "45" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header 1 ( "images" , [] , [] ) [ Str "Images" ]
+  , Para
+      [ Str "Textile"
+      , Space
+      , Str "inline"
+      , Space
+      , Str "image"
+      , Space
+      , Str "syntax,"
+      , Space
+      , Str "like"
+      , LineBreak
+      , Str "here"
+      , Space
+      , Image
+          ( "" , [] , [] )
+          [ Str "this is the alt text" ]
+          ( "this_is_an_image.png" , "this is the alt text" )
+      , LineBreak
+      , Str "and"
+      , Space
+      , Str "here"
+      , Space
+      , Image
+          ( "" , [] , [] ) [ Str "" ] ( "this_is_an_image.png" , "" )
+      , Str "."
+      ]
+  , Header 1 ( "attributes" , [] , [] ) [ Str "Attributes" ]
+  , Header
+      2
+      ( "ident"
+      , [ "bar" , "foo" ]
+      , [ ( "style" , "color:red;" ) , ( "lang" , "en" ) ]
+      )
+      [ Str "HTML"
+      , Space
+      , Str "and"
+      , Space
+      , Str "CSS"
+      , Space
+      , Str "attributes"
+      , Space
+      , Str "are"
+      , Space
+      , Str "parsed"
+      , Space
+      , Str "in"
+      , Space
+      , Str "headers."
+      ]
+  , Header
+      2
+      ( "centered" , [] , [ ( "style" , "text-align:center;" ) ] )
+      [ Str "Centered" ]
+  , Header
+      2
+      ( "right" , [] , [ ( "style" , "text-align:right;" ) ] )
+      [ Str "Right" ]
+  , Header
+      2
+      ( "justified"
+      , []
+      , [ ( "lang" , "en" )
+        , ( "style" , "color:blue;text-align:justify;" )
+        ]
+      )
+      [ Str "Justified" ]
+  , Para
+      [ Str "as"
+      , Space
+      , Str "well"
+      , Space
+      , Str "as"
+      , Space
+      , Strong
+          [ Span
+              ( "" , [ "foo" ] , [] )
+              [ Str "inline" , Space , Str "attributes" ]
+          ]
+      , Space
+      , Str "of"
+      , Space
+      , Span
+          ( "" , [] , [ ( "style" , "color:red;" ) ] )
+          [ Str "all" , Space , Str "kind" ]
+      ]
+  , Para
+      [ Str "and"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "attributes,"
+      , Space
+      , Str "and"
+      , Space
+      , Str "table"
+      , Space
+      , Str "attributes."
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "name" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "age" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "sex" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "joan" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "24" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para [ Emph [ Str "(class#id)" , Space , Str "emph" ] ]
+  , Para
+      [ Emph
+          [ Str "(no" , Space , Str "class#id)" , Space , Str "emph" ]
+      ]
+  , Header 1 ( "entities" , [] , [] ) [ Str "Entities" ]
+  , Para [ Str "*" , LineBreak , Str "&" ]
+  , Header
+      1
+      ( "raw-html" , [] , [] )
+      [ Str "Raw" , Space , Str "HTML" ]
+  , Para
+      [ Str "However,"
+      , Space
+      , RawInline (Format "html") "<strong>"
+      , Space
+      , Str "raw"
+      , Space
+      , Str "HTML"
+      , Space
+      , Str "inlines"
+      , Space
+      , RawInline (Format "html") "</strong>"
+      , Space
+      , Str "are"
+      , Space
+      , Str "accepted,"
+      , Space
+      , Str "as"
+      , Space
+      , Str "well"
+      , Space
+      , Str "as"
+      , Space
+      , Str ":"
+      ]
+  , RawBlock (Format "html") "<div class=\"foobar\">"
+  , Para
+      [ Str "any"
+      , Space
+      , Strong
+          [ Str "Raw" , Space , Str "HTML" , Space , Str "Block" ]
+      , Space
+      , Str "with"
+      , Space
+      , Str "bold"
+      ]
+  , RawBlock (Format "html") "</div>"
+  , Para
+      [ Str "Html" , Space , Str "blocks" , Space , Str "can" ]
+  , RawBlock (Format "html") "<div>"
+  , Para [ Str "interrupt" , Space , Str "paragraphs" ]
+  , RawBlock (Format "html") "</div>"
+  , Para [ Str "as" , Space , Str "well." ]
+  , Para
+      [ Str "Can"
+      , Space
+      , Str "you"
+      , Space
+      , Str "prove"
+      , Space
+      , Str "that"
+      , Space
+      , Str "2"
+      , Space
+      , Str "<"
+      , Space
+      , Str "3"
+      , Space
+      , Str "?"
+      ]
+  , Header
+      1
+      ( "acronyms-and-marks" , [] , [] )
+      [ Str "Acronyms" , Space , Str "and" , Space , Str "marks" ]
+  , Para [ Str "PBS (Public Broadcasting System)" ]
+  , Para [ Str "Hi\8482" ]
+  , Para [ Str "Hi" , Space , Str "\8482" ]
+  , Para [ Str "\174" , Space , Str "Hi\174" ]
+  , Para
+      [ Str "Hi\169\&2008"
+      , Space
+      , Str "\169"
+      , Space
+      , Str "2008"
+      ]
+  , Header 1 ( "footnotes" , [] , [] ) [ Str "Footnotes" ]
+  , Para
+      [ Str "A"
+      , Space
+      , Str "note."
+      , Note
+          [ Para
+              [ Str "The"
+              , Space
+              , Str "note"
+              , LineBreak
+              , Str "is"
+              , Space
+              , Str "here!"
+              ]
+          ]
+      , Space
+      , Str "Another"
+      , Space
+      , Str "note"
+      , Note [ Para [ Str "Other" , Space , Str "note." ] ]
+      , Str "."
+      ]
+  , Header
+      1
+      ( "comment-blocks" , [] , [] )
+      [ Str "Comment" , Space , Str "blocks" ]
+  , Para
+      [ Str "not" , Space , Str "a" , Space , Str "comment." ]
+  ]
diff --git a/test/tikiwiki-reader.native b/test/tikiwiki-reader.native
--- a/test/tikiwiki-reader.native
+++ b/test/tikiwiki-reader.native
@@ -1,212 +1,775 @@
-Pandoc (Meta {unMeta = fromList []})
-[Header 1 ("header",[],[]) [Str "header"]
-,Header 2 ("header-level-two",[],[]) [Str "header",Space,Str "level",Space,Str "two"]
-,Header 3 ("header-level-3",[],[]) [Str "header",Space,Str "level",Space,Str "3"]
-,Header 4 ("header-_level_-four",[],[]) [Str "header",Space,Str "_level_",Space,Str "four"]
-,Header 5 ("header-level-5",[],[]) [Str "header",Space,Str "level",Space,Str "5"]
-,Header 6 ("header-level-6",[],[]) [Str "header",Space,Str "level",Space,Str "6"]
-,Para [Str "!!!!!!!",Space,Str "not",Space,Str "a",Space,Str "header"]
-,Para [Str "--++",Space,Str "not",Space,Str "a",Space,Str "header"]
-,Header 1 ("emph-and-strong",[],[]) [Str "emph",Space,Str "and",Space,Str "strong"]
-,Para [Emph [Str "emph"],Space,Strong [Str "strong"]]
-,Para [Emph [Strong [Str "strong",Space,Str "and",Space,Str "emph",Space,Str "1"]]]
-,Para [Strong [Emph [Str "strong",Space,Str "and",Space,Str "emph",Space,Str "2"]]]
-,Para [Strong [Emph [Str "emph",Space,Str "inside"],Space,Str "strong"]]
-,Para [Strong [Str "strong",Space,Str "with",Space,Emph [Str "emph"]]]
-,Para [Emph [Strong [Str "strong",Space,Str "inside"],Space,Str "emph"]]
-,Header 1 ("horizontal-rule",[],[]) [Str "horizontal",Space,Str "rule"]
-,Para [Str "top"]
-,HorizontalRule
-,Para [Str "bottom"]
-,HorizontalRule
-,Header 1 ("nop",[],[]) [Str "nop"]
-,Para [Str "__not emph__"]
-,Header 1 ("entities",[],[]) [Str "entities"]
-,Para [Str "hi",Space,Str "&",Space,Str "low"]
-,Para [Str "hi",Space,Str "&",Space,Str "low"]
-,Para [Str "G\246del"]
-,Para [Str "\777\2730"]
-,Header 1 ("linebreaks",[],[]) [Str "linebreaks"]
-,Para [Str "hi",LineBreak,Str "there"]
-,Para [Str "hi",LineBreak,Str "there"]
-,Header 1 ("inline-code",[],[]) [Str "inline",Space,Str "code"]
-,Para [Code ("",[],[]) "*\8594*",Space,Code ("",[],[]) "typed",Space,Code ("",[],[]) ">>="]
-,Header 1 ("code-blocks",[],[]) [Str "code",Space,Str "blocks"]
-,CodeBlock ("",[],[]) "\ncase xs of\n     (_:_) -> reverse xs\n     []    -> ['*']\n"
-,CodeBlock ("",["haskell"],[("colors","haskell"),("ln","0")]) "\ncase xs of\n     (_:_) -> reverse xs\n     []    -> ['*']\n"
-,Header 1 ("external-links",[],[]) [Str "external",Space,Str "links"]
-,Para [Link ("",[],[]) [Emph [Str "Google"],Space,Str "search",Space,Str "engine"] ("http://google.com","")]
-,Para [Link ("",[],[]) [Str "http://pandoc.org"] ("http://pandoc.org","")]
-,Para [Link ("",[],[]) [Str "http://google.com"] ("http://google.com",""),Space,Link ("",[],[]) [Str "http://yahoo.com"] ("http://yahoo.com","")]
-,Para [Link ("",[],[]) [Str "email",Space,Str "me"] ("mailto:info@example.org","")]
-,Para [Str "http://google.com"]
-,Para [Str "info@example.org"]
-,Header 1 ("lists",[],[]) [Str "lists"]
-,BulletList
- [[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
- ,[Plain [Str "with",Space,Str "an",Space,Str "asterisk",Space,Str "(*)."]
-  ,BulletList
-   [[Plain [Str "More",Space,Str "asterisks",Space,Str "gives",Space,Str "deeper"]
-    ,BulletList
-     [[Plain [Str "and",Space,Str "deeper",Space,Str "levels."]]]]]]
- ,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels."]]
- ,[Plain [Str "Continuations",Space,Str "are",Space,Str "also",Space,Str "possible"]
-  ,BulletList
-   [[Plain [Str "and",Space,Str "do",Space,Str "not",Space,Str "break",Space,Str "the",Space,Str "list",Space,Str "flow"]]]]
- ,[Plain [Str "Level",Space,Str "one"]]]
-,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "ends",Space,Str "the",Space,Str "list."]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
- ,[Plain [Str "with",Space,Str "a",Space,Str "number",Space,Str "(1.)."]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "More",Space,Str "number",Space,Str "signs",Space,Str "gives",Space,Str "deeper"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "and",Space,Str "deeper"]]
-     ,[Plain [Str "levels."]]]]]]
- ,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels."]]
- ,[Plain [Str "Blank",Space,Str "lines"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "end",Space,Str "the",Space,Str "list",Space,Str "and",Space,Str "start",Space,Str "another."]]]
-,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "also",Space,Str "ends",Space,Str "the",Space,Str "list."]
-,DefinitionList
- [([Str "item",Space,Str "1"],
-   [[Plain [Str "definition",Space,Str "1"]]])
- ,([Str "item",Space,Str "2"],
-   [[Plain [Str "definition",Space,Str "2-1",Space,Str "definition",Space,Str "2-2"]]])
- ,([Str "item",Space,Emph [Str "3"]],
-   [[Plain [Str "definition",Space,Emph [Str "3"]]]])]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "one"]]
- ,[Plain [Str "two"]
-  ,BulletList
-   [[Plain [Str "two",Space,Str "point",Space,Str "one"]]
-   ,[Plain [Str "two",Space,Str "point",Space,Str "two"]]]]
- ,[Plain [Str "three"]]
- ,[Plain [Str "four"]]
- ,[Plain [Str "five"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "five",Space,Str "sub",Space,Str "1"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "five",Space,Str "sub",Space,Str "1",Space,Str "sub",Space,Str "1"]]]]
-   ,[Plain [Str "five",Space,Str "sub",Space,Str "2"]]]]]
-,Header 1 ("tables",[],[]) [Str "tables"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str ""]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str ""]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Apple"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Bread"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Pie"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Butter"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Ice",Space,Str "cream"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str ""]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str ""]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Apple"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Bread"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Pie"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Strong [Str "Butter"]]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Ice",Space,Str "cream"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str ""]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str ""]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Apple"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Bread",LineBreak,LineBreak,Str "and",Space,Str "cheese"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Pie",LineBreak,LineBreak,Strong [Str "apple"],Space,Str "and",Space,Emph [Str "carrot"],Space]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str ""]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str ""]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str ""]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Space,Str "Orange",Space]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Space,Str "Apple",Space]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Space,Str "more"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Space,Str "Bread",Space]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Space,Str "Pie",Space]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Space,Str "more"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Space,Str "Butter",Space]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Space,Str "Ice",Space,Str "cream",Space]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Space,Str "and",Space,Str "more",Space]]]])]
- (TableFoot ("",[],[])
- [])]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Header 1 ( "header" , [] , [] ) [ Str "header" ]
+  , Header
+      2
+      ( "header-level-two" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "two" ]
+  , Header
+      3
+      ( "header-level-3" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "3" ]
+  , Header
+      4
+      ( "header-_level_-four" , [] , [] )
+      [ Str "header"
+      , Space
+      , Str "_level_"
+      , Space
+      , Str "four"
+      ]
+  , Header
+      5
+      ( "header-level-5" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "5" ]
+  , Header
+      6
+      ( "header-level-6" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "6" ]
+  , Para
+      [ Str "!!!!!!!"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header"
+      ]
+  , Para
+      [ Str "--++"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header"
+      ]
+  , Header
+      1
+      ( "emph-and-strong" , [] , [] )
+      [ Str "emph" , Space , Str "and" , Space , Str "strong" ]
+  , Para
+      [ Emph [ Str "emph" ] , Space , Strong [ Str "strong" ] ]
+  , Para
+      [ Emph
+          [ Strong
+              [ Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "emph"
+              , Space
+              , Str "1"
+              ]
+          ]
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "emph"
+              , Space
+              , Str "2"
+              ]
+          ]
+      ]
+  , Para
+      [ Strong
+          [ Emph [ Str "emph" , Space , Str "inside" ]
+          , Space
+          , Str "strong"
+          ]
+      ]
+  , Para
+      [ Strong
+          [ Str "strong"
+          , Space
+          , Str "with"
+          , Space
+          , Emph [ Str "emph" ]
+          ]
+      ]
+  , Para
+      [ Emph
+          [ Strong [ Str "strong" , Space , Str "inside" ]
+          , Space
+          , Str "emph"
+          ]
+      ]
+  , Header
+      1
+      ( "horizontal-rule" , [] , [] )
+      [ Str "horizontal" , Space , Str "rule" ]
+  , Para [ Str "top" ]
+  , HorizontalRule
+  , Para [ Str "bottom" ]
+  , HorizontalRule
+  , Header 1 ( "nop" , [] , [] ) [ Str "nop" ]
+  , Para [ Str "__not emph__" ]
+  , Header 1 ( "entities" , [] , [] ) [ Str "entities" ]
+  , Para [ Str "hi" , Space , Str "&" , Space , Str "low" ]
+  , Para [ Str "hi" , Space , Str "&" , Space , Str "low" ]
+  , Para [ Str "G\246del" ]
+  , Para [ Str "\777\2730" ]
+  , Header 1 ( "linebreaks" , [] , [] ) [ Str "linebreaks" ]
+  , Para [ Str "hi" , LineBreak , Str "there" ]
+  , Para [ Str "hi" , LineBreak , Str "there" ]
+  , Header
+      1
+      ( "inline-code" , [] , [] )
+      [ Str "inline" , Space , Str "code" ]
+  , Para
+      [ Code ( "" , [] , [] ) "*\8594*"
+      , Space
+      , Code ( "" , [] , [] ) "typed"
+      , Space
+      , Code ( "" , [] , [] ) ">>="
+      ]
+  , Header
+      1
+      ( "code-blocks" , [] , [] )
+      [ Str "code" , Space , Str "blocks" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "\ncase xs of\n     (_:_) -> reverse xs\n     []    -> ['*']\n"
+  , CodeBlock
+      ( ""
+      , [ "haskell" ]
+      , [ ( "colors" , "haskell" ) , ( "ln" , "0" ) ]
+      )
+      "\ncase xs of\n     (_:_) -> reverse xs\n     []    -> ['*']\n"
+  , Header
+      1
+      ( "external-links" , [] , [] )
+      [ Str "external" , Space , Str "links" ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Emph [ Str "Google" ]
+          , Space
+          , Str "search"
+          , Space
+          , Str "engine"
+          ]
+          ( "http://google.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "http://pandoc.org" ]
+          ( "http://pandoc.org" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "http://google.com" ]
+          ( "http://google.com" , "" )
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://yahoo.com" ]
+          ( "http://yahoo.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "email" , Space , Str "me" ]
+          ( "mailto:info@example.org" , "" )
+      ]
+  , Para [ Str "http://google.com" ]
+  , Para [ Str "info@example.org" ]
+  , Header 1 ( "lists" , [] , [] ) [ Str "lists" ]
+  , BulletList
+      [ [ Plain
+            [ Str "Start" , Space , Str "each" , Space , Str "line" ]
+        ]
+      , [ Plain
+            [ Str "with"
+            , Space
+            , Str "an"
+            , Space
+            , Str "asterisk"
+            , Space
+            , Str "(*)."
+            ]
+        , BulletList
+            [ [ Plain
+                  [ Str "More"
+                  , Space
+                  , Str "asterisks"
+                  , Space
+                  , Str "gives"
+                  , Space
+                  , Str "deeper"
+                  ]
+              , BulletList
+                  [ [ Plain
+                        [ Str "and"
+                        , Space
+                        , Str "deeper"
+                        , Space
+                        , Str "levels."
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain
+            [ Str "Line"
+            , Space
+            , Str "breaks"
+            , LineBreak
+            , Str "don't"
+            , Space
+            , Str "break"
+            , Space
+            , Str "levels."
+            ]
+        ]
+      , [ Plain
+            [ Str "Continuations"
+            , Space
+            , Str "are"
+            , Space
+            , Str "also"
+            , Space
+            , Str "possible"
+            ]
+        , BulletList
+            [ [ Plain
+                  [ Str "and"
+                  , Space
+                  , Str "do"
+                  , Space
+                  , Str "not"
+                  , Space
+                  , Str "break"
+                  , Space
+                  , Str "the"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "flow"
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain [ Str "Level" , Space , Str "one" ] ]
+      ]
+  , Para
+      [ Str "Any"
+      , Space
+      , Str "other"
+      , Space
+      , Str "start"
+      , Space
+      , Str "ends"
+      , Space
+      , Str "the"
+      , Space
+      , Str "list."
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Start" , Space , Str "each" , Space , Str "line" ]
+        ]
+      , [ Plain
+            [ Str "with"
+            , Space
+            , Str "a"
+            , Space
+            , Str "number"
+            , Space
+            , Str "(1.)."
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Str "More"
+                  , Space
+                  , Str "number"
+                  , Space
+                  , Str "signs"
+                  , Space
+                  , Str "gives"
+                  , Space
+                  , Str "deeper"
+                  ]
+              , OrderedList
+                  ( 1 , DefaultStyle , DefaultDelim )
+                  [ [ Plain [ Str "and" , Space , Str "deeper" ] ]
+                  , [ Plain [ Str "levels." ] ]
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain
+            [ Str "Line"
+            , Space
+            , Str "breaks"
+            , LineBreak
+            , Str "don't"
+            , Space
+            , Str "break"
+            , Space
+            , Str "levels."
+            ]
+        ]
+      , [ Plain [ Str "Blank" , Space , Str "lines" ] ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "end"
+            , Space
+            , Str "the"
+            , Space
+            , Str "list"
+            , Space
+            , Str "and"
+            , Space
+            , Str "start"
+            , Space
+            , Str "another."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Any"
+      , Space
+      , Str "other"
+      , Space
+      , Str "start"
+      , Space
+      , Str "also"
+      , Space
+      , Str "ends"
+      , Space
+      , Str "the"
+      , Space
+      , Str "list."
+      ]
+  , DefinitionList
+      [ ( [ Str "item" , Space , Str "1" ]
+        , [ [ Plain [ Str "definition" , Space , Str "1" ] ] ]
+        )
+      , ( [ Str "item" , Space , Str "2" ]
+        , [ [ Plain
+                [ Str "definition"
+                , Space
+                , Str "2-1"
+                , Space
+                , Str "definition"
+                , Space
+                , Str "2-2"
+                ]
+            ]
+          ]
+        )
+      , ( [ Str "item" , Space , Emph [ Str "3" ] ]
+        , [ [ Plain [ Str "definition" , Space , Emph [ Str "3" ] ]
+            ]
+          ]
+        )
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "one" ] ]
+      , [ Plain [ Str "two" ]
+        , BulletList
+            [ [ Plain
+                  [ Str "two"
+                  , Space
+                  , Str "point"
+                  , Space
+                  , Str "one"
+                  ]
+              ]
+            , [ Plain
+                  [ Str "two"
+                  , Space
+                  , Str "point"
+                  , Space
+                  , Str "two"
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain [ Str "three" ] ]
+      , [ Plain [ Str "four" ] ]
+      , [ Plain [ Str "five" ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Str "five" , Space , Str "sub" , Space , Str "1" ]
+              , OrderedList
+                  ( 1 , DefaultStyle , DefaultDelim )
+                  [ [ Plain
+                        [ Str "five"
+                        , Space
+                        , Str "sub"
+                        , Space
+                        , Str "1"
+                        , Space
+                        , Str "sub"
+                        , Space
+                        , Str "1"
+                        ]
+                    ]
+                  ]
+              ]
+            , [ Plain
+                  [ Str "five" , Space , Str "sub" , Space , Str "2" ]
+              ]
+            ]
+        ]
+      ]
+  , Header 1 ( "tables" , [] , [] ) [ Str "tables" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Orange" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Apple" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Bread" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Pie" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Butter" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Ice" , Space , Str "cream" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Orange" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Apple" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Bread" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Pie" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Strong [ Str "Butter" ] ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Ice" , Space , Str "cream" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Orange" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Apple" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Bread"
+                      , LineBreak
+                      , LineBreak
+                      , Str "and"
+                      , Space
+                      , Str "cheese"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Pie"
+                      , LineBreak
+                      , LineBreak
+                      , Strong [ Str "apple" ]
+                      , Space
+                      , Str "and"
+                      , Space
+                      , Emph [ Str "carrot" ]
+                      , Space
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Space , Str "Orange" , Space ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Space , Str "Apple" , Space ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Space , Str "more" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Space , Str "Bread" , Space ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Space , Str "Pie" , Space ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Space , Str "more" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Space , Str "Butter" , Space ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Space
+                      , Str "Ice"
+                      , Space
+                      , Str "cream"
+                      , Space
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Space , Str "and" , Space , Str "more" , Space ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  ]
diff --git a/test/twiki-reader.native b/test/twiki-reader.native
--- a/test/twiki-reader.native
+++ b/test/twiki-reader.native
@@ -1,250 +1,863 @@
-Pandoc (Meta {unMeta = fromList []})
-[Header 1 ("header",[],[]) [Str "header"]
-,Header 2 ("header-level-two",[],[]) [Str "header",Space,Str "level",Space,Str "two"]
-,Header 3 ("header-level-3",[],[]) [Str "header",Space,Str "level",Space,Str "3"]
-,Header 4 ("header-level-four",[],[]) [Str "header",Space,Emph [Str "level"],Space,Str "four"]
-,Header 5 ("header-level-5",[],[]) [Str "header",Space,Str "level",Space,Str "5"]
-,Header 6 ("header-level-6",[],[]) [Str "header",Space,Str "level",Space,Str "6"]
-,Para [Str "---+++++++",Space,Str "not",Space,Str "a",Space,Str "header"]
-,Para [Str "--++",Space,Str "not",Space,Str "a",Space,Str "header"]
-,Header 1 ("emph-and-strong",[],[]) [Str "emph",Space,Str "and",Space,Str "strong"]
-,Para [Emph [Str "emph"],Space,Strong [Str "strong"]]
-,Para [Emph [Strong [Str "strong",Space,Str "and",Space,Str "emph"]]]
-,Para [Strong [Emph [Str "emph",Space,Str "inside"],Space,Str "strong"]]
-,Para [Strong [Str "strong",Space,Str "with",Space,Emph [Str "emph"]]]
-,Para [Emph [Strong [Str "strong",Space,Str "inside"],Space,Str "emph"]]
-,Header 1 ("horizontal-rule",[],[]) [Str "horizontal",Space,Str "rule"]
-,Para [Str "top"]
-,HorizontalRule
-,Para [Str "bottom"]
-,HorizontalRule
-,Header 1 ("nop",[],[]) [Str "nop"]
-,Para [Str "_not",Space,Str "emph_"]
-,Header 1 ("entities",[],[]) [Str "entities"]
-,Para [Str "hi",Space,Str "&",Space,Str "low"]
-,Para [Str "hi",Space,Str "&",Space,Str "low"]
-,Para [Str "G\246del"]
-,Para [Str "\777\2730"]
-,Header 1 ("comments",[],[]) [Str "comments"]
-,Para [Str "inline",Space,Str "comment"]
-,Para [Str "between",Space,Str "blocks"]
-,Header 1 ("linebreaks",[],[]) [Str "linebreaks"]
-,Para [Str "hi",LineBreak,Str "there"]
-,Para [Str "hi",LineBreak,Str "there"]
-,Header 1 ("inline-code",[],[]) [Str "inline",Space,Str "code"]
-,Para [Code ("",[],[]) "*\8594*",Space,Code ("",[],[]) "typed",Space,Code ("",["haskell"],[]) ">>="]
-,Header 1 ("code-blocks",[],[]) [Str "code",Space,Str "blocks"]
-,CodeBlock ("",[],[]) "case xs of\n     (_:_) -> reverse xs\n     []    -> ['*']"
-,CodeBlock ("",["haskell"],[]) "case xs of\n     (_:_) -> reverse xs\n     []    -> ['*']"
-,Header 1 ("block-quotes",[],[]) [Str "block",Space,Str "quotes"]
-,Para [Str "Regular",Space,Str "paragraph"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote."]
- ,Para [Str "With",Space,Str "two",Space,Str "paragraphs."]]
-,Para [Str "Nother",Space,Str "paragraph."]
-,Header 1 ("external-links",[],[]) [Str "external",Space,Str "links"]
-,Para [Link ("",[],[]) [Emph [Str "Google"],Space,Str "search",Space,Str "engine"] ("http://google.com","")]
-,Para [Link ("",[],[]) [Str "http://pandoc.org"] ("http://pandoc.org","")]
-,Para [Link ("",[],[]) [Str "http://google.com"] ("http://google.com",""),Space,Link ("",[],[]) [Str "http://yahoo.com"] ("http://yahoo.com","")]
-,Para [Link ("",[],[]) [Str "email",Space,Str "me"] ("mailto:info@example.org","")]
-,Para [Str "http://google.com"]
-,Para [Str "http://google.com"]
-,Para [Str "http://google.com"]
-,Para [Str "info@example.org"]
-,Para [Str "info@example.org"]
-,Para [Str "info@example.org"]
-,Header 1 ("lists",[],[]) [Str "lists"]
-,BulletList
- [[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
- ,[Plain [Str "with",Space,Str "an",Space,Str "asterisk",Space,Str "(*)."]
-  ,BulletList
-   [[Plain [Str "More",Space,Str "asterisks",Space,Str "gives",Space,Str "deeper"]
-    ,BulletList
-     [[Plain [Str "and",Space,Str "deeper",Space,Str "levels."]]]]]]
- ,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels."]]
- ,[Plain [Str "Continuations",Space,Str "are",Space,Str "also",Space,Str "possible"]
-  ,BulletList
-   [[Plain [Str "and",Space,Str "do",Space,Str "not",Space,Str "break",Space,Str "the",Space,Str "list",Space,Str "flow"]]]]
- ,[Plain [Str "Level",Space,Str "one"]]]
-,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "ends",Space,Str "the",Space,Str "list."]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
- ,[Plain [Str "with",Space,Str "a",Space,Str "number",Space,Str "(1.)."]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "More",Space,Str "number",Space,Str "signs",Space,Str "gives",Space,Str "deeper"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "and",Space,Str "deeper"]]
-     ,[Plain [Str "levels."]]]]]]
- ,[Plain [Str "Line",Space,Str "breaks",LineBreak,Str "don't",Space,Str "break",Space,Str "levels."]]
- ,[Plain [Str "Blank",Space,Str "lines"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "end",Space,Str "the",Space,Str "list",Space,Str "and",Space,Str "start",Space,Str "another."]]]
-,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "also",Space,Str "ends",Space,Str "the",Space,Str "list."]
-,DefinitionList
- [([Str "item",Space,Str "1"],
-   [[Plain [Str "definition",Space,Str "1"]]])
- ,([Str "item",Space,Str "2"],
-   [[Plain [Str "definition",Space,Str "2-1",Space,Str "definition",Space,Str "2-2"]]])
- ,([Str "item",Space,Emph [Str "3"]],
-   [[Plain [Str "definition",Space,Emph [Str "3"]]]])]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "one"]]
- ,[Plain [Str "two"]
-  ,BulletList
-   [[Plain [Str "two",Space,Str "point",Space,Str "one"]]
-   ,[Plain [Str "two",Space,Str "point",Space,Str "two"]]]]
- ,[Plain [Str "three"]
-  ,DefinitionList
-   [([Str "three",Space,Str "item",Space,Str "one"],
-     [[Plain [Str "three",Space,Str "def",Space,Str "one"]]])]]
- ,[Plain [Str "four"]
-  ,DefinitionList
-   [([Str "four",Space,Str "def",Space,Str "one"],
-     [[Plain [Str "this",Space,Str "is",Space,Str "a",Space,Str "continuation"]]])]]
- ,[Plain [Str "five"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "five",Space,Str "sub",Space,Str "1"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "five",Space,Str "sub",Space,Str "1",Space,Str "sub",Space,Str "1"]]]]
-   ,[Plain [Str "five",Space,Str "sub",Space,Str "2"]]]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "other"]
-  ,OrderedList (1,UpperRoman,DefaultDelim)
-   [[Plain [Str "list"]]
-   ,[Plain [Str "styles"]]]]
- ,[Plain [Str "are"]
-  ,OrderedList (1,LowerRoman,DefaultDelim)
-   [[Plain [Str "also"]]
-   ,[Plain [Str "possible"]]]]
- ,[Plain [Str "all"]
-  ,OrderedList (1,LowerAlpha,DefaultDelim)
-   [[Plain [Str "the"]]
-   ,[Plain [Str "different"]]
-   ,[Plain [Str "styles"]]]]
- ,[Plain [Str "are"]
-  ,OrderedList (1,UpperAlpha,DefaultDelim)
-   [[Plain [Str "implemented"]]
-   ,[Plain [Str "and"]]
-   ,[Plain [Str "supported"]]]]]
-,Header 1 ("tables",[],[]) [Str "tables"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Apple"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Bread"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Pie"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Butter"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Ice",Space,Str "cream"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Orange"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Apple"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Bread"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Pie"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Strong [Str "Butter"]]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Ice",Space,Str "cream"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignLeft,ColWidthDefault)
- ,(AlignLeft,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Orange"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Apple"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Bread",LineBreak,LineBreak,Str "and",Space,Str "cheese"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Pie",LineBreak,LineBreak,Strong [Str "apple"],Space,Str "and",Space,Emph [Str "carrot"]]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Orange"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Apple"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "more"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Bread"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Pie"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "more"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Butter"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Ice",Space,Str "cream"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "and",Space,Str "more"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 1 ("macros",[],[]) [Str "macros"]
-,Para [Span ("",["twiki-macro","TEST"],[]) []]
-,Para [Span ("",["twiki-macro","TEST"],[]) [Str ""]]
-,Para [Span ("",["twiki-macro","TEST"],[]) [Str "content with spaces"]]
-,Para [Span ("",["twiki-macro","TEST"],[]) [Str "content with spaces"]]
-,Para [Span ("",["twiki-macro","TEST"],[("ARG1","test")]) [Str "content with spaces"]]
-,Para [Span ("",["twiki-macro","TEST"],[]) [Str "content with spaces ARG1=test"]]
-,Para [Span ("",["twiki-macro","TEST"],[("ARG1","test")]) [Str "content with spaces"]]
-,Para [Span ("",["twiki-macro","TEST"],[("ARG1","test"),("ARG2","test2")]) [Str ""]]
-,Para [Span ("",["twiki-macro","TEST"],[("ARG1","test"),("ARG2","test2")]) [Str ""]]
-,Para [Span ("",["twiki-macro","TEST"],[("ARG1","test"),("ARG2","test2")]) [Str "multiline\ndoes also work"]]]
+Pandoc
+  Meta { unMeta = fromList [] }
+  [ Header 1 ( "header" , [] , [] ) [ Str "header" ]
+  , Header
+      2
+      ( "header-level-two" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "two" ]
+  , Header
+      3
+      ( "header-level-3" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "3" ]
+  , Header
+      4
+      ( "header-level-four" , [] , [] )
+      [ Str "header"
+      , Space
+      , Emph [ Str "level" ]
+      , Space
+      , Str "four"
+      ]
+  , Header
+      5
+      ( "header-level-5" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "5" ]
+  , Header
+      6
+      ( "header-level-6" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "6" ]
+  , Para
+      [ Str "---+++++++"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header"
+      ]
+  , Para
+      [ Str "--++"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header"
+      ]
+  , Header
+      1
+      ( "emph-and-strong" , [] , [] )
+      [ Str "emph" , Space , Str "and" , Space , Str "strong" ]
+  , Para
+      [ Emph [ Str "emph" ] , Space , Strong [ Str "strong" ] ]
+  , Para
+      [ Emph
+          [ Strong
+              [ Str "strong" , Space , Str "and" , Space , Str "emph" ]
+          ]
+      ]
+  , Para
+      [ Strong
+          [ Emph [ Str "emph" , Space , Str "inside" ]
+          , Space
+          , Str "strong"
+          ]
+      ]
+  , Para
+      [ Strong
+          [ Str "strong"
+          , Space
+          , Str "with"
+          , Space
+          , Emph [ Str "emph" ]
+          ]
+      ]
+  , Para
+      [ Emph
+          [ Strong [ Str "strong" , Space , Str "inside" ]
+          , Space
+          , Str "emph"
+          ]
+      ]
+  , Header
+      1
+      ( "horizontal-rule" , [] , [] )
+      [ Str "horizontal" , Space , Str "rule" ]
+  , Para [ Str "top" ]
+  , HorizontalRule
+  , Para [ Str "bottom" ]
+  , HorizontalRule
+  , Header 1 ( "nop" , [] , [] ) [ Str "nop" ]
+  , Para [ Str "_not" , Space , Str "emph_" ]
+  , Header 1 ( "entities" , [] , [] ) [ Str "entities" ]
+  , Para [ Str "hi" , Space , Str "&" , Space , Str "low" ]
+  , Para [ Str "hi" , Space , Str "&" , Space , Str "low" ]
+  , Para [ Str "G\246del" ]
+  , Para [ Str "\777\2730" ]
+  , Header 1 ( "comments" , [] , [] ) [ Str "comments" ]
+  , Para [ Str "inline" , Space , Str "comment" ]
+  , Para [ Str "between" , Space , Str "blocks" ]
+  , Header 1 ( "linebreaks" , [] , [] ) [ Str "linebreaks" ]
+  , Para [ Str "hi" , LineBreak , Str "there" ]
+  , Para [ Str "hi" , LineBreak , Str "there" ]
+  , Header
+      1
+      ( "inline-code" , [] , [] )
+      [ Str "inline" , Space , Str "code" ]
+  , Para
+      [ Code ( "" , [] , [] ) "*\8594*"
+      , Space
+      , Code ( "" , [] , [] ) "typed"
+      , Space
+      , Code ( "" , [ "haskell" ] , [] ) ">>="
+      ]
+  , Header
+      1
+      ( "code-blocks" , [] , [] )
+      [ Str "code" , Space , Str "blocks" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "case xs of\n     (_:_) -> reverse xs\n     []    -> ['*']"
+  , CodeBlock
+      ( "" , [ "haskell" ] , [] )
+      "case xs of\n     (_:_) -> reverse xs\n     []    -> ['*']"
+  , Header
+      1
+      ( "block-quotes" , [] , [] )
+      [ Str "block" , Space , Str "quotes" ]
+  , Para [ Str "Regular" , Space , Str "paragraph" ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          ]
+      , Para
+          [ Str "With"
+          , Space
+          , Str "two"
+          , Space
+          , Str "paragraphs."
+          ]
+      ]
+  , Para [ Str "Nother" , Space , Str "paragraph." ]
+  , Header
+      1
+      ( "external-links" , [] , [] )
+      [ Str "external" , Space , Str "links" ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Emph [ Str "Google" ]
+          , Space
+          , Str "search"
+          , Space
+          , Str "engine"
+          ]
+          ( "http://google.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "http://pandoc.org" ]
+          ( "http://pandoc.org" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "http://google.com" ]
+          ( "http://google.com" , "" )
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://yahoo.com" ]
+          ( "http://yahoo.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "email" , Space , Str "me" ]
+          ( "mailto:info@example.org" , "" )
+      ]
+  , Para [ Str "http://google.com" ]
+  , Para [ Str "http://google.com" ]
+  , Para [ Str "http://google.com" ]
+  , Para [ Str "info@example.org" ]
+  , Para [ Str "info@example.org" ]
+  , Para [ Str "info@example.org" ]
+  , Header 1 ( "lists" , [] , [] ) [ Str "lists" ]
+  , BulletList
+      [ [ Plain
+            [ Str "Start" , Space , Str "each" , Space , Str "line" ]
+        ]
+      , [ Plain
+            [ Str "with"
+            , Space
+            , Str "an"
+            , Space
+            , Str "asterisk"
+            , Space
+            , Str "(*)."
+            ]
+        , BulletList
+            [ [ Plain
+                  [ Str "More"
+                  , Space
+                  , Str "asterisks"
+                  , Space
+                  , Str "gives"
+                  , Space
+                  , Str "deeper"
+                  ]
+              , BulletList
+                  [ [ Plain
+                        [ Str "and"
+                        , Space
+                        , Str "deeper"
+                        , Space
+                        , Str "levels."
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain
+            [ Str "Line"
+            , Space
+            , Str "breaks"
+            , LineBreak
+            , Str "don't"
+            , Space
+            , Str "break"
+            , Space
+            , Str "levels."
+            ]
+        ]
+      , [ Plain
+            [ Str "Continuations"
+            , Space
+            , Str "are"
+            , Space
+            , Str "also"
+            , Space
+            , Str "possible"
+            ]
+        , BulletList
+            [ [ Plain
+                  [ Str "and"
+                  , Space
+                  , Str "do"
+                  , Space
+                  , Str "not"
+                  , Space
+                  , Str "break"
+                  , Space
+                  , Str "the"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "flow"
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain [ Str "Level" , Space , Str "one" ] ]
+      ]
+  , Para
+      [ Str "Any"
+      , Space
+      , Str "other"
+      , Space
+      , Str "start"
+      , Space
+      , Str "ends"
+      , Space
+      , Str "the"
+      , Space
+      , Str "list."
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Start" , Space , Str "each" , Space , Str "line" ]
+        ]
+      , [ Plain
+            [ Str "with"
+            , Space
+            , Str "a"
+            , Space
+            , Str "number"
+            , Space
+            , Str "(1.)."
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Str "More"
+                  , Space
+                  , Str "number"
+                  , Space
+                  , Str "signs"
+                  , Space
+                  , Str "gives"
+                  , Space
+                  , Str "deeper"
+                  ]
+              , OrderedList
+                  ( 1 , DefaultStyle , DefaultDelim )
+                  [ [ Plain [ Str "and" , Space , Str "deeper" ] ]
+                  , [ Plain [ Str "levels." ] ]
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain
+            [ Str "Line"
+            , Space
+            , Str "breaks"
+            , LineBreak
+            , Str "don't"
+            , Space
+            , Str "break"
+            , Space
+            , Str "levels."
+            ]
+        ]
+      , [ Plain [ Str "Blank" , Space , Str "lines" ] ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "end"
+            , Space
+            , Str "the"
+            , Space
+            , Str "list"
+            , Space
+            , Str "and"
+            , Space
+            , Str "start"
+            , Space
+            , Str "another."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Any"
+      , Space
+      , Str "other"
+      , Space
+      , Str "start"
+      , Space
+      , Str "also"
+      , Space
+      , Str "ends"
+      , Space
+      , Str "the"
+      , Space
+      , Str "list."
+      ]
+  , DefinitionList
+      [ ( [ Str "item" , Space , Str "1" ]
+        , [ [ Plain [ Str "definition" , Space , Str "1" ] ] ]
+        )
+      , ( [ Str "item" , Space , Str "2" ]
+        , [ [ Plain
+                [ Str "definition"
+                , Space
+                , Str "2-1"
+                , Space
+                , Str "definition"
+                , Space
+                , Str "2-2"
+                ]
+            ]
+          ]
+        )
+      , ( [ Str "item" , Space , Emph [ Str "3" ] ]
+        , [ [ Plain [ Str "definition" , Space , Emph [ Str "3" ] ]
+            ]
+          ]
+        )
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "one" ] ]
+      , [ Plain [ Str "two" ]
+        , BulletList
+            [ [ Plain
+                  [ Str "two"
+                  , Space
+                  , Str "point"
+                  , Space
+                  , Str "one"
+                  ]
+              ]
+            , [ Plain
+                  [ Str "two"
+                  , Space
+                  , Str "point"
+                  , Space
+                  , Str "two"
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain [ Str "three" ]
+        , DefinitionList
+            [ ( [ Str "three" , Space , Str "item" , Space , Str "one" ]
+              , [ [ Plain
+                      [ Str "three"
+                      , Space
+                      , Str "def"
+                      , Space
+                      , Str "one"
+                      ]
+                  ]
+                ]
+              )
+            ]
+        ]
+      , [ Plain [ Str "four" ]
+        , DefinitionList
+            [ ( [ Str "four" , Space , Str "def" , Space , Str "one" ]
+              , [ [ Plain
+                      [ Str "this"
+                      , Space
+                      , Str "is"
+                      , Space
+                      , Str "a"
+                      , Space
+                      , Str "continuation"
+                      ]
+                  ]
+                ]
+              )
+            ]
+        ]
+      , [ Plain [ Str "five" ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Str "five" , Space , Str "sub" , Space , Str "1" ]
+              , OrderedList
+                  ( 1 , DefaultStyle , DefaultDelim )
+                  [ [ Plain
+                        [ Str "five"
+                        , Space
+                        , Str "sub"
+                        , Space
+                        , Str "1"
+                        , Space
+                        , Str "sub"
+                        , Space
+                        , Str "1"
+                        ]
+                    ]
+                  ]
+              ]
+            , [ Plain
+                  [ Str "five" , Space , Str "sub" , Space , Str "2" ]
+              ]
+            ]
+        ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "other" ]
+        , OrderedList
+            ( 1 , UpperRoman , DefaultDelim )
+            [ [ Plain [ Str "list" ] ] , [ Plain [ Str "styles" ] ] ]
+        ]
+      , [ Plain [ Str "are" ]
+        , OrderedList
+            ( 1 , LowerRoman , DefaultDelim )
+            [ [ Plain [ Str "also" ] ] , [ Plain [ Str "possible" ] ] ]
+        ]
+      , [ Plain [ Str "all" ]
+        , OrderedList
+            ( 1 , LowerAlpha , DefaultDelim )
+            [ [ Plain [ Str "the" ] ]
+            , [ Plain [ Str "different" ] ]
+            , [ Plain [ Str "styles" ] ]
+            ]
+        ]
+      , [ Plain [ Str "are" ]
+        , OrderedList
+            ( 1 , UpperAlpha , DefaultDelim )
+            [ [ Plain [ Str "implemented" ] ]
+            , [ Plain [ Str "and" ] ]
+            , [ Plain [ Str "supported" ] ]
+            ]
+        ]
+      ]
+  , Header 1 ( "tables" , [] , [] ) [ Str "tables" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Orange" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Apple" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Bread" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Pie" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Butter" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Ice" , Space , Str "cream" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Orange" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Apple" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Bread" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Pie" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Strong [ Str "Butter" ] ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Ice" , Space , Str "cream" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignLeft , ColWidthDefault )
+      , ( AlignLeft , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Orange" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Apple" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Bread"
+                      , LineBreak
+                      , LineBreak
+                      , Str "and"
+                      , Space
+                      , Str "cheese"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "Pie"
+                      , LineBreak
+                      , LineBreak
+                      , Strong [ Str "apple" ]
+                      , Space
+                      , Str "and"
+                      , Space
+                      , Emph [ Str "carrot" ]
+                      ]
+                  ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Orange" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Apple" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "more" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Bread" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Pie" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "more" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Butter" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Ice" , Space , Str "cream" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "and" , Space , Str "more" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header 1 ( "macros" , [] , [] ) [ Str "macros" ]
+  , Para [ Span ( "" , [ "twiki-macro" , "TEST" ] , [] ) [] ]
+  , Para
+      [ Span ( "" , [ "twiki-macro" , "TEST" ] , [] ) [ Str "" ] ]
+  , Para
+      [ Span
+          ( "" , [ "twiki-macro" , "TEST" ] , [] )
+          [ Str "content with spaces" ]
+      ]
+  , Para
+      [ Span
+          ( "" , [ "twiki-macro" , "TEST" ] , [] )
+          [ Str "content with spaces" ]
+      ]
+  , Para
+      [ Span
+          ( ""
+          , [ "twiki-macro" , "TEST" ]
+          , [ ( "ARG1" , "test" ) ]
+          )
+          [ Str "content with spaces" ]
+      ]
+  , Para
+      [ Span
+          ( "" , [ "twiki-macro" , "TEST" ] , [] )
+          [ Str "content with spaces ARG1=test" ]
+      ]
+  , Para
+      [ Span
+          ( ""
+          , [ "twiki-macro" , "TEST" ]
+          , [ ( "ARG1" , "test" ) ]
+          )
+          [ Str "content with spaces" ]
+      ]
+  , Para
+      [ Span
+          ( ""
+          , [ "twiki-macro" , "TEST" ]
+          , [ ( "ARG1" , "test" ) , ( "ARG2" , "test2" ) ]
+          )
+          [ Str "" ]
+      ]
+  , Para
+      [ Span
+          ( ""
+          , [ "twiki-macro" , "TEST" ]
+          , [ ( "ARG1" , "test" ) , ( "ARG2" , "test2" ) ]
+          )
+          [ Str "" ]
+      ]
+  , Para
+      [ Span
+          ( ""
+          , [ "twiki-macro" , "TEST" ]
+          , [ ( "ARG1" , "test" ) , ( "ARG2" , "test2" ) ]
+          )
+          [ Str "multiline\ndoes also work" ]
+      ]
+  ]
diff --git a/test/txt2tags.native b/test/txt2tags.native
--- a/test/txt2tags.native
+++ b/test/txt2tags.native
@@ -1,968 +1,5299 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "author"]]),("date",MetaInlines [Str "date"]),("includeconf",MetaString "rules.conf"),("title",MetaInlines [Str "Txt2tags",Space,Str "Markup",Space,Str "Rules"])]})
-[Para [Str "This",Space,Str "document",Space,Str "describes",Space,Str "all",Space,Str "the",Space,Str "details",Space,Str "about",Space,Str "each",Space,Str "txt2tags",Space,Str "mark.",SoftBreak,Str "The",Space,Str "target",Space,Str "audience",Space,Str "are",Space,Strong [Str "experienced"],Space,Str "users.",Space,Str "You",Space,Str "may",Space,Str "find",Space,Str "it",SoftBreak,Str "useful",Space,Str "if",Space,Str "you",Space,Str "want",Space,Str "to",Space,Str "master",Space,Str "the",Space,Str "marks",Space,Str "or",Space,Str "solve",Space,Str "a",Space,Str "specific",Space,Str "problem",SoftBreak,Str "about",Space,Str "a",Space,Str "mark."]
-,Para [Str "If",Space,Str "you",Space,Str "are",Space,Str "new",Space,Str "to",Space,Str "txt2tags",Space,Str "or",Space,Str "just",Space,Str "want",Space,Str "to",Space,Str "know",Space,Str "which",Space,Str "are",Space,Str "the",SoftBreak,Str "available",Space,Str "marks,",Space,Str "please",Space,Str "read",Space,Str "the",Space,Link ("",[],[]) [Str "Markup",Space,Str "Demo"] ("MARKUPDEMO",""),Str "."]
-,Para [Str "Note",Space,Str "1:",Space,Str "This",Space,Str "document",Space,Str "is",Space,Str "generated",Space,Str "directly",Space,Str "from",Space,Str "the",Space,Str "txt2tags",SoftBreak,Str "test-suite.",Space,Str "All",Space,Str "the",Space,Str "rules",Space,Str "mentioned",Space,Str "here",Space,Str "are",Space,Str "100%",Space,Str "in",Space,Str "sync",Space,Str "with",Space,Str "the",SoftBreak,Str "current",Space,Str "program",Space,Str "code."]
-,Para [Str "Note",Space,Str "2:",Space,Str "A",Space,Str "good",Space,Str "practice",Space,Str "is",Space,Str "to",Space,Str "consult",Space,Link ("",[],[]) [Str "the",Space,Str "sources"] ("rules.t2t",""),Space,Str "when",SoftBreak,Str "reading,",Space,Str "to",Space,Str "see",Space,Str "how",Space,Str "the",Space,Str "texts",Space,Str "were",Space,Str "made."]
-,Para [Str "Table",Space,Str "of",Space,Str "Contents:"]
-,HorizontalRule
-,Header 1 ("paragraph",[],[]) [Str "Paragraph"]
-,Para [Str "A",Space,Str "paragraph",Space,Str "is",Space,Str "composed",Space,Str "by",Space,Str "one",Space,Str "or",Space,Str "more",Space,Str "lines.",SoftBreak,Str "A",Space,Str "blank",Space,Str "line",Space,Str "(or",Space,Str "a",Space,Str "table,",Space,Str "or",Space,Str "a",Space,Str "list)",Space,Str "ends",Space,Str "the",SoftBreak,Str "current",Space,Str "paragraph."]
-,Para [Str "Leading",Space,Str "and",Space,Str "trailing",Space,Str "spaces",Space,Str "are",Space,Str "ignored."]
-,Para [Str "A",Space,Str "comment",Space,Str "line",Space,Str "can",Space,Str "be",Space,Str "placed",Space,Str "inside",Space,Str "a",Space,Str "paragraph.",SoftBreak,Str "It",Space,Str "will",Space,Str "not",Space,Str "affect",Space,Str "it."]
-,Para [Str "The",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "file",Space,Str "(EOF)",Space,Str "closes",Space,Str "the",SoftBreak,Str "currently",Space,Str "open",Space,Str "paragraph."]
-,Header 1 ("comment",[],[]) [Str "Comment"]
-,Para [Str "%",Space,Str "not",Space,Str "on",Space,Str "the",Space,Str "line",Space,Str "beginning",Space,Str "(at",Space,Str "column",Space,Str "2)"]
-,Para [Str "some",Space,Str "text",Space,Str "%",Space,Str "half",Space,Str "line",Space,Str "comments",Space,Str "are",Space,Str "not",Space,Str "allowed"]
-,Header 1 ("line",[],[]) [Str "Line"]
-,HorizontalRule
-,HorizontalRule
-,HorizontalRule
-,HorizontalRule
-,HorizontalRule
-,HorizontalRule
-,HorizontalRule
-,HorizontalRule
-,HorizontalRule
-,HorizontalRule
-,HorizontalRule
-,Para [Strikeout [Str "-----"],SoftBreak,Strikeout [Str "-------",Space,Str "--------"]]
-,Para [Strikeout [Str "-------+--------"]]
-,Para [Str "(",Space,Strikeout [Str "----------------"],Space,Str ")"]
-,Header 1 ("inline",[],[]) [Str "Inline"]
-,Para [Str "i)",Space,Strong [Str "b"],Space,Emph [Str "i"],Space,Underline [Str "u"],Space,Strikeout [Str "s"],Space,Code ("",[],[]) "m",Space,Str "r",Space,RawInline (Format "html") "t",SoftBreak,Str "i)",Space,Strong [Str "bo"],Space,Emph [Str "it"],Space,Underline [Str "un"],Space,Strikeout [Str "st"],Space,Code ("",[],[]) "mo",Space,Str "ra",Space,RawInline (Format "html") "tg",SoftBreak,Str "i)",Space,Strong [Str "bold"],Space,Emph [Str "ital"],Space,Underline [Str "undr"],Space,Strikeout [Str "strk"],Space,Code ("",[],[]) "mono",Space,Str "raw",Space,RawInline (Format "html") "tggd",SoftBreak,Str "i)",Space,Strong [Str "bo",Space,Str "ld"],Space,Emph [Str "it",Space,Str "al"],Space,Underline [Str "un",Space,Str "dr"],Space,Strikeout [Str "st",Space,Str "rk"],Space,Code ("",[],[]) "mo no",Space,Str "r",Space,Str "aw",Space,RawInline (Format "html") "tg gd",SoftBreak,Str "i)",Space,Strong [Str "bo",Space,Str "*",Space,Str "ld"],Space,Emph [Str "it",Space,Str "/",Space,Str "al"],Space,Underline [Str "un",Space,Str "_",Space,Str "dr"],Space,Strikeout [Str "st",Space,Str "-",Space,Str "rk"],Space,Code ("",[],[]) "mo ` no",Space,Str "r",Space,Str "\"",Space,Str "aw",Space,RawInline (Format "html") "tg ' gd",SoftBreak,Str "i)",Space,Strong [Str "bo",Space,Str "**ld"],Space,Emph [Str "it",Space,Str "//al"],Space,Underline [Str "un",Space,Str "__dr"],Space,Strikeout [Str "st",Space,Str "--rk"],Space,Code ("",[],[]) "mo ``no",Space,Str "r",Space,Str "\"\"aw",Space,RawInline (Format "html") "tg ''gd",SoftBreak,Str "i)",Space,Strong [Str "bo",Space,Str "**",Space,Str "ld"],Space,Emph [Str "it",Space,Str "//",Space,Str "al"],Space,Underline [Str "un",Space,Str "__",Space,Str "dr"],Space,Strikeout [Str "st",Space,Str "--",Space,Str "rk"],Space,Code ("",[],[]) "mo `` no",Space,Str "r",Space,Str "\"\"",Space,Str "aw",Space,RawInline (Format "html") "tg '' gd",SoftBreak,Str "i)",Space,Strong [Str "**bold**"],Space,Emph [Str "//ital//"],Space,Underline [Str "__undr__"],Space,Strikeout [Str "--strk--"],Space,Code ("",[],[]) "``mono``",Space,Str "\"\"raw\"\"",Space,RawInline (Format "html") "''tggd''",SoftBreak,Str "i)",Space,Strong [Str "*bold*"],Space,Emph [Str "/ital/"],Space,Underline [Str "_undr_"],Space,Strikeout [Str "-strk-"],Space,Code ("",[],[]) "`mono`",Space,Str "\"raw\"",Space,RawInline (Format "html") "'tggd'"]
-,Para [Str "i)",Space,Strong [Str "*"],Space,Emph [Str "/"],Space,Underline [Str "_"],Space,Strikeout [Str "-"],Space,Code ("",[],[]) "`",Space,Str "\"",Space,RawInline (Format "html") "'",SoftBreak,Str "i)",Space,Strong [Str "**"],Space,Emph [Str "//"],Space,Underline [Str "__"],Space,Strikeout [Str "--"],Space,Code ("",[],[]) "``",Space,Str "\"\"",Space,RawInline (Format "html") "''",SoftBreak,Str "i)",Space,Strong [Str "***"],Space,Emph [Str "///"],Space,Underline [Str "___"],Space,Strikeout [Str "---"],Space,Code ("",[],[]) "```",Space,Str "\"\"\"",Space,RawInline (Format "html") "'''",SoftBreak,Str "i)",Space,Strong [Str "****"],Space,Emph [Str "////"],Space,Underline [Str "____"],Space,Strikeout [Str "----"],Space,Code ("",[],[]) "````",Space,Str "\"\"\"\"",Space,RawInline (Format "html") "''''",SoftBreak,Str "i)",Space,Strong [Str "*****"],Space,Emph [Str "/////"],Space,Underline [Str "_____"],Space,Strikeout [Str "-----"],Space,Code ("",[],[]) "`````",Space,Str "\"\"\"\"\"",Space,RawInline (Format "html") "'''''",SoftBreak,Str "i)",Space,Strong [Str "******"],Space,Emph [Str "//////"],Space,Underline [Str "______"],Space,Strikeout [Str "------"],Space,Code ("",[],[]) "``````",Space,Str "\"\"\"\"\"\"",Space,RawInline (Format "html") "''''''"]
-,Para [Str "i)",Space,Str "****",Space,Str "////",Space,Str "____",Space,Str "----",Space,Str "````",Space,Str "\"\"\"\"",Space,Str "''''",SoftBreak,Str "i)",Space,Str "**",Space,Str "**",Space,Str "//",Space,Str "//",Space,Str "__",Space,Str "__",Space,Str "--",Space,Str "--",Space,Str "``",Space,Str "``",Space,Str "\"\"",Space,Str "\"\"",Space,Str "''",Space,Str "''"]
-,Para [Str "i)",Space,Str "**",Space,Str "bold**",Space,Str "//",Space,Str "ital//",Space,Str "__",Space,Str "undr__",Space,Str "--",Space,Str "strk--",Space,Str "``",Space,Str "mono``",Space,Str "\"\"",Space,Str "raw\"\"",Space,Str "''",Space,Str "tggd''",SoftBreak,Str "i)",Space,Str "**bold",Space,Str "**",Space,Str "//ital",Space,Str "//",Space,Str "__undr",Space,Str "__",Space,Str "--strk",Space,Str "--",Space,Str "``mono",Space,Str "``",Space,Str "\"\"raw",Space,Str "\"\"",Space,Str "''tggd",Space,Str "''",SoftBreak,Str "i)",Space,Str "**",Space,Str "bold",Space,Str "**",Space,Str "//",Space,Str "ital",Space,Str "//",Space,Str "__",Space,Str "undr",Space,Str "__",Space,Str "--",Space,Str "strk",Space,Str "--",Space,Str "``",Space,Str "mono",Space,Str "``",Space,Str "\"\"",Space,Str "raw",Space,Str "\"\"",Space,Str "''",Space,Str "tggd",Space,Str "''"]
-,Header 1 ("link",[],[]) [Str "Link"]
-,Para [Link ("",[],[]) [Str "mailto:user@domain.com"] ("user@domain.com",""),SoftBreak,Link ("",[],[]) [Str "mailto:user@domain.com"] ("user@domain.com",""),Str ".",SoftBreak,Link ("",[],[]) [Str "mailto:user@domain.com"] ("user@domain.com",""),Str ".",Space,Str "any",Space,Str "text.",SoftBreak,Str "any",Space,Str "text:",Space,Link ("",[],[]) [Str "mailto:user@domain.com"] ("user@domain.com",""),Str ".",Space,Str "any",Space,Str "text.",SoftBreak,Link ("",[],[]) [Str "label"] ("user@domain.com",""),SoftBreak,Link ("",[],[]) [Str "mailto:user@domain.com?subject=bla"] ("user@domain.com?subject=bla",""),SoftBreak,Link ("",[],[]) [Str "mailto:user@domain.com?subject=bla"] ("user@domain.com?subject=bla",""),Str ".",SoftBreak,Link ("",[],[]) [Str "mailto:user@domain.com?subject=bla"] ("user@domain.com?subject=bla",""),Str ",",SoftBreak,Link ("",[],[]) [Str "mailto:user@domain.com?subject=bla&cc=otheruser@domain.com"] ("user@domain.com?subject=bla&cc=otheruser@domain.com",""),SoftBreak,Link ("",[],[]) [Str "mailto:user@domain.com?subject=bla&cc=otheruser@domain.com"] ("user@domain.com?subject=bla&cc=otheruser@domain.com",""),Str ".",SoftBreak,Link ("",[],[]) [Str "mailto:user@domain.com?subject=bla&cc=otheruser@domain.com"] ("user@domain.com?subject=bla&cc=otheruser@domain.com",""),Str ",",SoftBreak,Link ("",[],[]) [Str "label"] ("user@domain.com?subject=bla&cc=otheruser@domain.com",""),Str ".",SoftBreak,Link ("",[],[]) [Str "label"] ("user@domain.com?subject=bla&cc=otheruser@domain.com.",""),Str ".",SoftBreak,Link ("",[],[]) [Str "http://www.domain.com"] ("http://www.domain.com",""),SoftBreak,Link ("",[],[]) [Str "http://www.domain.com/dir/"] ("http://www.domain.com/dir/",""),SoftBreak,Link ("",[],[]) [Str "http://www.domain.com/dir///"] ("http://www.domain.com/dir///",""),SoftBreak,Link ("",[],[]) [Str "http://www.domain.com."] ("http://www.domain.com.",""),SoftBreak,Link ("",[],[]) [Str "http://www.domain.com,"] ("http://www.domain.com,",""),SoftBreak,Link ("",[],[]) [Str "http://www.domain.com."] ("http://www.domain.com.",""),Space,Str "any",Space,Str "text.",SoftBreak,Link ("",[],[]) [Str "http://www.domain.com,"] ("http://www.domain.com,",""),Space,Str "any",Space,Str "text.",SoftBreak,Link ("",[],[]) [Str "http://www.domain.com/dir/."] ("http://www.domain.com/dir/.",""),Space,Str "any",Space,Str "text.",SoftBreak,Str "any",Space,Str "text:",Space,Link ("",[],[]) [Str "http://www.domain.com."] ("http://www.domain.com.",""),Space,Str "any",Space,Str "text.",SoftBreak,Str "any",Space,Str "text:",Space,Link ("",[],[]) [Str "http://www.domain.com/dir/."] ("http://www.domain.com/dir/.",""),Space,Str "any",Space,Str "text.",SoftBreak,Str "any",Space,Str "text:",Space,Link ("",[],[]) [Str "http://www.domain.com/dir/index.html."] ("http://www.domain.com/dir/index.html.",""),Space,Str "any",Space,Str "text.",SoftBreak,Str "any",Space,Str "text:",Space,Link ("",[],[]) [Str "http://www.domain.com/dir/index.html,"] ("http://www.domain.com/dir/index.html,",""),Space,Str "any",Space,Str "text.",SoftBreak,Link ("",[],[]) [Str "http://www.domain.com/dir/#anchor"] ("http://www.domain.com/dir/#anchor",""),SoftBreak,Link ("",[],[]) [Str "http://www.domain.com/dir/index.html#anchor"] ("http://www.domain.com/dir/index.html#anchor",""),SoftBreak,Link ("",[],[]) [Str "http://www.domain.com/dir/index.html#anchor."] ("http://www.domain.com/dir/index.html#anchor.",""),SoftBreak,Link ("",[],[]) [Str "http://www.domain.com/dir/#anchor."] ("http://www.domain.com/dir/#anchor.",""),Space,Str "any",Space,Str "text.",SoftBreak,Link ("",[],[]) [Str "http://www.domain.com/dir/index.html#anchor."] ("http://www.domain.com/dir/index.html#anchor.",""),Space,Str "any",Space,Str "text.",SoftBreak,Str "any",Space,Str "text:",Space,Link ("",[],[]) [Str "http://www.domain.com/dir/#anchor."] ("http://www.domain.com/dir/#anchor.",""),Space,Str "any",Space,Str "text.",SoftBreak,Str "any",Space,Str "text:",Space,Link ("",[],[]) [Str "http://www.domain.com/dir/index.html#anchor."] ("http://www.domain.com/dir/index.html#anchor.",""),Space,Str "any",Space,Str "text.",SoftBreak,Link ("",[],[]) [Str "http://domain.com?a=a@a.a&b=a+b+c."] ("http://domain.com?a=a@a.a&b=a+b+c.",""),SoftBreak,Link ("",[],[]) [Str "http://domain.com?a=a@a.a&b=a+b+c,"] ("http://domain.com?a=a@a.a&b=a+b+c,",""),SoftBreak,Link ("",[],[]) [Str "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c."] ("http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.",""),SoftBreak,Link ("",[],[]) [Str "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@."] ("http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.",""),SoftBreak,Link ("",[],[]) [Str "http://domain.com?a=a@a.a&b=a+b+c.#anchor"] ("http://domain.com?a=a@a.a&b=a+b+c.#anchor",""),SoftBreak,Link ("",[],[]) [Str "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor"] ("http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor",""),SoftBreak,Link ("",[],[]) [Str "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.#anchor"] ("http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.#anchor",""),SoftBreak,Link ("",[],[]) [Str "http://user:password@domain.com/bla.html."] ("http://user:password@domain.com/bla.html.",""),SoftBreak,Link ("",[],[]) [Str "http://user:password@domain.com/dir/."] ("http://user:password@domain.com/dir/.",""),SoftBreak,Link ("",[],[]) [Str "http://user:password@domain.com."] ("http://user:password@domain.com.",""),SoftBreak,Link ("",[],[]) [Str "http://user:@domain.com."] ("http://user:@domain.com.",""),SoftBreak,Link ("",[],[]) [Str "http://user@domain.com."] ("http://user@domain.com.",""),SoftBreak,Link ("",[],[]) [Str "http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor"] ("http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor",""),SoftBreak,Link ("",[],[]) [Str "http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c@#anchor"] ("http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c@#anchor",""),SoftBreak,Link ("",[],[]) [Str "label"] ("www.domain.com",""),SoftBreak,Str "[",Space,Str "label",Space,Link ("",[],[]) [Str "www.domain.com"] ("www.domain.com",""),Str "]",SoftBreak,Link ("",[],[]) [Str "label",Space] ("www.domain.com",""),SoftBreak,Link ("",[],[]) [Str "anchor",Space] ("http://www.domain.com/dir/index.html#anchor.",""),SoftBreak,Link ("",[],[]) [Str "login",Space] ("http://user:password@domain.com/bla.html",""),SoftBreak,Link ("",[],[]) [Str "form",Space] ("http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.",""),SoftBreak,Link ("",[],[]) [Str "form",Space,Str "&",Space,Str "anchor"] ("http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor",""),SoftBreak,Link ("",[],[]) [Str "login",Space,Str "&",Space,Str "form",Space] ("http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.",""),SoftBreak,Link ("",[],[]) [Str "local",Space,Str "link",Space,Str "up",Space] ("..",""),SoftBreak,Link ("",[],[]) [Str "local",Space,Str "link",Space,Str "file",Space] ("bla.html",""),SoftBreak,Link ("",[],[]) [Str "local",Space,Str "link",Space,Str "anchor",Space] ("#anchor",""),SoftBreak,Link ("",[],[]) [Str "local",Space,Str "link",Space,Str "file/anchor"] ("bla.html#anchor",""),SoftBreak,Link ("",[],[]) [Str "local",Space,Str "link",Space,Str "file/anchor"] ("bla.html#anchor.",""),SoftBreak,Link ("",[],[]) [Str "local",Space,Str "link",Space,Str "img",Space] ("abc.gif",""),SoftBreak,Link ("",[],[]) [Str "www.fake.com"] ("www.domain.com",""),SoftBreak,Link ("",[],[]) [Str "http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm"] ("http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm",""),SoftBreak,Link ("",[],[]) [Str "http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-"] ("http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-",""),SoftBreak,Link ("",[],[]) [Str "http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_"] ("http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_",""),Str "-1%.",SoftBreak,Link ("",[],[]) [Str "http://foo._user-9:pass!#$%&*()+word@domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_"] ("http://foo._user-9:pass!#$%&*()+word@domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_",""),Str "-1%.",SoftBreak,Link ("",[],[]) [Str "http://L1.com"] ("http://L1.com",""),Space,Str "!",Space,Link ("",[],[]) [Str "mailto:L2@www.com"] ("L2@www.com",""),Space,Str "!",Space,Link ("",[],[]) [Str "L3"] ("www.com",""),Space,Str "!",Space,Link ("",[],[]) [Str "L4"] ("w@ww.com",""),Space,Str "!",Space,Link ("",[],[]) [Str "www.L5.com"] ("www.L5.com",""),SoftBreak,Link ("",[],[]) [Str "www.domain.com"] ("www.domain.com",""),SoftBreak,Link ("",[],[]) [Str "www2.domain.com"] ("www2.domain.com",""),SoftBreak,Link ("",[],[]) [Str "ftp.domain.com"] ("ftp.domain.com",""),SoftBreak,Link ("",[],[]) [Str "WWW.DOMAIN.COM"] ("WWW.DOMAIN.COM",""),SoftBreak,Link ("",[],[]) [Str "FTP.DOMAIN.COM"] ("FTP.DOMAIN.COM",""),SoftBreak,Link ("",[],[]) [Str "label"] ("www.domain.com",""),SoftBreak,Link ("",[],[]) [Str "label"] ("ftp.domain.com",""),SoftBreak,Link ("",[],[]) [Str "label"] ("WWW.DOMAIN.COM",""),SoftBreak,Link ("",[],[]) [Str "label"] ("FTP.DOMAIN.COM",""),SoftBreak,Str "[label",Space,Link ("",[],[]) [Str "www.domain.com"] ("www.domain.com",""),Space,Str "]",SoftBreak,Str "[label]",Space,Link ("",[],[]) [Str "www.domain.com"] ("www.domain.com",""),Str "]"]
-,Header 1 ("image",[],[]) [Str "Image"]
-,Para [Image ("",[],[]) [] ("img.png","")]
-,Para [Link ("",[],[]) [Image ("",[],[]) [] ("img.png","")] ("https://txt2tags.org","")]
-,Para [Image ("",[],[]) [] ("img.png",""),Space,Str "Image",Space,Str "at",Space,Str "the",Space,Str "line",Space,Str "beginning."]
-,Para [Str "Image",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Image ("",[],[]) [] ("img.png",""),Space,Str "of",Space,Str "the",Space,Str "line."]
-,Para [Str "Image",Space,Str "at",Space,Str "the",Space,Str "line",Space,Str "end.",Space,Image ("",[],[]) [] ("img.png","")]
-,Para [Image ("",[],[]) [] ("img.png",""),SoftBreak,Image ("",[],[]) [] ("img.png",""),SoftBreak,Image ("",[],[]) [] ("img.png","")]
-,Para [Image ("",[],[]) [] ("img.png",""),Image ("",[],[]) [] ("img.png","")]
-,Para [Str "Images",Space,Image ("",[],[]) [] ("img.png",""),Space,Str "mixed",Space,Image ("",[],[]) [] ("img.png",""),Space,Str "with",Space,Image ("",[],[]) [] ("img.png",""),Space,Str "text."]
-,Para [Str "Images",Space,Str "glued",Space,Str "together:",Space,Image ("",[],[]) [] ("img.png",""),Image ("",[],[]) [] ("img.png",""),Image ("",[],[]) [] ("img.png",""),Str "."]
-,Para [Str "[img.png",Space,Str "]"]
-,Para [Str "[",Space,Str "img.png]"]
-,Para [Str "[",Space,Str "img.png",Space,Str "]"]
-,Header 1 ("numtitle",[],[]) [Str "Numbered",Space,Str "Title"]
-,Header 1 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "1"]
-,Header 2 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "2"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 4 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "4"]
-,Header 5 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "5"]
-,Header 1 ("lab_el-1",[],[]) [Str "Title",Space,Str "Level",Space,Str "1"]
-,Header 2 ("lab_el-2",[],[]) [Str "Title",Space,Str "Level",Space,Str "2"]
-,Header 3 ("lab_el-3",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 4 ("lab_el-4",[],[]) [Str "Title",Space,Str "Level",Space,Str "4"]
-,Header 5 ("lab_el-5",[],[]) [Str "Title",Space,Str "Level",Space,Str "5"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 3 ("lab_el-9",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Para [Str "+Not",Space,Str "Title"]
-,Para [Str "++Not",Space,Str "Title+"]
-,Para [Str "+++Not",Space,Str "Title++++",SoftBreak,Str "++++++Not",Space,Str "Title",Space,Str "6++++++"]
-,Para [Str "+++++++Not",Space,Str "Title",Space,Str "7+++++++",SoftBreak,Str "+Not",Space,Str "Title+",Space,Str "[label1]",SoftBreak,Str "+Not",Space,Str "Title+[",Space,Str "label",Space,Str "]",SoftBreak,Str "+Not",Space,Str "Title+[la/bel]"]
-,Header 1 ("title",[],[]) [Str "Title"]
-,Header 1 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "1"]
-,Header 2 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "2"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 4 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "4"]
-,Header 5 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "5"]
-,Header 1 ("lab_el-1",[],[]) [Str "Title",Space,Str "Level",Space,Str "1"]
-,Header 2 ("lab_el-2",[],[]) [Str "Title",Space,Str "Level",Space,Str "2"]
-,Header 3 ("lab_el-3",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 4 ("lab_el-4",[],[]) [Str "Title",Space,Str "Level",Space,Str "4"]
-,Header 5 ("lab_el-5",[],[]) [Str "Title",Space,Str "Level",Space,Str "5"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 3 ("",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Header 3 ("lab_el-9",[],[]) [Str "Title",Space,Str "Level",Space,Str "3"]
-,Para [Str "=Not",Space,Str "Title"]
-,Para [Str "==Not",Space,Str "Title="]
-,Para [Str "===Not",Space,Str "Title====",SoftBreak,Str "======Not",Space,Str "Title",Space,Str "6======"]
-,Para [Str "=======Not",Space,Str "Title",Space,Str "7=======",SoftBreak,Str "=Not",Space,Str "Title=",Space,Str "[label1]",SoftBreak,Str "=Not",Space,Str "Title=[",Space,Str "label",Space,Str "]",SoftBreak,Str "=Not",Space,Str "Title=[la/bel]"]
-,Header 1 ("quote",[],[]) [Str "Quote"]
-,BlockQuote
- [Para [Str "To",Space,Str "quote",Space,Str "a",Space,Str "paragraph,",Space,Str "just",Space,Str "prefix",Space,Str "it",Space,Str "by",Space,Str "a",Space,Str "TAB",SoftBreak,Str "character.",Space,Str "All",Space,Str "the",Space,Str "lines",Space,Str "of",Space,Str "the",Space,Str "paragraph",Space,Str "must",SoftBreak,Str "begin",Space,Str "with",Space,Str "a",Space,Str "TAB."]]
-,Para [Str "Any",Space,Str "non-tabbed",Space,Str "line",Space,Str "closes",Space,Str "the",Space,Str "quote",Space,Str "block."]
-,BlockQuote
- [Para [Str "The",Space,Str "number",Space,Str "of",Space,Str "leading",Space,Str "TABs",Space,Str "identifies",Space,Str "the",Space,Str "quote",SoftBreak,Str "block",Space,Str "depth.",Space,Str "This",Space,Str "is",Space,Str "quote",Space,Str "level",Space,Str "1."]
- ,BlockQuote
-  [Para [Str "With",Space,Str "two",Space,Str "TABs,",Space,Str "we",Space,Str "are",Space,Str "on",Space,Str "the",Space,Str "quote",SoftBreak,Str "level",Space,Str "2."]
-  ,BlockQuote
-   [Para [Str "The",Space,Str "more",Space,Str "TABs,",Space,Str "more",Space,Str "deep",Space,Str "is",SoftBreak,Str "the",Space,Str "quote",Space,Str "level."]
-   ,BlockQuote
-    [Para [Str "There",Space,Str "isn't",Space,Str "a",Space,Str "limit."]]]]]
-,BlockQuote
- [BlockQuote
-  [BlockQuote
-   [BlockQuote
-    [Para [Str "This",Space,Str "quote",Space,Str "starts",Space,Str "at",SoftBreak,Str "level",Space,Str "4."]]
-   ,Para [Str "Then",Space,Str "its",Space,Str "depth",Space,Str "is",Space,Str "decreased."]]
-  ,Para [Str "Counting",Space,Str "down,",Space,Str "one",Space,Str "by",Space,Str "one."]]
- ,Para [Str "Until",Space,Str "the",Space,Str "level",Space,Str "1."]]
-,BlockQuote
- [BlockQuote
-  [BlockQuote
-   [Para [Str "Unlike",Space,Str "lists,",Space,Str "any",Space,Str "quote",Space,Str "block",Space,Str "is",SoftBreak,Str "independent,",Space,Str "not",Space,Str "part",Space,Str "of",Space,Str "a",Space,Str "tree."]]]
- ,Para [Str "The",Space,Str "TAB",Space,Str "count",Space,Str "don't",Space,Str "need",Space,Str "to",Space,Str "be",Space,Str "incremental",SoftBreak,Str "by",Space,Str "one."]
- ,BlockQuote
-  [BlockQuote
-   [BlockQuote
-    [Para [Str "The",Space,Str "nesting",Space,Str "don't",Space,Str "need",SoftBreak,Str "to",Space,Str "follow",Space,Str "any",Space,Str "rule."]]]
-  ,Para [Str "Quotes",Space,Str "can",Space,Str "be",Space,Str "opened",Space,Str "and",Space,Str "closed",SoftBreak,Str "in",Space,Str "any",Space,Str "way."]
-  ,BlockQuote
-   [BlockQuote
-    [BlockQuote
-     [Para [Str "You",Space,Str "choose."]]]]]]
-,BlockQuote
- [Para [Str "Some",Space,Str "targets",Space,Str "(as",Space,Str "sgml)",Space,Str "don't",Space,Str "support",Space,Str "the",SoftBreak,Str "nesting",Space,Str "of",Space,Str "quotes.",Space,Str "There",Space,Str "is",Space,Str "only",Space,Str "one",Space,Str "quote",SoftBreak,Str "level."]
- ,BlockQuote
-  [Para [Str "In",Space,Str "this",Space,Str "case,",Space,Str "no",Space,Str "matter",Space,Str "how",Space,Str "much",SoftBreak,Str "TABs",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "define",Space,Str "the",Space,Str "quote",SoftBreak,Str "block,",Space,Str "it",Space,Str "always",Space,Str "will",Space,Str "be",Space,Str "level",Space,Str "1."]]]
-,BlockQuote
- [Para [Str "Spaces",Space,Str "AFTER",Space,Str "the",Space,Str "TAB",Space,Str "character",Space,Str "are",Space,Str "allowed.",SoftBreak,Str "But",Space,Str "be",Space,Str "careful,",Space,Str "it",Space,Str "can",Space,Str "be",Space,Str "confusing."]]
-,Para [Str "Spaces",Space,Str "BEFORE",Space,Str "the",Space,Str "TAB",Space,Str "character",SoftBreak,Str "invalidate",Space,Str "the",Space,Str "mark.",Space,Str "It's",Space,Str "not",Space,Str "quote."]
-,BlockQuote
- [Para [Str "Paragraph",Space,Str "breaks",Space,Str "inside",Space,Str "a",Space,Str "quote",Space,Str "aren't",SoftBreak,Str "possible."]
- ,Para [Str "This",Space,Str "sample",Space,Str "are",Space,Str "two",Space,Str "separated",Space,Str "quoted",SoftBreak,Str "paragraphs,",Space,Str "not",Space,Str "a",Space,Str "quote",Space,Str "block",Space,Str "with",SoftBreak,Str "two",Space,Str "paragraphs",Space,Str "inside."]]
-,BlockQuote
- [Para [Str "The",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "file",Space,Str "(EOF)",Space,Str "closes",Space,Str "the",SoftBreak,Str "currently",Space,Str "open",Space,Str "quote",Space,Str "block."]]
-,Header 1 ("raw",[],[]) [Str "Raw"]
-,Para [Str "A raw line.\n"]
-,Para [Str "  Another raw line, with leading spaces.\n"]
-,Para [Str "A raw area delimited\n       by lines with marks.\n"]
-,Para [Str "Trailing spaces and TABs after the area marks\nare allowed, but not encouraged nor documented.\n"]
-,Para [Str "\"\"\"Not",Space,Str "a",Space,Str "raw",Space,Str "line,",Space,Str "need",Space,Str "one",Space,Str "space",Space,Str "after",Space,Str "mark."]
-,Para [Str "\"\"\"",SoftBreak,Str "Not",Space,Str "a",Space,Str "raw",Space,Str "area.",SoftBreak,Str "The",Space,Str "marks",Space,Str "must",Space,Str "be",Space,Str "at",Space,Str "the",Space,Str "line",Space,Str "beginning,",SoftBreak,Str "no",Space,Str "leading",Space,Str "spaces.",SoftBreak,Str "\"\"\""]
-,Para [Str "The end of the file (EOF) closes\nthe currently open raw area.\n"]
-,Header 1 ("verbatim",[],[]) [Str "Verbatim"]
-,CodeBlock ("",[],[]) "A verbatim line.\n"
-,CodeBlock ("",[],[]) "  Another verbatim line, with leading spaces.\n"
-,CodeBlock ("",[],[]) "A verbatim area delimited\n       by lines with marks.\n"
-,CodeBlock ("",[],[]) "Trailing spaces and TABs after the area marks\nare allowed, but not encouraged nor documented.\n"
-,Para [Str "```Not",Space,Str "a",Space,Str "verbatim",Space,Str "line,",Space,Str "need",Space,Str "one",Space,Str "space",Space,Str "after",Space,Str "mark."]
-,Para [Str "```",SoftBreak,Str "Not",Space,Str "a",Space,Str "verbatim",Space,Str "area.",SoftBreak,Str "The",Space,Str "marks",Space,Str "must",Space,Str "be",Space,Str "at",Space,Str "the",Space,Str "line",Space,Str "beginning,",SoftBreak,Str "no",Space,Str "leading",Space,Str "spaces.",SoftBreak,Str "```"]
-,CodeBlock ("",[],[]) "The end of the file (EOF) closes\nthe currently open verbatim area.\n"
-,Header 1 ("deflist",[],[]) [Str "Definition",Space,Str "List"]
-,DefinitionList
- [([Str "Definition",Space,Str "list"],
-   [[Plain [Str "A",Space,Str "list",Space,Str "with",Space,Str "terms"]]])
- ,([Str "Start",Space,Str "term",Space,Str "with",Space,Str "colon"],
-   [[Plain [Str "And",Space,Str "its",Space,Str "definition",Space,Str "follows"]]])]
-,Header 1 ("numlist",[],[]) [Str "Numbered",Space,Str "List"]
-,Para [Str "See",Space,Link ("",[],[]) [Str "List"] ("#list",""),Str ",",Space,Str "the",Space,Str "same",Space,Str "rules",Space,Str "apply."]
-,Header 1 ("list",[],[]) [Str "List"]
-,BulletList
- [[Plain [Str "Use",Space,Str "the",Space,Str "hyphen",Space,Str "to",Space,Str "prefix",Space,Str "list",Space,Str "items."]]
- ,[Plain [Str "There",Space,Str "must",Space,Str "be",Space,Str "one",Space,Str "space",Space,Str "after",Space,Str "the",Space,Str "hyphen."]]
- ,[Plain [Str "The",Space,Str "list",Space,Str "is",Space,Str "closed",Space,Str "by",Space,Str "two",Space,Str "consecutive",Space,Str "blank",Space,Str "lines."]]]
-,BulletList
- [[Plain [Str "The",Space,Str "list",Space,Str "can",Space,Str "be",Space,Str "indented",Space,Str "on",Space,Str "the",Space,Str "source",Space,Str "document."]]
- ,[Plain [Str "You",Space,Str "can",Space,Str "use",Space,Str "any",Space,Str "number",Space,Str "of",Space,Str "spaces."]]
- ,[Plain [Str "The",Space,Str "result",Space,Str "will",Space,Str "be",Space,Str "the",Space,Str "same."]]]
-,BulletList
- [[Para [Str "Let",Space,Str "one",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "the",Space,Str "list",Space,Str "items."]]
- ,[Para [Str "It",Space,Str "will",Space,Str "be",Space,Str "maintained",Space,Str "on",Space,Str "the",Space,Str "conversion."]]
- ,[Para [Str "Some",Space,Str "targets",Space,Str "don't",Space,Str "support",Space,Str "this",Space,Str "behavior."]]
- ,[Para [Str "This",Space,Str "one",Space,Str "was",Space,Str "separated",Space,Str "by",Space,Str "a",Space,Str "line",Space,Str "with",Space,Str "blanks.",SoftBreak,Str "You",Space,Str "can",Space,Str "also",Space,Str "put",Space,Str "a",Space,Str "blank",Space,Str "line",Space,Str "inside"]
-  ,Para [Str "the",Space,Str "item",Space,Str "contents",Space,Str "and",Space,Str "it",Space,Str "will",Space,Str "be",Space,Str "preserved."]]]
-,Para [Str "-This",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "list",Space,Str "(no",Space,Str "space)"]
-,Para [Str "-",Space,Str "This",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "list",Space,Str "(more",Space,Str "than",Space,Str "one",Space,Str "space)"]
-,Para [Str "-",Space,Str "This",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "list",Space,Str "(a",Space,Str "TAB",Space,Str "instead",Space,Str "the",Space,Str "space)"]
-,BulletList
- [[BulletList
-   [[Plain [Str "This",Space,Str "is",Space,Str "a",Space,Str "list"]]]]
- ,[OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "This",Space,Str "is",Space,Str "a",Space,Str "list"]]]]
- ,[DefinitionList
-   [([Str "This",Space,Str "is",Space,Str "a",Space,Str "list"],
-     [[]])]]]
-,BulletList
- [[Plain [Str "This",Space,Str "is",Space,Str "the",Space,Str "\"mother\"",Space,Str "list",Space,Str "first",Space,Str "item."]]
- ,[Plain [Str "Here",Space,Str "is",Space,Str "the",Space,Str "second,",Space,Str "but",Space,Str "inside",Space,Str "this",Space,Str "item,"]
-  ,BulletList
-   [[Plain [Str "there",Space,Str "is",Space,Str "a",Space,Str "sublist,",Space,Str "with",Space,Str "its",Space,Str "own",Space,Str "items."]]
-   ,[Plain [Str "Note",Space,Str "that",Space,Str "the",Space,Str "items",Space,Str "of",Space,Str "the",Space,Str "same",Space,Str "sublist"]]
-   ,[Plain [Str "must",Space,Str "have",Space,Str "the",Space,Str "same",Space,Str "indentation."]
-    ,BulletList
-     [[Plain [Str "And",Space,Str "this",Space,Str "can",Space,Str "go",Space,Str "on,",Space,Str "opening",Space,Str "sublists."]
-      ,BulletList
-       [[Plain [Str "Just",Space,Str "add",Space,Str "leading",Space,Str "spaces",Space,Str "before",Space,Str "the"]]
-       ,[Plain [Str "hyphen",Space,Str "and",Space,Str "sublists",Space,Str "will",Space,Str "be",Space,Str "opened."]]
-       ,[Plain [Str "The",Space,Str "two",Space,Str "blank",Space,Str "lines",Space,Str "closes",Space,Str "them",Space,Str "all."]]]]]]]]]
-,BulletList
- [[Plain [Str "When",Space,Str "nesting",Space,Str "lists,",Space,Str "the",Space,Str "additional",Space,Str "spaces",Space,Str "are",Space,Str "free."]]
- ,[Plain [Str "You",Space,Str "can",Space,Str "add",Space,Str "just",Space,Str "one,"]
-  ,BulletList
-   [[Plain [Str "or",Space,Str "many."]
-    ,BulletList
-     [[Plain [Str "What",Space,Str "matters",Space,Str "is",Space,Str "to",Space,Str "put",Space,Str "more",Space,Str "than",Space,Str "the",Space,Str "previous."]]
-     ,[Plain [Str "But",Space,Str "remember",Space,Str "that",Space,Str "the",Space,Str "other",Space,Str "items",Space,Str "of",Space,Str "the",Space,Str "same",Space,Str "list"]]
-     ,[Plain [Str "must",Space,Str "use",Space,Str "the",Space,Str "same",Space,Str "indentation."]]]]]]]
-,BulletList
- [[Plain [Str "There",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "depth",Space,Str "limit,"]
-  ,BulletList
-   [[Plain [Str "you",Space,Str "can",Space,Str "go",Space,Str "deeper",Space,Str "and",Space,Str "deeper."]
-    ,BulletList
-     [[Plain [Str "But",Space,Str "some",Space,Str "targets",Space,Str "may",Space,Str "have",Space,Str "restrictions."]
-      ,BulletList
-       [[Plain [Str "The",Space,Str "LaTeX",Space,Str "maximum",Space,Str "is",Space,Str "here,",Space,Str "4",Space,Str "levels."]]]]]]]]]
-,BulletList
- [[Plain [Str "Reverse",Space,Str "nesting",Space,Str "doesn't",Space,Str "work."]]
- ,[Plain [Str "Because",Space,Str "a",Space,Str "sublist",Space,Str "*must*",Space,Str "have",Space,Str "a",Space,Str "mother",Space,Str "list."]]
- ,[Plain [Str "It's",Space,Str "the",Space,Str "list",Space,Str "concept,",Space,Str "not",Space,Str "a",Space,Str "txt2tags",Space,Str "limitation."]]
- ,[Plain [Str "All",Space,Str "this",Space,Str "sublists",Space,Str "will",Space,Str "be",Space,Str "bumped",Space,Str "to",Space,Str "mother",Space,Str "lists."]]
- ,[Plain [Str "At",Space,Str "level",Space,Str "1,",Space,Str "like",Space,Str "this",Space,Str "one."]]]
-,BulletList
- [[Plain [Str "Level",Space,Str "1"]
-  ,BulletList
-   [[Plain [Str "Level",Space,Str "2"]
-    ,BulletList
-     [[Plain [Str "Level",Space,Str "3"]
-      ,BulletList
-       [[Plain [Str "Level",Space,Str "4"]]]]
-     ,[Plain [Str "Level",Space,Str "3",Space,Str "--",Space,Str "(closed",Space,Str "Level",Space,Str "4)"]]]]
-   ,[Plain [Str "Level",Space,Str "2",Space,Str "--",Space,Str "(closed",Space,Str "Level",Space,Str "3)"]]]]
- ,[Plain [Str "Level",Space,Str "1",Space,Str "--",Space,Str "(closed",Space,Str "Level",Space,Str "2)"]]]
-,BulletList
- [[Plain [Str "Level",Space,Str "1"]
-  ,BulletList
-   [[Plain [Str "Level",Space,Str "2"]
-    ,BulletList
-     [[Plain [Str "Level",Space,Str "3"]
-      ,BulletList
-       [[Plain [Str "Level",Space,Str "4"]]]]]]]]
- ,[Plain [Str "Level",Space,Str "1",Space,Str "--",Space,Str "(closed",Space,Str "Level",Space,Str "4,",Space,Str "Level",Space,Str "3",Space,Str "and",Space,Str "Level",Space,Str "2)"]]]
-,BulletList
- [[Para [Str "Level",Space,Str "1"]
-  ,BulletList
-   [[Para [Str "Level",Space,Str "2",Space,Str "--",Space,Str "blank",Space,Str "BEFORE",Space,Str "and",Space,Str "AFTER",Space,Str "(in)"]
-    ,BulletList
-     [[Plain [Str "Level",Space,Str "3"]]]]]]]
-,BulletList
- [[Plain [Str "Level",Space,Str "4"]]]
-,BulletList
- [[Para [Str "Level",Space,Str "3"]]
- ,[Para [Str "Level",Space,Str "2",Space,Str "--",Space,Str "blank",Space,Str "BEFORE",Space,Str "and",Space,Str "AFTER",Space,Str "(out)"]]
- ,[Para [Str "Level",Space,Str "1"]
-  ,BulletList
-   [[Para [Str "Level",Space,Str "2",Space,Str "--",Space,Str "blank",Space,Str "BEFORE",Space,Str "(spaces)",Space,Str "and",Space,Str "AFTER",Space,Str "(TAB)"]
-    ,BulletList
-     [[Plain [Str "Level",Space,Str "3"]]]]]]]
-,BulletList
- [[Plain [Str "Level",Space,Str "1"]
-  ,BulletList
-   [[Plain [Str "Level",Space,Str "2"]
-    ,BulletList
-     [[Plain [Str "Level",Space,Str "3"]
-      ,BulletList
-       [[Plain [Str "Level",Space,Str "4"]]
-       ,[Plain [Str "Level",Space,Str "3.5",Space,Str "???"]]]]
-     ,[Plain [Str "Level",Space,Str "3"]]
-     ,[Plain [Str "Level",Space,Str "2.5",Space,Str "???"]]]]
-   ,[Plain [Str "Level",Space,Str "2"]]
-   ,[Plain [Str "Level",Space,Str "1.5",Space,Str "???"]]]]
- ,[Plain [Str "Level",Space,Str "1"]]]
-,BulletList
- [[Plain [Str "This",Space,Str "list",Space,Str "is",Space,Str "closed",Space,Str "by",Space,Str "a",Space,Str "line",Space,Str "with",Space,Str "spaces",Space,Str "and",Space,Str "other",Space,Str "with",Space,Str "TABs"]]]
-,BulletList
- [[Plain [Str "This",Space,Str "list",Space,Str "is",Space,Str "NOT",Space,Str "closed",Space,Str "by",Space,Str "two",Space,Str "comment",Space,Str "lines"]]]
-,BulletList
- [[Plain [Str "This",Space,Str "list",Space,Str "is",Space,Str "closed",Space,Str "by",Space,Str "a",Space,Str "line",Space,Str "with",Space,Str "spaces",Space,Str "and",Space,Str "TAB,"]]
- ,[Plain [Str "then",Space,Str "a",Space,Str "comment",Space,Str "line,",Space,Str "then",Space,Str "an",Space,Str "empty",Space,Str "line."]]]
-,BulletList
- [[Plain [Str "Level",Space,Str "1"]
-  ,BulletList
-   [[Plain [Str "Level",Space,Str "2"]
-    ,BulletList
-     [[Plain [Str "Level",Space,Str "3"]]]
-    ,Plain [Str "-",SoftBreak,Str "Level",Space,Str "2"]]]
-  ,Plain [Str "-",SoftBreak,Str "Level",Space,Str "1"]]]
-,Para [Str "-"]
-,BulletList
- [[Plain [Str "Empty",Space,Str "item",Space,Str "with",Space,Str "trailing",Space,Str "spaces."]]]
-,Para [Str "-"]
-,BulletList
- [[Plain [Str "Empty",Space,Str "item",Space,Str "with",Space,Str "trailing",Space,Str "TAB."]]]
-,Para [Str "-"]
-,BulletList
- [[Plain [Str "If",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "file",Space,Str "(EOF)",Space,Str "is",Space,Str "hit,"]
-  ,BulletList
-   [[Plain [Str "all",Space,Str "the",Space,Str "currently",Space,Str "opened",Space,Str "list",Space,Str "are",Space,Str "closed,"]
-    ,BulletList
-     [[Plain [Str "just",Space,Str "like",Space,Str "when",Space,Str "using",Space,Str "the",Space,Str "two",Space,Str "blank",Space,Str "lines."]]]]]]]
-,Header 1 ("table",[],[]) [Str "Table"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignRight,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignRight,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3"]]]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "||",Space,Str "Cell",Space,Str "1",Space,Str "|",Space,Str "Cell",Space,Str "2",Space,Str "|",Space,Str "Cell",Space,Str "3",Space,Str "|"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Cell",Space,Str "3"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Heading"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Heading"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Heading"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "<-"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "--"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "->"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "--"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "--"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "--"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "->"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "--"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "<-"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "1"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "2"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "3+4"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1+2+3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2+3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1+2+3+4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "7"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "8"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "A"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "B"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "D"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "E"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "F"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Jan"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Fev"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Mar"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "Apr"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "May"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "20%"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "40%"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "60%"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "80%"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "100%"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "/"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "/",Space,Str "/",Space,Str "/",Space,Str "/",Space,Str "/"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "/",Space,Str "/",Space,Str "/",Space,Str "/",Space,Str "/",Space,Str "/",Space,Str "/",Space,Str "/",Space,Str "/"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "o"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "o"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "."]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "=",Space,Str "=",Space,Str "=",Space,Str "="]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "01"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "02"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "05"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "07"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "11"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "13"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "16"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "17"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "19"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "20"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "23"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "25"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "26"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "29"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "30"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "32"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "35"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "37"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "39"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "40"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)
- ,(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "7"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "8"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "9"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "A"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "B"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "C"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "D"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "E"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "F"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "0"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "3"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "4"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "5"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "6"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "7"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "8"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "9"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "A"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "B"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "C"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "D"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "E"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "F"]]]])]
- (TableFoot ("",[],[])
- [])
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignCenter,ColWidthDefault)]
- (TableHead ("",[],[])
- [])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]])]
- (TableFoot ("",[],[])
- [])
-,Para [Str "|this|is|not|a|table|"]
-,Para [Str "|this|",Space,Str "is|",Space,Str "not|",Space,Str "a|",Space,Str "table|"]
-,Para [Str "|this",Space,Str "|is",Space,Str "|not",Space,Str "|a",Space,Str "|table",Space,Str "|"]
-,Para [Str "|",Space,Str "this\t|",Space,Str "is\t|",Space,Str "not\t|",Space,Str "a\t|",Space,Str "table\t|"]
-,HorizontalRule
-,Para [Str "The",Space,Str "End."]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author" , MetaList [ MetaInlines [ Str "author" ] ] )
+          , ( "date" , MetaInlines [ Str "date" ] )
+          , ( "includeconf" , MetaString "rules.conf" )
+          , ( "title"
+            , MetaInlines
+                [ Str "Txt2tags"
+                , Space
+                , Str "Markup"
+                , Space
+                , Str "Rules"
+                ]
+            )
+          ]
+    }
+  [ Para
+      [ Str "This"
+      , Space
+      , Str "document"
+      , Space
+      , Str "describes"
+      , Space
+      , Str "all"
+      , Space
+      , Str "the"
+      , Space
+      , Str "details"
+      , Space
+      , Str "about"
+      , Space
+      , Str "each"
+      , Space
+      , Str "txt2tags"
+      , Space
+      , Str "mark."
+      , SoftBreak
+      , Str "The"
+      , Space
+      , Str "target"
+      , Space
+      , Str "audience"
+      , Space
+      , Str "are"
+      , Space
+      , Strong [ Str "experienced" ]
+      , Space
+      , Str "users."
+      , Space
+      , Str "You"
+      , Space
+      , Str "may"
+      , Space
+      , Str "find"
+      , Space
+      , Str "it"
+      , SoftBreak
+      , Str "useful"
+      , Space
+      , Str "if"
+      , Space
+      , Str "you"
+      , Space
+      , Str "want"
+      , Space
+      , Str "to"
+      , Space
+      , Str "master"
+      , Space
+      , Str "the"
+      , Space
+      , Str "marks"
+      , Space
+      , Str "or"
+      , Space
+      , Str "solve"
+      , Space
+      , Str "a"
+      , Space
+      , Str "specific"
+      , Space
+      , Str "problem"
+      , SoftBreak
+      , Str "about"
+      , Space
+      , Str "a"
+      , Space
+      , Str "mark."
+      ]
+  , Para
+      [ Str "If"
+      , Space
+      , Str "you"
+      , Space
+      , Str "are"
+      , Space
+      , Str "new"
+      , Space
+      , Str "to"
+      , Space
+      , Str "txt2tags"
+      , Space
+      , Str "or"
+      , Space
+      , Str "just"
+      , Space
+      , Str "want"
+      , Space
+      , Str "to"
+      , Space
+      , Str "know"
+      , Space
+      , Str "which"
+      , Space
+      , Str "are"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "available"
+      , Space
+      , Str "marks,"
+      , Space
+      , Str "please"
+      , Space
+      , Str "read"
+      , Space
+      , Str "the"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "Markup" , Space , Str "Demo" ]
+          ( "MARKUPDEMO" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Note"
+      , Space
+      , Str "1:"
+      , Space
+      , Str "This"
+      , Space
+      , Str "document"
+      , Space
+      , Str "is"
+      , Space
+      , Str "generated"
+      , Space
+      , Str "directly"
+      , Space
+      , Str "from"
+      , Space
+      , Str "the"
+      , Space
+      , Str "txt2tags"
+      , SoftBreak
+      , Str "test-suite."
+      , Space
+      , Str "All"
+      , Space
+      , Str "the"
+      , Space
+      , Str "rules"
+      , Space
+      , Str "mentioned"
+      , Space
+      , Str "here"
+      , Space
+      , Str "are"
+      , Space
+      , Str "100%"
+      , Space
+      , Str "in"
+      , Space
+      , Str "sync"
+      , Space
+      , Str "with"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "current"
+      , Space
+      , Str "program"
+      , Space
+      , Str "code."
+      ]
+  , Para
+      [ Str "Note"
+      , Space
+      , Str "2:"
+      , Space
+      , Str "A"
+      , Space
+      , Str "good"
+      , Space
+      , Str "practice"
+      , Space
+      , Str "is"
+      , Space
+      , Str "to"
+      , Space
+      , Str "consult"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "the" , Space , Str "sources" ]
+          ( "rules.t2t" , "" )
+      , Space
+      , Str "when"
+      , SoftBreak
+      , Str "reading,"
+      , Space
+      , Str "to"
+      , Space
+      , Str "see"
+      , Space
+      , Str "how"
+      , Space
+      , Str "the"
+      , Space
+      , Str "texts"
+      , Space
+      , Str "were"
+      , Space
+      , Str "made."
+      ]
+  , Para
+      [ Str "Table" , Space , Str "of" , Space , Str "Contents:" ]
+  , HorizontalRule
+  , Header 1 ( "paragraph" , [] , [] ) [ Str "Paragraph" ]
+  , Para
+      [ Str "A"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "is"
+      , Space
+      , Str "composed"
+      , Space
+      , Str "by"
+      , Space
+      , Str "one"
+      , Space
+      , Str "or"
+      , Space
+      , Str "more"
+      , Space
+      , Str "lines."
+      , SoftBreak
+      , Str "A"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      , Space
+      , Str "(or"
+      , Space
+      , Str "a"
+      , Space
+      , Str "table,"
+      , Space
+      , Str "or"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list)"
+      , Space
+      , Str "ends"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "current"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "Leading"
+      , Space
+      , Str "and"
+      , Space
+      , Str "trailing"
+      , Space
+      , Str "spaces"
+      , Space
+      , Str "are"
+      , Space
+      , Str "ignored."
+      ]
+  , Para
+      [ Str "A"
+      , Space
+      , Str "comment"
+      , Space
+      , Str "line"
+      , Space
+      , Str "can"
+      , Space
+      , Str "be"
+      , Space
+      , Str "placed"
+      , Space
+      , Str "inside"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph."
+      , SoftBreak
+      , Str "It"
+      , Space
+      , Str "will"
+      , Space
+      , Str "not"
+      , Space
+      , Str "affect"
+      , Space
+      , Str "it."
+      ]
+  , Para
+      [ Str "The"
+      , Space
+      , Str "end"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "file"
+      , Space
+      , Str "(EOF)"
+      , Space
+      , Str "closes"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "currently"
+      , Space
+      , Str "open"
+      , Space
+      , Str "paragraph."
+      ]
+  , Header 1 ( "comment" , [] , [] ) [ Str "Comment" ]
+  , Para
+      [ Str "%"
+      , Space
+      , Str "not"
+      , Space
+      , Str "on"
+      , Space
+      , Str "the"
+      , Space
+      , Str "line"
+      , Space
+      , Str "beginning"
+      , Space
+      , Str "(at"
+      , Space
+      , Str "column"
+      , Space
+      , Str "2)"
+      ]
+  , Para
+      [ Str "some"
+      , Space
+      , Str "text"
+      , Space
+      , Str "%"
+      , Space
+      , Str "half"
+      , Space
+      , Str "line"
+      , Space
+      , Str "comments"
+      , Space
+      , Str "are"
+      , Space
+      , Str "not"
+      , Space
+      , Str "allowed"
+      ]
+  , Header 1 ( "line" , [] , [] ) [ Str "Line" ]
+  , HorizontalRule
+  , HorizontalRule
+  , HorizontalRule
+  , HorizontalRule
+  , HorizontalRule
+  , HorizontalRule
+  , HorizontalRule
+  , HorizontalRule
+  , HorizontalRule
+  , HorizontalRule
+  , HorizontalRule
+  , Para
+      [ Strikeout [ Str "-----" ]
+      , SoftBreak
+      , Strikeout [ Str "-------" , Space , Str "--------" ]
+      ]
+  , Para [ Strikeout [ Str "-------+--------" ] ]
+  , Para
+      [ Str "("
+      , Space
+      , Strikeout [ Str "----------------" ]
+      , Space
+      , Str ")"
+      ]
+  , Header 1 ( "inline" , [] , [] ) [ Str "Inline" ]
+  , Para
+      [ Str "i)"
+      , Space
+      , Strong [ Str "b" ]
+      , Space
+      , Emph [ Str "i" ]
+      , Space
+      , Underline [ Str "u" ]
+      , Space
+      , Strikeout [ Str "s" ]
+      , Space
+      , Code ( "" , [] , [] ) "m"
+      , Space
+      , Str "r"
+      , Space
+      , RawInline (Format "html") "t"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "bo" ]
+      , Space
+      , Emph [ Str "it" ]
+      , Space
+      , Underline [ Str "un" ]
+      , Space
+      , Strikeout [ Str "st" ]
+      , Space
+      , Code ( "" , [] , [] ) "mo"
+      , Space
+      , Str "ra"
+      , Space
+      , RawInline (Format "html") "tg"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "bold" ]
+      , Space
+      , Emph [ Str "ital" ]
+      , Space
+      , Underline [ Str "undr" ]
+      , Space
+      , Strikeout [ Str "strk" ]
+      , Space
+      , Code ( "" , [] , [] ) "mono"
+      , Space
+      , Str "raw"
+      , Space
+      , RawInline (Format "html") "tggd"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "bo" , Space , Str "ld" ]
+      , Space
+      , Emph [ Str "it" , Space , Str "al" ]
+      , Space
+      , Underline [ Str "un" , Space , Str "dr" ]
+      , Space
+      , Strikeout [ Str "st" , Space , Str "rk" ]
+      , Space
+      , Code ( "" , [] , [] ) "mo no"
+      , Space
+      , Str "r"
+      , Space
+      , Str "aw"
+      , Space
+      , RawInline (Format "html") "tg gd"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "bo" , Space , Str "*" , Space , Str "ld" ]
+      , Space
+      , Emph [ Str "it" , Space , Str "/" , Space , Str "al" ]
+      , Space
+      , Underline
+          [ Str "un" , Space , Str "_" , Space , Str "dr" ]
+      , Space
+      , Strikeout
+          [ Str "st" , Space , Str "-" , Space , Str "rk" ]
+      , Space
+      , Code ( "" , [] , [] ) "mo ` no"
+      , Space
+      , Str "r"
+      , Space
+      , Str "\""
+      , Space
+      , Str "aw"
+      , Space
+      , RawInline (Format "html") "tg ' gd"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "bo" , Space , Str "**ld" ]
+      , Space
+      , Emph [ Str "it" , Space , Str "//al" ]
+      , Space
+      , Underline [ Str "un" , Space , Str "__dr" ]
+      , Space
+      , Strikeout [ Str "st" , Space , Str "--rk" ]
+      , Space
+      , Code ( "" , [] , [] ) "mo ``no"
+      , Space
+      , Str "r"
+      , Space
+      , Str "\"\"aw"
+      , Space
+      , RawInline (Format "html") "tg ''gd"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "bo" , Space , Str "**" , Space , Str "ld" ]
+      , Space
+      , Emph [ Str "it" , Space , Str "//" , Space , Str "al" ]
+      , Space
+      , Underline
+          [ Str "un" , Space , Str "__" , Space , Str "dr" ]
+      , Space
+      , Strikeout
+          [ Str "st" , Space , Str "--" , Space , Str "rk" ]
+      , Space
+      , Code ( "" , [] , [] ) "mo `` no"
+      , Space
+      , Str "r"
+      , Space
+      , Str "\"\""
+      , Space
+      , Str "aw"
+      , Space
+      , RawInline (Format "html") "tg '' gd"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "**bold**" ]
+      , Space
+      , Emph [ Str "//ital//" ]
+      , Space
+      , Underline [ Str "__undr__" ]
+      , Space
+      , Strikeout [ Str "--strk--" ]
+      , Space
+      , Code ( "" , [] , [] ) "``mono``"
+      , Space
+      , Str "\"\"raw\"\""
+      , Space
+      , RawInline (Format "html") "''tggd''"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "*bold*" ]
+      , Space
+      , Emph [ Str "/ital/" ]
+      , Space
+      , Underline [ Str "_undr_" ]
+      , Space
+      , Strikeout [ Str "-strk-" ]
+      , Space
+      , Code ( "" , [] , [] ) "`mono`"
+      , Space
+      , Str "\"raw\""
+      , Space
+      , RawInline (Format "html") "'tggd'"
+      ]
+  , Para
+      [ Str "i)"
+      , Space
+      , Strong [ Str "*" ]
+      , Space
+      , Emph [ Str "/" ]
+      , Space
+      , Underline [ Str "_" ]
+      , Space
+      , Strikeout [ Str "-" ]
+      , Space
+      , Code ( "" , [] , [] ) "`"
+      , Space
+      , Str "\""
+      , Space
+      , RawInline (Format "html") "'"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "**" ]
+      , Space
+      , Emph [ Str "//" ]
+      , Space
+      , Underline [ Str "__" ]
+      , Space
+      , Strikeout [ Str "--" ]
+      , Space
+      , Code ( "" , [] , [] ) "``"
+      , Space
+      , Str "\"\""
+      , Space
+      , RawInline (Format "html") "''"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "***" ]
+      , Space
+      , Emph [ Str "///" ]
+      , Space
+      , Underline [ Str "___" ]
+      , Space
+      , Strikeout [ Str "---" ]
+      , Space
+      , Code ( "" , [] , [] ) "```"
+      , Space
+      , Str "\"\"\""
+      , Space
+      , RawInline (Format "html") "'''"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "****" ]
+      , Space
+      , Emph [ Str "////" ]
+      , Space
+      , Underline [ Str "____" ]
+      , Space
+      , Strikeout [ Str "----" ]
+      , Space
+      , Code ( "" , [] , [] ) "````"
+      , Space
+      , Str "\"\"\"\""
+      , Space
+      , RawInline (Format "html") "''''"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "*****" ]
+      , Space
+      , Emph [ Str "/////" ]
+      , Space
+      , Underline [ Str "_____" ]
+      , Space
+      , Strikeout [ Str "-----" ]
+      , Space
+      , Code ( "" , [] , [] ) "`````"
+      , Space
+      , Str "\"\"\"\"\""
+      , Space
+      , RawInline (Format "html") "'''''"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Strong [ Str "******" ]
+      , Space
+      , Emph [ Str "//////" ]
+      , Space
+      , Underline [ Str "______" ]
+      , Space
+      , Strikeout [ Str "------" ]
+      , Space
+      , Code ( "" , [] , [] ) "``````"
+      , Space
+      , Str "\"\"\"\"\"\""
+      , Space
+      , RawInline (Format "html") "''''''"
+      ]
+  , Para
+      [ Str "i)"
+      , Space
+      , Str "****"
+      , Space
+      , Str "////"
+      , Space
+      , Str "____"
+      , Space
+      , Str "----"
+      , Space
+      , Str "````"
+      , Space
+      , Str "\"\"\"\""
+      , Space
+      , Str "''''"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Str "**"
+      , Space
+      , Str "**"
+      , Space
+      , Str "//"
+      , Space
+      , Str "//"
+      , Space
+      , Str "__"
+      , Space
+      , Str "__"
+      , Space
+      , Str "--"
+      , Space
+      , Str "--"
+      , Space
+      , Str "``"
+      , Space
+      , Str "``"
+      , Space
+      , Str "\"\""
+      , Space
+      , Str "\"\""
+      , Space
+      , Str "''"
+      , Space
+      , Str "''"
+      ]
+  , Para
+      [ Str "i)"
+      , Space
+      , Str "**"
+      , Space
+      , Str "bold**"
+      , Space
+      , Str "//"
+      , Space
+      , Str "ital//"
+      , Space
+      , Str "__"
+      , Space
+      , Str "undr__"
+      , Space
+      , Str "--"
+      , Space
+      , Str "strk--"
+      , Space
+      , Str "``"
+      , Space
+      , Str "mono``"
+      , Space
+      , Str "\"\""
+      , Space
+      , Str "raw\"\""
+      , Space
+      , Str "''"
+      , Space
+      , Str "tggd''"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Str "**bold"
+      , Space
+      , Str "**"
+      , Space
+      , Str "//ital"
+      , Space
+      , Str "//"
+      , Space
+      , Str "__undr"
+      , Space
+      , Str "__"
+      , Space
+      , Str "--strk"
+      , Space
+      , Str "--"
+      , Space
+      , Str "``mono"
+      , Space
+      , Str "``"
+      , Space
+      , Str "\"\"raw"
+      , Space
+      , Str "\"\""
+      , Space
+      , Str "''tggd"
+      , Space
+      , Str "''"
+      , SoftBreak
+      , Str "i)"
+      , Space
+      , Str "**"
+      , Space
+      , Str "bold"
+      , Space
+      , Str "**"
+      , Space
+      , Str "//"
+      , Space
+      , Str "ital"
+      , Space
+      , Str "//"
+      , Space
+      , Str "__"
+      , Space
+      , Str "undr"
+      , Space
+      , Str "__"
+      , Space
+      , Str "--"
+      , Space
+      , Str "strk"
+      , Space
+      , Str "--"
+      , Space
+      , Str "``"
+      , Space
+      , Str "mono"
+      , Space
+      , Str "``"
+      , Space
+      , Str "\"\""
+      , Space
+      , Str "raw"
+      , Space
+      , Str "\"\""
+      , Space
+      , Str "''"
+      , Space
+      , Str "tggd"
+      , Space
+      , Str "''"
+      ]
+  , Header 1 ( "link" , [] , [] ) [ Str "Link" ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "mailto:user@domain.com" ]
+          ( "user@domain.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "mailto:user@domain.com" ]
+          ( "user@domain.com" , "" )
+      , Str "."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "mailto:user@domain.com" ]
+          ( "user@domain.com" , "" )
+      , Str "."
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Str "any"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "mailto:user@domain.com" ]
+          ( "user@domain.com" , "" )
+      , Str "."
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "label" ] ( "user@domain.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "mailto:user@domain.com?subject=bla" ]
+          ( "user@domain.com?subject=bla" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "mailto:user@domain.com?subject=bla" ]
+          ( "user@domain.com?subject=bla" , "" )
+      , Str "."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "mailto:user@domain.com?subject=bla" ]
+          ( "user@domain.com?subject=bla" , "" )
+      , Str ","
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str
+              "mailto:user@domain.com?subject=bla&cc=otheruser@domain.com"
+          ]
+          ( "user@domain.com?subject=bla&cc=otheruser@domain.com"
+          , ""
+          )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str
+              "mailto:user@domain.com?subject=bla&cc=otheruser@domain.com"
+          ]
+          ( "user@domain.com?subject=bla&cc=otheruser@domain.com"
+          , ""
+          )
+      , Str "."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str
+              "mailto:user@domain.com?subject=bla&cc=otheruser@domain.com"
+          ]
+          ( "user@domain.com?subject=bla&cc=otheruser@domain.com"
+          , ""
+          )
+      , Str ","
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "label" ]
+          ( "user@domain.com?subject=bla&cc=otheruser@domain.com"
+          , ""
+          )
+      , Str "."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "label" ]
+          ( "user@domain.com?subject=bla&cc=otheruser@domain.com."
+          , ""
+          )
+      , Str "."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com" ]
+          ( "http://www.domain.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/" ]
+          ( "http://www.domain.com/dir/" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir///" ]
+          ( "http://www.domain.com/dir///" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com." ]
+          ( "http://www.domain.com." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com," ]
+          ( "http://www.domain.com," , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com." ]
+          ( "http://www.domain.com." , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com," ]
+          ( "http://www.domain.com," , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/." ]
+          ( "http://www.domain.com/dir/." , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Str "any"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com." ]
+          ( "http://www.domain.com." , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Str "any"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/." ]
+          ( "http://www.domain.com/dir/." , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Str "any"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/index.html." ]
+          ( "http://www.domain.com/dir/index.html." , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Str "any"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/index.html," ]
+          ( "http://www.domain.com/dir/index.html," , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/#anchor" ]
+          ( "http://www.domain.com/dir/#anchor" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/index.html#anchor" ]
+          ( "http://www.domain.com/dir/index.html#anchor" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/index.html#anchor." ]
+          ( "http://www.domain.com/dir/index.html#anchor." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/#anchor." ]
+          ( "http://www.domain.com/dir/#anchor." , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/index.html#anchor." ]
+          ( "http://www.domain.com/dir/index.html#anchor." , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Str "any"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/#anchor." ]
+          ( "http://www.domain.com/dir/#anchor." , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Str "any"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://www.domain.com/dir/index.html#anchor." ]
+          ( "http://www.domain.com/dir/index.html#anchor." , "" )
+      , Space
+      , Str "any"
+      , Space
+      , Str "text."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://domain.com?a=a@a.a&b=a+b+c." ]
+          ( "http://domain.com?a=a@a.a&b=a+b+c." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://domain.com?a=a@a.a&b=a+b+c," ]
+          ( "http://domain.com?a=a@a.a&b=a+b+c," , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c." ]
+          ( "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@." ]
+          ( "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://domain.com?a=a@a.a&b=a+b+c.#anchor" ]
+          ( "http://domain.com?a=a@a.a&b=a+b+c.#anchor" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor" ]
+          ( "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.#anchor" ]
+          ( "http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.#anchor"
+          , ""
+          )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://user:password@domain.com/bla.html." ]
+          ( "http://user:password@domain.com/bla.html." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://user:password@domain.com/dir/." ]
+          ( "http://user:password@domain.com/dir/." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://user:password@domain.com." ]
+          ( "http://user:password@domain.com." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://user:@domain.com." ]
+          ( "http://user:@domain.com." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://user@domain.com." ]
+          ( "http://user@domain.com." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str
+              "http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor"
+          ]
+          ( "http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor"
+          , ""
+          )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str
+              "http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c@#anchor"
+          ]
+          ( "http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c@#anchor"
+          , ""
+          )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "label" ] ( "www.domain.com" , "" )
+      , SoftBreak
+      , Str "["
+      , Space
+      , Str "label"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "www.domain.com" ]
+          ( "www.domain.com" , "" )
+      , Str "]"
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "label" , Space ]
+          ( "www.domain.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "anchor" , Space ]
+          ( "http://www.domain.com/dir/index.html#anchor." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "login" , Space ]
+          ( "http://user:password@domain.com/bla.html" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "form" , Space ]
+          ( "http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "form" , Space , Str "&" , Space , Str "anchor" ]
+          ( "http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor"
+          , ""
+          )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "login"
+          , Space
+          , Str "&"
+          , Space
+          , Str "form"
+          , Space
+          ]
+          ( "http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c."
+          , ""
+          )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "local"
+          , Space
+          , Str "link"
+          , Space
+          , Str "up"
+          , Space
+          ]
+          ( ".." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "local"
+          , Space
+          , Str "link"
+          , Space
+          , Str "file"
+          , Space
+          ]
+          ( "bla.html" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "local"
+          , Space
+          , Str "link"
+          , Space
+          , Str "anchor"
+          , Space
+          ]
+          ( "#anchor" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "local"
+          , Space
+          , Str "link"
+          , Space
+          , Str "file/anchor"
+          ]
+          ( "bla.html#anchor" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "local"
+          , Space
+          , Str "link"
+          , Space
+          , Str "file/anchor"
+          ]
+          ( "bla.html#anchor." , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "local"
+          , Space
+          , Str "link"
+          , Space
+          , Str "img"
+          , Space
+          ]
+          ( "abc.gif" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "www.fake.com" ]
+          ( "www.domain.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str
+              "http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm"
+          ]
+          ( "http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm"
+          , ""
+          )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str
+              "http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-"
+          ]
+          ( "http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-"
+          , ""
+          )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str
+              "http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_"
+          ]
+          ( "http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_"
+          , ""
+          )
+      , Str "-1%."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str
+              "http://foo._user-9:pass!#$%&*()+word@domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_"
+          ]
+          ( "http://foo._user-9:pass!#$%&*()+word@domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_"
+          , ""
+          )
+      , Str "-1%."
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "http://L1.com" ]
+          ( "http://L1.com" , "" )
+      , Space
+      , Str "!"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "mailto:L2@www.com" ]
+          ( "L2@www.com" , "" )
+      , Space
+      , Str "!"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "L3" ] ( "www.com" , "" )
+      , Space
+      , Str "!"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "L4" ] ( "w@ww.com" , "" )
+      , Space
+      , Str "!"
+      , Space
+      , Link
+          ( "" , [] , [] ) [ Str "www.L5.com" ] ( "www.L5.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "www.domain.com" ]
+          ( "www.domain.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "www2.domain.com" ]
+          ( "www2.domain.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "ftp.domain.com" ]
+          ( "ftp.domain.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "WWW.DOMAIN.COM" ]
+          ( "WWW.DOMAIN.COM" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "FTP.DOMAIN.COM" ]
+          ( "FTP.DOMAIN.COM" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "label" ] ( "www.domain.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "label" ] ( "ftp.domain.com" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "label" ] ( "WWW.DOMAIN.COM" , "" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] ) [ Str "label" ] ( "FTP.DOMAIN.COM" , "" )
+      , SoftBreak
+      , Str "[label"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "www.domain.com" ]
+          ( "www.domain.com" , "" )
+      , Space
+      , Str "]"
+      , SoftBreak
+      , Str "[label]"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "www.domain.com" ]
+          ( "www.domain.com" , "" )
+      , Str "]"
+      ]
+  , Header 1 ( "image" , [] , [] ) [ Str "Image" ]
+  , Para [ Image ( "" , [] , [] ) [] ( "img.png" , "" ) ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Image ( "" , [] , [] ) [] ( "img.png" , "" ) ]
+          ( "https://txt2tags.org" , "" )
+      ]
+  , Para
+      [ Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , Space
+      , Str "Image"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "line"
+      , Space
+      , Str "beginning."
+      ]
+  , Para
+      [ Str "Image"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "middle"
+      , Space
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "line."
+      ]
+  , Para
+      [ Str "Image"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "line"
+      , Space
+      , Str "end."
+      , Space
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      ]
+  , Para
+      [ Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , SoftBreak
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , SoftBreak
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      ]
+  , Para
+      [ Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      ]
+  , Para
+      [ Str "Images"
+      , Space
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , Space
+      , Str "mixed"
+      , Space
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , Space
+      , Str "with"
+      , Space
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , Space
+      , Str "text."
+      ]
+  , Para
+      [ Str "Images"
+      , Space
+      , Str "glued"
+      , Space
+      , Str "together:"
+      , Space
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , Image ( "" , [] , [] ) [] ( "img.png" , "" )
+      , Str "."
+      ]
+  , Para [ Str "[img.png" , Space , Str "]" ]
+  , Para [ Str "[" , Space , Str "img.png]" ]
+  , Para [ Str "[" , Space , Str "img.png" , Space , Str "]" ]
+  , Header
+      1
+      ( "numtitle" , [] , [] )
+      [ Str "Numbered" , Space , Str "Title" ]
+  , Header
+      1
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "1" ]
+  , Header
+      2
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "2" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      4
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "4" ]
+  , Header
+      5
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "5" ]
+  , Header
+      1
+      ( "lab_el-1" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "1" ]
+  , Header
+      2
+      ( "lab_el-2" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "2" ]
+  , Header
+      3
+      ( "lab_el-3" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      4
+      ( "lab_el-4" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "4" ]
+  , Header
+      5
+      ( "lab_el-5" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "5" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      3
+      ( "lab_el-9" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Para [ Str "+Not" , Space , Str "Title" ]
+  , Para [ Str "++Not" , Space , Str "Title+" ]
+  , Para
+      [ Str "+++Not"
+      , Space
+      , Str "Title++++"
+      , SoftBreak
+      , Str "++++++Not"
+      , Space
+      , Str "Title"
+      , Space
+      , Str "6++++++"
+      ]
+  , Para
+      [ Str "+++++++Not"
+      , Space
+      , Str "Title"
+      , Space
+      , Str "7+++++++"
+      , SoftBreak
+      , Str "+Not"
+      , Space
+      , Str "Title+"
+      , Space
+      , Str "[label1]"
+      , SoftBreak
+      , Str "+Not"
+      , Space
+      , Str "Title+["
+      , Space
+      , Str "label"
+      , Space
+      , Str "]"
+      , SoftBreak
+      , Str "+Not"
+      , Space
+      , Str "Title+[la/bel]"
+      ]
+  , Header 1 ( "title" , [] , [] ) [ Str "Title" ]
+  , Header
+      1
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "1" ]
+  , Header
+      2
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "2" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      4
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "4" ]
+  , Header
+      5
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "5" ]
+  , Header
+      1
+      ( "lab_el-1" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "1" ]
+  , Header
+      2
+      ( "lab_el-2" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "2" ]
+  , Header
+      3
+      ( "lab_el-3" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      4
+      ( "lab_el-4" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "4" ]
+  , Header
+      5
+      ( "lab_el-5" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "5" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      3
+      ( "" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Header
+      3
+      ( "lab_el-9" , [] , [] )
+      [ Str "Title" , Space , Str "Level" , Space , Str "3" ]
+  , Para [ Str "=Not" , Space , Str "Title" ]
+  , Para [ Str "==Not" , Space , Str "Title=" ]
+  , Para
+      [ Str "===Not"
+      , Space
+      , Str "Title===="
+      , SoftBreak
+      , Str "======Not"
+      , Space
+      , Str "Title"
+      , Space
+      , Str "6======"
+      ]
+  , Para
+      [ Str "=======Not"
+      , Space
+      , Str "Title"
+      , Space
+      , Str "7======="
+      , SoftBreak
+      , Str "=Not"
+      , Space
+      , Str "Title="
+      , Space
+      , Str "[label1]"
+      , SoftBreak
+      , Str "=Not"
+      , Space
+      , Str "Title=["
+      , Space
+      , Str "label"
+      , Space
+      , Str "]"
+      , SoftBreak
+      , Str "=Not"
+      , Space
+      , Str "Title=[la/bel]"
+      ]
+  , Header 1 ( "quote" , [] , [] ) [ Str "Quote" ]
+  , BlockQuote
+      [ Para
+          [ Str "To"
+          , Space
+          , Str "quote"
+          , Space
+          , Str "a"
+          , Space
+          , Str "paragraph,"
+          , Space
+          , Str "just"
+          , Space
+          , Str "prefix"
+          , Space
+          , Str "it"
+          , Space
+          , Str "by"
+          , Space
+          , Str "a"
+          , Space
+          , Str "TAB"
+          , SoftBreak
+          , Str "character."
+          , Space
+          , Str "All"
+          , Space
+          , Str "the"
+          , Space
+          , Str "lines"
+          , Space
+          , Str "of"
+          , Space
+          , Str "the"
+          , Space
+          , Str "paragraph"
+          , Space
+          , Str "must"
+          , SoftBreak
+          , Str "begin"
+          , Space
+          , Str "with"
+          , Space
+          , Str "a"
+          , Space
+          , Str "TAB."
+          ]
+      ]
+  , Para
+      [ Str "Any"
+      , Space
+      , Str "non-tabbed"
+      , Space
+      , Str "line"
+      , Space
+      , Str "closes"
+      , Space
+      , Str "the"
+      , Space
+      , Str "quote"
+      , Space
+      , Str "block."
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "The"
+          , Space
+          , Str "number"
+          , Space
+          , Str "of"
+          , Space
+          , Str "leading"
+          , Space
+          , Str "TABs"
+          , Space
+          , Str "identifies"
+          , Space
+          , Str "the"
+          , Space
+          , Str "quote"
+          , SoftBreak
+          , Str "block"
+          , Space
+          , Str "depth."
+          , Space
+          , Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "quote"
+          , Space
+          , Str "level"
+          , Space
+          , Str "1."
+          ]
+      , BlockQuote
+          [ Para
+              [ Str "With"
+              , Space
+              , Str "two"
+              , Space
+              , Str "TABs,"
+              , Space
+              , Str "we"
+              , Space
+              , Str "are"
+              , Space
+              , Str "on"
+              , Space
+              , Str "the"
+              , Space
+              , Str "quote"
+              , SoftBreak
+              , Str "level"
+              , Space
+              , Str "2."
+              ]
+          , BlockQuote
+              [ Para
+                  [ Str "The"
+                  , Space
+                  , Str "more"
+                  , Space
+                  , Str "TABs,"
+                  , Space
+                  , Str "more"
+                  , Space
+                  , Str "deep"
+                  , Space
+                  , Str "is"
+                  , SoftBreak
+                  , Str "the"
+                  , Space
+                  , Str "quote"
+                  , Space
+                  , Str "level."
+                  ]
+              , BlockQuote
+                  [ Para
+                      [ Str "There"
+                      , Space
+                      , Str "isn't"
+                      , Space
+                      , Str "a"
+                      , Space
+                      , Str "limit."
+                      ]
+                  ]
+              ]
+          ]
+      ]
+  , BlockQuote
+      [ BlockQuote
+          [ BlockQuote
+              [ BlockQuote
+                  [ Para
+                      [ Str "This"
+                      , Space
+                      , Str "quote"
+                      , Space
+                      , Str "starts"
+                      , Space
+                      , Str "at"
+                      , SoftBreak
+                      , Str "level"
+                      , Space
+                      , Str "4."
+                      ]
+                  ]
+              , Para
+                  [ Str "Then"
+                  , Space
+                  , Str "its"
+                  , Space
+                  , Str "depth"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "decreased."
+                  ]
+              ]
+          , Para
+              [ Str "Counting"
+              , Space
+              , Str "down,"
+              , Space
+              , Str "one"
+              , Space
+              , Str "by"
+              , Space
+              , Str "one."
+              ]
+          ]
+      , Para
+          [ Str "Until"
+          , Space
+          , Str "the"
+          , Space
+          , Str "level"
+          , Space
+          , Str "1."
+          ]
+      ]
+  , BlockQuote
+      [ BlockQuote
+          [ BlockQuote
+              [ Para
+                  [ Str "Unlike"
+                  , Space
+                  , Str "lists,"
+                  , Space
+                  , Str "any"
+                  , Space
+                  , Str "quote"
+                  , Space
+                  , Str "block"
+                  , Space
+                  , Str "is"
+                  , SoftBreak
+                  , Str "independent,"
+                  , Space
+                  , Str "not"
+                  , Space
+                  , Str "part"
+                  , Space
+                  , Str "of"
+                  , Space
+                  , Str "a"
+                  , Space
+                  , Str "tree."
+                  ]
+              ]
+          ]
+      , Para
+          [ Str "The"
+          , Space
+          , Str "TAB"
+          , Space
+          , Str "count"
+          , Space
+          , Str "don't"
+          , Space
+          , Str "need"
+          , Space
+          , Str "to"
+          , Space
+          , Str "be"
+          , Space
+          , Str "incremental"
+          , SoftBreak
+          , Str "by"
+          , Space
+          , Str "one."
+          ]
+      , BlockQuote
+          [ BlockQuote
+              [ BlockQuote
+                  [ Para
+                      [ Str "The"
+                      , Space
+                      , Str "nesting"
+                      , Space
+                      , Str "don't"
+                      , Space
+                      , Str "need"
+                      , SoftBreak
+                      , Str "to"
+                      , Space
+                      , Str "follow"
+                      , Space
+                      , Str "any"
+                      , Space
+                      , Str "rule."
+                      ]
+                  ]
+              ]
+          , Para
+              [ Str "Quotes"
+              , Space
+              , Str "can"
+              , Space
+              , Str "be"
+              , Space
+              , Str "opened"
+              , Space
+              , Str "and"
+              , Space
+              , Str "closed"
+              , SoftBreak
+              , Str "in"
+              , Space
+              , Str "any"
+              , Space
+              , Str "way."
+              ]
+          , BlockQuote
+              [ BlockQuote
+                  [ BlockQuote
+                      [ Para [ Str "You" , Space , Str "choose." ] ]
+                  ]
+              ]
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Some"
+          , Space
+          , Str "targets"
+          , Space
+          , Str "(as"
+          , Space
+          , Str "sgml)"
+          , Space
+          , Str "don't"
+          , Space
+          , Str "support"
+          , Space
+          , Str "the"
+          , SoftBreak
+          , Str "nesting"
+          , Space
+          , Str "of"
+          , Space
+          , Str "quotes."
+          , Space
+          , Str "There"
+          , Space
+          , Str "is"
+          , Space
+          , Str "only"
+          , Space
+          , Str "one"
+          , Space
+          , Str "quote"
+          , SoftBreak
+          , Str "level."
+          ]
+      , BlockQuote
+          [ Para
+              [ Str "In"
+              , Space
+              , Str "this"
+              , Space
+              , Str "case,"
+              , Space
+              , Str "no"
+              , Space
+              , Str "matter"
+              , Space
+              , Str "how"
+              , Space
+              , Str "much"
+              , SoftBreak
+              , Str "TABs"
+              , Space
+              , Str "are"
+              , Space
+              , Str "used"
+              , Space
+              , Str "to"
+              , Space
+              , Str "define"
+              , Space
+              , Str "the"
+              , Space
+              , Str "quote"
+              , SoftBreak
+              , Str "block,"
+              , Space
+              , Str "it"
+              , Space
+              , Str "always"
+              , Space
+              , Str "will"
+              , Space
+              , Str "be"
+              , Space
+              , Str "level"
+              , Space
+              , Str "1."
+              ]
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Spaces"
+          , Space
+          , Str "AFTER"
+          , Space
+          , Str "the"
+          , Space
+          , Str "TAB"
+          , Space
+          , Str "character"
+          , Space
+          , Str "are"
+          , Space
+          , Str "allowed."
+          , SoftBreak
+          , Str "But"
+          , Space
+          , Str "be"
+          , Space
+          , Str "careful,"
+          , Space
+          , Str "it"
+          , Space
+          , Str "can"
+          , Space
+          , Str "be"
+          , Space
+          , Str "confusing."
+          ]
+      ]
+  , Para
+      [ Str "Spaces"
+      , Space
+      , Str "BEFORE"
+      , Space
+      , Str "the"
+      , Space
+      , Str "TAB"
+      , Space
+      , Str "character"
+      , SoftBreak
+      , Str "invalidate"
+      , Space
+      , Str "the"
+      , Space
+      , Str "mark."
+      , Space
+      , Str "It's"
+      , Space
+      , Str "not"
+      , Space
+      , Str "quote."
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Paragraph"
+          , Space
+          , Str "breaks"
+          , Space
+          , Str "inside"
+          , Space
+          , Str "a"
+          , Space
+          , Str "quote"
+          , Space
+          , Str "aren't"
+          , SoftBreak
+          , Str "possible."
+          ]
+      , Para
+          [ Str "This"
+          , Space
+          , Str "sample"
+          , Space
+          , Str "are"
+          , Space
+          , Str "two"
+          , Space
+          , Str "separated"
+          , Space
+          , Str "quoted"
+          , SoftBreak
+          , Str "paragraphs,"
+          , Space
+          , Str "not"
+          , Space
+          , Str "a"
+          , Space
+          , Str "quote"
+          , Space
+          , Str "block"
+          , Space
+          , Str "with"
+          , SoftBreak
+          , Str "two"
+          , Space
+          , Str "paragraphs"
+          , Space
+          , Str "inside."
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "The"
+          , Space
+          , Str "end"
+          , Space
+          , Str "of"
+          , Space
+          , Str "the"
+          , Space
+          , Str "file"
+          , Space
+          , Str "(EOF)"
+          , Space
+          , Str "closes"
+          , Space
+          , Str "the"
+          , SoftBreak
+          , Str "currently"
+          , Space
+          , Str "open"
+          , Space
+          , Str "quote"
+          , Space
+          , Str "block."
+          ]
+      ]
+  , Header 1 ( "raw" , [] , [] ) [ Str "Raw" ]
+  , Para [ Str "A raw line.\n" ]
+  , Para [ Str "  Another raw line, with leading spaces.\n" ]
+  , Para
+      [ Str "A raw area delimited\n       by lines with marks.\n"
+      ]
+  , Para
+      [ Str
+          "Trailing spaces and TABs after the area marks\nare allowed, but not encouraged nor documented.\n"
+      ]
+  , Para
+      [ Str "\"\"\"Not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "raw"
+      , Space
+      , Str "line,"
+      , Space
+      , Str "need"
+      , Space
+      , Str "one"
+      , Space
+      , Str "space"
+      , Space
+      , Str "after"
+      , Space
+      , Str "mark."
+      ]
+  , Para
+      [ Str "\"\"\""
+      , SoftBreak
+      , Str "Not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "raw"
+      , Space
+      , Str "area."
+      , SoftBreak
+      , Str "The"
+      , Space
+      , Str "marks"
+      , Space
+      , Str "must"
+      , Space
+      , Str "be"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "line"
+      , Space
+      , Str "beginning,"
+      , SoftBreak
+      , Str "no"
+      , Space
+      , Str "leading"
+      , Space
+      , Str "spaces."
+      , SoftBreak
+      , Str "\"\"\""
+      ]
+  , Para
+      [ Str
+          "The end of the file (EOF) closes\nthe currently open raw area.\n"
+      ]
+  , Header 1 ( "verbatim" , [] , [] ) [ Str "Verbatim" ]
+  , CodeBlock ( "" , [] , [] ) "A verbatim line.\n"
+  , CodeBlock
+      ( "" , [] , [] )
+      "  Another verbatim line, with leading spaces.\n"
+  , CodeBlock
+      ( "" , [] , [] )
+      "A verbatim area delimited\n       by lines with marks.\n"
+  , CodeBlock
+      ( "" , [] , [] )
+      "Trailing spaces and TABs after the area marks\nare allowed, but not encouraged nor documented.\n"
+  , Para
+      [ Str "```Not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "verbatim"
+      , Space
+      , Str "line,"
+      , Space
+      , Str "need"
+      , Space
+      , Str "one"
+      , Space
+      , Str "space"
+      , Space
+      , Str "after"
+      , Space
+      , Str "mark."
+      ]
+  , Para
+      [ Str "```"
+      , SoftBreak
+      , Str "Not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "verbatim"
+      , Space
+      , Str "area."
+      , SoftBreak
+      , Str "The"
+      , Space
+      , Str "marks"
+      , Space
+      , Str "must"
+      , Space
+      , Str "be"
+      , Space
+      , Str "at"
+      , Space
+      , Str "the"
+      , Space
+      , Str "line"
+      , Space
+      , Str "beginning,"
+      , SoftBreak
+      , Str "no"
+      , Space
+      , Str "leading"
+      , Space
+      , Str "spaces."
+      , SoftBreak
+      , Str "```"
+      ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "The end of the file (EOF) closes\nthe currently open verbatim area.\n"
+  , Header
+      1
+      ( "deflist" , [] , [] )
+      [ Str "Definition" , Space , Str "List" ]
+  , DefinitionList
+      [ ( [ Str "Definition" , Space , Str "list" ]
+        , [ [ Plain
+                [ Str "A"
+                , Space
+                , Str "list"
+                , Space
+                , Str "with"
+                , Space
+                , Str "terms"
+                ]
+            ]
+          ]
+        )
+      , ( [ Str "Start"
+          , Space
+          , Str "term"
+          , Space
+          , Str "with"
+          , Space
+          , Str "colon"
+          ]
+        , [ [ Plain
+                [ Str "And"
+                , Space
+                , Str "its"
+                , Space
+                , Str "definition"
+                , Space
+                , Str "follows"
+                ]
+            ]
+          ]
+        )
+      ]
+  , Header
+      1
+      ( "numlist" , [] , [] )
+      [ Str "Numbered" , Space , Str "List" ]
+  , Para
+      [ Str "See"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "List" ] ( "#list" , "" )
+      , Str ","
+      , Space
+      , Str "the"
+      , Space
+      , Str "same"
+      , Space
+      , Str "rules"
+      , Space
+      , Str "apply."
+      ]
+  , Header 1 ( "list" , [] , [] ) [ Str "List" ]
+  , BulletList
+      [ [ Plain
+            [ Str "Use"
+            , Space
+            , Str "the"
+            , Space
+            , Str "hyphen"
+            , Space
+            , Str "to"
+            , Space
+            , Str "prefix"
+            , Space
+            , Str "list"
+            , Space
+            , Str "items."
+            ]
+        ]
+      , [ Plain
+            [ Str "There"
+            , Space
+            , Str "must"
+            , Space
+            , Str "be"
+            , Space
+            , Str "one"
+            , Space
+            , Str "space"
+            , Space
+            , Str "after"
+            , Space
+            , Str "the"
+            , Space
+            , Str "hyphen."
+            ]
+        ]
+      , [ Plain
+            [ Str "The"
+            , Space
+            , Str "list"
+            , Space
+            , Str "is"
+            , Space
+            , Str "closed"
+            , Space
+            , Str "by"
+            , Space
+            , Str "two"
+            , Space
+            , Str "consecutive"
+            , Space
+            , Str "blank"
+            , Space
+            , Str "lines."
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "The"
+            , Space
+            , Str "list"
+            , Space
+            , Str "can"
+            , Space
+            , Str "be"
+            , Space
+            , Str "indented"
+            , Space
+            , Str "on"
+            , Space
+            , Str "the"
+            , Space
+            , Str "source"
+            , Space
+            , Str "document."
+            ]
+        ]
+      , [ Plain
+            [ Str "You"
+            , Space
+            , Str "can"
+            , Space
+            , Str "use"
+            , Space
+            , Str "any"
+            , Space
+            , Str "number"
+            , Space
+            , Str "of"
+            , Space
+            , Str "spaces."
+            ]
+        ]
+      , [ Plain
+            [ Str "The"
+            , Space
+            , Str "result"
+            , Space
+            , Str "will"
+            , Space
+            , Str "be"
+            , Space
+            , Str "the"
+            , Space
+            , Str "same."
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Para
+            [ Str "Let"
+            , Space
+            , Str "one"
+            , Space
+            , Str "blank"
+            , Space
+            , Str "line"
+            , Space
+            , Str "between"
+            , Space
+            , Str "the"
+            , Space
+            , Str "list"
+            , Space
+            , Str "items."
+            ]
+        ]
+      , [ Para
+            [ Str "It"
+            , Space
+            , Str "will"
+            , Space
+            , Str "be"
+            , Space
+            , Str "maintained"
+            , Space
+            , Str "on"
+            , Space
+            , Str "the"
+            , Space
+            , Str "conversion."
+            ]
+        ]
+      , [ Para
+            [ Str "Some"
+            , Space
+            , Str "targets"
+            , Space
+            , Str "don't"
+            , Space
+            , Str "support"
+            , Space
+            , Str "this"
+            , Space
+            , Str "behavior."
+            ]
+        ]
+      , [ Para
+            [ Str "This"
+            , Space
+            , Str "one"
+            , Space
+            , Str "was"
+            , Space
+            , Str "separated"
+            , Space
+            , Str "by"
+            , Space
+            , Str "a"
+            , Space
+            , Str "line"
+            , Space
+            , Str "with"
+            , Space
+            , Str "blanks."
+            , SoftBreak
+            , Str "You"
+            , Space
+            , Str "can"
+            , Space
+            , Str "also"
+            , Space
+            , Str "put"
+            , Space
+            , Str "a"
+            , Space
+            , Str "blank"
+            , Space
+            , Str "line"
+            , Space
+            , Str "inside"
+            ]
+        , Para
+            [ Str "the"
+            , Space
+            , Str "item"
+            , Space
+            , Str "contents"
+            , Space
+            , Str "and"
+            , Space
+            , Str "it"
+            , Space
+            , Str "will"
+            , Space
+            , Str "be"
+            , Space
+            , Str "preserved."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "-This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "(no"
+      , Space
+      , Str "space)"
+      ]
+  , Para
+      [ Str "-"
+      , Space
+      , Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "(more"
+      , Space
+      , Str "than"
+      , Space
+      , Str "one"
+      , Space
+      , Str "space)"
+      ]
+  , Para
+      [ Str "-"
+      , Space
+      , Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "(a"
+      , Space
+      , Str "TAB"
+      , Space
+      , Str "instead"
+      , Space
+      , Str "the"
+      , Space
+      , Str "space)"
+      ]
+  , BulletList
+      [ [ BulletList
+            [ [ Plain
+                  [ Str "This"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "a"
+                  , Space
+                  , Str "list"
+                  ]
+              ]
+            ]
+        ]
+      , [ OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Str "This"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "a"
+                  , Space
+                  , Str "list"
+                  ]
+              ]
+            ]
+        ]
+      , [ DefinitionList
+            [ ( [ Str "This"
+                , Space
+                , Str "is"
+                , Space
+                , Str "a"
+                , Space
+                , Str "list"
+                ]
+              , [ [] ]
+              )
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "This"
+            , Space
+            , Str "is"
+            , Space
+            , Str "the"
+            , Space
+            , Str "\"mother\""
+            , Space
+            , Str "list"
+            , Space
+            , Str "first"
+            , Space
+            , Str "item."
+            ]
+        ]
+      , [ Plain
+            [ Str "Here"
+            , Space
+            , Str "is"
+            , Space
+            , Str "the"
+            , Space
+            , Str "second,"
+            , Space
+            , Str "but"
+            , Space
+            , Str "inside"
+            , Space
+            , Str "this"
+            , Space
+            , Str "item,"
+            ]
+        , BulletList
+            [ [ Plain
+                  [ Str "there"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "a"
+                  , Space
+                  , Str "sublist,"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "its"
+                  , Space
+                  , Str "own"
+                  , Space
+                  , Str "items."
+                  ]
+              ]
+            , [ Plain
+                  [ Str "Note"
+                  , Space
+                  , Str "that"
+                  , Space
+                  , Str "the"
+                  , Space
+                  , Str "items"
+                  , Space
+                  , Str "of"
+                  , Space
+                  , Str "the"
+                  , Space
+                  , Str "same"
+                  , Space
+                  , Str "sublist"
+                  ]
+              ]
+            , [ Plain
+                  [ Str "must"
+                  , Space
+                  , Str "have"
+                  , Space
+                  , Str "the"
+                  , Space
+                  , Str "same"
+                  , Space
+                  , Str "indentation."
+                  ]
+              , BulletList
+                  [ [ Plain
+                        [ Str "And"
+                        , Space
+                        , Str "this"
+                        , Space
+                        , Str "can"
+                        , Space
+                        , Str "go"
+                        , Space
+                        , Str "on,"
+                        , Space
+                        , Str "opening"
+                        , Space
+                        , Str "sublists."
+                        ]
+                    , BulletList
+                        [ [ Plain
+                              [ Str "Just"
+                              , Space
+                              , Str "add"
+                              , Space
+                              , Str "leading"
+                              , Space
+                              , Str "spaces"
+                              , Space
+                              , Str "before"
+                              , Space
+                              , Str "the"
+                              ]
+                          ]
+                        , [ Plain
+                              [ Str "hyphen"
+                              , Space
+                              , Str "and"
+                              , Space
+                              , Str "sublists"
+                              , Space
+                              , Str "will"
+                              , Space
+                              , Str "be"
+                              , Space
+                              , Str "opened."
+                              ]
+                          ]
+                        , [ Plain
+                              [ Str "The"
+                              , Space
+                              , Str "two"
+                              , Space
+                              , Str "blank"
+                              , Space
+                              , Str "lines"
+                              , Space
+                              , Str "closes"
+                              , Space
+                              , Str "them"
+                              , Space
+                              , Str "all."
+                              ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "When"
+            , Space
+            , Str "nesting"
+            , Space
+            , Str "lists,"
+            , Space
+            , Str "the"
+            , Space
+            , Str "additional"
+            , Space
+            , Str "spaces"
+            , Space
+            , Str "are"
+            , Space
+            , Str "free."
+            ]
+        ]
+      , [ Plain
+            [ Str "You"
+            , Space
+            , Str "can"
+            , Space
+            , Str "add"
+            , Space
+            , Str "just"
+            , Space
+            , Str "one,"
+            ]
+        , BulletList
+            [ [ Plain [ Str "or" , Space , Str "many." ]
+              , BulletList
+                  [ [ Plain
+                        [ Str "What"
+                        , Space
+                        , Str "matters"
+                        , Space
+                        , Str "is"
+                        , Space
+                        , Str "to"
+                        , Space
+                        , Str "put"
+                        , Space
+                        , Str "more"
+                        , Space
+                        , Str "than"
+                        , Space
+                        , Str "the"
+                        , Space
+                        , Str "previous."
+                        ]
+                    ]
+                  , [ Plain
+                        [ Str "But"
+                        , Space
+                        , Str "remember"
+                        , Space
+                        , Str "that"
+                        , Space
+                        , Str "the"
+                        , Space
+                        , Str "other"
+                        , Space
+                        , Str "items"
+                        , Space
+                        , Str "of"
+                        , Space
+                        , Str "the"
+                        , Space
+                        , Str "same"
+                        , Space
+                        , Str "list"
+                        ]
+                    ]
+                  , [ Plain
+                        [ Str "must"
+                        , Space
+                        , Str "use"
+                        , Space
+                        , Str "the"
+                        , Space
+                        , Str "same"
+                        , Space
+                        , Str "indentation."
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "There"
+            , Space
+            , Str "is"
+            , Space
+            , Str "not"
+            , Space
+            , Str "a"
+            , Space
+            , Str "depth"
+            , Space
+            , Str "limit,"
+            ]
+        , BulletList
+            [ [ Plain
+                  [ Str "you"
+                  , Space
+                  , Str "can"
+                  , Space
+                  , Str "go"
+                  , Space
+                  , Str "deeper"
+                  , Space
+                  , Str "and"
+                  , Space
+                  , Str "deeper."
+                  ]
+              , BulletList
+                  [ [ Plain
+                        [ Str "But"
+                        , Space
+                        , Str "some"
+                        , Space
+                        , Str "targets"
+                        , Space
+                        , Str "may"
+                        , Space
+                        , Str "have"
+                        , Space
+                        , Str "restrictions."
+                        ]
+                    , BulletList
+                        [ [ Plain
+                              [ Str "The"
+                              , Space
+                              , Str "LaTeX"
+                              , Space
+                              , Str "maximum"
+                              , Space
+                              , Str "is"
+                              , Space
+                              , Str "here,"
+                              , Space
+                              , Str "4"
+                              , Space
+                              , Str "levels."
+                              ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "Reverse"
+            , Space
+            , Str "nesting"
+            , Space
+            , Str "doesn't"
+            , Space
+            , Str "work."
+            ]
+        ]
+      , [ Plain
+            [ Str "Because"
+            , Space
+            , Str "a"
+            , Space
+            , Str "sublist"
+            , Space
+            , Str "*must*"
+            , Space
+            , Str "have"
+            , Space
+            , Str "a"
+            , Space
+            , Str "mother"
+            , Space
+            , Str "list."
+            ]
+        ]
+      , [ Plain
+            [ Str "It's"
+            , Space
+            , Str "the"
+            , Space
+            , Str "list"
+            , Space
+            , Str "concept,"
+            , Space
+            , Str "not"
+            , Space
+            , Str "a"
+            , Space
+            , Str "txt2tags"
+            , Space
+            , Str "limitation."
+            ]
+        ]
+      , [ Plain
+            [ Str "All"
+            , Space
+            , Str "this"
+            , Space
+            , Str "sublists"
+            , Space
+            , Str "will"
+            , Space
+            , Str "be"
+            , Space
+            , Str "bumped"
+            , Space
+            , Str "to"
+            , Space
+            , Str "mother"
+            , Space
+            , Str "lists."
+            ]
+        ]
+      , [ Plain
+            [ Str "At"
+            , Space
+            , Str "level"
+            , Space
+            , Str "1,"
+            , Space
+            , Str "like"
+            , Space
+            , Str "this"
+            , Space
+            , Str "one."
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain [ Str "Level" , Space , Str "1" ]
+        , BulletList
+            [ [ Plain [ Str "Level" , Space , Str "2" ]
+              , BulletList
+                  [ [ Plain [ Str "Level" , Space , Str "3" ]
+                    , BulletList
+                        [ [ Plain [ Str "Level" , Space , Str "4" ] ] ]
+                    ]
+                  , [ Plain
+                        [ Str "Level"
+                        , Space
+                        , Str "3"
+                        , Space
+                        , Str "--"
+                        , Space
+                        , Str "(closed"
+                        , Space
+                        , Str "Level"
+                        , Space
+                        , Str "4)"
+                        ]
+                    ]
+                  ]
+              ]
+            , [ Plain
+                  [ Str "Level"
+                  , Space
+                  , Str "2"
+                  , Space
+                  , Str "--"
+                  , Space
+                  , Str "(closed"
+                  , Space
+                  , Str "Level"
+                  , Space
+                  , Str "3)"
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain
+            [ Str "Level"
+            , Space
+            , Str "1"
+            , Space
+            , Str "--"
+            , Space
+            , Str "(closed"
+            , Space
+            , Str "Level"
+            , Space
+            , Str "2)"
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain [ Str "Level" , Space , Str "1" ]
+        , BulletList
+            [ [ Plain [ Str "Level" , Space , Str "2" ]
+              , BulletList
+                  [ [ Plain [ Str "Level" , Space , Str "3" ]
+                    , BulletList
+                        [ [ Plain [ Str "Level" , Space , Str "4" ] ] ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain
+            [ Str "Level"
+            , Space
+            , Str "1"
+            , Space
+            , Str "--"
+            , Space
+            , Str "(closed"
+            , Space
+            , Str "Level"
+            , Space
+            , Str "4,"
+            , Space
+            , Str "Level"
+            , Space
+            , Str "3"
+            , Space
+            , Str "and"
+            , Space
+            , Str "Level"
+            , Space
+            , Str "2)"
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Para [ Str "Level" , Space , Str "1" ]
+        , BulletList
+            [ [ Para
+                  [ Str "Level"
+                  , Space
+                  , Str "2"
+                  , Space
+                  , Str "--"
+                  , Space
+                  , Str "blank"
+                  , Space
+                  , Str "BEFORE"
+                  , Space
+                  , Str "and"
+                  , Space
+                  , Str "AFTER"
+                  , Space
+                  , Str "(in)"
+                  ]
+              , BulletList
+                  [ [ Plain [ Str "Level" , Space , Str "3" ] ] ]
+              ]
+            ]
+        ]
+      ]
+  , BulletList [ [ Plain [ Str "Level" , Space , Str "4" ] ] ]
+  , BulletList
+      [ [ Para [ Str "Level" , Space , Str "3" ] ]
+      , [ Para
+            [ Str "Level"
+            , Space
+            , Str "2"
+            , Space
+            , Str "--"
+            , Space
+            , Str "blank"
+            , Space
+            , Str "BEFORE"
+            , Space
+            , Str "and"
+            , Space
+            , Str "AFTER"
+            , Space
+            , Str "(out)"
+            ]
+        ]
+      , [ Para [ Str "Level" , Space , Str "1" ]
+        , BulletList
+            [ [ Para
+                  [ Str "Level"
+                  , Space
+                  , Str "2"
+                  , Space
+                  , Str "--"
+                  , Space
+                  , Str "blank"
+                  , Space
+                  , Str "BEFORE"
+                  , Space
+                  , Str "(spaces)"
+                  , Space
+                  , Str "and"
+                  , Space
+                  , Str "AFTER"
+                  , Space
+                  , Str "(TAB)"
+                  ]
+              , BulletList
+                  [ [ Plain [ Str "Level" , Space , Str "3" ] ] ]
+              ]
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain [ Str "Level" , Space , Str "1" ]
+        , BulletList
+            [ [ Plain [ Str "Level" , Space , Str "2" ]
+              , BulletList
+                  [ [ Plain [ Str "Level" , Space , Str "3" ]
+                    , BulletList
+                        [ [ Plain [ Str "Level" , Space , Str "4" ] ]
+                        , [ Plain
+                              [ Str "Level"
+                              , Space
+                              , Str "3.5"
+                              , Space
+                              , Str "???"
+                              ]
+                          ]
+                        ]
+                    ]
+                  , [ Plain [ Str "Level" , Space , Str "3" ] ]
+                  , [ Plain
+                        [ Str "Level"
+                        , Space
+                        , Str "2.5"
+                        , Space
+                        , Str "???"
+                        ]
+                    ]
+                  ]
+              ]
+            , [ Plain [ Str "Level" , Space , Str "2" ] ]
+            , [ Plain
+                  [ Str "Level"
+                  , Space
+                  , Str "1.5"
+                  , Space
+                  , Str "???"
+                  ]
+              ]
+            ]
+        ]
+      , [ Plain [ Str "Level" , Space , Str "1" ] ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "This"
+            , Space
+            , Str "list"
+            , Space
+            , Str "is"
+            , Space
+            , Str "closed"
+            , Space
+            , Str "by"
+            , Space
+            , Str "a"
+            , Space
+            , Str "line"
+            , Space
+            , Str "with"
+            , Space
+            , Str "spaces"
+            , Space
+            , Str "and"
+            , Space
+            , Str "other"
+            , Space
+            , Str "with"
+            , Space
+            , Str "TABs"
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "This"
+            , Space
+            , Str "list"
+            , Space
+            , Str "is"
+            , Space
+            , Str "NOT"
+            , Space
+            , Str "closed"
+            , Space
+            , Str "by"
+            , Space
+            , Str "two"
+            , Space
+            , Str "comment"
+            , Space
+            , Str "lines"
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "This"
+            , Space
+            , Str "list"
+            , Space
+            , Str "is"
+            , Space
+            , Str "closed"
+            , Space
+            , Str "by"
+            , Space
+            , Str "a"
+            , Space
+            , Str "line"
+            , Space
+            , Str "with"
+            , Space
+            , Str "spaces"
+            , Space
+            , Str "and"
+            , Space
+            , Str "TAB,"
+            ]
+        ]
+      , [ Plain
+            [ Str "then"
+            , Space
+            , Str "a"
+            , Space
+            , Str "comment"
+            , Space
+            , Str "line,"
+            , Space
+            , Str "then"
+            , Space
+            , Str "an"
+            , Space
+            , Str "empty"
+            , Space
+            , Str "line."
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain [ Str "Level" , Space , Str "1" ]
+        , BulletList
+            [ [ Plain [ Str "Level" , Space , Str "2" ]
+              , BulletList
+                  [ [ Plain [ Str "Level" , Space , Str "3" ] ] ]
+              , Plain
+                  [ Str "-"
+                  , SoftBreak
+                  , Str "Level"
+                  , Space
+                  , Str "2"
+                  ]
+              ]
+            ]
+        , Plain
+            [ Str "-" , SoftBreak , Str "Level" , Space , Str "1" ]
+        ]
+      ]
+  , Para [ Str "-" ]
+  , BulletList
+      [ [ Plain
+            [ Str "Empty"
+            , Space
+            , Str "item"
+            , Space
+            , Str "with"
+            , Space
+            , Str "trailing"
+            , Space
+            , Str "spaces."
+            ]
+        ]
+      ]
+  , Para [ Str "-" ]
+  , BulletList
+      [ [ Plain
+            [ Str "Empty"
+            , Space
+            , Str "item"
+            , Space
+            , Str "with"
+            , Space
+            , Str "trailing"
+            , Space
+            , Str "TAB."
+            ]
+        ]
+      ]
+  , Para [ Str "-" ]
+  , BulletList
+      [ [ Plain
+            [ Str "If"
+            , Space
+            , Str "the"
+            , Space
+            , Str "end"
+            , Space
+            , Str "of"
+            , Space
+            , Str "the"
+            , Space
+            , Str "file"
+            , Space
+            , Str "(EOF)"
+            , Space
+            , Str "is"
+            , Space
+            , Str "hit,"
+            ]
+        , BulletList
+            [ [ Plain
+                  [ Str "all"
+                  , Space
+                  , Str "the"
+                  , Space
+                  , Str "currently"
+                  , Space
+                  , Str "opened"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "are"
+                  , Space
+                  , Str "closed,"
+                  ]
+              , BulletList
+                  [ [ Plain
+                        [ Str "just"
+                        , Space
+                        , Str "like"
+                        , Space
+                        , Str "when"
+                        , Space
+                        , Str "using"
+                        , Space
+                        , Str "the"
+                        , Space
+                        , Str "two"
+                        , Space
+                        , Str "blank"
+                        , Space
+                        , Str "lines."
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Header 1 ( "table" , [] , [] ) [ Str "Table" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignRight , ColWidthDefault ) ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cell" , Space , Str "1" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignRight , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cell" , Space , Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cell" , Space , Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cell" , Space , Str "3" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cell" , Space , Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cell" , Space , Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cell" , Space , Str "3" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para
+      [ Str "||"
+      , Space
+      , Str "Cell"
+      , Space
+      , Str "1"
+      , Space
+      , Str "|"
+      , Space
+      , Str "Cell"
+      , Space
+      , Str "2"
+      , Space
+      , Str "|"
+      , Space
+      , Str "Cell"
+      , Space
+      , Str "3"
+      , Space
+      , Str "|"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cell" , Space , Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cell" , Space , Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Cell" , Space , Str "3" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Heading" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Heading" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Heading" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "<-" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "--" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "->" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "--" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "--" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "--" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "->" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "--" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "<-" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "1" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "2" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "3+4" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1+2+3" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2+3" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1+2+3+4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "7" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "8" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "A" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "B" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "D" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "E" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "F" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Jan" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Fev" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Mar" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "Apr" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "May" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "20%" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "40%" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "60%" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "80%" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "100%" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "/" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "/"
+                      , Space
+                      , Str "/"
+                      , Space
+                      , Str "/"
+                      , Space
+                      , Str "/"
+                      , Space
+                      , Str "/"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "/"
+                      , Space
+                      , Str "/"
+                      , Space
+                      , Str "/"
+                      , Space
+                      , Str "/"
+                      , Space
+                      , Str "/"
+                      , Space
+                      , Str "/"
+                      , Space
+                      , Str "/"
+                      , Space
+                      , Str "/"
+                      , Space
+                      , Str "/"
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "o" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "o" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "." ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain
+                      [ Str "="
+                      , Space
+                      , Str "="
+                      , Space
+                      , Str "="
+                      , Space
+                      , Str "="
+                      ]
+                  ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "01" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "02" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "05" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "07" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "11" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "13" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "16" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "17" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "19" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "20" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "23" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "25" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "26" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "29" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "30" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "32" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "35" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "37" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "39" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "40" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      , ( AlignCenter , ColWidthDefault )
+      ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "7" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "8" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "9" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "A" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "B" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "C" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "D" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "E" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "F" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "0" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "3" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "4" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "5" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "6" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "7" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "8" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "9" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "A" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "B" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "C" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "D" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "E" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "F" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignCenter , ColWidthDefault ) ]
+      (TableHead ( "" , [] , [] ) [])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  []
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Para [ Str "|this|is|not|a|table|" ]
+  , Para
+      [ Str "|this|"
+      , Space
+      , Str "is|"
+      , Space
+      , Str "not|"
+      , Space
+      , Str "a|"
+      , Space
+      , Str "table|"
+      ]
+  , Para
+      [ Str "|this"
+      , Space
+      , Str "|is"
+      , Space
+      , Str "|not"
+      , Space
+      , Str "|a"
+      , Space
+      , Str "|table"
+      , Space
+      , Str "|"
+      ]
+  , Para
+      [ Str "|"
+      , Space
+      , Str "this\t|"
+      , Space
+      , Str "is\t|"
+      , Space
+      , Str "not\t|"
+      , Space
+      , Str "a\t|"
+      , Space
+      , Str "table\t|"
+      ]
+  , HorizontalRule
+  , Para [ Str "The" , Space , Str "End." ]
+  ]
diff --git a/test/vimwiki-reader.native b/test/vimwiki-reader.native
--- a/test/vimwiki-reader.native
+++ b/test/vimwiki-reader.native
@@ -1,449 +1,2429 @@
-Pandoc (Meta {unMeta = fromList [("date",MetaInlines [Str "2017-05-01"]),("title",MetaInlines [Str "title"])]})
-[Header 1 ("implemented",[],[]) [Emph [Span ("implemented",[],[]) [],Strong [Str "implemented"]]]
-,Header 1 ("header",[],[]) [Str "header"]
-,Header 2 ("header level two",[],[]) [Str "header",Space,Str "level",Space,Str "two"]
-,Header 3 ("header level 3",[],[]) [Str "header",Space,Code ("",[],[]) "level",Space,Str "3"]
-,Header 4 ("header level four",[],[]) [Str "header",Space,Strikeout [Str "level"],Space,Str "four"]
-,Header 5 ("header level 5",[],[]) [Str "header",Space,Emph [Span ("level",[],[]) [],Strong [Str "level"],Space,Str "5"]]
-,Header 6 ("header level 6",[],[]) [Str "header",Space,Str "level",Space,Str "6"]
-,Para [Str "=======",Space,Str "not",Space,Str "a",Space,Str "header",Space,Str "========"]
-,Para [Str "hi==",Space,Str "not",Space,Str "a",Space,Str "header",Space,Str "=="]
-,Para [Str "===",Space,Str "not",Space,Str "a",Space,Str "header",Space,Str "=="]
-,Para [Str "===",Space,Str "not",Space,Str "a",Space,Str "header",Space,Str "===-"]
-,Para [Str "not",Space,Str "a",Space,Str "header:"]
-,Para [Str "=n="]
-,Para [Str "===",Space,Str "not",Space,Str "a",Space,Str "header",Space,Str "===="]
-,Header 2 ("centred header",["justcenter"],[]) [Str "centred",Space,Str "header"]
-,Header 2 ("header with some == in between",[],[]) [Str "header",Space,Str "with",Space,Str "some",Space,Code ("",[],[]) "==",Space,Str "in",Space,Str "between"]
-,Header 2 ("header with some == in between",[],[]) [Str "header",Space,Str "with",Space,Str "some",Space,Str "==",Space,Str "in",Space,Str "between"]
-,Header 2 ("header with some ==in between",[],[]) [Str "header",Space,Str "with",Space,Str "some",Space,Str "==in",Space,Str "between"]
-,Header 2 ("emph strong and strikeout",[],[]) [Str "emph",Space,Str "strong",Space,Str "and",Space,Str "strikeout"]
-,Para [Emph [Str "emph"],Space,Span ("strong",[],[]) [],Strong [Str "strong"]]
-,Para [Span ("strong and emph",[],[]) [],Strong [Emph [Str "strong",Space,Str "and",Space,Str "emph"]]]
-,Para [Emph [Span ("emph and strong",[],[]) [],Strong [Str "emph",Space,Str "and",Space,Str "strong"]]]
-,Para [Span ("emph inside strong",[],[]) [],Strong [Emph [Str "emph",Space,Str "inside"],Space,Str "strong"]]
-,Para [Span ("strong with emph",[],[]) [],Strong [Str "strong",Space,Str "with",Space,Emph [Str "emph"]]]
-,Para [Emph [Span ("strong inside",[],[]) [],Strong [Str "strong",Space,Str "inside"],Space,Str "emph"]]
-,Para [Emph [Strikeout [Str "strikeout"],Space,Str "inside",Space,Str "emph"]]
-,Para [Strikeout [Str "This",Space,Str "is",Space,Emph [Str "struck",Space,Str "out"],Space,Str "with",Space,Str "emph"]]
-,Para [Str "*not",SoftBreak,Str "strong*"]
-,Para [Str "just",Space,Str "two",Space,Str "stars:",Space,Str "**"]
-,Para [Str "just",Space,Str "two",Space,Str "underscores:",Space,Str "__"]
-,Para [Str "just",Space,Str "four",Space,Str "~s:",Space,Str "~~~~"]
-,Para [Str "_not",SoftBreak,Str "emph_"]
-,Para [Str "~~not",SoftBreak,Str "strikeout~~"]
-,Header 2 ("horizontal rule",[],[]) [Str "horizontal",Space,Str "rule"]
-,Para [Str "top"]
-,HorizontalRule
-,Para [Str "middle"]
-,HorizontalRule
-,Para [Str "not",Space,Str "a",Space,Str "rule-----"]
-,Para [Str "not",Space,Str "a",Space,Str "rule",Space,Str "(trailing",Space,Str "spaces):",SoftBreak,Str "-----"]
-,Para [Str "not",Space,Str "a",Space,Str "rule",Space,Str "(leading",Space,Str "spaces):",SoftBreak,Str "----"]
-,Header 2 ("comments",[],[]) [Str "comments"]
-,Para [Str "this",SoftBreak,Str "is",Space,Str "%%",Space,Str "not",Space,Str "secret"]
-,Header 2 ("inline code",[],[]) [Str "inline",Space,Str "code"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Code ("",[],[]) "inline code",Str "."]
-,Para [Str "Just",Space,Str "two",Space,Str "backticks:",Space,Str "``"]
-,Header 2 ("preformatted text",[],[]) [Str "preformatted",Space,Str "text"]
-,CodeBlock ("",[],[]) "  Tyger! Tyger! burning bright\n   In the forests of the night,\n    What immortal hand or eye\n     Could frame thy fearful symmetry?\n  In what distant deeps or skies\n   Burnt the fire of thine eyes?\n    On what wings dare he aspire?\n     What the hand dare sieze the fire?"
-,Header 3 ("preformatted text with attributes",[],[]) [Str "preformatted",Space,Str "text",Space,Str "with",Space,Str "attributes"]
-,CodeBlock ("",[],[("class","python"),("style","color:blue")]) " for i in range(1, 5):\n     print(i)"
-,Header 3 ("preformatted text with nested syntax",[],[]) [Str "preformatted",Space,Str "text",Space,Str "with",Space,Str "nested",Space,Str "syntax"]
-,CodeBlock ("",["sql"],[]) "SELECT * FROM table"
-,Header 3 ("empty preformatted text",[],[]) [Str "empty",Space,Str "preformatted",Space,Str "text"]
-,CodeBlock ("",[],[]) ""
-,Header 2 ("block quotes",[],[]) [Str "block",Space,Str "quotes"]
-,BlockQuote
- [Plain [Str "(indentation",Space,Str "4",Space,Str "spaces)",Space,Str "This",Space,Str "would",Space,Str "be",Space,Str "a",Space,Str "blockquote",Space,Str "in",Space,Str "Vimwiki.",Space,Str "It",Space,Str "is",Space,Str "not",Space,Span ("highlighted",[],[]) [],Strong [Str "highlighted"],Space,Str "in",Space,Str "Vim",Space,Str "but",SoftBreak,Str "(indentation",Space,Str "1",Space,Str "space",Space,Str "followed",Space,Str "by",Space,Str "1",Space,Str "tab",Space,Str "of",Space,Str "width",Space,Str "4)",Space,Str "could",Space,Str "be",Space,Str "styled",Space,Str "by",Space,Str "CSS",Space,Str "in",Space,Str "HTML.",Space,Str "Blockquotes",Space,Str "are",Space,Str "usually",Space,Str "used",Space,Str "to",Space,Str "quote",Space,Str "a",SoftBreak,Str "(indentation",Space,Str "1",Space,Str "tab",Space,Str "of",Space,Str "width",Space,Str "4)",Space,Str "long",Space,Str "piece",Space,Str "of",Space,Str "text",Space,Str "from",Space,Str "another",Space,Str "source.",Space,Strikeout [Str "blah",Space,Str "blah"],Space,Span ("-blockquote",[],[]) [Str ""],Span ("blockquote",["tag"],[]) [Str "blockquote"]]]
-,Header 2 ("external links",[],[]) [Str "external",Space,Str "links"]
-,Para [Link ("",[],[]) [Emph [Str "Google"],Space,Str "search",Space,Str "engine"] ("http://google.com","")]
-,Para [Link ("",[],[]) [Str "http://pandoc.org"] ("http://pandoc.org","")]
-,Para [Link ("",[],[]) [Str "ftp://vim.org"] ("ftp://vim.org","")]
-,Para [Link ("",[],[]) [Str "http://google.com"] ("http://google.com","")]
-,Para [Link ("",[],[]) [Str "email",Space,Str "me"] ("mailto:info@example.org","")]
-,Para [Link ("",[],[]) [Str "mailto:hello@bye.com"] ("mailto:hello@bye.com","")]
-,Header 2 ("internal links",[],[]) [Str "internal",Space,Str "links"]
-,Para [Link ("",[],[]) [Str "This is a link"] ("This is a link","wikilink")]
-,Para [Link ("",[],[]) [Str "Description",Space,Str "of",Space,Str "the",Space,Str "link"] ("This is a link source","wikilink")]
-,Para [Link ("",[],[]) [Str "projects/Important Project 1"] ("projects/Important Project 1","wikilink"),SoftBreak,Link ("",[],[]) [Str "../index"] ("../index","wikilink"),SoftBreak,Link ("",[],[]) [Str "Other",Space,Str "files"] ("a subdirectory/","wikilink")]
-,Para [Link ("",[],[]) [Str "try",Space,Str "me",Space,Str "to",Space,Str "test",Space,Str "tag",Space,Str "anchors"] ("#tag-one","wikilink")]
-,Para [Link ("",[],[]) [Str "try",Space,Str "me",Space,Str "to",Space,Str "test",Space,Str "header",Space,Str "anchors"] ("#block quotes","wikilink")]
-,Para [Link ("",[],[]) [Str "try",Space,Str "me",Space,Str "to",Space,Str "test",Space,Str "strong",Space,Str "anchors"] ("#strong","wikilink")]
-,Para [Link ("",[],[]) [Str "Tasks",Space,Str "for",Space,Str "tomorrow"] ("Todo List#Tomorrow","wikilink")]
-,Para [Link ("",[],[]) [Str "diary:2017-05-01"] ("diary/2017-05-01","wikilink")]
-,Para [Link ("",[],[]) [Str "Important",Space,Str "Data"] ("file:../assets/data.csv","")]
-,Header 3 ("links with thumbnails",[],[]) [Str "links",Space,Str "with",Space,Str "thumbnails"]
-,Para [Link ("",[],[]) [Image ("",[],[]) [Str ""] ("./movie.jpg","")] ("http://www.google.com","")]
-,Header 2 ("images",[],[]) [Str "images"]
-,Para [Image ("",[],[]) [Str ""] ("file:./lalune.jpg","")]
-,Para [Image ("",[],[]) [Str "Vimwiki"] ("http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png",""),SoftBreak,Image ("",[],[]) [Str ""] ("file:./movie.jpg","")]
-,Header 3 ("image with attributes",[],[]) [Str "image",Space,Str "with",Space,Str "attributes"]
-,Para [Image ("",[],[("style","width:150px;height:120px;")]) [Emph [Str "cool",Space,Str "stuff"]] ("lalune.jpg","")]
-,Para [Image ("",[],[("style","font-color:red")]) [Span ("Non-existing",[],[]) [],Strong [Str "Non-existing"],Space,Str "image"] ("nonexist.jpg","")]
-,Para [Image ("",[],[("style","width:150px;height:120px;")]) [Emph [Str "cool",Space,Str "stuff"]] ("lalune.jpg","")]
-,Header 2 ("lists",[],[]) [Str "lists"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "ordered",Space,Str "list",Space,Str "item",Space,Str "1,",Space,Str "and",Space,Str "here",Space,Str "is",Space,Str "some",Space,Str "math",Space,Str "belonging",Space,Str "to",Space,Str "list",Space,Str "item",Space,Str "1"]
-  ,Para [Math DisplayMath "a^2 + b^2 = c^2"]
-  ,Plain [Str "and",Space,Str "some",Space,Str "preformatted",Space,Str "and",Space,Str "tables",Space,Str "belonging",Space,Str "to",Space,Str "item",Space,Str "1",Space,Str "as",Space,Str "well"]
-  ,CodeBlock ("",[],[]) "I'm part of item 1."
-  ,Table ("",[],[]) (Caption Nothing
-   [])
-   [(AlignDefault,ColWidthDefault)
-   ,(AlignDefault,ColWidthDefault)]
-   (TableHead ("",[],[])
-   [Row ("",[],[])
-    [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     []
-    ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     []]])
-   [(TableBody ("",[],[]) (RowHeadColumns 0)
-    []
-    [Row ("",[],[])
-     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-      [Plain [Str "this",Space,Str "table"]]
-     ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-      [Plain [Str "is"]]]
-    ,Row ("",[],[])
-     [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-      [Plain [Str "also",Space,Str "a",Space,Str "part"]]
-     ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-      [Plain [Str "of",Space,Str "item",Space,Str "1"]]]])]
-   (TableFoot ("",[],[])
-   [])
-  ,Plain [Str "and",Space,Str "some",Space,Str "more",Space,Str "text",Space,Str "belonging",Space,Str "to",Space,Str "item",Space,Str "1."]]
- ,[Plain [Str "ordered",Space,Str "list",Space,Str "item",Space,Str "2"]]]
-,BulletList
- [[Plain [Str "Bulleted",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "Bulleted",Space,Str "list",Space,Str "item",Space,Str "2"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Bulleted",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "the",Space,Str "#",Space,Str "become",Space,Str "numbers",Space,Str "when",Space,Str "converted",Space,Str "to",Space,Str "HTML"]]]
-,BulletList
- [[Plain [Str "Bulleted",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "Bulleted",Space,Str "list",Space,Str "item",Space,Str "2"]]]
-,BulletList
- [[Plain [Str "Item",Space,Str "1"]]
- ,[Plain [Str "Item",Space,Str "2"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "Sub",Space,Str "item",Space,Str "1",Space,Str "(indentation",Space,Str "4",Space,Str "spaces)",SoftBreak,Str "Sub",Space,Str "item",Space,Str "1",Space,Str "continued",Space,Str "line.",SoftBreak,Str "Sub",Space,Str "item",Space,Str "1",Space,Str "next",Space,Str "continued",Space,Str "line."]]
-   ,[Plain [Str "Sub",Space,Str "item",Space,Str "2,",Space,Str "as",Space,Str "an",Space,Str "ordered",Space,Str "list",Space,Str "item",Space,Str "even",Space,Str "though",Space,Str "the",Space,Str "identifier",Space,Str "is",Space,Code ("",[],[]) "*",Space,Str "(indentation",Space,Str "2",Space,Str "spaces",Space,Str "followed",Space,Str "by",Space,Str "one",Space,Str "tab",Space,Str "of",Space,Str "width",Space,Str "4)"]]
-   ,[Plain [Str "etc.",SoftBreak,Str "Continuation",Space,Str "of",Space,Str "Item",Space,Str "2",SoftBreak,Str "Next",Space,Str "continuation",Space,Str "of",Space,Str "Item",Space,Str "2"]]]]]
-,Para [Str "But",Space,Str "this",Space,Str "is",Space,Str "a",Space,Str "new",Space,Str "paragraph."]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "1"]
-  ,BulletList
-   [[Plain [Code ("",[],[]) "1.1"]]]]
- ,[Plain [Str "2"]
-  ,BulletList
-   [[Plain [Str "2.1"]]]]]
-,BulletList
- [[Plain [Str "3"]]]
-,Header 3 ("ordered lists with non-# identifiers",[],[]) [Str "ordered",Space,Str "lists",Space,Str "with",Space,Str "non-#",Space,Str "identifiers"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "2"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "3"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "2"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "3"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "2"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "3"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "2"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "3"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "2"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "3"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "2"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "3"]]]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "2"]]
- ,[Plain [Str "Numbered",Space,Str "list",Space,Str "item",Space,Str "3"]]]
-,BulletList
- [[Plain [Str "Bulleted",Space,Str "list",Space,Str "item",Space,Str "1"]]
- ,[Plain [Str "Bulleted",Space,Str "list",Space,Str "item",Space,Str "2"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "Numbered",Space,Str "list",Space,Str "sub",Space,Str "item",Space,Str "1"]]
-   ,[Plain [Str "more",Space,Str "..."]
-    ,BulletList
-     [[Plain [Str "and",Space,Str "more",Space,Str "..."]]
-     ,[Plain [Str "..."]]]]
-   ,[Plain [Str "Numbered",Space,Str "list",Space,Str "sub",Space,Str "item",Space,Str "3"]
-    ,OrderedList (1,DefaultStyle,DefaultDelim)
-     [[Plain [Str "Numbered",Space,Str "list",Space,Str "sub",Space,Str "sub",Space,Str "item",Space,Str "1"]]
-     ,[Plain [Str "Numbered",Space,Str "list",Space,Str "sub",Space,Str "sub",Space,Str "item",Space,Str "2"]]]]
-   ,[Plain [Str "etc."]]]]
- ,[Plain [Str "Bulleted",Space,Str "list",Space,Str "item",Space,Str "3"]]]
-,Header 2 ("todo lists",[],[]) [Str "todo",Space,Str "lists"]
-,BulletList
- [[Plain [Span ("",["done0"],[]) [],Str "task",Space,Str "1"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Span ("",["done1"],[]) [],Str "5"]]]]
- ,[Plain [Span ("",["done2"],[]) [],Str "3"]]
- ,[Plain [Str "[]",Space,Str "not",Space,Str "a",Space,Str "todo",Space,Str "item"]]
- ,[Plain [Str "[",Space,Str "]not",Space,Str "a",Space,Str "todo",Space,Str "item"]]
- ,[Plain [Str "[r]",Space,Str "not",Space,Str "a",Space,Str "todo",Space,Str "item"]]
- ,[Plain [Str "[",Space,Str "]",Space,Str "not",Space,Str "a",Space,Str "todo",Space,Str "item"]]
- ,[Plain [Span ("",["done2"],[]) [],Str "a",Space,Str "tab",Space,Str "in",Space,Str "the",Space,Str "todo",Space,Str "list",Space,Str "marker",Space,Code ("",[],[]) "[ ]"]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Span ("",["done3"],[]) [],Str "4",SoftBreak,Str "5"]]
-   ,[Plain [Span ("",["done4"],[]) []]
-    ,Table ("",[],[]) (Caption Nothing
-     [])
-     [(AlignDefault,ColWidthDefault)
-     ,(AlignDefault,ColWidthDefault)]
-     (TableHead ("",[],[])
-     [Row ("",[],[])
-      [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-       []
-      ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-       []]])
-     [(TableBody ("",[],[]) (RowHeadColumns 0)
-      []
-      [Row ("",[],[])
-       [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-        [Plain [Str "a"]]
-       ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-        [Plain [Str "b"]]]])]
-     (TableFoot ("",[],[])
-     [])]]]
- ,[Plain [Span ("",["done4"],[]) [],Str "task",Space,Str "2"]]]
-,Header 2 ("math",[],[]) [Str "math"]
-,Para [Math InlineMath " \\sum_i a_i^2 = 1 "]
-,Para [Math DisplayMath "\\sum_i a_i^2\n=\n1"]
-,Para [Math DisplayMath "\\begin{aligned}\n\\sum_i a_i^2 &= 1 + 1 \\\\\n&= 2.\n\\end{aligned}"]
-,Para [Str "edge",Space,Str "case",Space,Str "(the",Space,Code ("",[],[]) "c^2 + ",Space,Str "after",Space,Str "the",Space,Str "multline",Space,Str "tag",Space,Str "is",Space,Str "in",Space,Str "the",Space,Str "equation):"]
-,Para [Math DisplayMath "\\begin{gathered}\nc^2 + \na^2 + b^2\n\\end{gathered}"]
-,Para [Str "edge",Space,Str "case",Space,Str "(the",Space,Str "tag",Space,Str "is",Space,Code ("",[],[]) "hello%bye",Str ")"]
-,Para [Math DisplayMath "\\begin{hello%bye}\n\\int_a^b f(x) dx\n\\end{hello%bye}"]
-,Para [Str "Just",Space,Str "two",Space,Str "dollar",Space,Str "signs:",Space,Str "$$"]
-,Para [Str "[not",Space,Str "math]",Space,Str "You",Space,Str "have",Space,Str "$1",SoftBreak,Str "and",Space,Str "I",Space,Str "have",Space,Str "$1."]
-,Header 2 ("tags",[],[]) [Str "tags"]
-,Para [Span ("-tag-one",[],[]) [Str ""],Span ("tag-one",["tag"],[]) [Str "tag-one"],Space,Span ("-tag-two",[],[]) [Str ""],Span ("tag-two",["tag"],[]) [Str "tag-two"]]
-,Header 2 ("tables",[],[]) [Str "tables"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Year"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Temperature",Space,Str "(low)"]]
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   [Plain [Str "Temperature",Space,Str "(high)"]]]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1900"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "-10"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "25"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1910"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "-15"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "30"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1920"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "-10"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "32"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1930"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Emph [Str "N/A"]]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Emph [Str "N/A"]]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "1940"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "-2"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "40"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 3 ("centered headerless tables",[],[]) [Str "centered",Space,Str "headerless",Space,Str "tables"]
-,Div ("",["center"],[])
- [Table ("",[],[]) (Caption Nothing
-  [])
-  [(AlignDefault,ColWidthDefault)
-  ,(AlignDefault,ColWidthDefault)]
-  (TableHead ("",[],[])
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    []]])
-  [(TableBody ("",[],[]) (RowHeadColumns 0)
-   []
-   [Row ("",[],[])
-    [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "a"]]
-    ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "b"]]]
-   ,Row ("",[],[])
-    [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "c"]]
-    ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-     [Plain [Str "d"]]]])]
-  (TableFoot ("",[],[])
-  [])]
-,Header 2 ("paragraphs",[],[]) [Str "paragraphs"]
-,Para [Str "This",Space,Str "is",Space,Str "first",Space,Str "paragraph",SoftBreak,Str "with",Space,Str "two",Space,Str "lines."]
-,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "second",Space,Str "paragraph",Space,Str "with",SoftBreak,Str "two",Space,Str "lines",Space,Str "after",Space,Str "many",Space,Str "blank",Space,Str "lines."]
-,Header 2 ("definition list",[],[]) [Str "definition",Space,Str "list"]
-,DefinitionList
- [([Str "Term",Space,Str "1"],
-   [[Plain [Str "Definition",Space,Str "1"]]])
- ,([Str "Term",Space,Str "2"],
-   [[Plain [Str "Definition",Space,Str "2"]]
-   ,[Plain [Str "Definition",Space,Str "3"]]])
- ,([Str "Term",Space,Str "::",Space,Span ("separated",[],[]) [],Strong [Str "separated"],Space,Str "by",Space,Str "::",Space,Emph [Str "double",Space,Str "colons"]],
-   [[Plain [Str "Def1"]]
-   ,[Plain [Str "Def2"]]])
- ,([Str "Term",Space,Str "with",Space,Str "lots",Space,Str "of",Space,Str "trailing",Space,Str "colons:::::::"],
-   [[Plain [Str "Definition"]]])
- ,([Str "::",Space,Str "This",Space,Str "is",Space,Str "::",Space,Str "A",Space,Str "term",Space,Str "(rather",Space,Str "than",Space,Str "a",Space,Str "definition)"],
-   [[Plain [Str "and",Space,Str "this",Space,Str "is",Space,Str "a",Space,Str "definition"]]])
- ,([Str "Term",Space,Str "Without",Space,Str "definitions"],
-   [[]])
- ,([Str "Part",Space,Str "::",Space,Str "of",Space,Str "::",Space,Str "dt"],
-   [[Plain [Str "part",Space,Str "of",Space,Str "::dd"]]])]
-,DefinitionList
- [([],
-   [[Plain [Str "Definition",Space,Str "1",Space,Str "without",Space,Str "a",Space,Str "term"]]
-   ,[Plain [Str "Definition",Space,Str "2",Space,Str "without",Space,Str "a",Space,Str "term"]]])]
-,DefinitionList
- [([Str "T1"],
-   [[Plain [Str "D1"]]])]
-,Para [Str "new",Space,Str "paragraph"]
-,DefinitionList
- [([Str "T1"],
-   [[Plain [Str "D1"]]])]
-,Para [Str "Not::Definition"]
-,Para [Str "Not",Space,Str "::Definition"]
-,Para [Str "::Not",Space,Str "definition"]
-,BlockQuote
- [Plain [Str "::",Space,Str "blockquote"]]
-,BlockQuote
- [Plain [Str "block",Space,Str "::",Space,Str "quote"]]
-,Header 2 ("metadata placeholders",[],[]) [Str "metadata",Space,Str "placeholders"]
-,Para [Str "%this",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "placeholder"]
-,Para [Str "placeholders",SoftBreak,Str "serves",Space,Str "as",Space,Str "space",Space,Str "/",Space,Str "softbreak",Space,Str "in",Space,Str "paragraphs"]
-,Header 2 ("sup, sub",[],[]) [Str "sup,",Space,Str "sub"]
-,Para [Str "super",Superscript [Str "script"]]
-,Para [Str "sub",Subscript [Str "script"]]
-,Header 2 ("the todo mark",[],[]) [Str "the",Space,Str "todo",Space,Str "mark"]
-,Para [Span ("",["todo"],[]) [Str "TODO:"]]
-,Header 1 ("not implemented yet",[],[]) [Emph [Span ("not implemented yet",[],[]) [],Strong [Str "not",Space,Str "implemented",Space,Str "yet"]]]
-,Header 2 ("tables with spans",[],[]) [Str "tables",Space,Str "with",Space,Str "spans"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "a"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "d"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "\\/"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "e"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str ">"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "f"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "\\/"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "\\/"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str ">"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "g"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "h"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str ">"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str ">"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str ">"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 2 ("tables with multiple lines of headers",[],[]) [Str "tables",Space,Str "with",Space,Str "multiple",Space,Str "lines",Space,Str "of",Space,Str "headers"]
-,Table ("",[],[]) (Caption Nothing
- [])
- [(AlignDefault,ColWidthDefault)
- ,(AlignDefault,ColWidthDefault)]
- (TableHead ("",[],[])
- [Row ("",[],[])
-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []
-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-   []]])
- [(TableBody ("",[],[]) (RowHeadColumns 0)
-  []
-  [Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "a"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "b"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "c"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "d"]]]
-  ,Row ("",[],[])
-   [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "---"]]
-   ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
-    [Plain [Str "---"]]]])]
- (TableFoot ("",[],[])
- [])
-,Header 2 ("some other placeholders",[],[]) [Str "some",Space,Str "other",Space,Str "placeholders"]
-,Para [Code ("",[],[]) "template",Space,Str "placeholder",Space,Str "is",Space,Str "ignored."]
-,Para [Code ("",[],[]) "nohtml",Space,Str "placeholder",Space,Str "is",Space,Str "ignored."]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "date" , MetaInlines [ Str "2017-05-01" ] )
+          , ( "title" , MetaInlines [ Str "title" ] )
+          ]
+    }
+  [ Header
+      1
+      ( "implemented" , [] , [] )
+      [ Emph
+          [ Span ( "implemented" , [] , [] ) []
+          , Strong [ Str "implemented" ]
+          ]
+      ]
+  , Header 1 ( "header" , [] , [] ) [ Str "header" ]
+  , Header
+      2
+      ( "header level two" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "two" ]
+  , Header
+      3
+      ( "header level 3" , [] , [] )
+      [ Str "header"
+      , Space
+      , Code ( "" , [] , [] ) "level"
+      , Space
+      , Str "3"
+      ]
+  , Header
+      4
+      ( "header level four" , [] , [] )
+      [ Str "header"
+      , Space
+      , Strikeout [ Str "level" ]
+      , Space
+      , Str "four"
+      ]
+  , Header
+      5
+      ( "header level 5" , [] , [] )
+      [ Str "header"
+      , Space
+      , Emph
+          [ Span ( "level" , [] , [] ) []
+          , Strong [ Str "level" ]
+          , Space
+          , Str "5"
+          ]
+      ]
+  , Header
+      6
+      ( "header level 6" , [] , [] )
+      [ Str "header" , Space , Str "level" , Space , Str "6" ]
+  , Para
+      [ Str "======="
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header"
+      , Space
+      , Str "========"
+      ]
+  , Para
+      [ Str "hi=="
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header"
+      , Space
+      , Str "=="
+      ]
+  , Para
+      [ Str "==="
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header"
+      , Space
+      , Str "=="
+      ]
+  , Para
+      [ Str "==="
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header"
+      , Space
+      , Str "===-"
+      ]
+  , Para
+      [ Str "not" , Space , Str "a" , Space , Str "header:" ]
+  , Para [ Str "=n=" ]
+  , Para
+      [ Str "==="
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "header"
+      , Space
+      , Str "===="
+      ]
+  , Header
+      2
+      ( "centred header" , [ "justcenter" ] , [] )
+      [ Str "centred" , Space , Str "header" ]
+  , Header
+      2
+      ( "header with some == in between" , [] , [] )
+      [ Str "header"
+      , Space
+      , Str "with"
+      , Space
+      , Str "some"
+      , Space
+      , Code ( "" , [] , [] ) "=="
+      , Space
+      , Str "in"
+      , Space
+      , Str "between"
+      ]
+  , Header
+      2
+      ( "header with some == in between" , [] , [] )
+      [ Str "header"
+      , Space
+      , Str "with"
+      , Space
+      , Str "some"
+      , Space
+      , Str "=="
+      , Space
+      , Str "in"
+      , Space
+      , Str "between"
+      ]
+  , Header
+      2
+      ( "header with some ==in between" , [] , [] )
+      [ Str "header"
+      , Space
+      , Str "with"
+      , Space
+      , Str "some"
+      , Space
+      , Str "==in"
+      , Space
+      , Str "between"
+      ]
+  , Header
+      2
+      ( "emph strong and strikeout" , [] , [] )
+      [ Str "emph"
+      , Space
+      , Str "strong"
+      , Space
+      , Str "and"
+      , Space
+      , Str "strikeout"
+      ]
+  , Para
+      [ Emph [ Str "emph" ]
+      , Space
+      , Span ( "strong" , [] , [] ) []
+      , Strong [ Str "strong" ]
+      ]
+  , Para
+      [ Span ( "strong and emph" , [] , [] ) []
+      , Strong
+          [ Emph
+              [ Str "strong" , Space , Str "and" , Space , Str "emph" ]
+          ]
+      ]
+  , Para
+      [ Emph
+          [ Span ( "emph and strong" , [] , [] ) []
+          , Strong
+              [ Str "emph" , Space , Str "and" , Space , Str "strong" ]
+          ]
+      ]
+  , Para
+      [ Span ( "emph inside strong" , [] , [] ) []
+      , Strong
+          [ Emph [ Str "emph" , Space , Str "inside" ]
+          , Space
+          , Str "strong"
+          ]
+      ]
+  , Para
+      [ Span ( "strong with emph" , [] , [] ) []
+      , Strong
+          [ Str "strong"
+          , Space
+          , Str "with"
+          , Space
+          , Emph [ Str "emph" ]
+          ]
+      ]
+  , Para
+      [ Emph
+          [ Span ( "strong inside" , [] , [] ) []
+          , Strong [ Str "strong" , Space , Str "inside" ]
+          , Space
+          , Str "emph"
+          ]
+      ]
+  , Para
+      [ Emph
+          [ Strikeout [ Str "strikeout" ]
+          , Space
+          , Str "inside"
+          , Space
+          , Str "emph"
+          ]
+      ]
+  , Para
+      [ Strikeout
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Emph [ Str "struck" , Space , Str "out" ]
+          , Space
+          , Str "with"
+          , Space
+          , Str "emph"
+          ]
+      ]
+  , Para [ Str "*not" , SoftBreak , Str "strong*" ]
+  , Para
+      [ Str "just"
+      , Space
+      , Str "two"
+      , Space
+      , Str "stars:"
+      , Space
+      , Str "**"
+      ]
+  , Para
+      [ Str "just"
+      , Space
+      , Str "two"
+      , Space
+      , Str "underscores:"
+      , Space
+      , Str "__"
+      ]
+  , Para
+      [ Str "just"
+      , Space
+      , Str "four"
+      , Space
+      , Str "~s:"
+      , Space
+      , Str "~~~~"
+      ]
+  , Para [ Str "_not" , SoftBreak , Str "emph_" ]
+  , Para [ Str "~~not" , SoftBreak , Str "strikeout~~" ]
+  , Header
+      2
+      ( "horizontal rule" , [] , [] )
+      [ Str "horizontal" , Space , Str "rule" ]
+  , Para [ Str "top" ]
+  , HorizontalRule
+  , Para [ Str "middle" ]
+  , HorizontalRule
+  , Para
+      [ Str "not" , Space , Str "a" , Space , Str "rule-----" ]
+  , Para
+      [ Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "rule"
+      , Space
+      , Str "(trailing"
+      , Space
+      , Str "spaces):"
+      , SoftBreak
+      , Str "-----"
+      ]
+  , Para
+      [ Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "rule"
+      , Space
+      , Str "(leading"
+      , Space
+      , Str "spaces):"
+      , SoftBreak
+      , Str "----"
+      ]
+  , Header 2 ( "comments" , [] , [] ) [ Str "comments" ]
+  , Para
+      [ Str "this"
+      , SoftBreak
+      , Str "is"
+      , Space
+      , Str "%%"
+      , Space
+      , Str "not"
+      , Space
+      , Str "secret"
+      ]
+  , Header
+      2
+      ( "inline code" , [] , [] )
+      [ Str "inline" , Space , Str "code" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Code ( "" , [] , [] ) "inline code"
+      , Str "."
+      ]
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "two"
+      , Space
+      , Str "backticks:"
+      , Space
+      , Str "``"
+      ]
+  , Header
+      2
+      ( "preformatted text" , [] , [] )
+      [ Str "preformatted" , Space , Str "text" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "  Tyger! Tyger! burning bright\n   In the forests of the night,\n    What immortal hand or eye\n     Could frame thy fearful symmetry?\n  In what distant deeps or skies\n   Burnt the fire of thine eyes?\n    On what wings dare he aspire?\n     What the hand dare sieze the fire?"
+  , Header
+      3
+      ( "preformatted text with attributes" , [] , [] )
+      [ Str "preformatted"
+      , Space
+      , Str "text"
+      , Space
+      , Str "with"
+      , Space
+      , Str "attributes"
+      ]
+  , CodeBlock
+      ( ""
+      , []
+      , [ ( "class" , "python" ) , ( "style" , "color:blue" ) ]
+      )
+      " for i in range(1, 5):\n     print(i)"
+  , Header
+      3
+      ( "preformatted text with nested syntax" , [] , [] )
+      [ Str "preformatted"
+      , Space
+      , Str "text"
+      , Space
+      , Str "with"
+      , Space
+      , Str "nested"
+      , Space
+      , Str "syntax"
+      ]
+  , CodeBlock ( "" , [ "sql" ] , [] ) "SELECT * FROM table"
+  , Header
+      3
+      ( "empty preformatted text" , [] , [] )
+      [ Str "empty"
+      , Space
+      , Str "preformatted"
+      , Space
+      , Str "text"
+      ]
+  , CodeBlock ( "" , [] , [] ) ""
+  , Header
+      2
+      ( "block quotes" , [] , [] )
+      [ Str "block" , Space , Str "quotes" ]
+  , BlockQuote
+      [ Plain
+          [ Str "(indentation"
+          , Space
+          , Str "4"
+          , Space
+          , Str "spaces)"
+          , Space
+          , Str "This"
+          , Space
+          , Str "would"
+          , Space
+          , Str "be"
+          , Space
+          , Str "a"
+          , Space
+          , Str "blockquote"
+          , Space
+          , Str "in"
+          , Space
+          , Str "Vimwiki."
+          , Space
+          , Str "It"
+          , Space
+          , Str "is"
+          , Space
+          , Str "not"
+          , Space
+          , Span ( "highlighted" , [] , [] ) []
+          , Strong [ Str "highlighted" ]
+          , Space
+          , Str "in"
+          , Space
+          , Str "Vim"
+          , Space
+          , Str "but"
+          , SoftBreak
+          , Str "(indentation"
+          , Space
+          , Str "1"
+          , Space
+          , Str "space"
+          , Space
+          , Str "followed"
+          , Space
+          , Str "by"
+          , Space
+          , Str "1"
+          , Space
+          , Str "tab"
+          , Space
+          , Str "of"
+          , Space
+          , Str "width"
+          , Space
+          , Str "4)"
+          , Space
+          , Str "could"
+          , Space
+          , Str "be"
+          , Space
+          , Str "styled"
+          , Space
+          , Str "by"
+          , Space
+          , Str "CSS"
+          , Space
+          , Str "in"
+          , Space
+          , Str "HTML."
+          , Space
+          , Str "Blockquotes"
+          , Space
+          , Str "are"
+          , Space
+          , Str "usually"
+          , Space
+          , Str "used"
+          , Space
+          , Str "to"
+          , Space
+          , Str "quote"
+          , Space
+          , Str "a"
+          , SoftBreak
+          , Str "(indentation"
+          , Space
+          , Str "1"
+          , Space
+          , Str "tab"
+          , Space
+          , Str "of"
+          , Space
+          , Str "width"
+          , Space
+          , Str "4)"
+          , Space
+          , Str "long"
+          , Space
+          , Str "piece"
+          , Space
+          , Str "of"
+          , Space
+          , Str "text"
+          , Space
+          , Str "from"
+          , Space
+          , Str "another"
+          , Space
+          , Str "source."
+          , Space
+          , Strikeout [ Str "blah" , Space , Str "blah" ]
+          , Space
+          , Span ( "-blockquote" , [] , [] ) [ Str "" ]
+          , Span
+              ( "blockquote" , [ "tag" ] , [] ) [ Str "blockquote" ]
+          ]
+      ]
+  , Header
+      2
+      ( "external links" , [] , [] )
+      [ Str "external" , Space , Str "links" ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Emph [ Str "Google" ]
+          , Space
+          , Str "search"
+          , Space
+          , Str "engine"
+          ]
+          ( "http://google.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "http://pandoc.org" ]
+          ( "http://pandoc.org" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "ftp://vim.org" ]
+          ( "ftp://vim.org" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "http://google.com" ]
+          ( "http://google.com" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "email" , Space , Str "me" ]
+          ( "mailto:info@example.org" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "mailto:hello@bye.com" ]
+          ( "mailto:hello@bye.com" , "" )
+      ]
+  , Header
+      2
+      ( "internal links" , [] , [] )
+      [ Str "internal" , Space , Str "links" ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "This is a link" ]
+          ( "This is a link" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Description"
+          , Space
+          , Str "of"
+          , Space
+          , Str "the"
+          , Space
+          , Str "link"
+          ]
+          ( "This is a link source" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "projects/Important Project 1" ]
+          ( "projects/Important Project 1" , "wikilink" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "../index" ]
+          ( "../index" , "wikilink" )
+      , SoftBreak
+      , Link
+          ( "" , [] , [] )
+          [ Str "Other" , Space , Str "files" ]
+          ( "a subdirectory/" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "try"
+          , Space
+          , Str "me"
+          , Space
+          , Str "to"
+          , Space
+          , Str "test"
+          , Space
+          , Str "tag"
+          , Space
+          , Str "anchors"
+          ]
+          ( "#tag-one" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "try"
+          , Space
+          , Str "me"
+          , Space
+          , Str "to"
+          , Space
+          , Str "test"
+          , Space
+          , Str "header"
+          , Space
+          , Str "anchors"
+          ]
+          ( "#block quotes" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "try"
+          , Space
+          , Str "me"
+          , Space
+          , Str "to"
+          , Space
+          , Str "test"
+          , Space
+          , Str "strong"
+          , Space
+          , Str "anchors"
+          ]
+          ( "#strong" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Tasks" , Space , Str "for" , Space , Str "tomorrow" ]
+          ( "Todo List#Tomorrow" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "diary:2017-05-01" ]
+          ( "diary/2017-05-01" , "wikilink" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Important" , Space , Str "Data" ]
+          ( "file:../assets/data.csv" , "" )
+      ]
+  , Header
+      3
+      ( "links with thumbnails" , [] , [] )
+      [ Str "links"
+      , Space
+      , Str "with"
+      , Space
+      , Str "thumbnails"
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Image ( "" , [] , [] ) [ Str "" ] ( "./movie.jpg" , "" ) ]
+          ( "http://www.google.com" , "" )
+      ]
+  , Header 2 ( "images" , [] , [] ) [ Str "images" ]
+  , Para
+      [ Image
+          ( "" , [] , [] ) [ Str "" ] ( "file:./lalune.jpg" , "" )
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "Vimwiki" ]
+          ( "http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png"
+          , ""
+          )
+      , SoftBreak
+      , Image
+          ( "" , [] , [] ) [ Str "" ] ( "file:./movie.jpg" , "" )
+      ]
+  , Header
+      3
+      ( "image with attributes" , [] , [] )
+      [ Str "image"
+      , Space
+      , Str "with"
+      , Space
+      , Str "attributes"
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [ ( "style" , "width:150px;height:120px;" ) ] )
+          [ Emph [ Str "cool" , Space , Str "stuff" ] ]
+          ( "lalune.jpg" , "" )
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [ ( "style" , "font-color:red" ) ] )
+          [ Span ( "Non-existing" , [] , [] ) []
+          , Strong [ Str "Non-existing" ]
+          , Space
+          , Str "image"
+          ]
+          ( "nonexist.jpg" , "" )
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [ ( "style" , "width:150px;height:120px;" ) ] )
+          [ Emph [ Str "cool" , Space , Str "stuff" ] ]
+          ( "lalune.jpg" , "" )
+      ]
+  , Header 2 ( "lists" , [] , [] ) [ Str "lists" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "ordered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1,"
+            , Space
+            , Str "and"
+            , Space
+            , Str "here"
+            , Space
+            , Str "is"
+            , Space
+            , Str "some"
+            , Space
+            , Str "math"
+            , Space
+            , Str "belonging"
+            , Space
+            , Str "to"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        , Para [ Math DisplayMath "a^2 + b^2 = c^2" ]
+        , Plain
+            [ Str "and"
+            , Space
+            , Str "some"
+            , Space
+            , Str "preformatted"
+            , Space
+            , Str "and"
+            , Space
+            , Str "tables"
+            , Space
+            , Str "belonging"
+            , Space
+            , Str "to"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            , Space
+            , Str "as"
+            , Space
+            , Str "well"
+            ]
+        , CodeBlock ( "" , [] , [] ) "I'm part of item 1."
+        , Table
+            ( "" , [] , [] )
+            (Caption Nothing [])
+            [ ( AlignDefault , ColWidthDefault )
+            , ( AlignDefault , ColWidthDefault )
+            ]
+            (TableHead
+               ( "" , [] , [] )
+               [ Row
+                   ( "" , [] , [] )
+                   [ Cell
+                       ( "" , [] , [] )
+                       AlignDefault
+                       (RowSpan 1)
+                       (ColSpan 1)
+                       []
+                   , Cell
+                       ( "" , [] , [] )
+                       AlignDefault
+                       (RowSpan 1)
+                       (ColSpan 1)
+                       []
+                   ]
+               ])
+            [ TableBody
+                ( "" , [] , [] )
+                (RowHeadColumns 0)
+                []
+                [ Row
+                    ( "" , [] , [] )
+                    [ Cell
+                        ( "" , [] , [] )
+                        AlignDefault
+                        (RowSpan 1)
+                        (ColSpan 1)
+                        [ Plain [ Str "this" , Space , Str "table" ] ]
+                    , Cell
+                        ( "" , [] , [] )
+                        AlignDefault
+                        (RowSpan 1)
+                        (ColSpan 1)
+                        [ Plain [ Str "is" ] ]
+                    ]
+                , Row
+                    ( "" , [] , [] )
+                    [ Cell
+                        ( "" , [] , [] )
+                        AlignDefault
+                        (RowSpan 1)
+                        (ColSpan 1)
+                        [ Plain
+                            [ Str "also"
+                            , Space
+                            , Str "a"
+                            , Space
+                            , Str "part"
+                            ]
+                        ]
+                    , Cell
+                        ( "" , [] , [] )
+                        AlignDefault
+                        (RowSpan 1)
+                        (ColSpan 1)
+                        [ Plain
+                            [ Str "of"
+                            , Space
+                            , Str "item"
+                            , Space
+                            , Str "1"
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+            (TableFoot ( "" , [] , [] ) [])
+        , Plain
+            [ Str "and"
+            , Space
+            , Str "some"
+            , Space
+            , Str "more"
+            , Space
+            , Str "text"
+            , Space
+            , Str "belonging"
+            , Space
+            , Str "to"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1."
+            ]
+        ]
+      , [ Plain
+            [ Str "ordered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "Bulleted"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "Bulleted"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Bulleted"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "the"
+            , Space
+            , Str "#"
+            , Space
+            , Str "become"
+            , Space
+            , Str "numbers"
+            , Space
+            , Str "when"
+            , Space
+            , Str "converted"
+            , Space
+            , Str "to"
+            , Space
+            , Str "HTML"
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "Bulleted"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "Bulleted"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain [ Str "Item" , Space , Str "1" ] ]
+      , [ Plain [ Str "Item" , Space , Str "2" ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Str "Sub"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "1"
+                  , Space
+                  , Str "(indentation"
+                  , Space
+                  , Str "4"
+                  , Space
+                  , Str "spaces)"
+                  , SoftBreak
+                  , Str "Sub"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "1"
+                  , Space
+                  , Str "continued"
+                  , Space
+                  , Str "line."
+                  , SoftBreak
+                  , Str "Sub"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "1"
+                  , Space
+                  , Str "next"
+                  , Space
+                  , Str "continued"
+                  , Space
+                  , Str "line."
+                  ]
+              ]
+            , [ Plain
+                  [ Str "Sub"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "2,"
+                  , Space
+                  , Str "as"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "ordered"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "even"
+                  , Space
+                  , Str "though"
+                  , Space
+                  , Str "the"
+                  , Space
+                  , Str "identifier"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Code ( "" , [] , [] ) "*"
+                  , Space
+                  , Str "(indentation"
+                  , Space
+                  , Str "2"
+                  , Space
+                  , Str "spaces"
+                  , Space
+                  , Str "followed"
+                  , Space
+                  , Str "by"
+                  , Space
+                  , Str "one"
+                  , Space
+                  , Str "tab"
+                  , Space
+                  , Str "of"
+                  , Space
+                  , Str "width"
+                  , Space
+                  , Str "4)"
+                  ]
+              ]
+            , [ Plain
+                  [ Str "etc."
+                  , SoftBreak
+                  , Str "Continuation"
+                  , Space
+                  , Str "of"
+                  , Space
+                  , Str "Item"
+                  , Space
+                  , Str "2"
+                  , SoftBreak
+                  , Str "Next"
+                  , Space
+                  , Str "continuation"
+                  , Space
+                  , Str "of"
+                  , Space
+                  , Str "Item"
+                  , Space
+                  , Str "2"
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para
+      [ Str "But"
+      , Space
+      , Str "this"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "new"
+      , Space
+      , Str "paragraph."
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "1" ]
+        , BulletList [ [ Plain [ Code ( "" , [] , [] ) "1.1" ] ] ]
+        ]
+      , [ Plain [ Str "2" ]
+        , BulletList [ [ Plain [ Str "2.1" ] ] ]
+        ]
+      ]
+  , BulletList [ [ Plain [ Str "3" ] ] ]
+  , Header
+      3
+      ( "ordered lists with non-# identifiers" , [] , [] )
+      [ Str "ordered"
+      , Space
+      , Str "lists"
+      , Space
+      , Str "with"
+      , Space
+      , Str "non-#"
+      , Space
+      , Str "identifiers"
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "3"
+            ]
+        ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "3"
+            ]
+        ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "3"
+            ]
+        ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "3"
+            ]
+        ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "3"
+            ]
+        ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "3"
+            ]
+        ]
+      ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        ]
+      , [ Plain
+            [ Str "Numbered"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "3"
+            ]
+        ]
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "Bulleted"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "1"
+            ]
+        ]
+      , [ Plain
+            [ Str "Bulleted"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "2"
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Str "Numbered"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "sub"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "1"
+                  ]
+              ]
+            , [ Plain [ Str "more" , Space , Str "..." ]
+              , BulletList
+                  [ [ Plain
+                        [ Str "and"
+                        , Space
+                        , Str "more"
+                        , Space
+                        , Str "..."
+                        ]
+                    ]
+                  , [ Plain [ Str "..." ] ]
+                  ]
+              ]
+            , [ Plain
+                  [ Str "Numbered"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "sub"
+                  , Space
+                  , Str "item"
+                  , Space
+                  , Str "3"
+                  ]
+              , OrderedList
+                  ( 1 , DefaultStyle , DefaultDelim )
+                  [ [ Plain
+                        [ Str "Numbered"
+                        , Space
+                        , Str "list"
+                        , Space
+                        , Str "sub"
+                        , Space
+                        , Str "sub"
+                        , Space
+                        , Str "item"
+                        , Space
+                        , Str "1"
+                        ]
+                    ]
+                  , [ Plain
+                        [ Str "Numbered"
+                        , Space
+                        , Str "list"
+                        , Space
+                        , Str "sub"
+                        , Space
+                        , Str "sub"
+                        , Space
+                        , Str "item"
+                        , Space
+                        , Str "2"
+                        ]
+                    ]
+                  ]
+              ]
+            , [ Plain [ Str "etc." ] ]
+            ]
+        ]
+      , [ Plain
+            [ Str "Bulleted"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , Space
+            , Str "3"
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "todo lists" , [] , [] )
+      [ Str "todo" , Space , Str "lists" ]
+  , BulletList
+      [ [ Plain
+            [ Span ( "" , [ "done0" ] , [] ) []
+            , Str "task"
+            , Space
+            , Str "1"
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain [ Span ( "" , [ "done1" ] , [] ) [] , Str "5" ] ]
+            ]
+        ]
+      , [ Plain [ Span ( "" , [ "done2" ] , [] ) [] , Str "3" ] ]
+      , [ Plain
+            [ Str "[]"
+            , Space
+            , Str "not"
+            , Space
+            , Str "a"
+            , Space
+            , Str "todo"
+            , Space
+            , Str "item"
+            ]
+        ]
+      , [ Plain
+            [ Str "["
+            , Space
+            , Str "]not"
+            , Space
+            , Str "a"
+            , Space
+            , Str "todo"
+            , Space
+            , Str "item"
+            ]
+        ]
+      , [ Plain
+            [ Str "[r]"
+            , Space
+            , Str "not"
+            , Space
+            , Str "a"
+            , Space
+            , Str "todo"
+            , Space
+            , Str "item"
+            ]
+        ]
+      , [ Plain
+            [ Str "["
+            , Space
+            , Str "]"
+            , Space
+            , Str "not"
+            , Space
+            , Str "a"
+            , Space
+            , Str "todo"
+            , Space
+            , Str "item"
+            ]
+        ]
+      , [ Plain
+            [ Span ( "" , [ "done2" ] , [] ) []
+            , Str "a"
+            , Space
+            , Str "tab"
+            , Space
+            , Str "in"
+            , Space
+            , Str "the"
+            , Space
+            , Str "todo"
+            , Space
+            , Str "list"
+            , Space
+            , Str "marker"
+            , Space
+            , Code ( "" , [] , [] ) "[ ]"
+            ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim )
+            [ [ Plain
+                  [ Span ( "" , [ "done3" ] , [] ) []
+                  , Str "4"
+                  , SoftBreak
+                  , Str "5"
+                  ]
+              ]
+            , [ Plain [ Span ( "" , [ "done4" ] , [] ) [] ]
+              , Table
+                  ( "" , [] , [] )
+                  (Caption Nothing [])
+                  [ ( AlignDefault , ColWidthDefault )
+                  , ( AlignDefault , ColWidthDefault )
+                  ]
+                  (TableHead
+                     ( "" , [] , [] )
+                     [ Row
+                         ( "" , [] , [] )
+                         [ Cell
+                             ( "" , [] , [] )
+                             AlignDefault
+                             (RowSpan 1)
+                             (ColSpan 1)
+                             []
+                         , Cell
+                             ( "" , [] , [] )
+                             AlignDefault
+                             (RowSpan 1)
+                             (ColSpan 1)
+                             []
+                         ]
+                     ])
+                  [ TableBody
+                      ( "" , [] , [] )
+                      (RowHeadColumns 0)
+                      []
+                      [ Row
+                          ( "" , [] , [] )
+                          [ Cell
+                              ( "" , [] , [] )
+                              AlignDefault
+                              (RowSpan 1)
+                              (ColSpan 1)
+                              [ Plain [ Str "a" ] ]
+                          , Cell
+                              ( "" , [] , [] )
+                              AlignDefault
+                              (RowSpan 1)
+                              (ColSpan 1)
+                              [ Plain [ Str "b" ] ]
+                          ]
+                      ]
+                  ]
+                  (TableFoot ( "" , [] , [] ) [])
+              ]
+            ]
+        ]
+      , [ Plain
+            [ Span ( "" , [ "done4" ] , [] ) []
+            , Str "task"
+            , Space
+            , Str "2"
+            ]
+        ]
+      ]
+  , Header 2 ( "math" , [] , [] ) [ Str "math" ]
+  , Para [ Math InlineMath " \\sum_i a_i^2 = 1 " ]
+  , Para [ Math DisplayMath "\\sum_i a_i^2\n=\n1" ]
+  , Para
+      [ Math
+          DisplayMath
+          "\\begin{aligned}\n\\sum_i a_i^2 &= 1 + 1 \\\\\n&= 2.\n\\end{aligned}"
+      ]
+  , Para
+      [ Str "edge"
+      , Space
+      , Str "case"
+      , Space
+      , Str "(the"
+      , Space
+      , Code ( "" , [] , [] ) "c^2 + "
+      , Space
+      , Str "after"
+      , Space
+      , Str "the"
+      , Space
+      , Str "multline"
+      , Space
+      , Str "tag"
+      , Space
+      , Str "is"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "equation):"
+      ]
+  , Para
+      [ Math
+          DisplayMath
+          "\\begin{gathered}\nc^2 + \na^2 + b^2\n\\end{gathered}"
+      ]
+  , Para
+      [ Str "edge"
+      , Space
+      , Str "case"
+      , Space
+      , Str "(the"
+      , Space
+      , Str "tag"
+      , Space
+      , Str "is"
+      , Space
+      , Code ( "" , [] , [] ) "hello%bye"
+      , Str ")"
+      ]
+  , Para
+      [ Math
+          DisplayMath
+          "\\begin{hello%bye}\n\\int_a^b f(x) dx\n\\end{hello%bye}"
+      ]
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "two"
+      , Space
+      , Str "dollar"
+      , Space
+      , Str "signs:"
+      , Space
+      , Str "$$"
+      ]
+  , Para
+      [ Str "[not"
+      , Space
+      , Str "math]"
+      , Space
+      , Str "You"
+      , Space
+      , Str "have"
+      , Space
+      , Str "$1"
+      , SoftBreak
+      , Str "and"
+      , Space
+      , Str "I"
+      , Space
+      , Str "have"
+      , Space
+      , Str "$1."
+      ]
+  , Header 2 ( "tags" , [] , [] ) [ Str "tags" ]
+  , Para
+      [ Span ( "-tag-one" , [] , [] ) [ Str "" ]
+      , Span ( "tag-one" , [ "tag" ] , [] ) [ Str "tag-one" ]
+      , Space
+      , Span ( "-tag-two" , [] , [] ) [ Str "" ]
+      , Span ( "tag-two" , [ "tag" ] , [] ) [ Str "tag-two" ]
+      ]
+  , Header 2 ( "tables" , [] , [] ) [ Str "tables" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Year" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Temperature" , Space , Str "(low)" ] ]
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 [ Plain [ Str "Temperature" , Space , Str "(high)" ] ]
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1900" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "-10" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "25" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1910" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "-15" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "30" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1920" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "-10" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "32" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1930" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Emph [ Str "N/A" ] ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Emph [ Str "N/A" ] ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "1940" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "-2" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "40" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header
+      3
+      ( "centered headerless tables" , [] , [] )
+      [ Str "centered"
+      , Space
+      , Str "headerless"
+      , Space
+      , Str "tables"
+      ]
+  , Div
+      ( "" , [ "center" ] , [] )
+      [ Table
+          ( "" , [] , [] )
+          (Caption Nothing [])
+          [ ( AlignDefault , ColWidthDefault )
+          , ( AlignDefault , ColWidthDefault )
+          ]
+          (TableHead
+             ( "" , [] , [] )
+             [ Row
+                 ( "" , [] , [] )
+                 [ Cell
+                     ( "" , [] , [] )
+                     AlignDefault
+                     (RowSpan 1)
+                     (ColSpan 1)
+                     []
+                 , Cell
+                     ( "" , [] , [] )
+                     AlignDefault
+                     (RowSpan 1)
+                     (ColSpan 1)
+                     []
+                 ]
+             ])
+          [ TableBody
+              ( "" , [] , [] )
+              (RowHeadColumns 0)
+              []
+              [ Row
+                  ( "" , [] , [] )
+                  [ Cell
+                      ( "" , [] , [] )
+                      AlignDefault
+                      (RowSpan 1)
+                      (ColSpan 1)
+                      [ Plain [ Str "a" ] ]
+                  , Cell
+                      ( "" , [] , [] )
+                      AlignDefault
+                      (RowSpan 1)
+                      (ColSpan 1)
+                      [ Plain [ Str "b" ] ]
+                  ]
+              , Row
+                  ( "" , [] , [] )
+                  [ Cell
+                      ( "" , [] , [] )
+                      AlignDefault
+                      (RowSpan 1)
+                      (ColSpan 1)
+                      [ Plain [ Str "c" ] ]
+                  , Cell
+                      ( "" , [] , [] )
+                      AlignDefault
+                      (RowSpan 1)
+                      (ColSpan 1)
+                      [ Plain [ Str "d" ] ]
+                  ]
+              ]
+          ]
+          (TableFoot ( "" , [] , [] ) [])
+      ]
+  , Header 2 ( "paragraphs" , [] , [] ) [ Str "paragraphs" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "first"
+      , Space
+      , Str "paragraph"
+      , SoftBreak
+      , Str "with"
+      , Space
+      , Str "two"
+      , Space
+      , Str "lines."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "second"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "with"
+      , SoftBreak
+      , Str "two"
+      , Space
+      , Str "lines"
+      , Space
+      , Str "after"
+      , Space
+      , Str "many"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "lines."
+      ]
+  , Header
+      2
+      ( "definition list" , [] , [] )
+      [ Str "definition" , Space , Str "list" ]
+  , DefinitionList
+      [ ( [ Str "Term" , Space , Str "1" ]
+        , [ [ Plain [ Str "Definition" , Space , Str "1" ] ] ]
+        )
+      , ( [ Str "Term" , Space , Str "2" ]
+        , [ [ Plain [ Str "Definition" , Space , Str "2" ] ]
+          , [ Plain [ Str "Definition" , Space , Str "3" ] ]
+          ]
+        )
+      , ( [ Str "Term"
+          , Space
+          , Str "::"
+          , Space
+          , Span ( "separated" , [] , [] ) []
+          , Strong [ Str "separated" ]
+          , Space
+          , Str "by"
+          , Space
+          , Str "::"
+          , Space
+          , Emph [ Str "double" , Space , Str "colons" ]
+          ]
+        , [ [ Plain [ Str "Def1" ] ] , [ Plain [ Str "Def2" ] ] ]
+        )
+      , ( [ Str "Term"
+          , Space
+          , Str "with"
+          , Space
+          , Str "lots"
+          , Space
+          , Str "of"
+          , Space
+          , Str "trailing"
+          , Space
+          , Str "colons:::::::"
+          ]
+        , [ [ Plain [ Str "Definition" ] ] ]
+        )
+      , ( [ Str "::"
+          , Space
+          , Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "::"
+          , Space
+          , Str "A"
+          , Space
+          , Str "term"
+          , Space
+          , Str "(rather"
+          , Space
+          , Str "than"
+          , Space
+          , Str "a"
+          , Space
+          , Str "definition)"
+          ]
+        , [ [ Plain
+                [ Str "and"
+                , Space
+                , Str "this"
+                , Space
+                , Str "is"
+                , Space
+                , Str "a"
+                , Space
+                , Str "definition"
+                ]
+            ]
+          ]
+        )
+      , ( [ Str "Term"
+          , Space
+          , Str "Without"
+          , Space
+          , Str "definitions"
+          ]
+        , [ [] ]
+        )
+      , ( [ Str "Part"
+          , Space
+          , Str "::"
+          , Space
+          , Str "of"
+          , Space
+          , Str "::"
+          , Space
+          , Str "dt"
+          ]
+        , [ [ Plain
+                [ Str "part" , Space , Str "of" , Space , Str "::dd" ]
+            ]
+          ]
+        )
+      ]
+  , DefinitionList
+      [ ( []
+        , [ [ Plain
+                [ Str "Definition"
+                , Space
+                , Str "1"
+                , Space
+                , Str "without"
+                , Space
+                , Str "a"
+                , Space
+                , Str "term"
+                ]
+            ]
+          , [ Plain
+                [ Str "Definition"
+                , Space
+                , Str "2"
+                , Space
+                , Str "without"
+                , Space
+                , Str "a"
+                , Space
+                , Str "term"
+                ]
+            ]
+          ]
+        )
+      ]
+  , DefinitionList
+      [ ( [ Str "T1" ] , [ [ Plain [ Str "D1" ] ] ] ) ]
+  , Para [ Str "new" , Space , Str "paragraph" ]
+  , DefinitionList
+      [ ( [ Str "T1" ] , [ [ Plain [ Str "D1" ] ] ] ) ]
+  , Para [ Str "Not::Definition" ]
+  , Para [ Str "Not" , Space , Str "::Definition" ]
+  , Para [ Str "::Not" , Space , Str "definition" ]
+  , BlockQuote
+      [ Plain [ Str "::" , Space , Str "blockquote" ] ]
+  , BlockQuote
+      [ Plain
+          [ Str "block" , Space , Str "::" , Space , Str "quote" ]
+      ]
+  , Header
+      2
+      ( "metadata placeholders" , [] , [] )
+      [ Str "metadata" , Space , Str "placeholders" ]
+  , Para
+      [ Str "%this"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "a"
+      , Space
+      , Str "placeholder"
+      ]
+  , Para
+      [ Str "placeholders"
+      , SoftBreak
+      , Str "serves"
+      , Space
+      , Str "as"
+      , Space
+      , Str "space"
+      , Space
+      , Str "/"
+      , Space
+      , Str "softbreak"
+      , Space
+      , Str "in"
+      , Space
+      , Str "paragraphs"
+      ]
+  , Header
+      2
+      ( "sup, sub" , [] , [] )
+      [ Str "sup," , Space , Str "sub" ]
+  , Para [ Str "super" , Superscript [ Str "script" ] ]
+  , Para [ Str "sub" , Subscript [ Str "script" ] ]
+  , Header
+      2
+      ( "the todo mark" , [] , [] )
+      [ Str "the" , Space , Str "todo" , Space , Str "mark" ]
+  , Para [ Span ( "" , [ "todo" ] , [] ) [ Str "TODO:" ] ]
+  , Header
+      1
+      ( "not implemented yet" , [] , [] )
+      [ Emph
+          [ Span ( "not implemented yet" , [] , [] ) []
+          , Strong
+              [ Str "not"
+              , Space
+              , Str "implemented"
+              , Space
+              , Str "yet"
+              ]
+          ]
+      ]
+  , Header
+      2
+      ( "tables with spans" , [] , [] )
+      [ Str "tables" , Space , Str "with" , Space , Str "spans" ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "a" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "b" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "c" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "d" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "\\/" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "e" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str ">" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "f" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "\\/" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "\\/" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str ">" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "g" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "h" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str ">" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str ">" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str ">" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header
+      2
+      ( "tables with multiple lines of headers" , [] , [] )
+      [ Str "tables"
+      , Space
+      , Str "with"
+      , Space
+      , Str "multiple"
+      , Space
+      , Str "lines"
+      , Space
+      , Str "of"
+      , Space
+      , Str "headers"
+      ]
+  , Table
+      ( "" , [] , [] )
+      (Caption Nothing [])
+      [ ( AlignDefault , ColWidthDefault )
+      , ( AlignDefault , ColWidthDefault )
+      ]
+      (TableHead
+         ( "" , [] , [] )
+         [ Row
+             ( "" , [] , [] )
+             [ Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             , Cell
+                 ( "" , [] , [] )
+                 AlignDefault
+                 (RowSpan 1)
+                 (ColSpan 1)
+                 []
+             ]
+         ])
+      [ TableBody
+          ( "" , [] , [] )
+          (RowHeadColumns 0)
+          []
+          [ Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "a" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "b" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "c" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "d" ] ]
+              ]
+          , Row
+              ( "" , [] , [] )
+              [ Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "---" ] ]
+              , Cell
+                  ( "" , [] , [] )
+                  AlignDefault
+                  (RowSpan 1)
+                  (ColSpan 1)
+                  [ Plain [ Str "---" ] ]
+              ]
+          ]
+      ]
+      (TableFoot ( "" , [] , [] ) [])
+  , Header
+      2
+      ( "some other placeholders" , [] , [] )
+      [ Str "some"
+      , Space
+      , Str "other"
+      , Space
+      , Str "placeholders"
+      ]
+  , Para
+      [ Code ( "" , [] , [] ) "template"
+      , Space
+      , Str "placeholder"
+      , Space
+      , Str "is"
+      , Space
+      , Str "ignored."
+      ]
+  , Para
+      [ Code ( "" , [] , [] ) "nohtml"
+      , Space
+      , Str "placeholder"
+      , Space
+      , Str "is"
+      , Space
+      , Str "ignored."
+      ]
+  ]
diff --git a/test/writer.asciidoc b/test/writer.asciidoc
--- a/test/writer.asciidoc
+++ b/test/writer.asciidoc
@@ -431,8 +431,8 @@
 
 Subscripts: H~2~O, H~23~O, H~many of them~O.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a^b c^d, a~b c~d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a^b c^d, a~b c~d.
 
 '''''
 
@@ -630,10 +630,10 @@
 
 == Footnotes
 
-Here is a footnote reference,footnote:[Here is the footnote. It can go
-anywhere after the footnote reference. It need not be placed at the end of the
-document.] and another.[multiblock footnote omitted] This should _not_ be a
-footnote reference, because it contains a space.[^my note] Here is an inline
+Here is a footnote reference,footnote:[Here is the footnote. It can go anywhere
+after the footnote reference. It need not be placed at the end of the document.]
+and another.[multiblock footnote omitted] This should _not_ be a footnote
+reference, because it contains a space.[^my note] Here is an inline
 note.footnote:[This is _easier_ to type. Inline notes may contain
 http://google.com[links] and `]` verbatim characters, as well as [bracketed
 text].]
diff --git a/test/writer.asciidoctor b/test/writer.asciidoctor
--- a/test/writer.asciidoctor
+++ b/test/writer.asciidoctor
@@ -432,8 +432,8 @@
 
 Subscripts: H~2~O, H~23~O, H~many of them~O.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a^b c^d, a~b c~d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a^b c^d, a~b c~d.
 
 '''''
 
@@ -447,8 +447,8 @@
 
 '`He said, "`I want to go.`"`' Were you alive in the 70’s?
 
-Here is some quoted '``+code+``' and a
-"`http://example.com/?foo=1&bar=2[quoted link]`".
+Here is some quoted '``+code+``' and a "`http://example.com/?foo=1&bar=2[quoted
+link]`".
 
 Some dashes: one—two — three—four — five.
 
@@ -631,10 +631,10 @@
 
 == Footnotes
 
-Here is a footnote reference,footnote:[Here is the footnote. It can go
-anywhere after the footnote reference. It need not be placed at the end of the
-document.] and another.[multiblock footnote omitted] This should _not_ be a
-footnote reference, because it contains a space.[^my note] Here is an inline
+Here is a footnote reference,footnote:[Here is the footnote. It can go anywhere
+after the footnote reference. It need not be placed at the end of the document.]
+and another.[multiblock footnote omitted] This should _not_ be a footnote
+reference, because it contains a space.[^my note] Here is an inline
 note.footnote:[This is _easier_ to type. Inline notes may contain
 http://google.com[links] and `+]+` verbatim characters, as well as [bracketed
 text].]
diff --git a/test/writer.context b/test/writer.context
--- a/test/writer.context
+++ b/test/writer.context
@@ -643,8 +643,8 @@
 
 Subscripts: H\low{2}O, H\low{23}O, H\low{many~of~them}O.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a^b c^d, a\lettertilde{}b c\lettertilde{}d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a^b c^d, a\lettertilde{}b c\lettertilde{}d.
 
 \thinrule
 
@@ -878,10 +878,10 @@
 
 \section[title={Footnotes},reference={footnotes}]
 
-Here is a footnote reference,\footnote{Here is the footnote. It can go
-  anywhere after the footnote reference. It need not be placed at the end of
-  the document.} and another.\startbuffer Here's the long note. This one
-  contains multiple blocks.
+Here is a footnote reference,\footnote{Here is the footnote. It can go anywhere
+  after the footnote reference. It need not be placed at the end of the
+  document.} and another.\startbuffer Here's the long note. This one contains
+  multiple blocks.
 
   Subsequent blocks are indented to show that they belong to the footnote (as
   with list items).
diff --git a/test/writer.docbook4 b/test/writer.docbook4
--- a/test/writer.docbook4
+++ b/test/writer.docbook4
@@ -66,8 +66,8 @@
     </para>
     <para>
       In Markdown 1.0.0 and earlier. Version 8. This line turns into a list
-      item. Because a hard-wrapped line in the middle of a paragraph looked
-      like a list item.
+      item. Because a hard-wrapped line in the middle of a paragraph looked like
+      a list item.
     </para>
     <para>
       Here’s one with a bullet. * criminey.
@@ -1014,19 +1014,19 @@
   <sect1 id="smart-quotes-ellipses-dashes">
     <title>Smart quotes, ellipses, dashes</title>
     <para>
-      <quote>Hello,</quote> said the spider. <quote><quote>Shelob</quote> is
-      my name.</quote>
+      <quote>Hello,</quote> said the spider. <quote><quote>Shelob</quote> is my
+      name.</quote>
     </para>
     <para>
       <quote>A</quote>, <quote>B</quote>, and <quote>C</quote> are letters.
     </para>
     <para>
-      <quote>Oak,</quote> <quote>elm,</quote> and <quote>beech</quote> are
-      names of trees. So is <quote>pine.</quote>
+      <quote>Oak,</quote> <quote>elm,</quote> and <quote>beech</quote> are names
+      of trees. So is <quote>pine.</quote>
     </para>
     <para>
-      <quote>He said, <quote>I want to go.</quote></quote> Were you alive in
-      the 70’s?
+      <quote>He said, <quote>I want to go.</quote></quote> Were you alive in the
+      70’s?
     </para>
     <para>
       Here is some quoted <quote><literal>code</literal></quote> and a
@@ -1366,8 +1366,8 @@
     <para>
       Here is a footnote reference,<footnote>
         <para>
-          Here is the footnote. It can go anywhere after the footnote
-          reference. It need not be placed at the end of the document.
+          Here is the footnote. It can go anywhere after the footnote reference.
+          It need not be placed at the end of the document.
         </para>
       </footnote> and another.<footnote>
         <para>
@@ -1384,14 +1384,12 @@
           If you want, you can indent every line, but you can also be lazy and
           just indent the first line of each block.
         </para>
-      </footnote> This should <emphasis>not</emphasis> be a footnote
-      reference, because it contains a space.[^my note] Here is an inline
-      note.<footnote>
+      </footnote> This should <emphasis>not</emphasis> be a footnote reference,
+      because it contains a space.[^my note] Here is an inline note.<footnote>
         <para>
-          This is <emphasis>easier</emphasis> to type. Inline notes may
-          contain <ulink url="http://google.com">links</ulink> and
-          <literal>]</literal> verbatim characters, as well as [bracketed
-          text].
+          This is <emphasis>easier</emphasis> to type. Inline notes may contain
+          <ulink url="http://google.com">links</ulink> and <literal>]</literal>
+          verbatim characters, as well as [bracketed text].
         </para>
       </footnote>
     </para>
diff --git a/test/writer.docbook5 b/test/writer.docbook5
--- a/test/writer.docbook5
+++ b/test/writer.docbook5
@@ -68,8 +68,8 @@
     </para>
     <para>
       In Markdown 1.0.0 and earlier. Version 8. This line turns into a list
-      item. Because a hard-wrapped line in the middle of a paragraph looked
-      like a list item.
+      item. Because a hard-wrapped line in the middle of a paragraph looked like
+      a list item.
     </para>
     <para>
       Here’s one with a bullet. * criminey.
@@ -989,19 +989,19 @@
   <section xml:id="smart-quotes-ellipses-dashes">
     <title>Smart quotes, ellipses, dashes</title>
     <para>
-      <quote>Hello,</quote> said the spider. <quote><quote>Shelob</quote> is
-      my name.</quote>
+      <quote>Hello,</quote> said the spider. <quote><quote>Shelob</quote> is my
+      name.</quote>
     </para>
     <para>
       <quote>A</quote>, <quote>B</quote>, and <quote>C</quote> are letters.
     </para>
     <para>
-      <quote>Oak,</quote> <quote>elm,</quote> and <quote>beech</quote> are
-      names of trees. So is <quote>pine.</quote>
+      <quote>Oak,</quote> <quote>elm,</quote> and <quote>beech</quote> are names
+      of trees. So is <quote>pine.</quote>
     </para>
     <para>
-      <quote>He said, <quote>I want to go.</quote></quote> Were you alive in
-      the 70’s?
+      <quote>He said, <quote>I want to go.</quote></quote> Were you alive in the
+      70’s?
     </para>
     <para>
       Here is some quoted <quote><literal>code</literal></quote> and a
@@ -1266,8 +1266,7 @@
         <link xlink:href="http://att.com/">AT&amp;T</link>.
       </para>
       <para>
-        Here’s an <link xlink:href="/script?foo=1&amp;bar=2">inline
-        link</link>.
+        Here’s an <link xlink:href="/script?foo=1&amp;bar=2">inline link</link>.
       </para>
       <para>
         Here’s an <link xlink:href="/script?foo=1&amp;bar=2">inline link in
@@ -1342,8 +1341,8 @@
     <para>
       Here is a footnote reference,<footnote>
         <para>
-          Here is the footnote. It can go anywhere after the footnote
-          reference. It need not be placed at the end of the document.
+          Here is the footnote. It can go anywhere after the footnote reference.
+          It need not be placed at the end of the document.
         </para>
       </footnote> and another.<footnote>
         <para>
@@ -1360,14 +1359,12 @@
           If you want, you can indent every line, but you can also be lazy and
           just indent the first line of each block.
         </para>
-      </footnote> This should <emphasis>not</emphasis> be a footnote
-      reference, because it contains a space.[^my note] Here is an inline
-      note.<footnote>
+      </footnote> This should <emphasis>not</emphasis> be a footnote reference,
+      because it contains a space.[^my note] Here is an inline note.<footnote>
         <para>
-          This is <emphasis>easier</emphasis> to type. Inline notes may
-          contain <link xlink:href="http://google.com">links</link> and
-          <literal>]</literal> verbatim characters, as well as [bracketed
-          text].
+          This is <emphasis>easier</emphasis> to type. Inline notes may contain
+          <link xlink:href="http://google.com">links</link> and
+          <literal>]</literal> verbatim characters, as well as [bracketed text].
         </para>
       </footnote>
     </para>
diff --git a/test/writer.haddock b/test/writer.haddock
--- a/test/writer.haddock
+++ b/test/writer.haddock
@@ -1,7 +1,7 @@
 This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
 markdown test suite.
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Headers
 #headers#
@@ -34,7 +34,7 @@
 
 with no blank line
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Paragraphs
 #paragraphs#
@@ -50,7 +50,7 @@
 There should be a hard line break
 here.
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Block Quotes
 #block-quotes#
@@ -80,7 +80,7 @@
 
 And a following paragraph.
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Code Blocks
 #code-blocks#
@@ -101,7 +101,7 @@
 >
 > These should not be escaped:  \$ \\ \> \[ \{
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Lists
 #lists#
@@ -265,7 +265,7 @@
 
 B. Williams
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Definition Lists
 #definition-lists#
@@ -398,7 +398,7 @@
 
 Hr’s:
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Inline Markup
 #inline-markup#
@@ -425,10 +425,10 @@
 
 Subscripts: H2O, H23O, Hmany of themO.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a^b c^d, a~b c~d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a^b c^d, a~b c~d.
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Smart quotes, ellipses, dashes
 #smart-quotes-ellipses-dashes#
@@ -450,7 +450,7 @@
 
 Ellipses…and…and….
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = LaTeX
 #latex#
@@ -475,7 +475,7 @@
 
 Here’s a LaTeX table:
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Special Characters
 #special-characters#
@@ -530,7 +530,7 @@
 
 Minus: -
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Links
 #links#
@@ -607,7 +607,7 @@
 
 > or here: <http://example.com/>
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Images
 #images#
@@ -618,14 +618,14 @@
 
 Here is a movie <<movie.jpg movie>> icon.
 
-______________________________________________________________________________
+________________________________________________________________________________
 
 = Footnotes
 #footnotes#
 
 Here is a footnote reference,<#notes [1]> and another.<#notes [2]> This should
-/not/ be a footnote reference, because it contains a space.[^my note] Here is
-an inline note.<#notes [3]>
+/not/ be a footnote reference, because it contains a space.[^my note] Here is an
+inline note.<#notes [3]>
 
 Notes can go in quotes.<#notes [4]>
 
@@ -640,17 +640,16 @@
 
 2.  Here’s the long note. This one contains multiple blocks.
 
-    Subsequent blocks are indented to show that they belong to the footnote
-    (as with list items).
+    Subsequent blocks are indented to show that they belong to the footnote (as
+    with list items).
 
     >   { <code> }
 
     If you want, you can indent every line, but you can also be lazy and just
     indent the first line of each block.
 
-3.  This is /easier/ to type. Inline notes may contain
-    <http://google.com links> and @]@ verbatim characters, as well as
-    [bracketed text].
+3.  This is /easier/ to type. Inline notes may contain <http://google.com links>
+    and @]@ verbatim characters, as well as [bracketed text].
 
 4.  In quote.
 
diff --git a/test/writer.html4 b/test/writer.html4
--- a/test/writer.html4
+++ b/test/writer.html4
@@ -665,7 +665,7 @@
 <li>And in list items.<a href="#fn5" class="footnote-ref" id="fnref5"><sup>5</sup></a></li>
 </ol>
 <p>This paragraph should not be part of the note, as it is not indented.</p>
-<div class="footnotes">
+<div class="footnotes footnotes-end-of-document">
 <hr />
 <ol>
 <li id="fn1"><p>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.<a href="#fnref1" class="footnote-back">↩︎</a></p></li>
diff --git a/test/writer.html5 b/test/writer.html5
--- a/test/writer.html5
+++ b/test/writer.html5
@@ -667,7 +667,7 @@
 <li>And in list items.<a href="#fn5" class="footnote-ref" id="fnref5" role="doc-noteref"><sup>5</sup></a></li>
 </ol>
 <p>This paragraph should not be part of the note, as it is not indented.</p>
-<section class="footnotes" role="doc-endnotes">
+<section class="footnotes footnotes-end-of-document" role="doc-endnotes">
 <hr />
 <ol>
 <li id="fn1" role="doc-endnote"><p>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
diff --git a/test/writer.jats_archiving b/test/writer.jats_archiving
--- a/test/writer.jats_archiving
+++ b/test/writer.jats_archiving
@@ -68,9 +68,9 @@
 <sec id="paragraphs">
   <title>Paragraphs</title>
   <p>Here’s a regular paragraph.</p>
-  <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list
-  item. Because a hard-wrapped line in the middle of a paragraph looked like a
-  list item.</p>
+  <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.
+  Because a hard-wrapped line in the middle of a paragraph looked like a list
+  item.</p>
   <p>Here’s one with a bullet. * criminey.</p>
   <p>There should be a hard line break
   here.</p>
@@ -634,8 +634,7 @@
   <p><strike>This is <italic>strikeout</italic>.</strike></p>
   <p>Superscripts: a<sup>bc</sup>d a<sup><italic>hello</italic></sup>
   a<sup>hello there</sup>.</p>
-  <p>Subscripts: H<sub>2</sub>O, H<sub>23</sub>O,
-  H<sub>many of them</sub>O.</p>
+  <p>Subscripts: H<sub>2</sub>O, H<sub>23</sub>O, H<sub>many of them</sub>O.</p>
   <p>These should not be superscripts or subscripts, because of the unescaped
   spaces: a^b c^d, a~b c~d.</p>
 </sec>
@@ -689,8 +688,7 @@
       <mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mrow><mml:mo stretchy="true" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="true" form="postfix">)</mml:mo></mml:mrow><mml:mo>=</mml:mo><mml:munder><mml:mo>lim</mml:mo><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mrow><mml:mo stretchy="true" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo stretchy="true" form="postfix">)</mml:mo></mml:mrow><mml:mo>−</mml:mo><mml:mi>f</mml:mi><mml:mrow><mml:mo stretchy="true" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="true" form="postfix">)</mml:mo></mml:mrow></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></alternatives></disp-formula></p>
     </list-item>
     <list-item>
-      <p>Here’s one that has a line break in it:
-      <inline-formula><alternatives>
+      <p>Here’s one that has a line break in it: <inline-formula><alternatives>
       <tex-math><![CDATA[\alpha + \omega \times x^2]]></tex-math>
       <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>α</mml:mi><mml:mo>+</mml:mo><mml:mi>ω</mml:mi><mml:mo>×</mml:mo><mml:msup><mml:mi>x</mml:mi><mml:mn>2</mml:mn></mml:msup></mml:mrow></mml:math></alternatives></inline-formula>.</p>
     </list-item>
@@ -780,8 +778,7 @@
   </sec>
   <sec id="reference">
     <title>Reference</title>
-    <p>Foo
-    <ext-link ext-link-type="uri" xlink:href="/url/">bar</ext-link>.</p>
+    <p>Foo <ext-link ext-link-type="uri" xlink:href="/url/">bar</ext-link>.</p>
     <p>With <ext-link ext-link-type="uri" xlink:href="/url/">embedded
     [brackets]</ext-link>.</p>
     <p><ext-link ext-link-type="uri" xlink:href="/url/">b</ext-link> by itself
@@ -853,9 +850,8 @@
   <title>Footnotes</title>
   <p>Here is a footnote reference,<xref ref-type="fn" rid="fn1">1</xref> and
   another.<xref ref-type="fn" rid="fn2">2</xref> This should
-  <italic>not</italic> be a footnote reference, because it contains a
-  space.[^my note] Here is an inline
-  note.<xref ref-type="fn" rid="fn3">3</xref></p>
+  <italic>not</italic> be a footnote reference, because it contains a space.[^my
+  note] Here is an inline note.<xref ref-type="fn" rid="fn3">3</xref></p>
   <disp-quote>
     <p>Notes can go in quotes.<xref ref-type="fn" rid="fn4">4</xref></p>
   </disp-quote>
@@ -881,12 +877,12 @@
     <p specific-use="wrapper">
       <preformat>  { &lt;code&gt; }</preformat>
     </p>
-    <p>If you want, you can indent every line, but you can also be lazy and
-    just indent the first line of each block.</p>
+    <p>If you want, you can indent every line, but you can also be lazy and just
+    indent the first line of each block.</p>
   </fn>
   <fn id="fn3">
-    <label>3</label><p>This is <italic>easier</italic> to type. Inline notes
-    may contain
+    <label>3</label><p>This is <italic>easier</italic> to type. Inline notes may
+    contain
     <ext-link ext-link-type="uri" xlink:href="http://google.com">links</ext-link>
     and <monospace>]</monospace> verbatim characters, as well as [bracketed
     text].</p>
diff --git a/test/writer.jats_articleauthoring b/test/writer.jats_articleauthoring
--- a/test/writer.jats_articleauthoring
+++ b/test/writer.jats_articleauthoring
@@ -57,9 +57,9 @@
 <sec id="paragraphs">
   <title>Paragraphs</title>
   <p>Here’s a regular paragraph.</p>
-  <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list
-  item. Because a hard-wrapped line in the middle of a paragraph looked like a
-  list item.</p>
+  <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.
+  Because a hard-wrapped line in the middle of a paragraph looked like a list
+  item.</p>
   <p>Here’s one with a bullet. * criminey.</p>
   <p>There should be a hard line break
   here.</p>
@@ -631,8 +631,7 @@
   <p><strike>This is <italic>strikeout</italic>.</strike></p>
   <p>Superscripts: a<sup>bc</sup>d a<sup><italic>hello</italic></sup>
   a<sup>hello there</sup>.</p>
-  <p>Subscripts: H<sub>2</sub>O, H<sub>23</sub>O,
-  H<sub>many of them</sub>O.</p>
+  <p>Subscripts: H<sub>2</sub>O, H<sub>23</sub>O, H<sub>many of them</sub>O.</p>
   <p>These should not be superscripts or subscripts, because of the unescaped
   spaces: a^b c^d, a~b c~d.</p>
 </sec>
@@ -764,8 +763,7 @@
   </sec>
   <sec id="reference">
     <title>Reference</title>
-    <p>Foo
-    <ext-link ext-link-type="uri" xlink:href="/url/">bar</ext-link>.</p>
+    <p>Foo <ext-link ext-link-type="uri" xlink:href="/url/">bar</ext-link>.</p>
     <p>With <ext-link ext-link-type="uri" xlink:href="/url/">embedded
     [brackets]</ext-link>.</p>
     <p><ext-link ext-link-type="uri" xlink:href="/url/">b</ext-link> by itself
@@ -836,8 +834,8 @@
 <sec id="footnotes">
   <title>Footnotes</title>
   <p>Here is a footnote reference,<fn>
-    <p>Here is the footnote. It can go anywhere after the footnote reference.
-    It need not be placed at the end of the document.</p>
+    <p>Here is the footnote. It can go anywhere after the footnote reference. It
+    need not be placed at the end of the document.</p>
   </fn> and another.<fn>
     <p>Here’s the long note. This one contains multiple blocks.</p>
     <p>Subsequent blocks are indented to show that they belong to the footnote
@@ -845,8 +843,8 @@
     <p specific-use="wrapper">
       <preformat>  { &lt;code&gt; }</preformat>
     </p>
-    <p>If you want, you can indent every line, but you can also be lazy and
-    just indent the first line of each block.</p>
+    <p>If you want, you can indent every line, but you can also be lazy and just
+    indent the first line of each block.</p>
   </fn> This should <italic>not</italic> be a footnote reference, because it
   contains a space.[^my note] Here is an inline note.<fn>
     <p>This is <italic>easier</italic> to type. Inline notes may contain
diff --git a/test/writer.jats_publishing b/test/writer.jats_publishing
--- a/test/writer.jats_publishing
+++ b/test/writer.jats_publishing
@@ -68,9 +68,9 @@
 <sec id="paragraphs">
   <title>Paragraphs</title>
   <p>Here’s a regular paragraph.</p>
-  <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list
-  item. Because a hard-wrapped line in the middle of a paragraph looked like a
-  list item.</p>
+  <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.
+  Because a hard-wrapped line in the middle of a paragraph looked like a list
+  item.</p>
   <p>Here’s one with a bullet. * criminey.</p>
   <p>There should be a hard line break
   here.</p>
@@ -634,8 +634,7 @@
   <p><strike>This is <italic>strikeout</italic>.</strike></p>
   <p>Superscripts: a<sup>bc</sup>d a<sup><italic>hello</italic></sup>
   a<sup>hello there</sup>.</p>
-  <p>Subscripts: H<sub>2</sub>O, H<sub>23</sub>O,
-  H<sub>many of them</sub>O.</p>
+  <p>Subscripts: H<sub>2</sub>O, H<sub>23</sub>O, H<sub>many of them</sub>O.</p>
   <p>These should not be superscripts or subscripts, because of the unescaped
   spaces: a^b c^d, a~b c~d.</p>
 </sec>
@@ -689,8 +688,7 @@
       <mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mrow><mml:mo stretchy="true" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="true" form="postfix">)</mml:mo></mml:mrow><mml:mo>=</mml:mo><mml:munder><mml:mo>lim</mml:mo><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mrow><mml:mo stretchy="true" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo stretchy="true" form="postfix">)</mml:mo></mml:mrow><mml:mo>−</mml:mo><mml:mi>f</mml:mi><mml:mrow><mml:mo stretchy="true" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="true" form="postfix">)</mml:mo></mml:mrow></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></alternatives></disp-formula></p>
     </list-item>
     <list-item>
-      <p>Here’s one that has a line break in it:
-      <inline-formula><alternatives>
+      <p>Here’s one that has a line break in it: <inline-formula><alternatives>
       <tex-math><![CDATA[\alpha + \omega \times x^2]]></tex-math>
       <mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>α</mml:mi><mml:mo>+</mml:mo><mml:mi>ω</mml:mi><mml:mo>×</mml:mo><mml:msup><mml:mi>x</mml:mi><mml:mn>2</mml:mn></mml:msup></mml:mrow></mml:math></alternatives></inline-formula>.</p>
     </list-item>
@@ -780,8 +778,7 @@
   </sec>
   <sec id="reference">
     <title>Reference</title>
-    <p>Foo
-    <ext-link ext-link-type="uri" xlink:href="/url/">bar</ext-link>.</p>
+    <p>Foo <ext-link ext-link-type="uri" xlink:href="/url/">bar</ext-link>.</p>
     <p>With <ext-link ext-link-type="uri" xlink:href="/url/">embedded
     [brackets]</ext-link>.</p>
     <p><ext-link ext-link-type="uri" xlink:href="/url/">b</ext-link> by itself
@@ -853,9 +850,8 @@
   <title>Footnotes</title>
   <p>Here is a footnote reference,<xref ref-type="fn" rid="fn1">1</xref> and
   another.<xref ref-type="fn" rid="fn2">2</xref> This should
-  <italic>not</italic> be a footnote reference, because it contains a
-  space.[^my note] Here is an inline
-  note.<xref ref-type="fn" rid="fn3">3</xref></p>
+  <italic>not</italic> be a footnote reference, because it contains a space.[^my
+  note] Here is an inline note.<xref ref-type="fn" rid="fn3">3</xref></p>
   <disp-quote>
     <p>Notes can go in quotes.<xref ref-type="fn" rid="fn4">4</xref></p>
   </disp-quote>
@@ -881,12 +877,12 @@
     <p specific-use="wrapper">
       <preformat>  { &lt;code&gt; }</preformat>
     </p>
-    <p>If you want, you can indent every line, but you can also be lazy and
-    just indent the first line of each block.</p>
+    <p>If you want, you can indent every line, but you can also be lazy and just
+    indent the first line of each block.</p>
   </fn>
   <fn id="fn3">
-    <label>3</label><p>This is <italic>easier</italic> to type. Inline notes
-    may contain
+    <label>3</label><p>This is <italic>easier</italic> to type. Inline notes may
+    contain
     <ext-link ext-link-type="uri" xlink:href="http://google.com">links</ext-link>
     and <monospace>]</monospace> verbatim characters, as well as [bracketed
     text].</p>
diff --git a/test/writer.latex b/test/writer.latex
--- a/test/writer.latex
+++ b/test/writer.latex
@@ -711,8 +711,8 @@
 Subscripts: H\textsubscript{2}O, H\textsubscript{23}O,
 H\textsubscript{many~of~them}O.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a\^{}b c\^{}d, a\textasciitilde b c\textasciitilde d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a\^{}b c\^{}d, a\textasciitilde b c\textasciitilde d.
 
 \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
 
@@ -905,8 +905,7 @@
 Here's a \href{http://example.com/?foo=1\&bar=2}{link with an ampersand in the
 URL}.
 
-Here's a link with an amersand in the link text:
-\href{http://att.com/}{AT\&T}.
+Here's a link with an amersand in the link text: \href{http://att.com/}{AT\&T}.
 
 Here's an \href{/script?foo=1\&bar=2}{inline link}.
 
@@ -961,9 +960,9 @@
 \hypertarget{footnotes}{%
 \section{Footnotes}\label{footnotes}}
 
-Here is a footnote reference,\footnote{Here is the footnote. It can go
-  anywhere after the footnote reference. It need not be placed at the end of
-  the document.} and another.\footnote{Here's the long note. This one contains
+Here is a footnote reference,\footnote{Here is the footnote. It can go anywhere
+  after the footnote reference. It need not be placed at the end of the
+  document.} and another.\footnote{Here's the long note. This one contains
   multiple blocks.
 
   Subsequent blocks are indented to show that they belong to the footnote (as
@@ -977,8 +976,8 @@
   indent the first line of each block.} This should \emph{not} be a footnote
 reference, because it contains a space.{[}\^{}my note{]} Here is an inline
 note.\footnote{This is \emph{easier} to type. Inline notes may contain
-  \href{http://google.com}{links} and \texttt{{]}} verbatim characters, as
-  well as {[}bracketed text{]}.}
+  \href{http://google.com}{links} and \texttt{{]}} verbatim characters, as well
+  as {[}bracketed text{]}.}
 
 \begin{quote}
 Notes can go in quotes.\footnote{In quote.}
diff --git a/test/writer.man b/test/writer.man
--- a/test/writer.man
+++ b/test/writer.man
@@ -496,8 +496,8 @@
 .PP
 Subscripts: H~2~O, H~23~O, H~many\ of\ them~O.
 .PP
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.
 .PP
    *   *   *   *   *
 .SH Smart quotes, ellipses, dashes
@@ -706,9 +706,9 @@
    *   *   *   *   *
 .SH Footnotes
 .PP
-Here is a footnote reference,[1] and another.[2] This should \f[I]not\f[R] be
-a footnote reference, because it contains a space.[\[ha]my note] Here is an
-inline note.[3]
+Here is a footnote reference,[1] and another.[2] This should \f[I]not\f[R] be a
+footnote reference, because it contains a space.[\[ha]my note] Here is an inline
+note.[3]
 .RS
 .PP
 Notes can go in quotes.[4]
@@ -728,8 +728,8 @@
 Here\[cq]s the long note.
 This one contains multiple blocks.
 .PP
-Subsequent blocks are indented to show that they belong to the footnote (as
-with list items).
+Subsequent blocks are indented to show that they belong to the footnote (as with
+list items).
 .IP
 .nf
 \f[C]
@@ -737,8 +737,8 @@
 \f[R]
 .fi
 .PP
-If you want, you can indent every line, but you can also be lazy and just
-indent the first line of each block.
+If you want, you can indent every line, but you can also be lazy and just indent
+the first line of each block.
 .SS [3]
 .PP
 This is \f[I]easier\f[R] to type.
diff --git a/test/writer.markdown b/test/writer.markdown
--- a/test/writer.markdown
+++ b/test/writer.markdown
@@ -9,7 +9,7 @@
 This is a set of tests for pandoc. Most of them are adapted from John Gruber's
 markdown test suite.
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Headers
 
@@ -33,7 +33,7 @@
 
 with no blank line
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Paragraphs
 
@@ -48,7 +48,7 @@
 There should be a hard line break\
 here.
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Block Quotes
 
@@ -77,7 +77,7 @@
 
 And a following paragraph.
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Code Blocks
 
@@ -97,7 +97,7 @@
 
     These should not be escaped:  \$ \\ \> \[ \{
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Lists
 
@@ -254,7 +254,7 @@
 
 B. Williams
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Definition Lists
 
@@ -507,7 +507,7 @@
 <hr class="foo" id="bar">
 ```
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Inline Markup
 
@@ -533,10 +533,10 @@
 
 Subscripts: H~2~O, H~23~O, H~many of them~O.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a\^b c\^d, a\~b c\~d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a\^b c\^d, a\~b c\~d.
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Smart quotes, ellipses, dashes
 
@@ -557,7 +557,7 @@
 
 Ellipses...and...and....
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # LaTeX
 
@@ -589,7 +589,7 @@
 \end{tabular}
 ```
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Special Characters
 
@@ -643,7 +643,7 @@
 
 Minus: -
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Links
 
@@ -693,8 +693,7 @@
 
 Here's a [link with an ampersand in the URL](http://example.com/?foo=1&bar=2).
 
-Here's a link with an amersand in the link text:
-[AT&T](http://att.com/ "AT&T").
+Here's a link with an amersand in the link text: [AT&T](http://att.com/ "AT&T").
 
 Here's an [inline link](/script?foo=1&bar=2).
 
@@ -716,7 +715,7 @@
 
     or here: <http://example.com/>
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Images
 
@@ -726,13 +725,13 @@
 
 Here is a movie ![movie](movie.jpg) icon.
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 # Footnotes
 
 Here is a footnote reference,[^1] and another.[^2] This should *not* be a
-footnote reference, because it contains a space.\[\^my note\] Here is an
-inline note.[^3]
+footnote reference, because it contains a space.\[\^my note\] Here is an inline
+note.[^3]
 
 > Notes can go in quotes.[^4]
 
@@ -740,13 +739,13 @@
 
 This paragraph should not be part of the note, as it is not indented.
 
-[^1]: Here is the footnote. It can go anywhere after the footnote reference.
-    It need not be placed at the end of the document.
+[^1]: Here is the footnote. It can go anywhere after the footnote reference. It
+    need not be placed at the end of the document.
 
 [^2]: Here's the long note. This one contains multiple blocks.
 
-    Subsequent blocks are indented to show that they belong to the footnote
-    (as with list items).
+    Subsequent blocks are indented to show that they belong to the footnote (as
+    with list items).
 
           { <code> }
 
diff --git a/test/writer.ms b/test/writer.ms
--- a/test/writer.ms
+++ b/test/writer.ms
@@ -653,8 +653,8 @@
 .PP
 Subscripts: H\*<2\*>O, H\*<23\*>O, H\*<many\ of\ them\*>O.
 .PP
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.
 .HLINE
 .SH 1
 Smart quotes, ellipses, dashes
@@ -973,8 +973,8 @@
 Here\[cq]s the long note.
 This one contains multiple blocks.
 .PP
-Subsequent blocks are indented to show that they belong to the footnote (as
-with list items).
+Subsequent blocks are indented to show that they belong to the footnote (as with
+list items).
 .IP
 .nf
 \f[C]
@@ -982,8 +982,8 @@
 \f[]
 .fi
 .LP
-If you want, you can indent every line, but you can also be lazy and just
-indent the first line of each block.
+If you want, you can indent every line, but you can also be lazy and just indent
+the first line of each block.
 .FE
 This should \f[I]not\f[R] be a footnote reference, because it contains a
 space.[\[ha]my note] Here is an inline note.\**
diff --git a/test/writer.muse b/test/writer.muse
--- a/test/writer.muse
+++ b/test/writer.muse
@@ -483,8 +483,8 @@
 
 Subscripts: H<sub>2</sub>O, H<sub>23</sub>O, H<sub>many of them</sub>O.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a^b c^d, a~b c~d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a^b c^d, a~b c~d.
 
 ----
 
@@ -643,8 +643,7 @@
 
 ** With ampersands
 
-Here’s a [[http://example.com/?foo=1&bar=2][link with an ampersand in the
-URL]].
+Here’s a [[http://example.com/?foo=1&bar=2][link with an ampersand in the URL]].
 
 Here’s a link with an amersand in the link text: [[http://att.com/][AT&T]].
 
@@ -686,9 +685,8 @@
 
 * Footnotes
 
-Here is a footnote reference,[1] and another.[2] This should *not* be a
-footnote reference, because it contains a space.[^my note] Here is an inline
-note.[3]
+Here is a footnote reference,[1] and another.[2] This should *not* be a footnote
+reference, because it contains a space.[^my note] Here is an inline note.[3]
 
 <quote>
 Notes can go in quotes.[4]
@@ -703,8 +701,8 @@
 
 [2] Here’s the long note. This one contains multiple blocks.
 
-    Subsequent blocks are indented to show that they belong to the footnote
-    (as with list items).
+    Subsequent blocks are indented to show that they belong to the footnote (as
+    with list items).
 
     <example>
       { <code> }
diff --git a/test/writer.native b/test/writer.native
--- a/test/writer.native
+++ b/test/writer.native
@@ -1,409 +1,2166 @@
-Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Space,Str "MacFarlane"],MetaInlines [Str "Anonymous"]]),("date",MetaInlines [Str "July",Space,Str "17,",Space,Str "2006"]),("title",MetaInlines [Str "Pandoc",Space,Str "Test",Space,Str "Suite"])]})
-[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",SoftBreak,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
-,HorizontalRule
-,Header 1 ("headers",[],[]) [Str "Headers"]
-,Header 2 ("level-2-with-an-embedded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link ("",[],[]) [Str "embedded",Space,Str "link"] ("/url","")]
-,Header 3 ("level-3-with-emphasis",[],[]) [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 4 ("level-4",[],[]) [Str "Level",Space,Str "4"]
-,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
-,Header 1 ("level-1",[],[]) [Str "Level",Space,Str "1"]
-,Header 2 ("level-2-with-emphasis",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 3 ("level-3",[],[]) [Str "Level",Space,Str "3"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,Header 2 ("level-2",[],[]) [Str "Level",Space,Str "2"]
-,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,HorizontalRule
-,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
-,Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",SoftBreak,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",SoftBreak,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",SoftBreak,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",SoftBreak,Str "list",Space,Str "item."]
-,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",SoftBreak,Str "*",Space,Str "criminey."]
-,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."]
-,HorizontalRule
-,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
-,Para [Str "E-mail",Space,Str "style:"]
-,BlockQuote
- [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",SoftBreak,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
-,BlockQuote
- [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
- ,CodeBlock ("",[],[]) "sub status {\n    print \"working\";\n}"
- ,Para [Str "A",Space,Str "list:"]
- ,OrderedList (1,Decimal,Period)
-  [[Plain [Str "item",Space,Str "one"]]
-  ,[Plain [Str "item",Space,Str "two"]]]
- ,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
- ,BlockQuote
-  [Para [Str "nested"]]
- ,BlockQuote
-  [Para [Str "nested"]]]
-,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",SoftBreak,Str ">",Space,Str "1."]
-,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
-,HorizontalRule
-,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
-,Para [Str "And:"]
-,CodeBlock ("",[],[]) "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
-,HorizontalRule
-,Header 1 ("lists",[],[]) [Str "Lists"]
-,Header 2 ("unordered",[],[]) [Str "Unordered"]
-,Para [Str "Asterisks",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "asterisk",Space,Str "1"]]
- ,[Plain [Str "asterisk",Space,Str "2"]]
- ,[Plain [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Asterisks",Space,Str "loose:"]
-,BulletList
- [[Para [Str "asterisk",Space,Str "1"]]
- ,[Para [Str "asterisk",Space,Str "2"]]
- ,[Para [Str "asterisk",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "Plus",Space,Str "1"]]
- ,[Plain [Str "Plus",Space,Str "2"]]
- ,[Plain [Str "Plus",Space,Str "3"]]]
-,Para [Str "Pluses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Plus",Space,Str "1"]]
- ,[Para [Str "Plus",Space,Str "2"]]
- ,[Para [Str "Plus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "tight:"]
-,BulletList
- [[Plain [Str "Minus",Space,Str "1"]]
- ,[Plain [Str "Minus",Space,Str "2"]]
- ,[Plain [Str "Minus",Space,Str "3"]]]
-,Para [Str "Minuses",Space,Str "loose:"]
-,BulletList
- [[Para [Str "Minus",Space,Str "1"]]
- ,[Para [Str "Minus",Space,Str "2"]]
- ,[Para [Str "Minus",Space,Str "3"]]]
-,Header 2 ("ordered",[],[]) [Str "Ordered"]
-,Para [Str "Tight:"]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "First"]]
- ,[Plain [Str "Second"]]
- ,[Plain [Str "Third"]]]
-,Para [Str "and:"]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "One"]]
- ,[Plain [Str "Two"]]
- ,[Plain [Str "Three"]]]
-,Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second"]]
- ,[Para [Str "Third"]]]
-,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "One"]]
- ,[Para [Str "Two"]]
- ,[Para [Str "Three"]]]
-,Para [Str "Multiple",Space,Str "paragraphs:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
-  ,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",SoftBreak,Str "back."]]
- ,[Para [Str "Item",Space,Str "2."]]
- ,[Para [Str "Item",Space,Str "3."]]]
-,Header 2 ("nested",[],[]) [Str "Nested"]
-,BulletList
- [[Plain [Str "Tab"]
-  ,BulletList
-   [[Plain [Str "Tab"]
-    ,BulletList
-     [[Plain [Str "Tab"]]]]]]]
-,Para [Str "Here\8217s",Space,Str "another:"]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "First"]]
- ,[Plain [Str "Second:"]
-  ,BulletList
-   [[Plain [Str "Fee"]]
-   ,[Plain [Str "Fie"]]
-   ,[Plain [Str "Foe"]]]]
- ,[Plain [Str "Third"]]]
-,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
-,OrderedList (1,Decimal,Period)
- [[Para [Str "First"]]
- ,[Para [Str "Second:"]
-  ,BulletList
-   [[Plain [Str "Fee"]]
-   ,[Plain [Str "Fie"]]
-   ,[Plain [Str "Foe"]]]]
- ,[Para [Str "Third"]]]
-,Header 2 ("tabs-and-spaces",[],[]) [Str "Tabs",Space,Str "and",Space,Str "spaces"]
-,BulletList
- [[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",SoftBreak,Str "indented",Space,Str "with",Space,Str "tabs"]]
- ,[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",SoftBreak,Str "indented",Space,Str "with",Space,Str "spaces"]
-  ,BulletList
-   [[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",SoftBreak,Str "indented",Space,Str "with",Space,Str "tabs"]]
-   ,[Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",SoftBreak,Str "indented",Space,Str "with",Space,Str "spaces"]]]]]
-,Header 2 ("fancy-list-markers",[],[]) [Str "Fancy",Space,Str "list",Space,Str "markers"]
-,OrderedList (2,Decimal,TwoParens)
- [[Para [Str "begins",Space,Str "with",Space,Str "2"]]
- ,[Para [Str "and",Space,Str "now",Space,Str "3"]
-  ,Para [Str "with",Space,Str "a",Space,Str "continuation"]
-  ,OrderedList (4,LowerRoman,Period)
-   [[Plain [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",SoftBreak,Str "starting",Space,Str "with",Space,Str "4"]]
-   ,[Plain [Str "more",Space,Str "items"]
-    ,OrderedList (1,UpperAlpha,TwoParens)
-     [[Plain [Str "a",Space,Str "subsublist"]]
-     ,[Plain [Str "a",Space,Str "subsublist"]]]]]]]
-,Para [Str "Nesting:"]
-,OrderedList (1,UpperAlpha,Period)
- [[Plain [Str "Upper",Space,Str "Alpha"]
-  ,OrderedList (1,UpperRoman,Period)
-   [[Plain [Str "Upper",Space,Str "Roman."]
-    ,OrderedList (6,Decimal,TwoParens)
-     [[Plain [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
-      ,OrderedList (3,LowerAlpha,OneParen)
-       [[Plain [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
-,Para [Str "Autonumbering:"]
-,OrderedList (1,DefaultStyle,DefaultDelim)
- [[Plain [Str "Autonumber."]]
- ,[Plain [Str "More."]
-  ,OrderedList (1,DefaultStyle,DefaultDelim)
-   [[Plain [Str "Nested."]]]]]
-,Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item:"]
-,Para [Str "M.A.\160\&2007"]
-,Para [Str "B.",Space,Str "Williams"]
-,HorizontalRule
-,Header 1 ("definition-lists",[],[]) [Str "Definition",Space,Str "Lists"]
-,Para [Str "Tight",Space,Str "using",Space,Str "spaces:"]
-,DefinitionList
- [([Str "apple"],
-   [[Plain [Str "red",Space,Str "fruit"]]])
- ,([Str "orange"],
-   [[Plain [Str "orange",Space,Str "fruit"]]])
- ,([Str "banana"],
-   [[Plain [Str "yellow",Space,Str "fruit"]]])]
-,Para [Str "Tight",Space,Str "using",Space,Str "tabs:"]
-,DefinitionList
- [([Str "apple"],
-   [[Plain [Str "red",Space,Str "fruit"]]])
- ,([Str "orange"],
-   [[Plain [Str "orange",Space,Str "fruit"]]])
- ,([Str "banana"],
-   [[Plain [Str "yellow",Space,Str "fruit"]]])]
-,Para [Str "Loose:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]]])
- ,([Str "banana"],
-   [[Para [Str "yellow",Space,Str "fruit"]]])]
-,Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics:"]
-,DefinitionList
- [([Emph [Str "apple"]],
-   [[Para [Str "red",Space,Str "fruit"]
-    ,Para [Str "contains",Space,Str "seeds,",SoftBreak,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"]]])
- ,([Emph [Str "orange"]],
-   [[Para [Str "orange",Space,Str "fruit"]
-    ,CodeBlock ("",[],[]) "{ orange code block }"
-    ,BlockQuote
-     [Para [Str "orange",Space,Str "block",Space,Str "quote"]]]])]
-,Para [Str "Multiple",Space,Str "definitions,",Space,Str "tight:"]
-,DefinitionList
- [([Str "apple"],
-   [[Plain [Str "red",Space,Str "fruit"]]
-   ,[Plain [Str "computer"]]])
- ,([Str "orange"],
-   [[Plain [Str "orange",Space,Str "fruit"]]
-   ,[Plain [Str "bank"]]])]
-,Para [Str "Multiple",Space,Str "definitions,",Space,Str "loose:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]
-   ,[Para [Str "computer"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]]
-   ,[Para [Str "bank"]]])]
-,Para [Str "Blank",Space,Str "line",Space,Str "after",Space,Str "term,",Space,Str "indented",Space,Str "marker,",Space,Str "alternate",Space,Str "markers:"]
-,DefinitionList
- [([Str "apple"],
-   [[Para [Str "red",Space,Str "fruit"]]
-   ,[Para [Str "computer"]]])
- ,([Str "orange"],
-   [[Para [Str "orange",Space,Str "fruit"]
-    ,OrderedList (1,Decimal,Period)
-     [[Plain [Str "sublist"]]
-     ,[Plain [Str "sublist"]]]]])]
-,Header 1 ("html-blocks",[],[]) [Str "HTML",Space,Str "Blocks"]
-,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
-,Div ("",[],[])
- [Plain [Str "foo"]]
-,Para [Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"]
-,Div ("",[],[])
- [Div ("",[],[])
-  [Div ("",[],[])
-   [Para [Str "foo"]]]
- ,Div ("",[],[])
-  [Plain [Str "bar"]]]
-,Para [Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"]
-,RawBlock (Format "html") "<table>"
-,RawBlock (Format "html") "<tr>"
-,RawBlock (Format "html") "<td>"
-,Plain [Str "This",Space,Str "is",Space,Emph [Str "emphasized"]]
-,RawBlock (Format "html") "</td>"
-,RawBlock (Format "html") "<td>"
-,Plain [Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"]]
-,RawBlock (Format "html") "</td>"
-,RawBlock (Format "html") "</tr>"
-,RawBlock (Format "html") "</table>"
-,RawBlock (Format "html") "<script type=\"text/javascript\">document.write('This *should not* be interpreted as markdown');</script>"
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "simple",Space,Str "block:"]
-,Div ("",[],[])
- [Para [Str "foo"]]
-,Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
-,CodeBlock ("",[],[]) "<div>\n    foo\n</div>"
-,Para [Str "As",Space,Str "should",Space,Str "this:"]
-,CodeBlock ("",[],[]) "<div>foo</div>"
-,Para [Str "Now,",Space,Str "nested:"]
-,Div ("",[],[])
- [Div ("",[],[])
-  [Div ("",[],[])
-   [Plain [Str "foo"]]]]
-,Para [Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"]
-,RawBlock (Format "html") "<!-- Comment -->"
-,Para [Str "Multiline:"]
-,RawBlock (Format "html") "<!--\nBlah\nBlah\n-->"
-,RawBlock (Format "html") "<!--\n    This is another comment.\n-->"
-,Para [Str "Code",Space,Str "block:"]
-,CodeBlock ("",[],[]) "<!-- Comment -->"
-,Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"]
-,RawBlock (Format "html") "<!-- foo -->"
-,Para [Str "Code:"]
-,CodeBlock ("",[],[]) "<hr />"
-,Para [Str "Hr\8217s:"]
-,RawBlock (Format "html") "<hr>"
-,RawBlock (Format "html") "<hr />"
-,RawBlock (Format "html") "<hr />"
-,RawBlock (Format "html") "<hr>"
-,RawBlock (Format "html") "<hr />"
-,RawBlock (Format "html") "<hr />"
-,RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\" />"
-,RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\" />"
-,RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\">"
-,HorizontalRule
-,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
-,Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
-,Para [Str "An",Space,Emph [Link ("",[],[]) [Str "emphasized",Space,Str "link"] ("/url","")],Str "."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
-,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
-,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",Space,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",Space,Code ("",[],[]) "<html>",Str "."]
-,Para [Strikeout [Str "This",Space,Str "is",Space,Emph [Str "strikeout"],Str "."]]
-,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello\160there"],Str "."]
-,Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",Space,Str "H",Subscript [Str "many\160of\160them"],Str "O."]
-,Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts,",SoftBreak,Str "because",Space,Str "of",Space,Str "the",Space,Str "unescaped",Space,Str "spaces:",Space,Str "a^b",Space,Str "c^d,",Space,Str "a~b",Space,Str "c~d."]
-,HorizontalRule
-,Header 1 ("smart-quotes-ellipses-dashes",[],[]) [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
-,Para [Quoted DoubleQuote [Str "Hello,"],Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Quoted DoubleQuote [Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",Space,Str "name."]]
-,Para [Quoted SingleQuote [Str "A"],Str ",",Space,Quoted SingleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted SingleQuote [Str "C"],Space,Str "are",Space,Str "letters."]
-,Para [Quoted SingleQuote [Str "Oak,"],Space,Quoted SingleQuote [Str "elm,"],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",SoftBreak,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine."]]
-,Para [Quoted SingleQuote [Str "He",Space,Str "said,",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",SoftBreak,Str "70\8217s?"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Quoted SingleQuote [Code ("",[],[]) "code"],Space,Str "and",Space,Str "a",Space,Quoted DoubleQuote [Link ("",[],[]) [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."]
-,Para [Str "Some",Space,Str "dashes:",Space,Str "one\8212two",Space,Str "\8212",Space,Str "three\8212four",Space,Str "\8212",Space,Str "five."]
-,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5\8211\&7,",Space,Str "255\8211\&66,",Space,Str "1987\8211\&1999."]
-,Para [Str "Ellipses\8230and\8230and\8230."]
-,HorizontalRule
-,Header 1 ("latex",[],[]) [Str "LaTeX"]
-,BulletList
- [[Plain [RawInline (Format "tex") "\\cite[22-23]{smith.1899}"]]
- ,[Plain [Math InlineMath "2+2=4"]]
- ,[Plain [Math InlineMath "x \\in y"]]
- ,[Plain [Math InlineMath "\\alpha \\wedge \\omega"]]
- ,[Plain [Math InlineMath "223"]]
- ,[Plain [Math InlineMath "p",Str "-Tree"]]
- ,[Plain [Str "Here\8217s",Space,Str "some",Space,Str "display",Space,Str "math:",SoftBreak,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]]
- ,[Plain [Str "Here\8217s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]]
-,Para [Str "These",Space,Str "shouldn\8217t",Space,Str "be",Space,Str "math:"]
-,BulletList
- [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
- ,[Plain [Str "$22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$34,000.",SoftBreak,Str "(It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized.)"]]
- ,[Plain [Str "Shoes",Space,Str "($20)",Space,Str "and",Space,Str "socks",Space,Str "($5)."]]
- ,[Plain [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23$."]]]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
-,RawBlock (Format "tex") "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog    & 2      \\\\\nCat    & 1      \\\\ \\hline\n\\end{tabular}"
-,HorizontalRule
-,Header 1 ("special-characters",[],[]) [Str "Special",Space,Str "Characters"]
-,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
-,BulletList
- [[Plain [Str "I",Space,Str "hat:",Space,Str "\206"]]
- ,[Plain [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
- ,[Plain [Str "section:",Space,Str "\167"]]
- ,[Plain [Str "set",Space,Str "membership:",Space,Str "\8712"]]
- ,[Plain [Str "copyright:",Space,Str "\169"]]]
-,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
-,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
-,Para [Str "This",Space,Str "&",Space,Str "that."]
-,Para [Str "4",Space,Str "<",Space,Str "5."]
-,Para [Str "6",Space,Str ">",Space,Str "5."]
-,Para [Str "Backslash:",Space,Str "\\"]
-,Para [Str "Backtick:",Space,Str "`"]
-,Para [Str "Asterisk:",Space,Str "*"]
-,Para [Str "Underscore:",Space,Str "_"]
-,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
-,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
-,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
-,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
-,Para [Str "Left",Space,Str "paren:",Space,Str "("]
-,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
-,Para [Str "Greater-than:",Space,Str ">"]
-,Para [Str "Hash:",Space,Str "#"]
-,Para [Str "Period:",Space,Str "."]
-,Para [Str "Bang:",Space,Str "!"]
-,Para [Str "Plus:",Space,Str "+"]
-,Para [Str "Minus:",Space,Str "-"]
-,HorizontalRule
-,Header 1 ("links",[],[]) [Str "Links"]
-,Header 2 ("explicit",[],[]) [Str "Explicit"]
-,Para [Str "Just",Space,Str "a",Space,Link ("",[],[]) [Str "URL"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by two spaces"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by a tab"),Str "."]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with \"quotes\" in it")]
-,Para [Link ("",[],[]) [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with single quotes")]
-,Para [Link ("",[],[]) [Str "with_underscore"] ("/url/with_underscore","")]
-,Para [Link ("",[],[]) [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
-,Para [Link ("",[],[]) [Str "Empty"] ("",""),Str "."]
-,Header 2 ("reference",[],[]) [Str "Reference"]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/",""),Str "."]
-,Para [Str "With",Space,Link ("",[],[]) [Str "embedded",Space,Str "[brackets]"] ("/url/",""),Str "."]
-,Para [Link ("",[],[]) [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "once"] ("/url",""),Str "."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "twice"] ("/url",""),Str "."]
-,Para [Str "Indented",Space,Link ("",[],[]) [Str "thrice"] ("/url",""),Str "."]
-,Para [Str "This",Space,Str "should",Space,Str "[not][]",Space,Str "be",Space,Str "a",Space,Str "link."]
-,CodeBlock ("",[],[]) "[not]: /url"
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."]
-,Para [Str "Foo",Space,Link ("",[],[]) [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."]
-,Header 2 ("with-ampersands",[],[]) [Str "With",Space,Str "ampersands"]
-,Para [Str "Here\8217s",Space,Str "a",Space,Link ("",[],[]) [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link ("",[],[]) [Str "AT&T"] ("http://att.com/","AT&T"),Str "."]
-,Para [Str "Here\8217s",Space,Str "an",Space,Link ("",[],[]) [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
-,Para [Str "Here\8217s",Space,Str "an",Space,Link ("",[],[]) [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."]
-,Header 2 ("autolinks",[],[]) [Str "Autolinks"]
-,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link ("",["uri"],[]) [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
-,BulletList
- [[Plain [Str "In",Space,Str "a",Space,Str "list?"]]
- ,[Plain [Link ("",["uri"],[]) [Str "http://example.com/"] ("http://example.com/","")]]
- ,[Plain [Str "It",Space,Str "should."]]]
-,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Link ("",["email"],[]) [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
-,BlockQuote
- [Para [Str "Blockquoted:",Space,Link ("",["uri"],[]) [Str "http://example.com/"] ("http://example.com/","")]]
-,Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code ("",[],[]) "<http://example.com/>"]
-,CodeBlock ("",[],[]) "or here: <http://example.com/>"
-,HorizontalRule
-,Header 1 ("images",[],[]) [Str "Images"]
-,Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
-,Para [Image ("",[],[]) [Str "lalune"] ("lalune.jpg","fig:Voyage dans la Lune")]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image ("",[],[]) [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
-,HorizontalRule
-,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
-,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",SoftBreak,Str "reference.",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],Space,Str "and",Space,Str "another.",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",SoftBreak,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",SoftBreak,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock ("",[],[]) "  { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",SoftBreak,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],SoftBreak,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",SoftBreak,Str "contains",Space,Str "a",Space,Str "space.[^my",Space,Str "note]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note.",Note [Para [Str "This",SoftBreak,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",SoftBreak,Link ("",[],[]) [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",SoftBreak,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
-,BlockQuote
- [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]]]
-,OrderedList (1,Decimal,Period)
- [[Plain [Str "And",Space,Str "in",Space,Str "list",Space,Str "items.",Note [Para [Str "In",Space,Str "list."]]]]]
-,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented."]]
+Pandoc
+  Meta
+    { unMeta =
+        fromList
+          [ ( "author"
+            , MetaList
+                [ MetaInlines [ Str "John" , Space , Str "MacFarlane" ]
+                , MetaInlines [ Str "Anonymous" ]
+                ]
+            )
+          , ( "date"
+            , MetaInlines
+                [ Str "July" , Space , Str "17," , Space , Str "2006" ]
+            )
+          , ( "title"
+            , MetaInlines
+                [ Str "Pandoc" , Space , Str "Test" , Space , Str "Suite" ]
+            )
+          ]
+    }
+  [ Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "set"
+      , Space
+      , Str "of"
+      , Space
+      , Str "tests"
+      , Space
+      , Str "for"
+      , Space
+      , Str "pandoc."
+      , Space
+      , Str "Most"
+      , Space
+      , Str "of"
+      , Space
+      , Str "them"
+      , Space
+      , Str "are"
+      , Space
+      , Str "adapted"
+      , Space
+      , Str "from"
+      , SoftBreak
+      , Str "John"
+      , Space
+      , Str "Gruber\8217s"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "test"
+      , Space
+      , Str "suite."
+      ]
+  , HorizontalRule
+  , Header 1 ( "headers" , [] , [] ) [ Str "Headers" ]
+  , Header
+      2
+      ( "level-2-with-an-embedded-link" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "link" ]
+          ( "/url" , "" )
+      ]
+  , Header
+      3
+      ( "level-3-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "3"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      4 ( "level-4" , [] , [] ) [ Str "Level" , Space , Str "4" ]
+  , Header
+      5 ( "level-5" , [] , [] ) [ Str "Level" , Space , Str "5" ]
+  , Header
+      1 ( "level-1" , [] , [] ) [ Str "Level" , Space , Str "1" ]
+  , Header
+      2
+      ( "level-2-with-emphasis" , [] , [] )
+      [ Str "Level"
+      , Space
+      , Str "2"
+      , Space
+      , Str "with"
+      , Space
+      , Emph [ Str "emphasis" ]
+      ]
+  , Header
+      3 ( "level-3" , [] , [] ) [ Str "Level" , Space , Str "3" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , Header
+      2 ( "level-2" , [] , [] ) [ Str "Level" , Space , Str "2" ]
+  , Para
+      [ Str "with"
+      , Space
+      , Str "no"
+      , Space
+      , Str "blank"
+      , Space
+      , Str "line"
+      ]
+  , HorizontalRule
+  , Header 1 ( "paragraphs" , [] , [] ) [ Str "Paragraphs" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "regular"
+      , Space
+      , Str "paragraph."
+      ]
+  , Para
+      [ Str "In"
+      , Space
+      , Str "Markdown"
+      , Space
+      , Str "1.0.0"
+      , Space
+      , Str "and"
+      , Space
+      , Str "earlier."
+      , Space
+      , Str "Version"
+      , SoftBreak
+      , Str "8."
+      , Space
+      , Str "This"
+      , Space
+      , Str "line"
+      , Space
+      , Str "turns"
+      , Space
+      , Str "into"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item."
+      , SoftBreak
+      , Str "Because"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard-wrapped"
+      , Space
+      , Str "line"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "middle"
+      , Space
+      , Str "of"
+      , Space
+      , Str "a"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "looked"
+      , Space
+      , Str "like"
+      , Space
+      , Str "a"
+      , SoftBreak
+      , Str "list"
+      , Space
+      , Str "item."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "one"
+      , Space
+      , Str "with"
+      , Space
+      , Str "a"
+      , Space
+      , Str "bullet."
+      , SoftBreak
+      , Str "*"
+      , Space
+      , Str "criminey."
+      ]
+  , Para
+      [ Str "There"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "hard"
+      , Space
+      , Str "line"
+      , Space
+      , Str "break"
+      , LineBreak
+      , Str "here."
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "block-quotes" , [] , [] )
+      [ Str "Block" , Space , Str "Quotes" ]
+  , Para [ Str "E-mail" , Space , Str "style:" ]
+  , BlockQuote
+      [ Para
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote."
+          , SoftBreak
+          , Str "It"
+          , Space
+          , Str "is"
+          , Space
+          , Str "pretty"
+          , Space
+          , Str "short."
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Code"
+          , Space
+          , Str "in"
+          , Space
+          , Str "a"
+          , Space
+          , Str "block"
+          , Space
+          , Str "quote:"
+          ]
+      , CodeBlock
+          ( "" , [] , [] ) "sub status {\n    print \"working\";\n}"
+      , Para [ Str "A" , Space , Str "list:" ]
+      , OrderedList
+          ( 1 , Decimal , Period )
+          [ [ Plain [ Str "item" , Space , Str "one" ] ]
+          , [ Plain [ Str "item" , Space , Str "two" ] ]
+          ]
+      , Para
+          [ Str "Nested" , Space , Str "block" , Space , Str "quotes:" ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      , BlockQuote [ Para [ Str "nested" ] ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "block"
+      , Space
+      , Str "quote:"
+      , Space
+      , Str "2"
+      , SoftBreak
+      , Str ">"
+      , Space
+      , Str "1."
+      ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "a"
+      , Space
+      , Str "following"
+      , Space
+      , Str "paragraph."
+      ]
+  , HorizontalRule
+  , Header
+      1 ( "code-blocks" , [] , [] ) [ Str "Code" , Space , Str "Blocks" ]
+  , Para [ Str "Code:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "---- (should be four hyphens)\n\nsub status {\n    print \"working\";\n}\n\nthis code block is indented by one tab"
+  , Para [ Str "And:" ]
+  , CodeBlock
+      ( "" , [] , [] )
+      "    this code block is indented by two tabs\n\nThese should not be escaped:  \\$ \\\\ \\> \\[ \\{"
+  , HorizontalRule
+  , Header 1 ( "lists" , [] , [] ) [ Str "Lists" ]
+  , Header 2 ( "unordered" , [] , [] ) [ Str "Unordered" ]
+  , Para [ Str "Asterisks" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Plain [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Asterisks" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "asterisk" , Space , Str "1" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "2" ] ]
+      , [ Para [ Str "asterisk" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "Plus" , Space , Str "1" ] ]
+      , [ Plain [ Str "Plus" , Space , Str "2" ] ]
+      , [ Plain [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Pluses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Plus" , Space , Str "1" ] ]
+      , [ Para [ Str "Plus" , Space , Str "2" ] ]
+      , [ Para [ Str "Plus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "tight:" ]
+  , BulletList
+      [ [ Plain [ Str "Minus" , Space , Str "1" ] ]
+      , [ Plain [ Str "Minus" , Space , Str "2" ] ]
+      , [ Plain [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Para [ Str "Minuses" , Space , Str "loose:" ]
+  , BulletList
+      [ [ Para [ Str "Minus" , Space , Str "1" ] ]
+      , [ Para [ Str "Minus" , Space , Str "2" ] ]
+      , [ Para [ Str "Minus" , Space , Str "3" ] ]
+      ]
+  , Header 2 ( "ordered" , [] , [] ) [ Str "Ordered" ]
+  , Para [ Str "Tight:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "First" ] ]
+      , [ Plain [ Str "Second" ] ]
+      , [ Plain [ Str "Third" ] ]
+      ]
+  , Para [ Str "and:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "One" ] ]
+      , [ Plain [ Str "Two" ] ]
+      , [ Plain [ Str "Three" ] ]
+      ]
+  , Para [ Str "Loose" , Space , Str "using" , Space , Str "tabs:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second" ] ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Para [ Str "and" , Space , Str "using" , Space , Str "spaces:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "One" ] ]
+      , [ Para [ Str "Two" ] ]
+      , [ Para [ Str "Three" ] ]
+      ]
+  , Para [ Str "Multiple" , Space , Str "paragraphs:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para
+            [ Str "Item"
+            , Space
+            , Str "1,"
+            , Space
+            , Str "graf"
+            , Space
+            , Str "one."
+            ]
+        , Para
+            [ Str "Item"
+            , Space
+            , Str "1."
+            , Space
+            , Str "graf"
+            , Space
+            , Str "two."
+            , Space
+            , Str "The"
+            , Space
+            , Str "quick"
+            , Space
+            , Str "brown"
+            , Space
+            , Str "fox"
+            , Space
+            , Str "jumped"
+            , Space
+            , Str "over"
+            , Space
+            , Str "the"
+            , Space
+            , Str "lazy"
+            , Space
+            , Str "dog\8217s"
+            , SoftBreak
+            , Str "back."
+            ]
+        ]
+      , [ Para [ Str "Item" , Space , Str "2." ] ]
+      , [ Para [ Str "Item" , Space , Str "3." ] ]
+      ]
+  , Header 2 ( "nested" , [] , [] ) [ Str "Nested" ]
+  , BulletList
+      [ [ Plain [ Str "Tab" ]
+        , BulletList
+            [ [ Plain [ Str "Tab" ] , BulletList [ [ Plain [ Str "Tab" ] ] ] ]
+            ]
+        ]
+      ]
+  , Para [ Str "Here\8217s" , Space , Str "another:" ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain [ Str "First" ] ]
+      , [ Plain [ Str "Second:" ]
+        , BulletList
+            [ [ Plain [ Str "Fee" ] ]
+            , [ Plain [ Str "Fie" ] ]
+            , [ Plain [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Plain [ Str "Third" ] ]
+      ]
+  , Para
+      [ Str "Same"
+      , Space
+      , Str "thing"
+      , Space
+      , Str "but"
+      , Space
+      , Str "with"
+      , Space
+      , Str "paragraphs:"
+      ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Para [ Str "First" ] ]
+      , [ Para [ Str "Second:" ]
+        , BulletList
+            [ [ Plain [ Str "Fee" ] ]
+            , [ Plain [ Str "Fie" ] ]
+            , [ Plain [ Str "Foe" ] ]
+            ]
+        ]
+      , [ Para [ Str "Third" ] ]
+      ]
+  , Header
+      2
+      ( "tabs-and-spaces" , [] , [] )
+      [ Str "Tabs" , Space , Str "and" , Space , Str "spaces" ]
+  , BulletList
+      [ [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , SoftBreak
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "tabs"
+            ]
+        ]
+      , [ Para
+            [ Str "this"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Str "list"
+            , Space
+            , Str "item"
+            , SoftBreak
+            , Str "indented"
+            , Space
+            , Str "with"
+            , Space
+            , Str "spaces"
+            ]
+        , BulletList
+            [ [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , SoftBreak
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "tabs"
+                  ]
+              ]
+            , [ Para
+                  [ Str "this"
+                  , Space
+                  , Str "is"
+                  , Space
+                  , Str "an"
+                  , Space
+                  , Str "example"
+                  , Space
+                  , Str "list"
+                  , Space
+                  , Str "item"
+                  , SoftBreak
+                  , Str "indented"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "spaces"
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Header
+      2
+      ( "fancy-list-markers" , [] , [] )
+      [ Str "Fancy" , Space , Str "list" , Space , Str "markers" ]
+  , OrderedList
+      ( 2 , Decimal , TwoParens )
+      [ [ Para [ Str "begins" , Space , Str "with" , Space , Str "2" ] ]
+      , [ Para [ Str "and" , Space , Str "now" , Space , Str "3" ]
+        , Para
+            [ Str "with" , Space , Str "a" , Space , Str "continuation" ]
+        , OrderedList
+            ( 4 , LowerRoman , Period )
+            [ [ Plain
+                  [ Str "sublist"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "roman"
+                  , Space
+                  , Str "numerals,"
+                  , SoftBreak
+                  , Str "starting"
+                  , Space
+                  , Str "with"
+                  , Space
+                  , Str "4"
+                  ]
+              ]
+            , [ Plain [ Str "more" , Space , Str "items" ]
+              , OrderedList
+                  ( 1 , UpperAlpha , TwoParens )
+                  [ [ Plain [ Str "a" , Space , Str "subsublist" ] ]
+                  , [ Plain [ Str "a" , Space , Str "subsublist" ] ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Nesting:" ]
+  , OrderedList
+      ( 1 , UpperAlpha , Period )
+      [ [ Plain [ Str "Upper" , Space , Str "Alpha" ]
+        , OrderedList
+            ( 1 , UpperRoman , Period )
+            [ [ Plain [ Str "Upper" , Space , Str "Roman." ]
+              , OrderedList
+                  ( 6 , Decimal , TwoParens )
+                  [ [ Plain
+                        [ Str "Decimal"
+                        , Space
+                        , Str "start"
+                        , Space
+                        , Str "with"
+                        , Space
+                        , Str "6"
+                        ]
+                    , OrderedList
+                        ( 3 , LowerAlpha , OneParen )
+                        [ [ Plain
+                              [ Str "Lower"
+                              , Space
+                              , Str "alpha"
+                              , Space
+                              , Str "with"
+                              , Space
+                              , Str "paren"
+                              ]
+                          ]
+                        ]
+                    ]
+                  ]
+              ]
+            ]
+        ]
+      ]
+  , Para [ Str "Autonumbering:" ]
+  , OrderedList
+      ( 1 , DefaultStyle , DefaultDelim )
+      [ [ Plain [ Str "Autonumber." ] ]
+      , [ Plain [ Str "More." ]
+        , OrderedList
+            ( 1 , DefaultStyle , DefaultDelim ) [ [ Plain [ Str "Nested." ] ] ]
+        ]
+      ]
+  , Para
+      [ Str "Should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "list"
+      , Space
+      , Str "item:"
+      ]
+  , Para [ Str "M.A.\160\&2007" ]
+  , Para [ Str "B." , Space , Str "Williams" ]
+  , HorizontalRule
+  , Header
+      1
+      ( "definition-lists" , [] , [] )
+      [ Str "Definition" , Space , Str "Lists" ]
+  , Para
+      [ Str "Tight" , Space , Str "using" , Space , Str "spaces:" ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Plain [ Str "red" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Plain [ Str "orange" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "banana" ]
+        , [ [ Plain [ Str "yellow" , Space , Str "fruit" ] ] ]
+        )
+      ]
+  , Para [ Str "Tight" , Space , Str "using" , Space , Str "tabs:" ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Plain [ Str "red" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Plain [ Str "orange" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "banana" ]
+        , [ [ Plain [ Str "yellow" , Space , Str "fruit" ] ] ]
+        )
+      ]
+  , Para [ Str "Loose:" ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ] ] ]
+        )
+      , ( [ Str "banana" ]
+        , [ [ Para [ Str "yellow" , Space , Str "fruit" ] ] ]
+        )
+      ]
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "blocks"
+      , Space
+      , Str "with"
+      , Space
+      , Str "italics:"
+      ]
+  , DefinitionList
+      [ ( [ Emph [ Str "apple" ] ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ]
+            , Para
+                [ Str "contains"
+                , Space
+                , Str "seeds,"
+                , SoftBreak
+                , Str "crisp,"
+                , Space
+                , Str "pleasant"
+                , Space
+                , Str "to"
+                , Space
+                , Str "taste"
+                ]
+            ]
+          ]
+        )
+      , ( [ Emph [ Str "orange" ] ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ]
+            , CodeBlock ( "" , [] , [] ) "{ orange code block }"
+            , BlockQuote
+                [ Para
+                    [ Str "orange" , Space , Str "block" , Space , Str "quote" ]
+                ]
+            ]
+          ]
+        )
+      ]
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "definitions,"
+      , Space
+      , Str "tight:"
+      ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Plain [ Str "red" , Space , Str "fruit" ] ]
+          , [ Plain [ Str "computer" ] ]
+          ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Plain [ Str "orange" , Space , Str "fruit" ] ]
+          , [ Plain [ Str "bank" ] ]
+          ]
+        )
+      ]
+  , Para
+      [ Str "Multiple"
+      , Space
+      , Str "definitions,"
+      , Space
+      , Str "loose:"
+      ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ]
+          , [ Para [ Str "computer" ] ]
+          ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ] ]
+          , [ Para [ Str "bank" ] ]
+          ]
+        )
+      ]
+  , Para
+      [ Str "Blank"
+      , Space
+      , Str "line"
+      , Space
+      , Str "after"
+      , Space
+      , Str "term,"
+      , Space
+      , Str "indented"
+      , Space
+      , Str "marker,"
+      , Space
+      , Str "alternate"
+      , Space
+      , Str "markers:"
+      ]
+  , DefinitionList
+      [ ( [ Str "apple" ]
+        , [ [ Para [ Str "red" , Space , Str "fruit" ] ]
+          , [ Para [ Str "computer" ] ]
+          ]
+        )
+      , ( [ Str "orange" ]
+        , [ [ Para [ Str "orange" , Space , Str "fruit" ]
+            , OrderedList
+                ( 1 , Decimal , Period )
+                [ [ Plain [ Str "sublist" ] ] , [ Plain [ Str "sublist" ] ] ]
+            ]
+          ]
+        )
+      ]
+  , Header
+      1 ( "html-blocks" , [] , [] ) [ Str "HTML" , Space , Str "Blocks" ]
+  , Para
+      [ Str "Simple"
+      , Space
+      , Str "block"
+      , Space
+      , Str "on"
+      , Space
+      , Str "one"
+      , Space
+      , Str "line:"
+      ]
+  , Div ( "" , [] , [] ) [ Plain [ Str "foo" ] ]
+  , Para
+      [ Str "And"
+      , Space
+      , Str "nested"
+      , Space
+      , Str "without"
+      , Space
+      , Str "indentation:"
+      ]
+  , Div
+      ( "" , [] , [] )
+      [ Div
+          ( "" , [] , [] ) [ Div ( "" , [] , [] ) [ Para [ Str "foo" ] ] ]
+      , Div ( "" , [] , [] ) [ Plain [ Str "bar" ] ]
+      ]
+  , Para
+      [ Str "Interpreted"
+      , Space
+      , Str "markdown"
+      , Space
+      , Str "in"
+      , Space
+      , Str "a"
+      , Space
+      , Str "table:"
+      ]
+  , RawBlock (Format "html") "<table>"
+  , RawBlock (Format "html") "<tr>"
+  , RawBlock (Format "html") "<td>"
+  , Plain
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      ]
+  , RawBlock (Format "html") "</td>"
+  , RawBlock (Format "html") "<td>"
+  , Plain
+      [ Str "And"
+      , Space
+      , Str "this"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      ]
+  , RawBlock (Format "html") "</td>"
+  , RawBlock (Format "html") "</tr>"
+  , RawBlock (Format "html") "</table>"
+  , RawBlock
+      (Format "html")
+      "<script type=\"text/javascript\">document.write('This *should not* be interpreted as markdown');</script>"
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "simple"
+      , Space
+      , Str "block:"
+      ]
+  , Div ( "" , [] , [] ) [ Para [ Str "foo" ] ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "code"
+      , Space
+      , Str "block,"
+      , Space
+      , Str "though:"
+      ]
+  , CodeBlock ( "" , [] , [] ) "<div>\n    foo\n</div>"
+  , Para [ Str "As" , Space , Str "should" , Space , Str "this:" ]
+  , CodeBlock ( "" , [] , [] ) "<div>foo</div>"
+  , Para [ Str "Now," , Space , Str "nested:" ]
+  , Div
+      ( "" , [] , [] )
+      [ Div
+          ( "" , [] , [] ) [ Div ( "" , [] , [] ) [ Plain [ Str "foo" ] ] ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "just"
+      , Space
+      , Str "be"
+      , Space
+      , Str "an"
+      , Space
+      , Str "HTML"
+      , Space
+      , Str "comment:"
+      ]
+  , RawBlock (Format "html") "<!-- Comment -->"
+  , Para [ Str "Multiline:" ]
+  , RawBlock (Format "html") "<!--\nBlah\nBlah\n-->"
+  , RawBlock
+      (Format "html") "<!--\n    This is another comment.\n-->"
+  , Para [ Str "Code" , Space , Str "block:" ]
+  , CodeBlock ( "" , [] , [] ) "<!-- Comment -->"
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "plain"
+      , Space
+      , Str "comment,"
+      , Space
+      , Str "with"
+      , Space
+      , Str "trailing"
+      , Space
+      , Str "spaces"
+      , Space
+      , Str "on"
+      , Space
+      , Str "the"
+      , Space
+      , Str "line:"
+      ]
+  , RawBlock (Format "html") "<!-- foo -->"
+  , Para [ Str "Code:" ]
+  , CodeBlock ( "" , [] , [] ) "<hr />"
+  , Para [ Str "Hr\8217s:" ]
+  , RawBlock (Format "html") "<hr>"
+  , RawBlock (Format "html") "<hr />"
+  , RawBlock (Format "html") "<hr />"
+  , RawBlock (Format "html") "<hr>"
+  , RawBlock (Format "html") "<hr />"
+  , RawBlock (Format "html") "<hr />"
+  , RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\" />"
+  , RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\" />"
+  , RawBlock (Format "html") "<hr class=\"foo\" id=\"bar\">"
+  , HorizontalRule
+  , Header
+      1
+      ( "inline-markup" , [] , [] )
+      [ Str "Inline" , Space , Str "Markup" ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Emph [ Str "emphasized" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Emph [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Str "strong" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Str "so"
+      , Space
+      , Strong [ Str "is" , Space , Str "this" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Emph
+          [ Link
+              ( "" , [] , [] )
+              [ Str "emphasized" , Space , Str "link" ]
+              ( "/url" , "" )
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Strong
+          [ Emph
+              [ Str "This"
+              , Space
+              , Str "is"
+              , Space
+              , Str "strong"
+              , Space
+              , Str "and"
+              , Space
+              , Str "em."
+              ]
+          ]
+      ]
+  , Para
+      [ Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Strong [ Emph [ Str "this" ] ]
+      , Space
+      , Str "word."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "is"
+      , Space
+      , Str "code:"
+      , Space
+      , Code ( "" , [] , [] ) ">"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "\\$"
+      , Str ","
+      , Space
+      , Code ( "" , [] , [] ) "<html>"
+      , Str "."
+      ]
+  , Para
+      [ Strikeout
+          [ Str "This"
+          , Space
+          , Str "is"
+          , Space
+          , Emph [ Str "strikeout" ]
+          , Str "."
+          ]
+      ]
+  , Para
+      [ Str "Superscripts:"
+      , Space
+      , Str "a"
+      , Superscript [ Str "bc" ]
+      , Str "d"
+      , Space
+      , Str "a"
+      , Superscript [ Emph [ Str "hello" ] ]
+      , Space
+      , Str "a"
+      , Superscript [ Str "hello\160there" ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Subscripts:"
+      , Space
+      , Str "H"
+      , Subscript [ Str "2" ]
+      , Str "O,"
+      , Space
+      , Str "H"
+      , Subscript [ Str "23" ]
+      , Str "O,"
+      , Space
+      , Str "H"
+      , Subscript [ Str "many\160of\160them" ]
+      , Str "O."
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "superscripts"
+      , Space
+      , Str "or"
+      , Space
+      , Str "subscripts,"
+      , SoftBreak
+      , Str "because"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "unescaped"
+      , Space
+      , Str "spaces:"
+      , Space
+      , Str "a^b"
+      , Space
+      , Str "c^d,"
+      , Space
+      , Str "a~b"
+      , Space
+      , Str "c~d."
+      ]
+  , HorizontalRule
+  , Header
+      1
+      ( "smart-quotes-ellipses-dashes" , [] , [] )
+      [ Str "Smart"
+      , Space
+      , Str "quotes,"
+      , Space
+      , Str "ellipses,"
+      , Space
+      , Str "dashes"
+      ]
+  , Para
+      [ Quoted DoubleQuote [ Str "Hello," ]
+      , Space
+      , Str "said"
+      , Space
+      , Str "the"
+      , Space
+      , Str "spider."
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Quoted SingleQuote [ Str "Shelob" ]
+          , Space
+          , Str "is"
+          , Space
+          , Str "my"
+          , Space
+          , Str "name."
+          ]
+      ]
+  , Para
+      [ Quoted SingleQuote [ Str "A" ]
+      , Str ","
+      , Space
+      , Quoted SingleQuote [ Str "B" ]
+      , Str ","
+      , Space
+      , Str "and"
+      , Space
+      , Quoted SingleQuote [ Str "C" ]
+      , Space
+      , Str "are"
+      , Space
+      , Str "letters."
+      ]
+  , Para
+      [ Quoted SingleQuote [ Str "Oak," ]
+      , Space
+      , Quoted SingleQuote [ Str "elm," ]
+      , Space
+      , Str "and"
+      , Space
+      , Quoted SingleQuote [ Str "beech" ]
+      , Space
+      , Str "are"
+      , Space
+      , Str "names"
+      , Space
+      , Str "of"
+      , Space
+      , Str "trees."
+      , SoftBreak
+      , Str "So"
+      , Space
+      , Str "is"
+      , Space
+      , Quoted SingleQuote [ Str "pine." ]
+      ]
+  , Para
+      [ Quoted
+          SingleQuote
+          [ Str "He"
+          , Space
+          , Str "said,"
+          , Space
+          , Quoted
+              DoubleQuote
+              [ Str "I"
+              , Space
+              , Str "want"
+              , Space
+              , Str "to"
+              , Space
+              , Str "go."
+              ]
+          ]
+      , Space
+      , Str "Were"
+      , Space
+      , Str "you"
+      , Space
+      , Str "alive"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , SoftBreak
+      , Str "70\8217s?"
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "quoted"
+      , Space
+      , Quoted SingleQuote [ Code ( "" , [] , [] ) "code" ]
+      , Space
+      , Str "and"
+      , Space
+      , Str "a"
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Link
+              ( "" , [] , [] )
+              [ Str "quoted" , Space , Str "link" ]
+              ( "http://example.com/?foo=1&bar=2" , "" )
+          ]
+      , Str "."
+      ]
+  , Para
+      [ Str "Some"
+      , Space
+      , Str "dashes:"
+      , Space
+      , Str "one\8212two"
+      , Space
+      , Str "\8212"
+      , Space
+      , Str "three\8212four"
+      , Space
+      , Str "\8212"
+      , Space
+      , Str "five."
+      ]
+  , Para
+      [ Str "Dashes"
+      , Space
+      , Str "between"
+      , Space
+      , Str "numbers:"
+      , Space
+      , Str "5\8211\&7,"
+      , Space
+      , Str "255\8211\&66,"
+      , Space
+      , Str "1987\8211\&1999."
+      ]
+  , Para [ Str "Ellipses\8230and\8230and\8230." ]
+  , HorizontalRule
+  , Header 1 ( "latex" , [] , [] ) [ Str "LaTeX" ]
+  , BulletList
+      [ [ Plain [ RawInline (Format "tex") "\\cite[22-23]{smith.1899}" ]
+        ]
+      , [ Plain [ Math InlineMath "2+2=4" ] ]
+      , [ Plain [ Math InlineMath "x \\in y" ] ]
+      , [ Plain [ Math InlineMath "\\alpha \\wedge \\omega" ] ]
+      , [ Plain [ Math InlineMath "223" ] ]
+      , [ Plain [ Math InlineMath "p" , Str "-Tree" ] ]
+      , [ Plain
+            [ Str "Here\8217s"
+            , Space
+            , Str "some"
+            , Space
+            , Str "display"
+            , Space
+            , Str "math:"
+            , SoftBreak
+            , Math
+                DisplayMath
+                "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"
+            ]
+        ]
+      , [ Plain
+            [ Str "Here\8217s"
+            , Space
+            , Str "one"
+            , Space
+            , Str "that"
+            , Space
+            , Str "has"
+            , Space
+            , Str "a"
+            , Space
+            , Str "line"
+            , Space
+            , Str "break"
+            , Space
+            , Str "in"
+            , Space
+            , Str "it:"
+            , Space
+            , Math InlineMath "\\alpha + \\omega \\times x^2"
+            , Str "."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "These"
+      , Space
+      , Str "shouldn\8217t"
+      , Space
+      , Str "be"
+      , Space
+      , Str "math:"
+      ]
+  , BulletList
+      [ [ Plain
+            [ Str "To"
+            , Space
+            , Str "get"
+            , Space
+            , Str "the"
+            , Space
+            , Str "famous"
+            , Space
+            , Str "equation,"
+            , Space
+            , Str "write"
+            , Space
+            , Code ( "" , [] , [] ) "$e = mc^2$"
+            , Str "."
+            ]
+        ]
+      , [ Plain
+            [ Str "$22,000"
+            , Space
+            , Str "is"
+            , Space
+            , Str "a"
+            , Space
+            , Emph [ Str "lot" ]
+            , Space
+            , Str "of"
+            , Space
+            , Str "money."
+            , Space
+            , Str "So"
+            , Space
+            , Str "is"
+            , Space
+            , Str "$34,000."
+            , SoftBreak
+            , Str "(It"
+            , Space
+            , Str "worked"
+            , Space
+            , Str "if"
+            , Space
+            , Quoted DoubleQuote [ Str "lot" ]
+            , Space
+            , Str "is"
+            , Space
+            , Str "emphasized.)"
+            ]
+        ]
+      , [ Plain
+            [ Str "Shoes"
+            , Space
+            , Str "($20)"
+            , Space
+            , Str "and"
+            , Space
+            , Str "socks"
+            , Space
+            , Str "($5)."
+            ]
+        ]
+      , [ Plain
+            [ Str "Escaped"
+            , Space
+            , Code ( "" , [] , [] ) "$"
+            , Str ":"
+            , Space
+            , Str "$73"
+            , Space
+            , Emph
+                [ Str "this"
+                , Space
+                , Str "should"
+                , Space
+                , Str "be"
+                , Space
+                , Str "emphasized"
+                ]
+            , Space
+            , Str "23$."
+            ]
+        ]
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "LaTeX"
+      , Space
+      , Str "table:"
+      ]
+  , RawBlock
+      (Format "tex")
+      "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog    & 2      \\\\\nCat    & 1      \\\\ \\hline\n\\end{tabular}"
+  , HorizontalRule
+  , Header
+      1
+      ( "special-characters" , [] , [] )
+      [ Str "Special" , Space , Str "Characters" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "some"
+      , Space
+      , Str "unicode:"
+      ]
+  , BulletList
+      [ [ Plain [ Str "I" , Space , Str "hat:" , Space , Str "\206" ] ]
+      , [ Plain [ Str "o" , Space , Str "umlaut:" , Space , Str "\246" ]
+        ]
+      , [ Plain [ Str "section:" , Space , Str "\167" ] ]
+      , [ Plain
+            [ Str "set" , Space , Str "membership:" , Space , Str "\8712" ]
+        ]
+      , [ Plain [ Str "copyright:" , Space , Str "\169" ] ]
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "has"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "their"
+      , Space
+      , Str "name."
+      ]
+  , Para
+      [ Str "AT&T"
+      , Space
+      , Str "is"
+      , Space
+      , Str "another"
+      , Space
+      , Str "way"
+      , Space
+      , Str "to"
+      , Space
+      , Str "write"
+      , Space
+      , Str "it."
+      ]
+  , Para [ Str "This" , Space , Str "&" , Space , Str "that." ]
+  , Para [ Str "4" , Space , Str "<" , Space , Str "5." ]
+  , Para [ Str "6" , Space , Str ">" , Space , Str "5." ]
+  , Para [ Str "Backslash:" , Space , Str "\\" ]
+  , Para [ Str "Backtick:" , Space , Str "`" ]
+  , Para [ Str "Asterisk:" , Space , Str "*" ]
+  , Para [ Str "Underscore:" , Space , Str "_" ]
+  , Para [ Str "Left" , Space , Str "brace:" , Space , Str "{" ]
+  , Para [ Str "Right" , Space , Str "brace:" , Space , Str "}" ]
+  , Para [ Str "Left" , Space , Str "bracket:" , Space , Str "[" ]
+  , Para [ Str "Right" , Space , Str "bracket:" , Space , Str "]" ]
+  , Para [ Str "Left" , Space , Str "paren:" , Space , Str "(" ]
+  , Para [ Str "Right" , Space , Str "paren:" , Space , Str ")" ]
+  , Para [ Str "Greater-than:" , Space , Str ">" ]
+  , Para [ Str "Hash:" , Space , Str "#" ]
+  , Para [ Str "Period:" , Space , Str "." ]
+  , Para [ Str "Bang:" , Space , Str "!" ]
+  , Para [ Str "Plus:" , Space , Str "+" ]
+  , Para [ Str "Minus:" , Space , Str "-" ]
+  , HorizontalRule
+  , Header 1 ( "links" , [] , [] ) [ Str "Links" ]
+  , Header 2 ( "explicit" , [] , [] ) [ Str "Explicit" ]
+  , Para
+      [ Str "Just"
+      , Space
+      , Str "a"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "URL" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title preceded by two spaces" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title preceded by a tab" )
+      , Str "."
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title with \"quotes\" in it" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "URL" , Space , Str "and" , Space , Str "title" ]
+          ( "/url/" , "title with single quotes" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "with_underscore" ]
+          ( "/url/with_underscore" , "" )
+      ]
+  , Para
+      [ Link
+          ( "" , [] , [] )
+          [ Str "Email" , Space , Str "link" ]
+          ( "mailto:nobody@nowhere.net" , "" )
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "Empty" ] ( "" , "" ) , Str "." ]
+  , Header 2 ( "reference" , [] , [] ) [ Str "Reference" ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "bar" ] ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "With"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "embedded" , Space , Str "[brackets]" ]
+          ( "/url/" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Link ( "" , [] , [] ) [ Str "b" ] ( "/url/" , "" )
+      , Space
+      , Str "by"
+      , Space
+      , Str "itself"
+      , Space
+      , Str "should"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "once" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "twice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Indented"
+      , Space
+      , Link ( "" , [] , [] ) [ Str "thrice" ] ( "/url" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Str "[not][]"
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link."
+      ]
+  , CodeBlock ( "" , [] , [] ) "[not]: /url"
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "bar" ]
+          ( "/url/" , "Title with \"quotes\" inside" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Foo"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "biz" ]
+          ( "/url/" , "Title with \"quote\" inside" )
+      , Str "."
+      ]
+  , Header
+      2
+      ( "with-ampersands" , [] , [] )
+      [ Str "With" , Space , Str "ampersands" ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "link"
+          , Space
+          , Str "with"
+          , Space
+          , Str "an"
+          , Space
+          , Str "ampersand"
+          , Space
+          , Str "in"
+          , Space
+          , Str "the"
+          , Space
+          , Str "URL"
+          ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "a"
+      , Space
+      , Str "link"
+      , Space
+      , Str "with"
+      , Space
+      , Str "an"
+      , Space
+      , Str "amersand"
+      , Space
+      , Str "in"
+      , Space
+      , Str "the"
+      , Space
+      , Str "link"
+      , Space
+      , Str "text:"
+      , Space
+      , Link
+          ( "" , [] , [] ) [ Str "AT&T" ] ( "http://att.com/" , "AT&T" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline" , Space , Str "link" ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Para
+      [ Str "Here\8217s"
+      , Space
+      , Str "an"
+      , Space
+      , Link
+          ( "" , [] , [] )
+          [ Str "inline"
+          , Space
+          , Str "link"
+          , Space
+          , Str "in"
+          , Space
+          , Str "pointy"
+          , Space
+          , Str "braces"
+          ]
+          ( "/script?foo=1&bar=2" , "" )
+      , Str "."
+      ]
+  , Header 2 ( "autolinks" , [] , [] ) [ Str "Autolinks" ]
+  , Para
+      [ Str "With"
+      , Space
+      , Str "an"
+      , Space
+      , Str "ampersand:"
+      , Space
+      , Link
+          ( "" , [ "uri" ] , [] )
+          [ Str "http://example.com/?foo=1&bar=2" ]
+          ( "http://example.com/?foo=1&bar=2" , "" )
+      ]
+  , BulletList
+      [ [ Plain [ Str "In" , Space , Str "a" , Space , Str "list?" ] ]
+      , [ Plain
+            [ Link
+                ( "" , [ "uri" ] , [] )
+                [ Str "http://example.com/" ]
+                ( "http://example.com/" , "" )
+            ]
+        ]
+      , [ Plain [ Str "It" , Space , Str "should." ] ]
+      ]
+  , Para
+      [ Str "An"
+      , Space
+      , Str "e-mail"
+      , Space
+      , Str "address:"
+      , Space
+      , Link
+          ( "" , [ "email" ] , [] )
+          [ Str "nobody@nowhere.net" ]
+          ( "mailto:nobody@nowhere.net" , "" )
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Blockquoted:"
+          , Space
+          , Link
+              ( "" , [ "uri" ] , [] )
+              [ Str "http://example.com/" ]
+              ( "http://example.com/" , "" )
+          ]
+      ]
+  , Para
+      [ Str "Auto-links"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "occur"
+      , Space
+      , Str "here:"
+      , Space
+      , Code ( "" , [] , [] ) "<http://example.com/>"
+      ]
+  , CodeBlock ( "" , [] , [] ) "or here: <http://example.com/>"
+  , HorizontalRule
+  , Header 1 ( "images" , [] , [] ) [ Str "Images" ]
+  , Para
+      [ Str "From"
+      , Space
+      , Quoted
+          DoubleQuote
+          [ Str "Voyage"
+          , Space
+          , Str "dans"
+          , Space
+          , Str "la"
+          , Space
+          , Str "Lune"
+          ]
+      , Space
+      , Str "by"
+      , Space
+      , Str "Georges"
+      , Space
+      , Str "Melies"
+      , Space
+      , Str "(1902):"
+      ]
+  , Para
+      [ Image
+          ( "" , [] , [] )
+          [ Str "lalune" ]
+          ( "lalune.jpg" , "fig:Voyage dans la Lune" )
+      ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "movie"
+      , Space
+      , Image ( "" , [] , [] ) [ Str "movie" ] ( "movie.jpg" , "" )
+      , Space
+      , Str "icon."
+      ]
+  , HorizontalRule
+  , Header 1 ( "footnotes" , [] , [] ) [ Str "Footnotes" ]
+  , Para
+      [ Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference,"
+      , Note
+          [ Para
+              [ Str "Here"
+              , Space
+              , Str "is"
+              , Space
+              , Str "the"
+              , Space
+              , Str "footnote."
+              , Space
+              , Str "It"
+              , Space
+              , Str "can"
+              , Space
+              , Str "go"
+              , Space
+              , Str "anywhere"
+              , Space
+              , Str "after"
+              , Space
+              , Str "the"
+              , Space
+              , Str "footnote"
+              , SoftBreak
+              , Str "reference."
+              , Space
+              , Str "It"
+              , Space
+              , Str "need"
+              , Space
+              , Str "not"
+              , Space
+              , Str "be"
+              , Space
+              , Str "placed"
+              , Space
+              , Str "at"
+              , Space
+              , Str "the"
+              , Space
+              , Str "end"
+              , Space
+              , Str "of"
+              , Space
+              , Str "the"
+              , Space
+              , Str "document."
+              ]
+          ]
+      , Space
+      , Str "and"
+      , Space
+      , Str "another."
+      , Note
+          [ Para
+              [ Str "Here\8217s"
+              , Space
+              , Str "the"
+              , Space
+              , Str "long"
+              , Space
+              , Str "note."
+              , Space
+              , Str "This"
+              , Space
+              , Str "one"
+              , Space
+              , Str "contains"
+              , Space
+              , Str "multiple"
+              , SoftBreak
+              , Str "blocks."
+              ]
+          , Para
+              [ Str "Subsequent"
+              , Space
+              , Str "blocks"
+              , Space
+              , Str "are"
+              , Space
+              , Str "indented"
+              , Space
+              , Str "to"
+              , Space
+              , Str "show"
+              , Space
+              , Str "that"
+              , Space
+              , Str "they"
+              , Space
+              , Str "belong"
+              , Space
+              , Str "to"
+              , Space
+              , Str "the"
+              , SoftBreak
+              , Str "footnote"
+              , Space
+              , Str "(as"
+              , Space
+              , Str "with"
+              , Space
+              , Str "list"
+              , Space
+              , Str "items)."
+              ]
+          , CodeBlock ( "" , [] , [] ) "  { <code> }"
+          , Para
+              [ Str "If"
+              , Space
+              , Str "you"
+              , Space
+              , Str "want,"
+              , Space
+              , Str "you"
+              , Space
+              , Str "can"
+              , Space
+              , Str "indent"
+              , Space
+              , Str "every"
+              , Space
+              , Str "line,"
+              , Space
+              , Str "but"
+              , Space
+              , Str "you"
+              , Space
+              , Str "can"
+              , Space
+              , Str "also"
+              , Space
+              , Str "be"
+              , SoftBreak
+              , Str "lazy"
+              , Space
+              , Str "and"
+              , Space
+              , Str "just"
+              , Space
+              , Str "indent"
+              , Space
+              , Str "the"
+              , Space
+              , Str "first"
+              , Space
+              , Str "line"
+              , Space
+              , Str "of"
+              , Space
+              , Str "each"
+              , Space
+              , Str "block."
+              ]
+          ]
+      , SoftBreak
+      , Str "This"
+      , Space
+      , Str "should"
+      , Space
+      , Emph [ Str "not" ]
+      , Space
+      , Str "be"
+      , Space
+      , Str "a"
+      , Space
+      , Str "footnote"
+      , Space
+      , Str "reference,"
+      , Space
+      , Str "because"
+      , Space
+      , Str "it"
+      , SoftBreak
+      , Str "contains"
+      , Space
+      , Str "a"
+      , Space
+      , Str "space.[^my"
+      , Space
+      , Str "note]"
+      , Space
+      , Str "Here"
+      , Space
+      , Str "is"
+      , Space
+      , Str "an"
+      , Space
+      , Str "inline"
+      , Space
+      , Str "note."
+      , Note
+          [ Para
+              [ Str "This"
+              , SoftBreak
+              , Str "is"
+              , Space
+              , Emph [ Str "easier" ]
+              , Space
+              , Str "to"
+              , Space
+              , Str "type."
+              , Space
+              , Str "Inline"
+              , Space
+              , Str "notes"
+              , Space
+              , Str "may"
+              , Space
+              , Str "contain"
+              , SoftBreak
+              , Link
+                  ( "" , [] , [] ) [ Str "links" ] ( "http://google.com" , "" )
+              , Space
+              , Str "and"
+              , Space
+              , Code ( "" , [] , [] ) "]"
+              , Space
+              , Str "verbatim"
+              , Space
+              , Str "characters,"
+              , SoftBreak
+              , Str "as"
+              , Space
+              , Str "well"
+              , Space
+              , Str "as"
+              , Space
+              , Str "[bracketed"
+              , Space
+              , Str "text]."
+              ]
+          ]
+      ]
+  , BlockQuote
+      [ Para
+          [ Str "Notes"
+          , Space
+          , Str "can"
+          , Space
+          , Str "go"
+          , Space
+          , Str "in"
+          , Space
+          , Str "quotes."
+          , Note [ Para [ Str "In" , Space , Str "quote." ] ]
+          ]
+      ]
+  , OrderedList
+      ( 1 , Decimal , Period )
+      [ [ Plain
+            [ Str "And"
+            , Space
+            , Str "in"
+            , Space
+            , Str "list"
+            , Space
+            , Str "items."
+            , Note [ Para [ Str "In" , Space , Str "list." ] ]
+            ]
+        ]
+      ]
+  , Para
+      [ Str "This"
+      , Space
+      , Str "paragraph"
+      , Space
+      , Str "should"
+      , Space
+      , Str "not"
+      , Space
+      , Str "be"
+      , Space
+      , Str "part"
+      , Space
+      , Str "of"
+      , Space
+      , Str "the"
+      , Space
+      , Str "note,"
+      , Space
+      , Str "as"
+      , Space
+      , Str "it"
+      , Space
+      , Str "is"
+      , Space
+      , Str "not"
+      , Space
+      , Str "indented."
+      ]
+  ]
diff --git a/test/writer.opendocument b/test/writer.opendocument
--- a/test/writer.opendocument
+++ b/test/writer.opendocument
@@ -1207,9 +1207,9 @@
 <text:h text:style-name="Heading_20_1" text:outline-level="1"><text:bookmark-start text:name="paragraphs" />Paragraphs<text:bookmark-end text:name="paragraphs" /></text:h>
 <text:p text:style-name="First_20_paragraph">Here’s a regular
 paragraph.</text:p>
-<text:p text:style-name="Text_20_body">In Markdown 1.0.0 and earlier. Version
-8. This line turns into a list item. Because a hard-wrapped line in the middle
-of a paragraph looked like a list item.</text:p>
+<text:p text:style-name="Text_20_body">In Markdown 1.0.0 and earlier. Version 8.
+This line turns into a list item. Because a hard-wrapped line in the middle of a
+paragraph looked like a list item.</text:p>
 <text:p text:style-name="Text_20_body">Here’s one with a bullet. *
 criminey.</text:p>
 <text:p text:style-name="Text_20_body">There should be a hard line
@@ -1218,8 +1218,7 @@
 <text:h text:style-name="Heading_20_1" text:outline-level="1"><text:bookmark-start text:name="block-quotes" />Block
 Quotes<text:bookmark-end text:name="block-quotes" /></text:h>
 <text:p text:style-name="First_20_paragraph">E-mail style:</text:p>
-<text:p text:style-name="P1">This is a block quote. It is pretty
-short.</text:p>
+<text:p text:style-name="P1">This is a block quote. It is pretty short.</text:p>
 <text:p text:style-name="P2">Code in a block quote:</text:p>
 <text:p text:style-name="P3">sub status {</text:p>
 <text:p text:style-name="P4"><text:s text:c="4" />print &quot;working&quot;;</text:p>
@@ -1236,8 +1235,8 @@
 <text:p text:style-name="P2">Nested block quotes:</text:p>
 <text:p text:style-name="P7">nested</text:p>
 <text:p text:style-name="P8">nested</text:p>
-<text:p text:style-name="First_20_paragraph">This should not be a block quote:
-2 &gt; 1.</text:p>
+<text:p text:style-name="First_20_paragraph">This should not be a block quote: 2
+&gt; 1.</text:p>
 <text:p text:style-name="Text_20_body">And a following paragraph.</text:p>
 <text:p text:style-name="Horizontal_20_Line" />
 <text:h text:style-name="Heading_20_1" text:outline-level="1"><text:bookmark-start text:name="code-blocks" />Code
@@ -1464,12 +1463,12 @@
     <text:p text:style-name="P37">this is a list item indented with
     spaces</text:p><text:list text:style-name="L21">
       <text:list-item>
-        <text:p text:style-name="P38">this is an example list item indented
-        with tabs</text:p>
+        <text:p text:style-name="P38">this is an example list item indented with
+        tabs</text:p>
       </text:list-item>
       <text:list-item>
-        <text:p text:style-name="P38">this is an example list item indented
-        with spaces</text:p>
+        <text:p text:style-name="P38">this is an example list item indented with
+        spaces</text:p>
       </text:list-item>
     </text:list>
   </text:list-item>
@@ -1485,8 +1484,8 @@
     <text:p text:style-name="P39">with a continuation</text:p>
     <text:list>
       <text:list-item>
-        <text:p text:style-name="P39">sublist with roman numerals, starting
-        with 4</text:p>
+        <text:p text:style-name="P39">sublist with roman numerals, starting with
+        4</text:p>
       </text:list-item>
       <text:list-item>
         <text:p text:style-name="P39">more items</text:p>
@@ -1537,8 +1536,7 @@
     </text:list>
   </text:list-item>
 </text:list>
-<text:p text:style-name="First_20_paragraph">Should not be a list
-item:</text:p>
+<text:p text:style-name="First_20_paragraph">Should not be a list item:</text:p>
 <text:p text:style-name="Text_20_body">M.A. 2007</text:p>
 <text:p text:style-name="Text_20_body">B. Williams</text:p>
 <text:p text:style-name="Horizontal_20_Line" />
@@ -1573,8 +1571,8 @@
 italics:</text:p>
 <text:p text:style-name="Definition_20_Term"><text:span text:style-name="T1">apple</text:span></text:p>
 <text:p text:style-name="Definition_20_Definition">red
-fruit</text:p><text:p text:style-name="Definition_20_Definition">contains
-seeds, crisp, pleasant to taste</text:p>
+fruit</text:p><text:p text:style-name="Definition_20_Definition">contains seeds,
+crisp, pleasant to taste</text:p>
 <text:p text:style-name="Definition_20_Term"><text:span text:style-name="T1">orange</text:span></text:p>
 <text:p text:style-name="Definition_20_Definition">orange
 fruit</text:p><text:p text:style-name="P42">{ orange code block }</text:p><text:p text:style-name="P43">orange
@@ -1613,15 +1611,12 @@
 </text:list>
 <text:h text:style-name="Heading_20_1" text:outline-level="1"><text:bookmark-start text:name="html-blocks" />HTML
 Blocks<text:bookmark-end text:name="html-blocks" /></text:h>
-<text:p text:style-name="First_20_paragraph">Simple block on one
-line:</text:p>
+<text:p text:style-name="First_20_paragraph">Simple block on one line:</text:p>
 <text:p text:style-name="Text_20_body">foo</text:p>
-<text:p text:style-name="Text_20_body">And nested without
-indentation:</text:p>
+<text:p text:style-name="Text_20_body">And nested without indentation:</text:p>
 <text:p text:style-name="Text_20_body">foo</text:p>
 <text:p text:style-name="Text_20_body">bar</text:p>
-<text:p text:style-name="Text_20_body">Interpreted markdown in a
-table:</text:p>
+<text:p text:style-name="Text_20_body">Interpreted markdown in a table:</text:p>
 <text:p text:style-name="Text_20_body">This is
 <text:span text:style-name="T1">emphasized</text:span></text:p>
 <text:p text:style-name="Text_20_body">And this is
@@ -1689,13 +1684,13 @@
 <text:h text:style-name="Heading_20_1" text:outline-level="1"><text:bookmark-start text:name="smart-quotes-ellipses-dashes" />Smart
 quotes, ellipses,
 dashes<text:bookmark-end text:name="smart-quotes-ellipses-dashes" /></text:h>
-<text:p text:style-name="First_20_paragraph">“Hello,” said the spider.
-“‘Shelob’ is my name.”</text:p>
+<text:p text:style-name="First_20_paragraph">“Hello,” said the spider. “‘Shelob’
+is my name.”</text:p>
 <text:p text:style-name="Text_20_body">‘A’, ‘B’, and ‘C’ are letters.</text:p>
 <text:p text:style-name="Text_20_body">‘Oak,’ ‘elm,’ and ‘beech’ are names of
 trees. So is ‘pine.’</text:p>
-<text:p text:style-name="Text_20_body">‘He said, “I want to go.”’ Were you
-alive in the 70’s?</text:p>
+<text:p text:style-name="Text_20_body">‘He said, “I want to go.”’ Were you alive
+in the 70’s?</text:p>
 <text:p text:style-name="Text_20_body">Here is some quoted
 ‘<text:span text:style-name="Source_Text">code</text:span>’ and a
 “<text:a xlink:type="simple" xlink:href="http://example.com/?foo=1&amp;bar=2" office:name=""><text:span text:style-name="Definition">quoted
@@ -1743,8 +1738,8 @@
   </text:list-item>
   <text:list-item>
     <text:p text:style-name="P52">$22,000 is a
-    <text:span text:style-name="T1">lot</text:span> of money. So is $34,000.
-    (It worked if “lot” is emphasized.)</text:p>
+    <text:span text:style-name="T1">lot</text:span> of money. So is $34,000. (It
+    worked if “lot” is emphasized.)</text:p>
   </text:list-item>
   <text:list-item>
     <text:p text:style-name="P52">Shoes ($20) and socks ($5).</text:p>
@@ -1778,8 +1773,8 @@
     <text:p text:style-name="P53">copyright: ©</text:p>
   </text:list-item>
 </text:list>
-<text:p text:style-name="First_20_paragraph">AT&amp;T has an ampersand in
-their name.</text:p>
+<text:p text:style-name="First_20_paragraph">AT&amp;T has an ampersand in their
+name.</text:p>
 <text:p text:style-name="Text_20_body">AT&amp;T is another way to write
 it.</text:p>
 <text:p text:style-name="Text_20_body">This &amp; that.</text:p>
@@ -1888,25 +1883,23 @@
 <text:h text:style-name="Heading_20_1" text:outline-level="1"><text:bookmark-start text:name="footnotes" />Footnotes<text:bookmark-end text:name="footnotes" /></text:h>
 <text:p text:style-name="First_20_paragraph">Here is a footnote
 reference,<text:note text:id="ftn0" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body><text:p text:style-name="Footnote">Here
-is the footnote. It can go anywhere after the footnote reference. It need not
-be placed at the end of the document.</text:p></text:note-body></text:note>
-and
+is the footnote. It can go anywhere after the footnote reference. It need not be
+placed at the end of the document.</text:p></text:note-body></text:note> and
 another.<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>2</text:note-citation><text:note-body><text:p text:style-name="Footnote">Here’s
 the long note. This one contains multiple
 blocks.</text:p><text:p text:style-name="Footnote">Subsequent blocks are
 indented to show that they belong to the footnote (as with list
 items).</text:p><text:p text:style-name="P58"><text:s text:c="2" />{ &lt;code&gt; }</text:p><text:p text:style-name="Footnote">If
 you want, you can indent every line, but you can also be lazy and just indent
-the first line of each block.</text:p></text:note-body></text:note> This
-should <text:span text:style-name="T1">not</text:span> be a footnote
-reference, because it contains a space.[^my note] Here is an inline
+the first line of each block.</text:p></text:note-body></text:note> This should
+<text:span text:style-name="T1">not</text:span> be a footnote reference, because
+it contains a space.[^my note] Here is an inline
 note.<text:note text:id="ftn2" text:note-class="footnote"><text:note-citation>3</text:note-citation><text:note-body><text:p text:style-name="Footnote">This
-is <text:span text:style-name="T1">easier</text:span> to type. Inline notes
-may contain
+is <text:span text:style-name="T1">easier</text:span> to type. Inline notes may
+contain
 <text:a xlink:type="simple" xlink:href="http://google.com" office:name=""><text:span text:style-name="Definition">links</text:span></text:a>
-and <text:span text:style-name="Source_Text">]</text:span> verbatim
-characters, as well as [bracketed
-text].</text:p></text:note-body></text:note></text:p>
+and <text:span text:style-name="Source_Text">]</text:span> verbatim characters,
+as well as [bracketed text].</text:p></text:note-body></text:note></text:p>
 <text:p text:style-name="P59">Notes can go in
 quotes.<text:note text:id="ftn3" text:note-class="footnote"><text:note-citation>4</text:note-citation><text:note-body><text:p text:style-name="Footnote">In
 quote.</text:p></text:note-body></text:note></text:p>
diff --git a/test/writer.org b/test/writer.org
--- a/test/writer.org
+++ b/test/writer.org
@@ -81,9 +81,9 @@
   Code in a block quote:
 
   #+begin_example
-    sub status {
-        print "working";
-    }
+  sub status {
+      print "working";
+  }
   #+end_example
 
   A list:
@@ -115,21 +115,21 @@
 Code:
 
 #+begin_example
-  ---- (should be four hyphens)
+---- (should be four hyphens)
 
-  sub status {
-      print "working";
-  }
+sub status {
+    print "working";
+}
 
-  this code block is indented by one tab
+this code block is indented by one tab
 #+end_example
 
 And:
 
 #+begin_example
-      this code block is indented by two tabs
+    this code block is indented by two tabs
 
-  These should not be escaped:  \$ \\ \> \[ \{
+These should not be escaped:  \$ \\ \> \[ \{
 #+end_example
 
 --------------
@@ -348,7 +348,7 @@
 - /orange/ :: orange fruit
 
   #+begin_example
-    { orange code block }
+  { orange code block }
   #+end_example
 
   #+begin_quote
@@ -446,15 +446,15 @@
 This should be a code block, though:
 
 #+begin_example
-  <div>
-      foo
-  </div>
+<div>
+    foo
+</div>
 #+end_example
 
 As should this:
 
 #+begin_example
-  <div>foo</div>
+<div>foo</div>
 #+end_example
 
 Now, nested:
@@ -485,7 +485,7 @@
 Code block:
 
 #+begin_example
-  <!-- Comment -->
+<!-- Comment -->
 #+end_example
 
 Just plain comment, with trailing spaces on the line:
@@ -497,7 +497,7 @@
 Code:
 
 #+begin_example
-  <hr />
+<hr />
 #+end_example
 
 Hr's:
@@ -566,8 +566,8 @@
 
 Subscripts: H_{2}O, H_{23}O, H_{many of them}O.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a^b c^d, a~b c~d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a^b c^d, a~b c~d.
 
 --------------
 
@@ -728,7 +728,7 @@
 This should [not][] be a link.
 
 #+begin_example
-  [not]: /url
+[not]: /url
 #+end_example
 
 Foo [[/url/][bar]].
@@ -739,8 +739,7 @@
    :PROPERTIES:
    :CUSTOM_ID: with-ampersands
    :END:
-Here's a [[http://example.com/?foo=1&bar=2][link with an ampersand in the
-URL]].
+Here's a [[http://example.com/?foo=1&bar=2][link with an ampersand in the URL]].
 
 Here's a link with an amersand in the link text: [[http://att.com/][AT&T]].
 
@@ -767,7 +766,7 @@
 Auto-links should not occur here: =<http://example.com/>=
 
 #+begin_example
-  or here: <http://example.com/>
+or here: <http://example.com/>
 #+end_example
 
 --------------
@@ -801,8 +800,8 @@
 
 This paragraph should not be part of the note, as it is not indented.
 
-[fn:1] Here is the footnote. It can go anywhere after the footnote reference.
-       It need not be placed at the end of the document.
+[fn:1] Here is the footnote. It can go anywhere after the footnote reference. It
+       need not be placed at the end of the document.
 
 [fn:2] Here's the long note. This one contains multiple blocks.
 
@@ -810,11 +809,11 @@
        (as with list items).
 
        #+begin_example
-           { <code> }
+         { <code> }
        #+end_example
 
-       If you want, you can indent every line, but you can also be lazy and
-       just indent the first line of each block.
+       If you want, you can indent every line, but you can also be lazy and just
+       indent the first line of each block.
 
 [fn:3] This is /easier/ to type. Inline notes may contain
        [[http://google.com][links]] and =]= verbatim characters, as well as
diff --git a/test/writer.plain b/test/writer.plain
--- a/test/writer.plain
+++ b/test/writer.plain
@@ -5,7 +5,7 @@
 This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
 markdown test suite.
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Headers
 
@@ -29,7 +29,7 @@
 
 with no blank line
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Paragraphs
 
@@ -44,7 +44,7 @@
 There should be a hard line break
 here.
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Block Quotes
 
@@ -73,7 +73,7 @@
 
 And a following paragraph.
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Code Blocks
 
@@ -93,7 +93,7 @@
 
     These should not be escaped:  \$ \\ \> \[ \{
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Lists
 
@@ -250,7 +250,7 @@
 
 B. Williams
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Definition Lists
 
@@ -395,7 +395,7 @@
 
 Hr’s:
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Inline Markup
 
@@ -421,10 +421,10 @@
 
 Subscripts: H₂O, H₂₃O, H_(many of them)O.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a^b c^d, a~b c~d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a^b c^d, a~b c~d.
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Smart quotes, ellipses, dashes
 
@@ -444,7 +444,7 @@
 
 Ellipses…and…and….
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 LaTeX
 
@@ -468,7 +468,7 @@
 
 Here’s a LaTeX table:
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Special Characters
 
@@ -522,7 +522,7 @@
 
 Minus: -
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Links
 
@@ -594,7 +594,7 @@
 
     or here: <http://example.com/>
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Images
 
@@ -604,7 +604,7 @@
 
 Here is a movie [movie] icon.
 
-------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 Footnotes
 
@@ -622,13 +622,13 @@
 
 [2] Here’s the long note. This one contains multiple blocks.
 
-Subsequent blocks are indented to show that they belong to the footnote (as
-with list items).
+Subsequent blocks are indented to show that they belong to the footnote (as with
+list items).
 
       { <code> }
 
-If you want, you can indent every line, but you can also be lazy and just
-indent the first line of each block.
+If you want, you can indent every line, but you can also be lazy and just indent
+the first line of each block.
 
 [3] This is easier to type. Inline notes may contain links and ] verbatim
 characters, as well as [bracketed text].
diff --git a/test/writer.rst b/test/writer.rst
--- a/test/writer.rst
+++ b/test/writer.rst
@@ -580,8 +580,8 @@
 
 Subscripts: H\ :sub:`2`\ O, H\ :sub:`23`\ O, H\ :sub:`many of them`\ O.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a^b c^d, a~b c~d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a^b c^d, a~b c~d.
 
 --------------
 
diff --git a/test/writer.tei b/test/writer.tei
--- a/test/writer.tei
+++ b/test/writer.tei
@@ -54,9 +54,9 @@
 <div type="level1" xml:id="paragraphs">
   <head>Paragraphs</head>
   <p>Here’s a regular paragraph.</p>
-  <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list
-  item. Because a hard-wrapped line in the middle of a paragraph looked like a
-  list item.</p>
+  <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.
+  Because a hard-wrapped line in the middle of a paragraph looked like a list
+  item.</p>
   <p>Here’s one with a bullet. * criminey.</p>
   <p>There should be a hard line break<lb />here.</p>
   <milestone unit="undefined" type="separator" rendition="line" />
@@ -630,10 +630,10 @@
   <p><quote>Hello,</quote> said the spider. <quote><quote>Shelob</quote> is my
   name.</quote></p>
   <p><quote>A</quote>, <quote>B</quote>, and <quote>C</quote> are letters.</p>
-  <p><quote>Oak,</quote> <quote>elm,</quote> and <quote>beech</quote> are
-  names of trees. So is <quote>pine.</quote></p>
-  <p><quote>He said, <quote>I want to go.</quote></quote> Were you alive in
-  the 70’s?</p>
+  <p><quote>Oak,</quote> <quote>elm,</quote> and <quote>beech</quote> are names
+  of trees. So is <quote>pine.</quote></p>
+  <p><quote>He said, <quote>I want to go.</quote></quote> Were you alive in the
+  70’s?</p>
   <p>Here is some quoted <quote><seg type="code">code</seg></quote> and a
   <quote><ref target="http://example.com/?foo=1&amp;bar=2">quoted
   link</ref></quote>.</p>
@@ -821,8 +821,8 @@
 <div type="level1" xml:id="footnotes">
   <head>Footnotes</head>
   <p>Here is a footnote reference,<note>
-    <p>Here is the footnote. It can go anywhere after the footnote reference.
-    It need not be placed at the end of the document.</p>
+    <p>Here is the footnote. It can go anywhere after the footnote reference. It
+    need not be placed at the end of the document.</p>
   </note> and another.<note>
     <p>Here’s the long note. This one contains multiple blocks.</p>
     <p>Subsequent blocks are indented to show that they belong to the footnote
@@ -830,8 +830,8 @@
     <ab type='codeblock '>
   { &lt;code&gt; }
 </ab>
-    <p>If you want, you can indent every line, but you can also be lazy and
-    just indent the first line of each block.</p>
+    <p>If you want, you can indent every line, but you can also be lazy and just
+    indent the first line of each block.</p>
   </note> This should <hi rendition="simple:italic">not</hi> be a footnote
   reference, because it contains a space.[^my note] Here is an inline
   note.<note>
diff --git a/test/writer.texinfo b/test/writer.texinfo
--- a/test/writer.texinfo
+++ b/test/writer.texinfo
@@ -732,8 +732,8 @@
 
 Subscripts: H@sub{2}O, H@sub{23}O, H@sub{many@ of@ them}O.
 
-These should not be superscripts or subscripts, because of the unescaped
-spaces: a^b c^d, a~b c~d.
+These should not be superscripts or subscripts, because of the unescaped spaces:
+a^b c^d, a~b c~d.
 
 @iftex
 @bigskip@hrule@bigskip
@@ -1014,24 +1014,22 @@
 @node Footnotes
 @chapter Footnotes
 @anchor{#footnotes}
-Here is a footnote reference,@footnote{Here is the footnote. It can go
-anywhere after the footnote reference. It need not be placed at the end of the
-document.} and another.@footnote{Here's the long note. This one contains
-multiple blocks.
+Here is a footnote reference,@footnote{Here is the footnote. It can go anywhere
+after the footnote reference. It need not be placed at the end of the document.}
+and another.@footnote{Here's the long note. This one contains multiple blocks.
 
-Subsequent blocks are indented to show that they belong to the footnote (as
-with list items).
+Subsequent blocks are indented to show that they belong to the footnote (as with
+list items).
 
 @verbatim
   { <code> }
 @end verbatim
 
-If you want, you can indent every line, but you can also be lazy and just
-indent the first line of each block.} This should @emph{not} be a footnote
-reference, because it contains a space.[^my note] Here is an inline
-note.@footnote{This is @emph{easier} to type. Inline notes may contain
-@uref{http://google.com,links} and @code{]} verbatim characters, as well as
-[bracketed text].}
+If you want, you can indent every line, but you can also be lazy and just indent
+the first line of each block.} This should @emph{not} be a footnote reference,
+because it contains a space.[^my note] Here is an inline note.@footnote{This is
+@emph{easier} to type. Inline notes may contain @uref{http://google.com,links}
+and @code{]} verbatim characters, as well as [bracketed text].}
 
 @quotation
 Notes can go in quotes.@footnote{In quote.}
diff --git a/test/writers-lang-and-dir.latex b/test/writers-lang-and-dir.latex
--- a/test/writers-lang-and-dir.latex
+++ b/test/writers-lang-and-dir.latex
@@ -3,7 +3,6 @@
 \PassOptionsToPackage{hyphens}{url}
 %
 \documentclass[
-  english,
 ]{article}
 \usepackage{amsmath,amssymb}
 \usepackage{lmodern}
@@ -45,37 +44,23 @@
 \providecommand{\tightlist}{%
   \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
 \setcounter{secnumdepth}{-\maxdimen} % remove section numbering
-\ifXeTeX
-  % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
-  \usepackage{polyglossia}
-  \setmainlanguage[]{english}
-  \setotherlanguage[]{german}
-  \setotherlanguage[variant=british]{english}
-  \setotherlanguage[variant=swiss]{german}
-  \setotherlanguage[]{spanish}
-  \setotherlanguage[]{french}
+\ifLuaTeX
+\usepackage[bidi=basic]{babel}
 \else
-  \usepackage[ngerman,british,nswissgerman,spanish,french,main=english]{babel}
+\usepackage[bidi=default]{babel}
+\fi
+\babelprovide[main,import]{english}
+\babelprovide[import]{ngerman}
+\babelprovide[import]{british}
+\babelprovide[import]{nswissgerman}
+\babelprovide[import]{spanish}
+\babelprovide[import]{french}
 % get rid of language-specific shorthands (see #6817):
 \let\LanguageShortHands\languageshorthands
 \def\languageshorthands#1{}
-  \newcommand{\textgerman}[2][]{\foreignlanguage{ngerman}{#2}}
-  \newenvironment{german}[2][]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}}
-  \newcommand{\textenglish}[2][]{\foreignlanguage{british}{#2}}
-  \newenvironment{english}[2][]{\begin{otherlanguage}{british}}{\end{otherlanguage}}
-  \let\oritextspanish\textspanish
-  \AddBabelHook{spanish}{beforeextras}{\renewcommand{\textspanish}{\oritextspanish}}
-  \AddBabelHook{spanish}{afterextras}{\renewcommand{\textspanish}[2][]{\foreignlanguage{spanish}{##2}}}
-  \newcommand{\textfrench}[2][]{\foreignlanguage{french}{#2}}
-  \newenvironment{french}[2][]{\begin{otherlanguage}{french}}{\end{otherlanguage}}
-\fi
 \ifLuaTeX
   \usepackage{selnolig}  % disable illegal ligatures
 \fi
-\ifXeTeX
-  % Load bidi as late as possible as it modifies e.g. graphicx
-  \usepackage{bidi}
-\fi
 \ifPDFTeX
   \TeXXeTstate=1
   \newcommand{\RL}[1]{\beginR #1\endR}
@@ -123,18 +108,19 @@
 
 Some text and
 
-\begin{german}
+\begin{otherlanguage}{ngerman}
 
 German div contents
 
-\end{german}
+\end{otherlanguage}
 
 and more text.
 
-Next paragraph with a \textenglish[variant=british]{British span} and a
-word-that-includesa\textgerman[variant=swiss]{Swiss German span}right?
+Next paragraph with a \foreignlanguage{british}{British span} and a
+word-that-includesa\foreignlanguage{nswissgerman}{Swiss German
+span}right?
 
-Some \textspanish{Spanish text}.
+Some \foreignlanguage{spanish}{Spanish text}.
 
 \hypertarget{combined}{%
 \section{Combined}\label{combined}}
@@ -142,17 +128,17 @@
 Some text and
 
 \begin{RTL}
-\begin{french}
+\begin{otherlanguage}{french}
 
 French rtl div contents
 
-\end{french}
+\end{otherlanguage}
 \end{RTL}
 
 and more text.
 
-Next paragraph with a \LR{\textenglish[variant=british]{British ltr
-span}} and a word-that-includesa\LR{\textgerman[variant=swiss]{Swiss
-German ltr span}}right?
+Next paragraph with a \LR{\foreignlanguage{british}{British ltr span}}
+and a word-that-includesa\LR{\foreignlanguage{nswissgerman}{Swiss German
+ltr span}}right?
 
 \end{document}
