diff --git a/.gitignore b/.gitignore
index c3154ea..9b7630a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@ man/man?/*.html
 windows/*.wixobj
 data/reference.docx
 data/reference.odt
+.stack-work
diff --git a/.travis.yml b/.travis.yml
index 2901288..9c03121 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,87 +1,125 @@
-# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
-language: c
+# Copy these contents into the root directory of your Github project in a file
+# named .travis.yml
+
+# Use new container infrastructure to enable caching
 sudo: false
 
+# Choose a lightweight base image; we provide our own build tools.
+language: c
+
+# Caching so the next build will be fast too.
 cache:
   directories:
-    - $HOME/.cabsnap
-    - $HOME/.cabal/packages
-
-before_cache:
-  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
-  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
+  - $HOME/.ghc
+  - $HOME/.cabal
+  - $HOME/.stack
 
+# The different configurations we want to test. We have BUILD=cabal which uses
+# cabal-install, and BUILD=stack which uses Stack. More documentation on each
+# of those below.
+#
+# We set the compiler values here to tell Travis to use a different
+# cache file per set of arguments.
+#
+# If you need to have different apt packages for each combination in the
+# matrix, you can use a line such as:
+#     addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
 matrix:
   include:
-    - env: CABALVER=1.16 GHCVER=7.4.2 GHCOPTS=-Werror
-      compiler: ": #GHC 7.4.2"
-      addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}}
-    - env: CABALVER=1.16 GHCVER=7.6.3 GHCOPTS=-Werror
-      compiler: ": #GHC 7.6.3"
-      addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
-    - env: CABALVER=1.18 GHCVER=7.8.4 GHCOPTS=-Werror
-      compiler: ": #GHC 7.8.4"
-      addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
-    - env: CABALVER=1.22 GHCVER=7.10.2 GHCOPTS=-Werror
-      compiler: ": #GHC 7.10.2"
-      addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
+  # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See:
+  # https://github.com/hvr/multi-ghc-travis
+  - env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16
+    compiler: ": #GHC 7.4.2"
+    addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}}
+  - env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16
+    compiler: ": #GHC 7.6.3"
+    addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
+  - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18
+    compiler: ": #GHC 7.8.4"
+    addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
+  - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22
+    compiler: ": #GHC 7.10.3"
+    addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}
 
-before_install:
- - unset CC
- - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
+  # Build with the newest GHC and cabal-install. This is an accepted failure,
+  # see below.
+  - env: BUILD=cabal GHCVER=head  CABALVER=head
+    compiler: ": #GHC HEAD"
+    addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
 
-install:
- - cabal --version
- - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
- - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
-   then
-     zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
-          $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
-   fi
- - travis_retry cabal update -v
- - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
- - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
- - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
+  # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
+  # variable, such as using --stack-yaml to point to a different file.
+  - env: BUILD=stack ARGS="--resolver lts-5"
+    compiler: ": #stack 7.10.3"
+    addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
 
-# check whether current requested install-plan matches cached package-db snapshot
- - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
-   then
-     echo "cabal build-cache HIT";
-     rm -rfv .ghc;
-     cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
-     cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
-   else
-     echo "cabal build-cache MISS";
-     rm -rf $HOME/.cabsnap;
-     mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
-     cabal install --only-dependencies --enable-tests --enable-benchmarks;
-   fi
- 
-# snapshot package-db on cache miss
- - if [ ! -d $HOME/.cabsnap ];
-   then
-      echo "snapshotting package-db to build-cache";
-      mkdir $HOME/.cabsnap;
-      cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
-      cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
-   fi
+  # Nightly builds are allowed to fail
+  - env: BUILD=stack ARGS="--resolver nightly"
+    compiler: ": #stack nightly"
+    addons: {apt: {packages: [libgmp-dev]}}
 
-# Here starts the actual work to be performed for the package under test;
-# any command which exits with a non-zero exit code causes the build to fail.
-script:
- - if [ -f configure.ac ]; then autoreconf -i; fi
- - cabal configure --enable-tests --enable-benchmarks -v2  # -v2 provides useful information for debugging
- - cabal build --ghc-options=$GHCOPTS  # this builds all libraries and executables (including tests/benchmarks)
- - cabal test
- - cabal check
-# Test that a source-distribution can be generated
-# (with cabal >= 1.18 'cabal sdist' would work too):
- - ./dist/setup/setup sdist
+  - env: BUILD=stack ARGS="--resolver lts-5"
+    compiler: ": #stack 7.10.3 osx"
+    os: osx
 
-# Check that the resulting source distribution can be built & installed.
-# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
-# `cabal install --force-reinstalls dist/*-*.tar.gz`
- - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
-   (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
+  - env: BUILD=stack ARGS="--resolver nightly"
+    compiler: ": #stack nightly osx"
+    os: osx
 
-# EOF
+  allow_failures:
+  - env: BUILD=cabal GHCVER=head  CABALVER=head
+  - env: BUILD=stack ARGS="--resolver nightly"
+
+before_install:
+# Using compiler above sets CC to an invalid value, so unset it
+- unset CC
+
+# We want to always allow newer versions of packages when building on GHC HEAD
+- CABALARGS=""
+- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
+
+# Download and unpack the stack executable
+- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$PATH
+- mkdir -p ~/.local/bin
+- |
+  if [ `uname` = "Darwin" ]
+  then
+    curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
+  else
+    curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
+  fi
+
+install:
+- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
+- if [ -f configure.ac ]; then autoreconf -i; fi
+- |
+  case "$BUILD" in
+    stack)
+      stack --no-terminal --install-ghc $ARGS test --only-dependencies
+      ;;
+    cabal)
+      cabal --version
+      travis_retry cabal update
+      cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS
+      ;;
+  esac
+
+script:
+- |
+  case "$BUILD" in
+    stack)
+      stack --no-terminal $ARGS test --haddock --no-haddock-deps
+      ;;
+    cabal)
+      cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror"
+      cabal build
+      cabal check || [ "$CABALVER" == "1.16" ]
+      cabal test
+      cabal copy
+      # cabal sdist fails on cabal 1.16:
+      cabal sdist || [ "$CABALVER" == "1.16" ]
+      SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && \
+        (cd dist && cabal install --force-reinstalls "$SRC_TGZ" || \
+            [ "$CABALVER" == "1.16" ])
+      ;;
+  esac
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index eff0330..f39acab 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -145,21 +145,40 @@ Tests
 
 Tests can be run as follows:
 
+    cabal install --only-dependencies --enable-tests
     cabal configure --enable-tests
     cabal build
     cabal test
 
+or, if you're using [stack],
+
+    stack init
+    stack test
+
 The test program is `tests/test-pandoc.hs`.
 
-Benchmarks can be enabled by passing the `--enable-benchmarks` flag
-to `cabal configure`, and run using `cabal bench`.
+Benchmarks
+----------
+
+To run benchmarks with cabal:
+
+    cabal configure --enable-benchmarks
+    cabal build
+    cabal bench
+
+With stack:
+
+    stack bench
 
 Using the REPL
 --------------
 
 With a recent version of cabal, you can do `cabal repl` and get
-a ghci REPL for working with pandoc.  We recommend using the following
-`.ghci` file (which can be placed in the source directory):
+a ghci REPL for working with pandoc.  With [stack], use
+`cabal ghci`.
+
+We recommend using the following `.ghci` file (which can be
+placed in the source directory):
 
 ```
 :set -fobject-code
@@ -266,3 +285,5 @@ The library is structured as follows:
 [inprogress]: https://github.com/jgm/pandoc/labels/inprogress
 [more discussion needed]: https://github.com/jgm/pandoc/labels/More%20discussion%20needed
 [more info needed]: https://github.com/jgm/pandoc/labels/More%20info%20needed
+[stack]: https://github.com/commercialhaskell/stack
+
diff --git a/COPYRIGHT b/COPYRIGHT
index 19b5321..c94f4fd 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
 Pandoc
-Copyright (C) 2006-2015 John MacFarlane <jgm at berkeley dot edu>
+Copyright (C) 2006-2016 John MacFarlane <jgm at berkeley dot edu>
 
 This code is released under the [GPL], version 2 or later:
 
diff --git a/INSTALL b/INSTALL
index 3cb428d..bfb5489 100644
--- a/INSTALL
+++ b/INSTALL
@@ -11,7 +11,7 @@ https://github.com/jgm/pandoc/wiki/Installing-the-development-version-of-pandoc
 Quick install with stack
 ------------------------
 
-1.  Install [stack](https://github.com/commercialhaskell/stack/wiki/Downloads).
+1.  Install [stack](http://docs.haskellstack.org/en/stable/install_and_upgrade.html).
 
 2.  If you used git to get the pandoc source (as opposed to unpacking
     a release tarball), do
@@ -180,6 +180,10 @@ can be run from any directory and is completely self-contained.
 You can find the pandoc executable in `dist/build/pandoc`.  Copy this wherever
 you please.
 
+Or alternatively with `stack`:
+
+    stack install pandoc --flag pandoc:embed_data_files
+
 [zip-archive]: http://hackage.haskell.org/package/zip-archive
 [highlighting-kate]: http://hackage.haskell.org/package/highlighting-kate
 [blaze-html]: http://hackage.haskell.org/package/blaze-html
diff --git a/Makefile b/Makefile
index 7c16418..9620cf3 100644
--- a/Makefile
+++ b/Makefile
@@ -23,22 +23,28 @@ test:
 bench:
 	cabal bench
 
+changes_github:
+	pandoc --filter extract-changes.hs changelog -t markdown_github | pbcopy
+
 install: full
 	cabal copy
 	cabal register
 
+stack:
+	stack install --test --stack-yaml stack.full.yaml
+
 dist: man/pandoc.1
 	cabal sdist
 	rm -rf "pandoc-${version}"
 	tar xvzf dist/pandoc-${version}.tar.gz
 	cd pandoc-${version}
-	cabal configure ${CABALARGS} && cabal build && cabal test && cd .. && rm -rf "pandoc-${version}"
+	stack setup && stack test && cd .. && rm -rf "pandoc-${version}"
 
 .travis.yml: pandoc.cabal make_travis_yml.hs
 	runghc make_travis_yml.hs $< > $@
 
 debpkg: man/pandoc.1
-	./make_deb.sh
+	make -C deb
 
 osxpkg: man/pandoc.1
 	./make_osx_package.sh
@@ -48,6 +54,7 @@ man/pandoc.1: README man/pandoc.1.template
 		--filter man/capitalizeHeaders.hs \
 		--filter man/removeNotes.hs \
 		--filter man/removeLinks.hs \
+		--variable version="pandoc $(version)" \
 		-o $@
 
 download_stats:
@@ -57,4 +64,4 @@ download_stats:
 clean:
 	cabal clean
 
-.PHONY: deps quick full install clean test bench osxpkg dist prof download_stats
+.PHONY: deps quick full install clean test bench changes_github osxpkg dist prof download_stats
diff --git a/README b/README
index f10de12..9aaa561 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 % Pandoc User's Guide
 % John MacFarlane
-% July 15, 2015
+% January 12, 2016
 
 Synopsis
 ========
@@ -22,36 +22,36 @@ markup], [Haddock markup], [OPML], [Emacs Org mode], [DocBook],
 [OpenDocument], [ODT], [Word docx], [GNU Texinfo], [MediaWiki markup],
 [DokuWiki markup], [Haddock markup], [EPUB] (v2 or v3),
 [FictionBook2], [Textile], [groff man] pages, [Emacs Org mode],
-[AsciiDoc], [InDesign ICML], and [Slidy], [Slideous], [DZSlides],
+[AsciiDoc], [InDesign ICML], [TEI Simple], and [Slidy], [Slideous], [DZSlides],
 [reveal.js] or [S5] HTML slide shows. It can also produce [PDF] output
-on systems where LaTeX is installed.
+on systems where LaTeX, ConTeXt, or `wkhtmltopdf` is installed.
 
-Pandoc's enhanced version of markdown includes syntax for [footnotes],
+Pandoc's enhanced version of Markdown includes syntax for [footnotes],
 [tables], flexible [ordered lists], [definition lists], [fenced code blocks],
 [superscripts and subscripts], [strikeout], [metadata blocks], automatic tables of
-contents, [embedded LaTeX math][Math rendering in HTML], [citations], and [markdown inside HTML block
+contents, embedded LaTeX [math], [citations], and [Markdown inside HTML block
 elements][Extension: `markdown_in_html_blocks`]. (These enhancements, described below under
-[Pandoc's markdown], can be disabled using the
+[Pandoc's Markdown], can be disabled using the
 `markdown_strict` input or output format.)
 
-In contrast to most existing tools for converting markdown to HTML, which
-use regex substitutions, Pandoc has a modular design: it consists of a
+In contrast to most existing tools for converting Markdown to HTML, which
+use regex substitutions, pandoc has a modular design: it consists of a
 set of readers, which parse text in a given format and produce a native
 representation of the document, and a set of writers, which convert
 this native representation into a target format. Thus, adding an input
 or output format requires only adding a reader or writer.
 
-Because Pandoc's intermediate representation of a document is less
+Because pandoc's intermediate representation of a document is less
 expressive than many of the formats it converts between, one should
 not expect perfect conversions between every format and every other.
 Pandoc attempts to preserve the structural elements of a document, but
 not formatting details such as margin size.  And some document elements,
-such as complex tables, may not fit into Pandoc's simple document
-model.  While conversions from Pandoc's Markdown to all formats aspire
-to be perfect, conversions from formats more expressive than Pandoc's
+such as complex tables, may not fit into pandoc's simple document
+model.  While conversions from pandoc's Markdown to all formats aspire
+to be perfect, conversions from formats more expressive than pandoc's
 Markdown can be expected to be lossy.
 
-[markdown]: http://daringfireball.net/projects/markdown/
+[Markdown]: http://daringfireball.net/projects/markdown/
 [CommonMark]: http://commonmark.org
 [PHP Markdown Extra]: https://michelf.ca/projects/php-markdown/extra/
 [GitHub-Flavored Markdown]: https://help.github.com/articles/github-flavored-markdown/
@@ -65,7 +65,7 @@ Markdown can be expected to be lossy.
 [LaTeX]: http://latex-project.org
 [`beamer`]: https://ctan.org/pkg/beamer
 [Beamer User's Guide]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf
-[ConTeXt]: http://pragma-ade.nl
+[ConTeXt]: http://contextgarden.net/
 [RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
 [DocBook]: http://docbook.org
 [txt2tags]: http://txt2tags.org
@@ -89,6 +89,7 @@ Markdown can be expected to be lossy.
 [reveal.js]: http://lab.hakim.se/reveal-js/
 [FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
 [InDesign ICML]: https://www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/IDML/idml-specification.pdf
+[TEI Simple]: https://github.com/TEIC/TEI-Simple
 
 Using `pandoc`
 --------------
@@ -124,11 +125,11 @@ The format of the input and output can be specified explicitly using
 command-line options.  The input format can be specified using the
 `-r/--read` or `-f/--from` options, the output format using the
 `-w/--write` or `-t/--to` options.  Thus, to convert `hello.txt` from
-markdown to LaTeX, you could type:
+Markdown to LaTeX, you could type:
 
     pandoc -f markdown -t latex hello.txt
 
-To convert `hello.html` from HTML to markdown:
+To convert `hello.html` from HTML to Markdown:
 
     pandoc -f html -t markdown hello.html
 
@@ -143,12 +144,12 @@ the input and output filenames.  Thus, for example,
 
     pandoc -o hello.tex hello.txt
 
-will convert `hello.txt` from markdown to LaTeX.  If no output file
+will convert `hello.txt` from Markdown to LaTeX.  If no output file
 is specified (so that output goes to *stdout*), or if the output file's
 extension is unknown, the output format will default to HTML.
 If no input file is specified (so that input comes from *stdin*), or
 if the input files' extensions are unknown, the input format will
-be assumed to be markdown unless explicitly specified.
+be assumed to be Markdown unless explicitly specified.
 
 Pandoc uses the UTF-8 character encoding for both input and output.
 If your local character encoding is not UTF-8, you
@@ -167,7 +168,7 @@ Creating a PDF
 --------------
 
 To produce a PDF, specify an output file with a `.pdf` extension.
-Pandoc will use LaTeX to convert it to PDF:
+By default, pandoc will use LaTeX to convert it to PDF:
 
     pandoc test.txt -o test.pdf
 
@@ -176,20 +177,28 @@ Production of a PDF requires that a LaTeX engine be installed (see
 are available: [`amsfonts`], [`amsmath`], [`lm`],
 [`ifxetex`], [`ifluatex`], [`eurosym`], [`listings`] (if the
 `--listings` option is used), [`fancyvrb`], [`longtable`],
-[`booktabs`], [`url`], [`graphicx`] and [`grffile`] (if the
-document contains images), [`color`], [`hyperref`], [`ulem`],
+[`booktabs`], [`graphicx`] and [`grffile`] (if the
+document contains images), [`hyperref`], [`ulem`],
 [`geometry`] (with the `geometry` variable set), [`setspace`] (with
 `linestretch`), and [`babel`] (with `lang`). The use of `xelatex` or
 `lualatex` as the LaTeX engine requires [`fontspec`]; `xelatex` uses
 [`mathspec`], [`polyglossia`] (with `lang`), [`xecjk`], and
 [`bidi`] (with the `dir` variable set). The [`upquote`] and
 [`microtype`] packages are used if available, and [`csquotes`] will
-be used for [smart punctuation] if added to the template. The
-[`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can
-optionally be used for [citation rendering]. These are included with
-all recent versions of [TeX Live].
+be used for [smart punctuation] if added to the template or included in
+any header file. The [`natbib`], [`biblatex`], [`bibtex`], and [`biber`]
+packages can optionally be used for [citation rendering]. These are
+included with all recent versions of [TeX Live].
 
-PDF output can be controlled using [variables for LaTeX].
+Alternatively, pandoc can use ConTeXt or `wkhtmltopdf` to create a PDF.
+To do this, specify an output file with a `.pdf` extension,
+as before, but add `-t context` or `-t html5` to the command line.
+
+PDF output can be controlled using [variables for LaTeX] (if
+LaTeX is used) and [variables for ConTeXt] (if ConTeXt is used).
+If `wkhtmltopdf` is used, then the variables `margin-left`,
+`margin-right`, `margin-top`, `margin-bottom`, and `papersize`
+will affect the output, as will `--css`.
 
 [`amsfonts`]: https://ctan.org/pkg/amsfonts
 [`amsmath`]: https://ctan.org/pkg/amsmath
@@ -201,12 +210,10 @@ PDF output can be controlled using [variables for LaTeX].
 [`fancyvrb`]: https://ctan.org/pkg/fancyvrb
 [`longtable`]: https://ctan.org/pkg/longtable
 [`booktabs`]: https://ctan.org/pkg/booktabs
-[`url`]: https://ctan.org/pkg/url
 [`graphicx`]: https://ctan.org/pkg/graphicx
 [`grffile`]: https://ctan.org/pkg/grffile
 [`geometry`]: https://ctan.org/pkg/geometry
 [`setspace`]: https://ctan.org/pkg/setspace
-[`color`]: http://ctan.org/pkg/color
 [`xecjk`]: https://ctan.org/pkg/xecjk
 [`hyperref`]: https://ctan.org/pkg/hyperref
 [`ulem`]: https://ctan.org/pkg/ulem
@@ -224,19 +231,6 @@ PDF output can be controlled using [variables for LaTeX].
 [`biber`]: https://ctan.org/pkg/biber
 [TeX Live]: http://www.tug.org/texlive/
 
-`hsmarkdown`
-------------
-
-A user who wants a drop-in replacement for `Markdown.pl` may create
-a symbolic link to the `pandoc` executable called `hsmarkdown`. When
-invoked under the name `hsmarkdown`, `pandoc` will behave as if
-invoked with `-f markdown_strict --email-obfuscation=references`,
-and all command-line options will be treated as regular arguments.
-This approach does not work under [Cygwin], due to problems with
-its simulation of symbolic links.
-
-[Cygwin]: https://cygwin.com
-
 Options
 =======
 
@@ -247,10 +241,10 @@ General options
 
 :   Specify input format.  *FORMAT* can be `native` (native Haskell),
     `json` (JSON version of native AST), `markdown` (pandoc's
-    extended markdown), `markdown_strict` (original unextended
-    markdown), `markdown_phpextra` (PHP Markdown Extra),
+    extended Markdown), `markdown_strict` (original unextended
+    Markdown), `markdown_phpextra` (PHP Markdown Extra),
     `markdown_github` (GitHub-Flavored Markdown),
-    `commonmark` (CommonMark markdown), `textile` (Textile), `rst`
+    `commonmark` (CommonMark Markdown), `textile` (Textile), `rst`
     (reStructuredText), `html` (HTML), `docbook` (DocBook), `t2t`
     (txt2tags), `docx` (docx), `odt` (ODT), `epub` (EPUB), `opml` (OPML),
     `org` (Emacs Org mode), `mediawiki` (MediaWiki markup), `twiki` (TWiki
@@ -261,20 +255,20 @@ General options
     syntax extensions can be individually enabled or disabled by
     appending `+EXTENSION` or `-EXTENSION` to the format name. So, for
     example, `markdown_strict+footnotes+definition_lists` is strict
-    markdown with footnotes and definition lists enabled, and
-    `markdown-pipe_tables+hard_line_breaks` is pandoc's markdown
+    Markdown with footnotes and definition lists enabled, and
+    `markdown-pipe_tables+hard_line_breaks` is pandoc's Markdown
     without pipe tables and with hard line breaks. See [Pandoc's
-    markdown], below, for a list of extensions and
+    Markdown], below, for a list of extensions and
     their names.
 
 `-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
 
 :   Specify output format.  *FORMAT* can be `native` (native Haskell),
     `json` (JSON version of native AST), `plain` (plain text),
-    `markdown` (pandoc's extended markdown), `markdown_strict`
-    (original unextended markdown), `markdown_phpextra` (PHP Markdown
+    `markdown` (pandoc's extended Markdown), `markdown_strict`
+    (original unextended Markdown), `markdown_phpextra` (PHP Markdown
     Extra), `markdown_github` (GitHub-Flavored
-    Markdown), `commonmark` (CommonMark markdown), `rst`
+    Markdown), `commonmark` (CommonMark Markdown), `rst`
     (reStructuredText), `html` (XHTML), `html5` (HTML5), `latex`
     (LaTeX), `beamer` (LaTeX beamer slide show), `context` (ConTeXt),
     `man` (groff man), `mediawiki` (MediaWiki markup), `dokuwiki`
@@ -284,11 +278,11 @@ General options
     `docx` (Word docx), `haddock` (Haddock markup), `rtf` (rich text
     format), `epub` (EPUB v2 book), `epub3` (EPUB v3), `fb2`
     (FictionBook2 e-book), `asciidoc` (AsciiDoc), `icml` (InDesign
-    ICML), `slidy` (Slidy HTML and javascript slide show), `slideous`
-    (Slideous HTML and javascript slide show), `dzslides` (DZSlides
-    HTML5 + javascript slide show), `revealjs` (reveal.js HTML5 +
-    javascript slide show), `s5` (S5 HTML and javascript slide show),
-    or the path of a custom lua writer (see [Custom
+    ICML), `tei` (TEI Simple), `slidy` (Slidy HTML and javascript slide
+    show), `slideous` (Slideous HTML and javascript slide show),
+    `dzslides` (DZSlides HTML5 + javascript slide show), `revealjs`
+    (reveal.js HTML5 + javascript slide show), `s5` (S5 HTML and javascript
+    slide show), or the path of a custom lua writer (see [Custom
     writers], below). Note that `odt`, `epub`, and
     `epub3` output will not be directed to *stdout*; an output
     filename must be specified using the `-o/--output` option. If
@@ -355,9 +349,9 @@ Reader options
 
 :   Parse untranslatable HTML codes and LaTeX environments as raw HTML
     or LaTeX, instead of ignoring them.  Affects only HTML and LaTeX
-    input. Raw HTML can be printed in markdown, reStructuredText, HTML,
+    input. Raw HTML can be printed in Markdown, reStructuredText, HTML,
     Slidy, Slideous, DZSlides, reveal.js, and S5 output; raw LaTeX
-    can be printed in markdown, reStructuredText, LaTeX, and ConTeXt output.
+    can be printed in Markdown, reStructuredText, LaTeX, and ConTeXt output.
     The default is for the readers to omit untranslatable HTML codes and
     LaTeX environments.  (The LaTeX reader does pass through untranslatable
     LaTeX *commands*, even if `-R` is not specified.)
@@ -367,11 +361,9 @@ Reader options
 :   Produce typographically correct output, converting straight quotes
     to curly quotes, `---` to em-dashes, `--` to en-dashes, and
     `...` to ellipses. Nonbreaking spaces are inserted after certain
-    abbreviations, such as "Mr." (Note: This option is significant only when
-    the input format is `markdown`, `markdown_strict`, `textile` or `twiki`.
-    It is selected automatically when the input format is `textile` or the
-    output format is `latex` or `context`, unless `--no-tex-ligatures`
-    is used.)
+    abbreviations, such as "Mr." (Note: This option is selected automatically
+    when the output format is `latex` or `context`, unless `--no-tex-ligatures`
+    is used.  It has no effect for `latex` input.)
 
 `--old-dashes`
 
@@ -394,12 +386,20 @@ Reader options
 :   Specify a default extension to use when image paths/URLs have no
     extension.  This allows you to use the same source for formats that
     require different kinds of images.  Currently this option only affects
-    the markdown and LaTeX readers.
+    the Markdown and LaTeX readers.
+
+`--file-scope`
+
+:   Parse each file individually before combining for multifile
+    documents. This will allow footnotes in different files with the
+    same identifiers to work as expected. If this option is set,
+    footnotes and links will not work across files. Reading binary
+    files (docx, odt, epub) implies `--file-scope`.
 
 `--filter=`*EXECUTABLE*
 
 :   Specify an executable to be used as a filter transforming the
-    Pandoc AST after the input is parsed and before the output is
+    pandoc AST after the input is parsed and before the output is
     written.  The executable should read JSON from stdin and write
     JSON to stdout.  The JSON must be formatted like  pandoc's own
     JSON input and output.  The name of the output format will be
@@ -480,7 +480,7 @@ General writer options
 `-s`, `--standalone`
 
 :   Produce output with an appropriate header and footer (e.g. a
-    standalone HTML, LaTeX, or RTF file, not a fragment).  This option
+    standalone HTML, LaTeX, TEI, or RTF file, not a fragment).  This option
     is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
     output.
 
@@ -516,21 +516,38 @@ General writer options
 :   Print a system default data file.  Files in the user data directory
     are ignored.
 
+`--dpi`=*NUMBER*
+:   Specify the dpi (dots per inch) value for conversion from pixels
+    to inch/centimeters and vice versa. The default is 96dpi.
+    Technically, the correct term would be ppi (pixels per inch).
+
+`--wrap=[auto|none|preserve]`
+
+:   Determine how text is wrapped in the output (the source
+    code, not the rendered version).  With `auto` (the default),
+    pandoc will attempt to wrap lines to the column width specified by
+    `--columns` (default 80).  With `none`, pandoc will not wrap
+    lines at all.  With `preserve`, pandoc will attempt to
+    preserve the wrapping from the source document (that is,
+    where there are nonsemantic newlines in the source, there
+    will be nonsemantic newlines in the output as well).
+
 `--no-wrap`
 
-:   Disable text wrapping in output. By default, text is wrapped
-    appropriately for the output format.
+:   Deprecated synonym for `--wrap=none`.
 
 `--columns=`*NUMBER*
 
 :   Specify length of lines in characters (for text wrapping).
+    This affects only the generated source code, not the layout on
+    the rendered page.
 
 `--toc`, `--table-of-contents`
 
 :   Include an automatically generated table of contents (or, in
-    the case of `latex`, `context`, and `rst`, an instruction to create
+    the case of `latex`, `context`, `docx`, and `rst`, an instruction to create
     one) in the output document. This option has no effect on `man`,
-    `docbook`, `slidy`, `slideous`, `s5`, `docx`, or `odt` output.
+    `docbook`, `slidy`, `slideous`, `s5`, or `odt` output.
 
 `--toc-depth=`*NUMBER*
 
@@ -571,7 +588,7 @@ General writer options
 
 :   Include contents of *FILE*, verbatim, at the end of the document
     body (before the `</body>` tag in HTML, or the
-    `\end{document}` command in LaTeX). This option can be be used
+    `\end{document}` command in LaTeX). This option can be used
     repeatedly to include multiple files. They will be included in the
     order specified.  Implies `--standalone`.
 
@@ -590,16 +607,11 @@ Options affecting specific writers
     stylesheets at absolute URLs will be downloaded; those at relative URLs
     will be sought relative to the working directory (if the first source
     file is local) or relative to the base URL (if the first source
-    file is remote).  `--self-contained` does not work with `--mathjax`.
-
-`--offline`
-
-:   Deprecated synonym for `--self-contained`.
-
-`-5`, `--html5`
-
-:   Produce HTML5 instead of HTML4.  This option has no effect for writers
-    other than `html`. (*Deprecated:*  Use the `html5` output format instead.)
+    file is remote).  Limitation: resources that are loaded dynamically
+    through JavaScript cannot be incorporated; as a result, `--self-contained`
+    does not work with `--mathjax`, and some advanced features (e.g.
+    zoom or speaker notes) may not work in an offline "self-contained"
+    `reveal.js` slide show.
 
 `--html-q-tags`
 
@@ -613,20 +625,21 @@ Options affecting specific writers
 
 `--reference-links`
 
-:   Use reference-style links, rather than inline links, in writing markdown
+:   Use reference-style links, rather than inline links, in writing Markdown
     or reStructuredText.  By default inline links are used.
 
 `--atx-headers`
 
-:   Use ATX-style headers in markdown and asciidoc output. The default is
+:   Use ATX-style headers in Markdown and asciidoc output. The default is
     to use setext-style headers for levels 1-2, and then ATX headers.
 
 `--chapters`
 
 :   Treat top-level headers as chapters in LaTeX, ConTeXt, and DocBook
-    output.  When the LaTeX document class is set to `report`, `book`, or
-    `memoir`, this option is implied.  If `beamer` is the output
-    format, top-level headers will become `\part{..}`.
+    output.  When the LaTeX document class is set to `report`, `book`,
+    or `memoir` (unless the `article` option is specified), this
+    option is implied.  If `beamer` is the output format, top-level
+    headers will become `\part{..}`.
 
 `-N`, `--number-sections`
 
@@ -648,15 +661,19 @@ Options affecting specific writers
 
 `--no-tex-ligatures`
 
-:   Do not convert quotation marks, apostrophes, and dashes to
-    the TeX ligatures when writing LaTeX or ConTeXt. Instead, just
-    use literal unicode characters. This is needed for using advanced
-    OpenType features with `xelatex` and `lualatex`. Note: normally
-    `--smart` is selected automatically for LaTeX and ConTeXt
-    output, but it must be specified explicitly if `--no-tex-ligatures`
-    is selected. If you use literal curly quotes, dashes, and ellipses
-    in your source, then you may want to use `--no-tex-ligatures`
-    without `--smart`.
+:   Do not use the TeX ligatures for quotation marks, apostrophes,
+    and dashes (`` `...' ``, ` ``..'' `, `--`, `---`) when
+    writing or reading LaTeX or ConTeXt.  In reading LaTeX,
+    parse the characters `` ` ``, `'`, and `-` literally, rather
+    than parsing ligatures for quotation marks and dashes.  In
+    writing LaTeX or ConTeXt, print unicode quotation mark and
+    dash characters literally, rather than converting them to
+    the standard ASCII TeX ligatures.  Note: normally `--smart`
+    is selected automatically for LaTeX and ConTeXt output, but
+    it must be specified explicitly if `--no-tex-ligatures` is
+    selected. If you use literal curly quotes, dashes, and
+    ellipses in your source, then you may want to use
+    `--no-tex-ligatures` without `--smart`.
 
 `--listings`
 
@@ -689,12 +706,13 @@ Options affecting specific writers
 :   Specify a method for obfuscating `mailto:` links in HTML documents.
     `none` leaves `mailto:` links as they are.  `javascript` obfuscates
     them using javascript. `references` obfuscates them by printing their
-    letters as decimal or hexadecimal character references.
+    letters as decimal or hexadecimal character references.  The default
+    is `javascript`.
 
 `--id-prefix=`*STRING*
 
 :   Specify a prefix to be added to all automatically generated identifiers
-    in HTML and DocBook output, and to footnote numbers in markdown output.
+    in HTML and DocBook output, and to footnote numbers in Markdown output.
     This is useful for preventing duplicate identifiers when generating
     fragments to be included in other pages.
 
@@ -707,7 +725,7 @@ Options affecting specific writers
 
 `-c` *URL*, `--css=`*URL*
 
-:   Link to a CSS style sheet. This option can be be used repeatedly to
+:   Link to a CSS style sheet. This option can be used repeatedly to
     include multiple files. They will be included in the order specified.
 
 `--reference-odt=`*FILE*
@@ -751,7 +769,7 @@ Options affecting specific writers
 
 :   Use the specified image as the EPUB cover.  It is recommended
     that the image be less than 1000px in width and height. Note that
-    in a markdown source document you can also specify `cover-image`
+    in a Markdown source document you can also specify `cover-image`
     in a YAML metadata block (see [EPUB Metadata], below).
 
 `--epub-metadata=`*FILE*
@@ -771,7 +789,7 @@ Options affecting specific writers
     id="BookId">` (a randomly generated UUID). Any of these may be
     overridden by elements in the metadata file.
 
-    Note: if the source document is markdown, a YAML metadata block
+    Note: if the source document is Markdown, a YAML metadata block
     in the document can be used instead.  See below under
     [EPUB Metadata].
 
@@ -960,13 +978,13 @@ Options for wrapper scripts
     with the `-o` option, or `-` (for *stdout*) if no output file was
     specified.  The remaining lines contain the command-line arguments,
     one per line, in the order they appear.  These do not include regular
-    Pandoc options and their arguments, but do include any options appearing
+    pandoc options and their arguments, but do include any options appearing
     after a `--` separator at the end of the line.
 
 `--ignore-args`
 
 :   Ignore command-line arguments (for use in wrapper scripts).
-    Regular Pandoc options are not ignored.  Thus, for example,
+    Regular pandoc options are not ignored.  Thus, for example,
 
         pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
 
@@ -987,14 +1005,20 @@ where *FORMAT* is the name of the output format. A custom template
 can be specified using the `--template` option.  You can also override
 the system default templates for a given output format *FORMAT*
 by putting a file `templates/default.*FORMAT*` in the user data
-directory (see `--data-dir`, above). *Exceptions:* For `odt` output,
-customize the `default.opendocument` template.  For `pdf` output,
-customize the `default.latex` template.
+directory (see `--data-dir`, above). *Exceptions:*
+
+- For `odt` output, customize the `default.opendocument`
+  template.
+- For `pdf` output, customize the `default.latex` template
+  (or the `default.beamer` template, if you use `-t beamer`,
+  or the `default.context` template, if you use `-t context`).
+- `docx` has no template (however, you can use
+  `--reference-docx` to customize the output).
 
 Templates contain *variables*, which allow for the inclusion of
-arbitrary information at any point in the file. Variables may be set 
-within the document using [YAML metadata blocks][Extension: `yaml_metadata_block`].
-They may also be set at the
+arbitrary information at any point in the file. Variables may be set
+within the document using [YAML metadata blocks][Extension:
+`yaml_metadata_block`].  They may also be set at the
 command line using the `-V/--variable` option: variables set in this
 way override metadata fields with the same name.
 
@@ -1002,12 +1026,13 @@ Variables set by pandoc
 -----------------------
 
 Some variables are set automatically by pandoc.  These vary somewhat
-depending on the output format, but include metadata fields as well as the following:
+depending on the output format, but include metadata fields as well
+as the following:
 
 `title`, `author`, `date`
-:   allow identification of basic aspects of the document.
-    Included in PDF metadata through LaTeX.
-    These can be set through a [pandoc title block][Extension: `pandoc_title_block`],
+:   allow identification of basic aspects of the document.  Included
+    in PDF metadata through LaTeX and ConTeXt.  These can be set
+    through a [pandoc title block][Extension: `pandoc_title_block`],
     which allows for multiple authors, or through a YAML metadata block:
 
         ---
@@ -1016,8 +1041,22 @@ depending on the output format, but include metadata fields as well as the follo
         - Peter Abelard
         ...
 
+`subtitle`
+:   document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;
+    renders in LaTeX only when using a document class that supports
+    `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,
+    `scrreprt`, `scrbook`).[^subtitle]
+
+`institute`
+:   author affiliations (in LaTeX and Beamer only).  Can be a
+    list, when there are multiple authors.
+
 `abstract`
-:   allows for specification of document summary in LaTeX and Word docx
+:   document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
+
+`keywords`
+:   list of keywords to be included in HTML, PDF, and AsciiDoc metadata;
+    may be repeated as for `author`, above
 
 `header-includes`
 :   contents specified by `-H/--include-in-header` (may have multiple
@@ -1026,6 +1065,9 @@ depending on the output format, but include metadata fields as well as the follo
 `toc`
 :   non-null value if `--toc/--table-of-contents` was specified
 
+`toc-title`
+:   title of table of contents (works only with EPUB and docx)
+
 `include-before`
 :   contents specified by `-B/--include-before-body` (may have
     multiple values)
@@ -1037,6 +1079,18 @@ depending on the output format, but include metadata fields as well as the follo
 `body`
 :   body of document
 
+`meta-json`
+:   JSON representation of all of the document's metadata
+
+[^subtitle]: To make `subtitle` work with other LaTeX
+    document classes, you can add the following to `header-includes`:
+
+        \providecommand{\subtitle}[1]{%
+          \usepackage{titling}
+          \posttitle{%
+            \par\large#1\end{center}}
+        }
+
 Language variables
 ------------------
 
@@ -1047,12 +1101,21 @@ Language variables
     format stored in the additional variables `babel-lang`,
     `polyglossia-lang` (LaTeX) and `context-lang` (ConTeXt).
 
+    Native pandoc `span`s and `div`s with the lang attribute
+    (value in BCP 47) can be used to switch the language in
+    that range.
+
 `otherlangs`
 :   a list of other languages used in the document
     in the YAML metadata, according to [BCP 47]. For example:
     `otherlangs: [en-GB, fr]`.
-    Currently only used by `xelatex` through the generated
-    `polyglossia-otherlangs` variable.
+    This is automatically generated from the `lang` attributes
+    in all `span`s and `div`s but can be overridden.
+    Currently only used by LaTeX through the generated
+    `babel-otherlangs` and `polyglossia-otherlangs` variables.
+    The LaTeX writer outputs polyglossia commands in the text but
+    the `babel-newcommands` variable contains mappings for them
+    to the corresponding babel.
 
 `dir`
 :   the base direction of the document, either `rtl` (right-to-left)
@@ -1065,10 +1128,6 @@ Language variables
     (e.g. the browser, when generating HTML) supports the
     [Unicode Bidirectional Algorithm].
 
-    LaTeX and ConTeXt assume by default that all text is left-to-right.
-    Setting `dir: ltr` enables bidirectional text handling in a document
-    whose base direction is left-to-right but contains some right-to-left script.
-
     When using LaTeX for bidirectional documents, only the `xelatex` engine
     is fully supported (use `--latex-engine=xelatex`).
 
@@ -1097,6 +1156,15 @@ including all [reveal.js configuration options].
 `theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`
 :   themes for LaTeX [`beamer`] documents
 
+`navigation`
+:   controls navigation symbols in `beamer` documents
+    (default is `empty` for no navigation symbols; other valid values
+    are `frame`, `vertical`, and `horizontal`).
+
+`section-titles`
+:   enables on "title pages" for new sections in `beamer`
+    documents (default = true).
+
 [reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration
 
 Variables for LaTeX
@@ -1104,60 +1172,67 @@ Variables for LaTeX
 
 LaTeX variables are used when [creating a PDF].
 
+`papersize`
+:   paper size, e.g. `letter`, `A4`
+
 `fontsize`
-:   font size (e.g. `10pt`, `12pt`) for LaTeX documents
+:   font size for body text (e.g. `10pt`, `12pt`)
 
 `documentclass`
-:   document class for LaTeX documents, e.g. [`article`], [`report`], [`book`], [`memoir`]
+:   document class, e.g. [`article`], [`report`], [`book`], [`memoir`]
 
 `classoption`
-:   option for LaTeX document class, e.g. `oneside`; may be repeated
+:   option for document class, e.g. `oneside`; may be repeated
     for multiple options
 
 `geometry`
-:   option for LaTeX [`geometry`] package, e.g. `margin=1in`;
+:   option for [`geometry`] package, e.g. `margin=1in`;
     may be repeated for multiple options
 
+`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
+:   sets margins, if `geometry` is not used (otherwise `geometry`
+    overrides these)
+
 `linestretch`
-:   adjusts line spacing in LaTeX documents using the [`setspace`]
+:   adjusts line spacing using the [`setspace`]
     package, e.g. `1.25`, `1.5`
 
 `fontfamily`
-:   font package for LaTeX documents (with `pdflatex`):
+:   font package for use with `pdflatex`:
     [TeX Live] includes many options, documented in the [LaTeX Font Catalogue].
     The default is [Latin Modern][`lm`].
 
 `fontfamilyoptions`
 :   options for package used as `fontfamily`: e.g. `osf,sc` with
     `fontfamily` set to [`mathpazo`] provides Palatino with old-style
-    figures and true small caps
+    figures and true small caps; may be repeated for multiple options
 
 `mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
-:   fonts for LaTeX documents (works only with `xelatex` and
-    `lualatex`): takes the name of any system font, using the
+:   font families for use with `xelatex` or
+    `lualatex`: take the name of any system font, using the
     [`fontspec`] package.  Note that if `CJKmainfont` is used,
     the [`xecjk`] package must be available.
 
 `mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
 :   options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
-    `CJKmainfont` in `xelatex` and `lualatex`.  Allows for any choices
+    `CJKmainfont` in `xelatex` and `lualatex`.  Allow for any choices
     available through [`fontspec`], such as the OpenType features
-    `Numbers=OldStyle,Numbers=Proportional`.
+    `Numbers=OldStyle,Numbers=Proportional`. May be repeated for multiple options.
 
 `fontenc`
 :   allows font encoding to be specified through `fontenc` package (with `pdflatex`);
     default is `T1` (see guide to [LaTeX font encodings])
 
-`linkcolor`, `toccolor`, `urlcolor`, `citecolor`
-:   color for internal links, links in table of contents, external links,
-    and citation links in LaTeX documents, using options available through
-    [`color`] package, e.g. `red`, `green`, `magenta`, `cyan`, `blue`, `black`
+`colorlinks`
+:   add color to link text; automatically enabled if any of `linkcolor`, `citecolor`,
+    `urlcolor`, or `toccolor` are set
 
-`hidelinks`
-:   enables `hidelinks` option for [`hyperref`], disabling link color
+`linkcolor`, `citecolor`, `urlcolor`, `toccolor`
+:   color for internal links, citation links, external links, and links in table of contents:
+    uses any of the [predefined LaTeX colors]
 
 `links-as-notes`
-:   causes links to be printed as footnotes in LaTeX documents
+:   causes links to be printed as footnotes
 
 `indent`
 :   uses document class settings for indentation (the default LaTeX template
@@ -1167,35 +1242,100 @@ LaTeX variables are used when [creating a PDF].
 :   disables default behavior of LaTeX template that redefines (sub)paragraphs
     as sections, changing the appearance of nested headings in some classes
 
+`thanks`
+:   specifies contents of acknowledgments footnote after document title.
+
 `toc`
-:   include table of contents in LaTeX documents
+:   include table of contents (can also be set using `--toc/--table-of-contents`)
 
 `toc-depth`
-:   level of section to include in table of contents in LaTeX documents
-
-`toc-title`
-:   title of table of contents (works only with EPUB and docx)
-
-`lof`
-:   include list of figures in LaTeX documents
+:   level of section to include in table of contents
 
-`lot`
-:   include list of tables in LaTeX documents
+`lof`, `lot`
+:   include list of figures, list of tables
 
 `bibliography`
 :   bibliography to use for resolving references
 
 `biblio-style`
-:   bibliography style in LaTeX, when used with `--natbib`
+:   bibliography style, when used with `--natbib` and
+    `--biblatex`.
+
+`biblatexoptions`
+:   list of options for biblatex.
 
 [`article`]: https://ctan.org/pkg/article
 [`report`]: https://ctan.org/pkg/report
 [`book`]: https://ctan.org/pkg/book
+[KOMA-Script]: https://ctan.org/pkg/koma-script
 [`memoir`]: https://ctan.org/pkg/memoir
+[predefined LaTeX colors]: https://en.wikibooks.org/wiki/LaTeX/Colors#Predefined_colors
 [LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/
 [`mathpazo`]: https://ctan.org/pkg/mathpazo
 [LaTeX font encodings]: https://ctan.org/pkg/encguide
 
+Variables for ConTeXt
+---------------------
+
+`papersize`
+:   paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);
+    may be repeated for multiple options
+
+`layout`
+:   options for page margins and text arrangement (see [ConTeXt Layout]);
+    may be repeated for multiple options
+
+`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
+:   sets margins, if `layout` is not used (otherwise `layout`
+    overrides these)
+
+`fontsize`
+:   font size for body text (e.g. `10pt`, `12pt`)
+
+`mainfont`, `sansfont`, `monofont`, `mathfont`
+:   font families: take the name of any system font (see [ConTeXt Font Switching])
+
+`linkcolor`, `contrastcolor`
+:   color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
+
+`linkstyle`
+:   typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
+
+`indenting`
+:   controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
+    may be repeated for multiple options
+
+`whitespace`
+:   spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
+
+`interlinespace`
+:   adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
+    may be repeated for multiple options
+
+`headertext`, `footertext`
+:   text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
+    may be repeated up to four times for different placement
+
+`pagenumbering`
+:   page number style and location (using [`setuppagenumbering`]);
+    may be repeated for multiple options
+
+`toc`
+:   include table of contents (can also be set using `--toc/--table-of-contents`)
+
+`lof`, `lot`
+:   include list of figures, list of tables
+
+[ConTeXt Paper Setup]: http://wiki.contextgarden.net/PaperSetup
+[ConTeXt Layout]: http://wiki.contextgarden.net/Layout
+[ConTeXt Font Switching]: http://wiki.contextgarden.net/Font_Switching
+[ConTeXt Color]: http://wiki.contextgarden.net/Color
+[ConTeXt Headers and Footers]: http://wiki.contextgarden.net/Headers_and_Footers
+[ConTeXt Indentation]: http://wiki.contextgarden.net/Indentation
+[`setupwhitespace`]: http://wiki.contextgarden.net/Command/setupwhitespace
+[`setupinterlinespace`]: http://wiki.contextgarden.net/Command/setupinterlinespace
+[`setuppagenumbering`]: http://wiki.contextgarden.net/Command/setuppagenumbering
+
 Variables for man pages
 -----------------------
 
@@ -1266,18 +1406,18 @@ pandoc release.
 
 [pandoc-templates]: https://github.com/jgm/pandoc-templates
 
-Pandoc's markdown
+Pandoc's Markdown
 =================
 
 Pandoc understands an extended and slightly revised version of
-John Gruber's [markdown] syntax.  This document explains the syntax,
-noting differences from standard markdown. Except where noted, these
+John Gruber's [Markdown] syntax.  This document explains the syntax,
+noting differences from standard Markdown. Except where noted, these
 differences can be suppressed by using the `markdown_strict` format instead
 of `markdown`.  An extensions can be enabled by adding `+EXTENSION`
 to the format name and disabled by adding `-EXTENSION`. For example,
-`markdown_strict+footnotes` is strict markdown with footnotes
+`markdown_strict+footnotes` is strict Markdown with footnotes
 enabled, while `markdown-footnotes-pipe_tables` is pandoc's
-markdown without footnotes or pipe tables.
+Markdown without footnotes or pipe tables.
 
 Philosophy
 ----------
@@ -1294,7 +1434,7 @@ This principle has guided pandoc's decisions in finding syntax for
 tables, footnotes, and other extensions.
 
 There is, however, one respect in which pandoc's aims are different
-from the original aims of markdown.  Whereas markdown was originally
+from the original aims of Markdown.  Whereas Markdown was originally
 designed with HTML generation in mind, pandoc is designed for multiple
 output formats.  Thus, while pandoc allows the embedding of raw HTML,
 it discourages it, and provides other, non-HTMLish ways of representing
@@ -1351,7 +1491,7 @@ As with setext-style headers, the header text can contain formatting:
 
 #### Extension: `blank_before_header` ####
 
-Standard markdown syntax does not require a blank line before a header.
+Standard Markdown syntax does not require a blank line before a header.
 Pandoc does require this (except, of course, at the beginning of the
 document). The reason for the requirement is that it is all too easy for a
 `#` to end up at the beginning of a line by accident (perhaps through line
@@ -1418,11 +1558,11 @@ Thus, for example,
 
   Header                            Identifier
   -------------------------------   ----------------------------
-  Header identifiers in HTML        `header-identifiers-in-html`
-  *Dogs*?--in *my* house?           `dogs--in-my-house`
-  [HTML], [S5], or [RTF]?           `html-s5-or-rtf`
-  3. Applications                   `applications`
-  33                                `section`
+  `Header identifiers in HTML`      `header-identifiers-in-html`
+  `*Dogs*?--in *my* house?`         `dogs--in-my-house`
+  `[HTML], [S5], or [RTF]?`         `html-s5-or-rtf`
+  `3. Applications`                 `applications`
+  `33`                              `section`
 
 These rules should, in most cases, allow one to determine the identifier
 from the header text. The exception is when several headers have the
@@ -1523,7 +1663,7 @@ block in a block quote, you need five spaces after the `>`:
 
 #### Extension: `blank_before_blockquote` ####
 
-Standard markdown syntax does not require a blank line before a block
+Standard Markdown syntax does not require a blank line before a block
 quote.  Pandoc does require this (except, of course, at the beginning of the
 document). The reason for the requirement is that it is all too easy for a
 `>` to end up at the beginning of a line by accident (perhaps through line
@@ -1557,7 +1697,7 @@ Note: blank lines in the verbatim text need not begin with four spaces.
 
 #### Extension: `fenced_code_blocks` ####
 
-In addition to standard indented code blocks, Pandoc supports
+In addition to standard indented code blocks, pandoc supports
 *fenced* code blocks.  These begin with a row of three or more
 tildes (`~`) and end with a row of tildes that must be at least as long as
 the starting row. Everything between these lines is treated as code. No
@@ -1642,7 +1782,7 @@ Line blocks
 A line block is a sequence of lines beginning with a vertical bar (`|`)
 followed by a space.  The division into lines will be preserved in
 the output, as will any leading spaces; otherwise, the lines will
-be formatted as markdown.  This is useful for verse and addresses:
+be formatted as Markdown.  This is useful for verse and addresses:
 
     | The limerick packs laughs anatomical
     | In space that is quite economical.
@@ -1696,7 +1836,7 @@ line (after the bullet):
       list item.
     * and my second.
 
-But markdown also allows a "lazy" format:
+But Markdown also allows a "lazy" format:
 
     * here is my first
     list item.
@@ -1732,7 +1872,7 @@ one tab:
         + broccoli
         + chard
 
-As noted above, markdown allows you to write list items "lazily," instead of
+As noted above, Markdown allows you to write list items "lazily," instead of
 indenting continuation lines. However, if there are multiple paragraphs or
 other blocks in a list item, the first line of each must be indented.
 
@@ -1746,18 +1886,18 @@ other blocks in a list item, the first line of each must be indented.
     list item.
 
 **Note:**  Although the four-space rule for continuation paragraphs
-comes from the official [markdown syntax guide], the reference implementation,
+comes from the official [Markdown syntax guide], the reference implementation,
 `Markdown.pl`, does not follow it. So pandoc will give different results than
 `Markdown.pl` when authors have indented continuation paragraphs fewer than
 four spaces.
 
-The [markdown syntax guide] is not explicit whether the four-space
+The [Markdown syntax guide] is not explicit whether the four-space
 rule applies to *all* block-level content in a list item; it only
 mentions paragraphs and code blocks.  But it implies that the rule
 applies to all block-level content (including nested lists), and
 pandoc interprets it that way.
 
-  [markdown syntax guide]:
+  [Markdown syntax guide]:
     http://daringfireball.net/projects/markdown/syntax#list
 
 ### Ordered lists ###
@@ -1765,7 +1905,7 @@ pandoc interprets it that way.
 Ordered lists work just like bulleted lists, except that the items
 begin with enumerators rather than bullets.
 
-In standard markdown, enumerators are decimal numbers followed
+In standard Markdown, enumerators are decimal numbers followed
 by a period and a space.  The numbers themselves are ignored, so
 there is no difference between this list:
 
@@ -1781,7 +1921,7 @@ and this one:
 
 #### Extension: `fancy_lists` ####
 
-Unlike standard markdown, Pandoc allows ordered list items to be marked
+Unlike standard Markdown, pandoc allows ordered list items to be marked
 with uppercase and lowercase letters and roman numerals, in addition to
 arabic numerals. List markers may be enclosed in parentheses or followed by a
 single right-parentheses or period. They must be separated from the
@@ -1868,7 +2008,7 @@ 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 other markdown lists, you can "lazily" omit indentation except
+as with other Markdown lists, you can "lazily" omit indentation except
 at the beginning of a paragraph or other block element:
 
     Term 1
@@ -1940,14 +2080,14 @@ cases" involving lists.  Consider this source:
     +   Third
 
 Pandoc transforms this into a "compact list" (with no `<p>` tags around
-"First", "Second", or "Third"), while markdown puts `<p>` tags around
+"First", "Second", or "Third"), while Markdown puts `<p>` tags around
 "Second" and "Third" (but not "First"), because of the blank space
 around "Third". Pandoc follows a simple rule: if the text is followed by
 a blank line, it is treated as a paragraph. Since "Second" is followed
 by a list, and not a blank line, it isn't treated as a paragraph. The
 fact that the list is followed by a blank line is irrelevant. (Note:
 Pandoc works this way even when the `markdown_strict` format is specified. This
-behavior is consistent with the official markdown syntax description,
+behavior is consistent with the official Markdown syntax description,
 even though it is different from that of `Markdown.pl`.)
 
 
@@ -1960,7 +2100,7 @@ What if you want to put an indented code block after a list?
 
         { my code block }
 
-Trouble! Here pandoc (like other markdown implementations) will treat
+Trouble! Here pandoc (like other Markdown implementations) will treat
 `{ my code block }` as the second paragraph of item two, and not as
 a code block.
 
@@ -2088,7 +2228,7 @@ These work like simple tables, but with the following differences:
 In multiline tables, the table parser pays attention to the widths of
 the columns, and the writers try to reproduce these relative widths in
 the output. So, if you find that one of the columns is too narrow in the
-output, try widening it in the markdown source.
+output, try widening it in the Markdown source.
 
 Headers may be omitted in multiline tables as well as simple tables:
 
@@ -2160,12 +2300,13 @@ legal (though ugly) pipe table:
     orange|3.09
 
 The cells of pipe tables cannot contain block elements like paragraphs
-and lists, and cannot span multiple lines.  Note also that in LaTeX/PDF
-output, the cells produced by pipe tables will not wrap, since there
-is no information available about relative widths.  If you want content
-to wrap within cells, use multiline or grid tables.
+and lists, and cannot span multiple lines.  If a pipe table contains a
+row whose printable content is wider than the column width (see
+`--columns`), then the cell contents will wrap, with the
+relative cell widths determined by the widths of the separator
+lines.
 
-Note:  Pandoc also recognizes pipe tables of the following
+Note:  pandoc also recognizes pipe tables of the following
 form, as can be produced by Emacs' orgtbl-mode:
 
     | One | Two   |
@@ -2266,7 +2407,7 @@ hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
 document, but if it is not at the beginning, it must be preceded by a blank
 line.  (Note that, because of the way pandoc concatenates input files when
 several are provided, you may also keep the metadata in a separate YAML file
-and pass it to pandoc as an argument, along with your markdown files:
+and pass it to pandoc as an argument, along with your Markdown files:
 
     pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
 
@@ -2275,7 +2416,7 @@ Just be sure that the YAML file begins with `---` and ends with `---` or
 
 Metadata will be taken from the fields of the YAML object and added to any
 existing document metadata.  Metadata can contain lists and objects (nested
-arbitrarily), but all string scalars will be interpreted as markdown.  Fields
+arbitrarily), but all string scalars will be interpreted as Markdown.  Fields
 with names ending in an underscore will be ignored by pandoc.  (They may be
 given a role by external processors.)
 
@@ -2283,7 +2424,7 @@ A document may contain multiple metadata blocks.  The metadata fields will
 be combined through a *left-biased union*:  if two metadata blocks attempt
 to set the same field, the value from the first block will be taken.
 
-When pandoc is used with `-t markdown` to create a markdown document,
+When pandoc is used with `-t markdown` to create a Markdown document,
 a YAML metadata block will be produced only if the `-s/--standalone`
 option is used.  All of the metadata will appear in a single block
 at the beginning of the document.
@@ -2310,7 +2451,7 @@ when the field contains blank lines:
 
 Template variables will be set automatically from the metadata.  Thus, for
 example, in writing HTML, the variable `abstract` will be set to the HTML
-equivalent of the markdown in the `abstract` field:
+equivalent of the Markdown in the `abstract` field:
 
     <p>This is the abstract.</p>
     <p>It consists of two paragraphs.</p>
@@ -2347,12 +2488,12 @@ instead of
 
     <strong>hello</strong>
 
-This rule is easier to remember than standard markdown's rule,
+This rule is easier to remember than standard Markdown's rule,
 which allows only the following characters to be backslash-escaped:
 
     \`*_{}[]()>#+-.!
 
-(However, if the `markdown_strict` format is used, the standard markdown rule
+(However, if the `markdown_strict` format is used, the standard Markdown rule
 will be used.)
 
 A backslash-escaped space is parsed as a nonbreaking space.  It will
@@ -2362,7 +2503,7 @@ appear in TeX output as `~` and in HTML and XML as `\&#160;` or
 A backslash-escaped newline (i.e. a backslash occurring at the end of
 a line) is parsed as a hard line break.  It will appear in TeX output as
 `\\` and in HTML as `<br />`.  This is a nice alternative to
-markdown's "invisible" way of indicating hard line breaks using
+Markdown's "invisible" way of indicating hard line breaks using
 two trailing spaces on a line.
 
 Backslash escapes do not work in verbatim contexts.
@@ -2377,8 +2518,9 @@ correct output, converting straight quotes to curly quotes, `---` to
 em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces
 are inserted after certain abbreviations, such as "Mr."
 
-Note:  if your LaTeX template calls for the [`csquotes`] package, pandoc will
-detect this automatically and use `\enquote{...}` for quoted text.
+Note:  if your LaTeX template or any included header file call for the
+[`csquotes`] package, pandoc will detect this automatically and use
+`\enquote{...}` for quoted text.
 
 Inline formatting
 -----------------
@@ -2454,7 +2596,7 @@ of consecutive backticks (optionally followed by a space)
 and ends with a string of the same number of backticks (optionally
 preceded by a space).
 
-Note that backslash-escapes (and other markdown constructs) do not
+Note that backslash-escapes (and other Markdown constructs) do not
 work in verbatim contexts:
 
     This is a backslash followed by an asterisk: `\*`.
@@ -2587,7 +2729,7 @@ Raw HTML
 Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
 (except verbatim contexts, where `<`, `>`, and `&` are interpreted
 literally).  (Technically this is not an extension, since standard
-markdown allows it, but it has been made an extension so that it can
+Markdown allows it, but it has been made an extension so that it can
 be disabled if desired.)
 
 The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
@@ -2596,15 +2738,15 @@ formats.
 
 #### Extension: `markdown_in_html_blocks` ####
 
-Standard markdown allows you to include HTML "blocks":  blocks
+Standard Markdown allows you to include HTML "blocks":  blocks
 of HTML between balanced tags that are separated from the surrounding text
 with blank lines, and start and end at the left margin.  Within
-these blocks, everything is interpreted as HTML, not markdown;
+these blocks, everything is interpreted as HTML, not Markdown;
 so (for example), `*` does not signify emphasis.
 
 Pandoc behaves this way when the `markdown_strict` format is used; but
-by default, pandoc interprets material between HTML block tags as markdown.
-Thus, for example, Pandoc will turn
+by default, pandoc interprets material between HTML block tags as Markdown.
+Thus, for example, pandoc will turn
 
     <table>
     <tr>
@@ -2625,12 +2767,12 @@ into
 whereas `Markdown.pl` will preserve it as is.
 
 There is one exception to this rule:  text between `<script>` and
-`<style>` tags is not interpreted as markdown.
+`<style>` tags is not interpreted as Markdown.
 
-This departure from standard markdown should make it easier to mix
-markdown with HTML block elements.  For example, one can surround
-a block of markdown text with `<div>` tags without preventing it
-from being interpreted as markdown.
+This departure from standard Markdown should make it easier to mix
+Markdown with HTML block elements.  For example, one can surround
+a block of Markdown text with `<div>` tags without preventing it
+from being interpreted as Markdown.
 
 #### Extension: `native_divs` ####
 
@@ -2668,7 +2810,7 @@ Note that in LaTeX environments, like
     \end{tabular}
 
 the material between the begin and end tags will be interpreted as raw
-LaTeX, not as markdown.
+LaTeX, not as Markdown.
 
 Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
 and ConTeXt.
@@ -2764,7 +2906,7 @@ empty:
 
     [my website]: http://foo.bar.baz
 
-Note:  In `Markdown.pl` and most other markdown implementations,
+Note:  In `Markdown.pl` and most other Markdown implementations,
 reference link definitions cannot occur in nested constructions
 such as list items or block quotes.  Pandoc lifts this arbitrary
 seeming restriction.  So the following is fine in pandoc, though
@@ -2831,13 +2973,56 @@ nonbreaking space after the image:
 
     ![This image won't be a figure](/url/of/image.png)\ 
 
+#### Extension: `link_attributes` ####
+
+Attributes can be set on links and images:
+
+    An inline ![image](foo.jpg){#id .class width=30 height=20px}
+    and a reference ![image][ref] with attributes.
+
+    [ref]: foo.jpg "optional title" {#id .class key=val key2="val 2"}
+
+(This syntax is compatible with [PHP Markdown Extra] when only `#id`
+and `.class` are used.)
+
+For HTML and EPUB, all attributes except `width` and `height` (but
+including `srcset` and `sizes`) are passed through as is. The other
+writers ignore attributes that are not supported by their output
+format.
+
+The `width` and `height` attributes on images are treated specially. When
+used without a unit, the unit is assumed to be pixels. However, any of
+the following unit identifiers can be used: `px`, `cm`, `mm`, `in`, `inch`
+and `%`. There must not be any spaces between the number and the unit.
+For example:
+
+```
+![](file.jpg){ width=50% }
+```
+
+- Dimensions are converted to inches for output in page-based formats like
+  LaTeX. Dimensions are converted to pixels for output in HTML-like
+  formats.  Use the `--dpi` option to specify the number of pixels per
+  inch.  The default is 96dpi.
+- The `%` unit is generally relative to some available space.
+  For example the above example will render to
+  `<img href="file.jpg" style="width: 50%;" />` (HTML),
+  `\includegraphics[width=0.5\textwidth]{file.jpg}` (LaTeX), or
+  `\externalfigure[file.jpg][width=0.5\textwidth]` (ConTeXt).
+- Some output formats have a notion of a class
+  ([ConTeXt](http://wiki.contextgarden.net/Using_Graphics#Multiple_Image_Settings))
+  or a unique identifier (LaTeX `\caption`), or both (HTML).
+- When no `width` or `height` attributes are specified, the fallback
+  is to look at the image resolution and the dpi metadata embedded in
+  the image file.
+
 
 Footnotes
 ---------
 
 #### Extension: `footnotes` ####
 
-Pandoc's markdown allows footnotes, using the following syntax:
+Pandoc's Markdown allows footnotes, using the following syntax:
 
     Here is a footnote reference,[^1] and another.[^longnote]
 
@@ -2892,8 +3077,8 @@ In order to use this feature, you will need to specify a bibliography file
 using the `bibliography` metadata field in a YAML metadata section, or
 `--bibliography` command line argument. You can supply multiple `--bibliography`
 arguments or set `bibliography` metadata field to YAML array, if you want to
-use multiple bibliography files.
-The bibliography may have any of these formats:
+use multiple bibliography files.  The bibliography may have any of these
+formats:
 
   Format            File extension
   ------------      --------------
@@ -2916,7 +3101,7 @@ Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
 can produce `.json` and `.yaml` files from any of the supported formats.
 
 In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc parses
-a subset of LaTeX markup; in CSL YAML databases, pandoc markdown; and in CSL JSON databases, an [HTML-like markup][CSL markup specs]:
+a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown; and in CSL JSON databases, an [HTML-like markup][CSL markup specs]:
 
 `<i>...</i>`
 :   italics
@@ -2939,7 +3124,8 @@ a subset of LaTeX markup; in CSL YAML databases, pandoc markdown; and in CSL JSO
 `pandoc-citeproc -j` and `-y` interconvert the CSL JSON
 and CSL YAML formats as far as possible.
 
-As an alternative to specifying a bibliography file, you can include
+As an alternative to specifying a bibliography file using `--bibliography`
+or the YAML metadata field `bibliography`, you can include
 the citation data directly in the `references` field of the
 document's YAML metadata. The field should contain an array of
 YAML-encoded references, for example:
@@ -2979,6 +3165,9 @@ These files are specified using the `--csl` option or the `csl` metadata field.
 By default, `pandoc-citeproc` will use the [Chicago Manual of Style] author-date
 format.  The CSL project provides further information on [finding and editing styles].
 
+To make your citations hyperlinks to the corresponding bibliography
+entries, add `link-citations: true` to your YAML metadata.
+
 Citations go inside square brackets and are separated by semicolons.
 Each citation must have a key, composed of '@' + the citation
 identifier from the database, and may optionally have a prefix,
@@ -3048,20 +3237,23 @@ outlined above, and add `--natbib` or `--biblatex` argument to `pandoc`
 invocation. Bear in mind that bibliography files have to be in respective
 format (either BibTeX or BibLaTeX).
 
+For more information, see the [pandoc-citeproc man page].
+
 [CSL markup specs]: http://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
 [Chicago Manual of Style]: http://chicagomanualofstyle.org
 [Citation Style Language]: http://citationstyles.org
 [Zotero Style Repository]: https://www.zotero.org/styles
 [finding and editing styles]: http://citationstyles.org/styles/
 [CSL locale files]: https://github.com/citation-style-language/locales
+[pandoc-citeproc man page]: https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md
 
 Non-pandoc extensions
 ---------------------
 
-The following markdown syntax extensions are not enabled by default
+The following Markdown syntax extensions are not enabled by default
 in pandoc, but may be enabled by adding `+EXTENSION` to the format
 name, where `EXTENSION` is the name of the extension.  Thus, for
-example, `markdown+hard_line_breaks` is markdown with hard line breaks.
+example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
 
 #### Extension: `lists_without_preceding_blankline` ####
 
@@ -3080,6 +3272,18 @@ treated as spaces or as hard line breaks.  This option is intended for
 use with East Asian languages where spaces are not used between words,
 but text is divided into lines for readability.
 
+#### Extension: `east_asian_line_breaks` ####
+
+Causes newlines within a paragraph to be ignored, rather than
+being treated as spaces or as hard line breaks, when they occur
+between two East Asian wide characters.  This is a better choice
+than `ignore_line_breaks` for texts that include a mix of East
+Asian wide characters and other characters.
+
+##### Extension: `emoji` ####
+
+Parses textual emojis like `:smile:` as Unicode emoticons.
+
 #### Extension: `tex_math_single_backslash` ####
 
 Causes anything between `\(` and `\)` to be interpreted as inline
@@ -3095,8 +3299,8 @@ as display TeX math.
 
 #### Extension: `markdown_attribute` ####
 
-By default, pandoc interprets material inside block-level tags as markdown.
-This extension changes the behavior so that markdown is only parsed
+By default, pandoc interprets material inside block-level tags as Markdown.
+This extension changes the behavior so that Markdown is only parsed
 inside block-level tags if the tags have the attribute `markdown=1`.
 
 #### Extension: `mmd_title_block` ####
@@ -3137,11 +3341,16 @@ Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
 Accents are stripped off of accented latin letters, and non-latin
 letters are omitted.
 
-#### Extension: `link_attributes` ####
+#### Extension: `mmd_link_attributes` ####
+
+Parses multimarkdown style key-value attributes on link
+and image references. This extension should not be confused with the
+[`link_attributes`](#extension-link_attributes) extension.
+
+    This is a reference ![image][ref] with multimarkdown attributes.
 
-Parses multimarkdown style key-value attributes on link and image references.
-Note that pandoc's internal document model provides nowhere to put
-these, so they are presently just ignored.
+    [ref]: http://path.to/image "Image title" width=20px height=30px
+           id=myId class="myClass1 myClass2"
 
 #### Extension: `mmd_header_identifiers` ####
 
@@ -3178,23 +3387,23 @@ in several respects:
 Markdown variants
 -----------------
 
-In addition to pandoc's extended markdown, the following markdown
+In addition to pandoc's extended Markdown, the following Markdown
 variants are supported:
 
 `markdown_phpextra` (PHP Markdown Extra)
 :   `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
     `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
-    `header_attributes`, `abbreviations`, `shortcut_reference_links`.
+    `header_attributes`, `link_attributes`, `abbreviations`,
+    `shortcut_reference_links`.
 
 `markdown_github` (GitHub-Flavored Markdown)
-:   `pipe_tables`, `raw_html`, `tex_math_single_backslash`,
-    `fenced_code_blocks`, `auto_identifiers`,
+:   `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`,
     `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
-    `intraword_underscores`, `strikeout`, `hard_line_breaks`,
+    `intraword_underscores`, `strikeout`, `hard_line_breaks`, `emoji`,
     `shortcut_reference_links`.
 
 `markdown_mmd` (MultiMarkdown)
-:   `pipe_tables` `raw_html`, `markdown_attribute`, `link_attributes`,
+:   `pipe_tables`, `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
     `raw_tex`, `tex_math_double_backslash`, `intraword_underscores`,
     `mmd_title_block`, `footnotes`, `definition_lists`,
     `all_symbols_escapable`, `implicit_header_references`,
@@ -3204,11 +3413,11 @@ variants are supported:
 `markdown_strict` (Markdown.pl)
 :   `raw_html`
 
-Extensions with formats other than markdown
+Extensions with formats other than Markdown
 -------------------------------------------
 
 Some of the extensions discussed above can be used with formats
-other than markdown:
+other than Markdown:
 
 * `auto_identifiers` can be used with `latex`, `rst`, `mediawiki`,
   and `textile` input (and is used by default).
@@ -3218,15 +3427,15 @@ other than markdown:
   (This is handy for reading web pages formatted using MathJax,
   for example.)
 
-Producing slide shows with Pandoc
+Producing slide shows with pandoc
 =================================
 
-You can use Pandoc to produce an HTML + javascript slide presentation
+You can use pandoc to produce an HTML + javascript slide presentation
 that can be viewed via a web browser.  There are five ways to do this,
 using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
 You can also produce a PDF slide show using LaTeX [`beamer`].
 
-Here's the markdown source for a simple slide show, `habits.txt`:
+Here's the Markdown source for a simple slide show, `habits.txt`:
 
     % Habits
     % John Doe
@@ -3394,12 +3603,12 @@ Speaker notes
 -------------
 
 reveal.js has good support for speaker notes.  You can add notes to your
-markdown document thus:
+Markdown document thus:
 
     <div class="notes">
     This is my note.
 
-    - It can contain markdown
+    - It can contain Markdown
     - like this list
 
     </div>
@@ -3423,11 +3632,14 @@ the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
 `allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
 `shrink`.
 
+Creating EPUBs with pandoc
+==========================
+
 EPUB Metadata
-=============
+-------------
 
 EPUB metadata may be specified using the `--epub-metadata` option, but
-if the source document is markdown, it is better to use a [YAML metadata
+if the source document is Markdown, it is better to use a [YAML metadata
 block][Extension: `yaml_metadata_block`].  Here is an example:
 
     ---
@@ -3514,6 +3726,21 @@ The following fields are recognized:
 [MARC relators]: http://loc.gov/marc/relators/relaterm.html
 [`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
 
+Linked media
+------------
+
+By default, pandoc will download linked media (including audio and
+video) and include it in the EPUB container, yielding a completely
+self-contained EPUB.  If you want to link to external media resources
+instead, use raw HTML in your source and add `data-external="1"` to the tag
+with the `src` attribute.  For example:
+
+    <audio controls="1">
+      <source src="http://example.com/music/toccata.mp3"
+              data-external="1" type="audio/mpeg">
+      </source>
+    </audio>
+
 Literate Haskell support
 ========================
 
@@ -3522,12 +3749,12 @@ format (`markdown`, `markdown_strict`, `rst`, or `latex` for input or output;
 `beamer`, `html` or `html5` for output only), pandoc will treat the document as
 literate Haskell source. This means that
 
-  - In markdown input, "bird track" sections will be parsed as Haskell
+  - In Markdown input, "bird track" sections will be parsed as Haskell
     code rather than block quotations.  Text between `\begin{code}`
     and `\end{code}` will also be treated as Haskell code.  For
     ATX-style headers the character '=' will be used instead of '#'.
 
-  - In markdown output, code blocks with classes `haskell` and `literate`
+  - In Markdown output, code blocks with classes `haskell` and `literate`
     will be rendered using bird tracks, and block quotations will be
     indented one space, so they will not be treated as Haskell code.
     In addition, headers will be rendered setext-style (with underlines)
@@ -3553,7 +3780,7 @@ Examples:
 
     pandoc -f markdown+lhs -t html
 
-reads literate Haskell source formatted with markdown conventions and writes
+reads literate Haskell source formatted with Markdown conventions and writes
 ordinary HTML (without bird tracks).
 
     pandoc -f markdown+lhs -t html+lhs
@@ -3615,6 +3842,7 @@ Alfred Wechselberger,
 Andreas Lööw,
 Andrew Dunning,
 Antoine Latter,
+Arata Mizuki,
 Arlo O'Keeffe,
 Artyom Kazak,
 Ben Gamari,
@@ -3686,9 +3914,9 @@ Matej Kollar,
 Mathias Schenner,
 Matthew Pickering,
 Matthias C. M. Troffaes,
+Mauro Bieg,
 Max Bolingbroke,
 Max Rydahl Andersen,
-mb21,
 Merijn Verstraaten,
 Michael Snoyman,
 Michael Thompson,
diff --git a/RELEASE-CHECKLIST b/RELEASE-CHECKLIST
index fb786a9..2c68a8e 100644
--- a/RELEASE-CHECKLIST
+++ b/RELEASE-CHECKLIST
@@ -14,13 +14,16 @@ _ Generate Windows package and copy to directory.
 
 _ Generate Mac OSX package.
 
-_ Generate Ubuntu/Debian deb package.
+_ Generate Ubuntu/Debian deb package (cd deb; make package).
 
-- Add release on github (and upload files)
+- Add release on github (use 'make changes_github' and upload files)
 
 _ Upload to HackageDB
 
-_ Update website, including short description of changes
+_ if docs don't build on Hackage:
+  'cabal install neil && neil docs --username=MYUSERNAME'
+
+_ Update website, including short description of changes ('make changes')
 
 _ Announce on pandoc-announce, pandoc-discuss
 
diff --git a/appveyor.yml b/appveyor.yml
index 00a1aab..f2fe828 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,38 +1,19 @@
-install:
-- cmd: 'git submodule update --init'
-- ps: |
-    choco install haskellplatform -version 2014.2.0.0 -y
-    # Haskell Platfrom package doesn't update PATH for the current shell instance
+cache:
+- "c:\\sr" # stack root, short paths == fewer problems
 
-    $env:Path += ";${env:ProgramFiles}\Haskell Platform\2014.2.0.0\bin"
-    $env:Path += ";${env:ProgramFiles}\Haskell Platform\2014.2.0.0\lib\extralibs\bin"
-    $env:Path += ";${env:ProgramFiles}\Haskell Platform\2014.2.0.0\mingw\bin"
-    # choco install wixtoolset
-    cabal sandbox init
-    $env:Path += ";.\.cabal-sandbox\bin"
-    cabal update
-    cabal install --force hsb2hs
+build: off
 
-build_script:
-- cmd: |
-    cabal install --force --enable-tests -fembed_data_files
+before_test:
+- curl -ostack.zip -L --insecure http://www.stackage.org/stack/windows-i386
+- 7z x stack.zip stack.exe
 
-# after_build:
-# - cmd: |
-#     cabal install -fembed_data_files pandoc-citeproc
-#     strip .\.cabal-sandbox\bin\pandoc.exe
-#     strip .\.cabal-sandbox\bin\pandoc-citeproc.exe
-#     .\.cabal-sandbox\bin\pandoc.exe -s --template data\templates\default.html -S README -o README.html
-#     .\.cabal-sandbox\bin\pandoc.exe -s --template data\templates\default.rtf COPYING -t rtf -S -o COPYING.rtf
-#     copy COPYRIGHT COPYRIGHT.txt
-#     for /f "tokens=2 delims= " %%a in ('.\.cabal-sandbox\bin\pandoc --version') do ( set "VERSION=%%a" && exit )
-#     if "%VERSION%" == "" ( echo "Error: could not determine version number." && exit /b 1 )
-#     cd windows
-#     echo Creating msi...
-#     candle -dVERSION=%VERSION% pandoc.wxs
-#     if %errorlevel% neq 0 exit /b %errorlevel%
-#     light  -sw1076 -ext WixUIExtension -ext WixUtilExtension -out pandoc-%VERSION%-windows.msi pandoc.wixobj
+clone_folder: "c:\\stack"
+environment:
+  global:
+    STACK_ROOT: "c:\\sr"
 
 test_script:
-- cmd: |
-    cabal test
+- stack setup > nul
+# The ugly echo "" hack is to avoid complaints about 0 being an invalid file
+# descriptor
+- echo "" | stack --no-terminal test
diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs
index 849448f..2ea1407 100644
--- a/benchmark/benchmark-pandoc.hs
+++ b/benchmark/benchmark-pandoc.hs
@@ -28,7 +28,7 @@ readerBench :: Pandoc
 readerBench doc (name, reader) =
   case lookup name writers of
        Just (PureStringWriter writer) ->
-         let inp = writer def{ writerWrapText = True} doc
+         let inp = writer def{ writerWrapText = WrapAuto} doc
          in return $ bench (name ++ " reader") $ nfIO $
                  (fmap handleError <$> reader def{ readerSmart = True }) inp
        _ -> trace ("\nCould not find writer for " ++ name ++ "\n") Nothing
@@ -37,7 +37,7 @@ writerBench :: Pandoc
             -> (String, WriterOptions -> Pandoc -> String)
             -> Benchmark
 writerBench doc (name, writer) = bench (name ++ " writer") $ nf
-    (writer def{ writerWrapText = True }) doc
+    (writer def{ writerWrapText = WrapAuto }) doc
 
 main :: IO ()
 main = do
diff --git a/changelog b/changelog
index 7c48d86..5db0268 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,758 @@
+pandoc (1.17.0.2)
+
+  * Fixed serious regression in `htmlInBalanced`, which caused
+    newlines to be omitted in some raw HTML blocks in Markdown
+    (#2804).
+
+pandoc (1.17.0.1)
+
+  * File scope is no longer used when there are no input files (i.e.,
+    when input comes from stdin).  Previously file scope was triggered
+    when the `json` reader was specified and input came from `stdin`,
+    and this caused no output to be produced.  (Fix due to Jesse Rosenthal;
+    thanks to Fedor Sheremetyev for calling the bug to our attention.)
+  * Improved documentation of templates (#2797).
+
+pandoc (1.17)
+
+  * Added `--file-scope` option (Jesse Rosenthal).
+    By default pandoc operates on multiple files by first concatenating
+    them (around extra line breaks) and then processing the joined file. So
+    it only parses a multi-file document at the document scope. This has the
+    benefit that footnotes and links can be in different files, but for
+    some purposes it is useful to parse the individual files first
+    and then combine their outputs (e.g. when the files use footnotes
+    or links with the same labels).  The `--file-scope` option causes
+    pandoc to parse the files first, and then combine the parsed output,
+    instead of combining before parsing. `--file-scope` is selected
+    automatically for binary input files (which cannot be concatenated)
+    and for pandoc json.
+
+  * Add TEI Writer (Chris Forster) and `tei` output format.
+
+  * Added a general `ByteStringReader` with warnings, used by the docx
+    reader (API change, Jesse Rosenthal).
+
+  * Add `readDocxWithWarnings` (API change, Jesse Rosenthal).
+
+  * Changed type of `Shared.uniqueIdent`'s argument from `[String]`
+    to `Set String.` This avoids performance problems in documents with
+    many identically named headers (API change, #2671).
+
+  * Removed `tex_math_single_backslash` from `markdown_github` options
+    (#2707).
+
+  * Make language extensions as well as full language names
+    trigger syntax highlighting.  For example, `py` will now work as
+    well as `python` (jgm/highlighting-kate#83).
+
+  * Added `institute` variable to latex, beamer templates (Fraser
+    Tweedale, Josef Svenningsson).
+
+  * Docx reader (Jesse Rosenthal):
+
+    + Handle alternate content.  Some word functions (especially graphics)
+      give various choices for content so there can be backwards compatibility.
+    + Don't turn numbered headers into lists.
+    + Docx Reader: Add state to the parser, for warnings
+    + Update feature checklist in source code.
+    + Get rid of `Modifiable` typeclass.
+    + Add tests for adjacent hyperlinks.
+    + Add a "Link" modifier to `Reducible`. We want to make sure that
+      links have their spaces removed, and are appropriately smushed
+      together (#2689).
+
+  * HTML reader:
+
+    + Fixed behavior of base tag (#2777).
+      If the base path does not end with slash, the last component
+      will be replaced.  E.g. base = `http://example.com/foo`
+      combines with `bar.html` to give `http://example.com/bar.html`.
+      If the href begins with a slash, the whole path of the base
+      is replaced.  E.g. base = `http://example.com/foo/` combines
+      with `/bar.html` to give `http://example.com/bar.html`.
+    + Rewrote `htmlInBalanced`.  This version avoids an exponential
+      performance problem with `<script>` tags, and it should be faster
+      in general (#2730).
+    + Properly handle an empty cell in a simple table (#2718).
+    + Handle multiple `<meta>` tags with same name.  Put them in a list
+      in the metadata so they are all preserved, rather than (as before)
+      throwing out all but one..
+
+  * Markdown reader:
+
+    + Improved pipe table parsing (#2765).
+    + Allow `+` separators in pipe table cells.  We already allowed
+      them in the header, but not in the body rows, for some reason.
+      This gives compatibility with org-mode tables.
+    + Don't cross line boundary parsing pipe table row.
+      Previously an Emph element could be parsed across the newline
+      at the end of the pipe table row.
+    + Use `htmlInBalanced` for `rawVerbatimBlock`, for better
+      performance (#2730).
+    + Fixed bug with smart quotes around tex math.
+
+  * LaTeX reader:
+
+    + Handle interior `$` characters in math (#2743).  For example,
+      `$$\hbox{$i$}$$`.
+    + `inlineCommand` now gobbles an empty `{}` after any command (#2687).
+      This gives better results when people write e.g. `\TeX{}` in Markdown.
+    + Properly handle LaTeX "math" environment as inline math (#2171).
+
+  * Textile reader: Support `>`, `<`, `=`, `<>` text alignment attributes.
+    Closes #2674.
+
+  * Org reader (Albert Krewinkel):
+
+    + Prefix even empty figure names with "fig:" (#2643).  The
+      convention used by pandoc for figures is to mark them by prefixing
+      the name with `fig:`.  The org reader failed to do this if a figure
+      had no name.
+    + Refactor link-target processing (#2684).
+
+  * ConTeXt writer: Fix whitespace at line beginning in line blocks (#2744).
+    Thanks to @c-foster.
+
+  * HTML writer: Don't include alignment attribute for default table columns.
+    Previously these were given "left" alignment.  Better to leave off
+    alignment attributes altogether (#2694).
+
+  * Markdown writer: Use hyphens for YAML metadata block bottom line, for
+    better compatibility with other Markdown flavors (Henrik Tramberend).
+
+  * LaTeX writer:
+
+    + Use image identifier to create a label and hypertarget for
+      figures (Mauro Bieg).
+    + Avoid double toprule in headerless table with caption (#2742).
+    + Clean up options parser (Jesse Rosenthal).
+    + Treat `memoir` template with `article` option as article, instead
+      of treating all `memoir` templates as books.
+    + Allow more flexible table alignment (Henrik Tramberend, #2665).
+      New default is not to include `[c]` option (which is the default
+      anyway if no positioning is specified).  Now LaTeX emplates can
+      control the overall table alignment in a document by setting the
+      longtable length variables `LTleft` and `LTright`.  For example,
+      `\setlength\LTleft\parindent\setlength\LTright\fill`
+      will create left-aligned tables that respect paragraph indentation.
+
+  * Docx writer: Handle image alt text (#2754, Mauro Bieg).
+
+  * Org writer - pass through RawInline with format "org".
+
+  * DokuWiki writer: use `$$` for display math.
+
+  * Custom writer: Pass attributes parameter to CaptionedImage (#2697).
+
+  * Make protocol-relative URIs work again (#2737).
+
+  * make_osx_package.sh:  Use env variable for developer id certs.
+
+  * Raise `tagsoup` lower bound to 0.13.7 to fix entity-related
+    problems (#2734).
+
+  * Allow `zip-archive` 0.3.
+
+  * Allow `aeson` 0.11.
+
+pandoc (1.16.0.2)
+
+  * Depend on deepseq rather than deepseq-generics (fpco/stackage#1096).
+
+  * Fixed regression in latex smart quote parsing (#2645).
+    In cases where a match was not found for a quote, everything
+    from the open quote to the end of the paragraph was being dropped.
+
+pandoc (1.16.0.1)
+
+  * Fixed regression with `--latex-engine` (#2618).  In 1.16 `--latex-engine`
+    raises an error if a full path is given.
+
+  * Org reader: Fix function dropping subtrees tagged `:noexport`
+    (Albert Krewinkel, #2628):
+
+  * Markdown reader: renormalize table column widths if they exceed 100%
+    (#2626).
+
+  * Textile reader:  don't allow block HTML tags in inline contexts.
+    The reader previously did allow this, following redcloth,
+    which happily parses
+
+        Html blocks can be <div>inlined</div> as well.
+
+    as
+
+        <p>Html blocks can be <div>inlined</div> as well.</p>
+
+    This is invalid HTML.  The above sample now produces;
+
+        <p>Html blocks can be</p>
+        <div>
+        <p>inlined</p>
+        </div>
+        <p>as well.</p>
+
+  * Improved default template lookup for custom lua scripts (#2625).
+    Previously, if you tried to do `pandoc -s -t /path/to/lua/script.lua`,
+    pandoc would look for the template in
+    `~/.pandoc/templates/default./path/to/lua/script.lua`.
+    With this change it will look in the more reasonable
+    `~/.pandoc/templates/default.script.lua`.  This makes it possible to
+    store default templates for custom writers.
+
+  * RST, Markdown writers: Fixed rendering of grid tables with blank rows
+    (#2615).
+
+  * LaTeX writer: restore old treatment of Span (#2624).  A Span is
+    now rendered with surrounding `{}`, as it was before 1.16.
+
+  * Entity handling fixes: improved handling of entities like
+    `&lang;` that require a trailing semicolon.  Allow uppercase
+    `x` in numerical hexidecimal character references, working
+    around a tagsoup bug.
+
+  * `stack.yaml` - use lts-4.0, but with older aeson to avoid excessive
+    memory use on compile.  With aeson 0.10 we were getting an out of
+    memory error on a 2GB Ubuntu 64-bit VM.
+
+  * Improved deb package creation script. Made `DPKGVER` work.
+    Renamed `COMMIT` to `TREE`.  You should now be able to do
+    `TREE=1.16.0.1 DPKGVER=2 make deb`.
+
+
+pandoc (1.16)
+
+  * Added `Attr` field to `Link` and `Image` (Mauro Bieg, #261, API change).
+
+    + Added syntax for link and image attributes to pandoc's Markdown.
+    + Updated readers and writers to use link and image attributes
+      when appropriate.
+    + Support image attributes in Docx, Textile, RST readers.
+
+  * Renamed link attribute extensions.  The old `link_attributes` is
+    now `mmd_link_attributes`, and `link_attributes` now enables the
+    new pandoc-style link and image attributes (API change).
+    Note: this change could break some existing workflows.
+
+  * Implemented `SoftBreak` and new `--wrap` option (#1701, API change).
+    Added threefold wrapping option.
+
+    + Command line option: deprecated `--no-wrap`, added
+      `--wrap=[auto|none|preserve]`
+    + Added `WrapOption`, exported from `Text.Pandoc.Options`
+    + Changed type of `writerWrapText` in `WriterOptions` from
+      `Bool` to `WrapOption`.
+    + Modified `Text.Pandoc.Shared` functions to allow `SoftBreak`.
+    + Supported `SoftBreak` in readers and writers.
+
+  * Text.Pandoc.Options:  Added `writerDpi` to `WriterOptions` (API
+    change, Mauro Bieg).
+
+  * Added `--dpi` command-line option (Mauro Bieg).
+
+  * Rationalized behavior of `--no-tex-ligatures` and `--smart` (#2541).
+    This change makes `--no-tex-ligatures` affect the LaTeX reader
+    as well as the LaTeX and ConTeXt writers.  If it is used,
+    the LaTeX reader will parse characters `` ` ``, `'`, and `-`
+    literally, rather than parsing ligatures for quotation marks
+    and dashes.  And the LaTeX writer will print unicode quotation
+    mark and dash characters literally, rather than converting
+    them to the standard ASCII ligatures.  Note that `--smart` has
+    no effect on the LaTeX reader.  `--smart` is still the default
+    for all input formats when LaTeX or ConTeXt is the output format,
+    *unless* `--no-tex-ligatures` is used.
+
+    Some examples to illustrate the logic:
+
+    ```
+    % echo "'hi'" | pandoc -t latex
+    `hi'
+    % echo "'hi'" | pandoc -t latex --no-tex-ligatures
+    'hi'
+    % echo "'hi'" | pandoc -t latex --no-tex-ligatures --smart
+    ‘hi’
+    % echo "'hi'" | pandoc -f latex --no-tex-ligatures
+    <p>'hi'</p>
+    % echo "'hi'" | pandoc -f latex
+    <p>’hi’</p>
+    ```
+
+  * Removed deprecated options `--offline` and `--html5`.
+
+  * Fixed language code for Czech (`cs` not `cz`) (#2597).
+
+  * Implemented `east_asian_line_breaks` extension (#2586).
+    In `Text.Pandoc.Options`, added `Ext_east_asian_line_breaks` constructor
+    to `Extension` (API change).  This extension is like
+    `ignore_line_breaks`, but smarter -- it only ignores line breaks
+    between two East Asian wide characters.  This makes it better suited
+    for writing with a mix of East Asian and non-East Asian scripts.
+
+  * Added support for PDF creation via `wkhtmltopdf`.
+    To use this: `pandoc -t html5 -o result.pdf` (and add `--mathjax`
+    if you have math.) Margins can be set using the variables
+    `margin-top`, `margin-bottom`, `margin-left`, `margin-right`.
+    Other styling can be done through CSS.
+
+  * Fixed cite key parsing regression (jgm/pandoc-citeproc#201).
+    We were capturing final colons as in `[@foo: bar]`; the citation id
+    was being parsed as `@foo:`.
+
+  * ICML writer:
+
+    + Fixed image syntax for local files (#2589).
+    + Changed type of `writeICML` (Mauro Bieg).
+      API change:  It is now `WriterOptions -> Pandoc -> IO String`.
+      Also handle new image attributes.
+    + Intersperse line breaks instead of appending them to
+      every `ParagraphStyleRange` (Mauro Bieg, #2501).
+    + Add `Cite` style to citations (Mauro Bieg).
+    + Added figure handling (#2590, Mauro Bieg).
+    + Better handling of math.  Instead of just printing the raw tex,
+      we now try to fake it with unicode characters.
+
+  * HTML writer: Include `example` class for example lists (#2524).
+
+  * ODT/OpenDocument writer: improved image attributes (Mauro Bieg).
+
+    + Support for percentage widths/heights
+    + Use `Attr` instead of title to get dimensions from ODT walker
+      to `writeOpenDocument`.
+
+  * AsciiDoc writer:
+
+    + Support anchors in spans and divs with id elements
+      (jgm/pandoc-citeproc#143).
+    + Fixed code blocks (#1861).
+
+  * Haddock writer:  omit formatting inside links, which isn't supported
+    by Haddock (#2515).
+
+  * MediaWiki writer:  Fixed spacing issues in table cells.
+
+    + Start cell on new line unless it's a single Para or Plain
+      (#2606).
+    + For single Para or Plain, insert a space after the `|` to
+      avoid problems when the text begins with a character like
+      `-` (#2604).
+
+  * Beamer writer: mark frame as fragile when it contains verbatim (#1613).
+
+  * LaTeX writer:
+
+    + Add support for GAP highlighting using listings (Raniere Silva).
+    + Consider `header-includes` content as well as templates
+      when determining whether to use csquotes (Andreas Lööw).
+    + Create defaults for geometry using `margin-left` etc.
+      If `geometry` has no value, but `margin-left`, `margin-right`,
+      `margin-top`, and/or `-margin-bottom` are given, a default value
+      for `geometry` is created from these.  Note that these variables
+      already affect PDF production via HTML5 with `wkhtmltopdf`.
+
+  * ConTeXt writer: set default layout based on `margin-left`, etc.
+    This sets up `\setuplayout` based on the variables `margin-left`,
+    `margin-right`, `margin-bottom`, and `margin-top`, if no layout
+    is given.
+
+  * Docx writer:  better handling of PDF images.  Previously we tried
+    to get the image size from the image even if an explicit size was
+    specified.  Since we still can't get image size for PDFs, this made
+    it impossible to use PDF images in docx.  Now we don't try to get
+    the image size when a size is already explicitly specified.
+
+  * Markdown writer:  use raw HTML for link/image attributes when
+    the `link_attributes` extension is unset and `raw_html` is set (#2554).
+
+  * MediaWiki reader: interpret markup inside `<tt>`, `<code>` (#2607).
+
+  * LaTeX reader:
+
+    + Improved smart quote parsing (#2555). This fixes redering of
+      unmatched quotes.
+    + Use curly quotes for unmatched ` (#2555).
+    + Allow blank space between braced arguments of commands (#2592).
+
+  * Markdown reader:
+
+    + Improved pipe table relative widths.  Previously pipe table
+      columns got relative widths (based on the header underscore lines)
+      when the source of one of the rows was greater in width than the
+      column width.  This gave bad results in some cases where much of
+      the width of the row was due to nonprinting material (e.g. link
+      URLs).  Now pandoc only looks at printable width (the width of a
+      plain string version of the source), which should give better results.
+      Thanks to John Muccigrosso for bringing up the issue.
+    + Fixed parsing bug with macros.  Previously macro definitions in
+      indented code blocks were being parsed as macro definitions, not code.
+
+  * Textile reader:  skip over attribute in image source (#2515).
+    We don't have a place yet for styles or sizes on images, but
+    we can skip the attributes rather than incorrectly taking them
+    to be part of the filename.
+
+  * Docx reader: Handle dummy list items (Jesse Rosenthal).
+    These come up when people create a list item and then delete the
+    bullet. It doesn't refer to any real list item, and we used to ignore
+    it.
+
+  * CommonMark reader/writer rewritten to use latest `cmark`.
+
+  * Fixed Emoji character definitions (#2523).  There were many bugs in the
+    definitions.
+
+  * `Text.Pandoc.CSS`:
+
+    + Added `pickStylesToKVs` function to extract multiple properties at
+      once (API change, Mauro Bieg).
+    + Parse CSS that doesn't contain the optional semicolon (Mauro Bieg).
+
+  * `trypandoc`: sort drop-down lists.
+
+  * Beamer template:
+
+    + Made `\euro` conditional on presence of character.
+      for xelatex and lualatex, as it is for pdflatex (Andrew Dunning).
+    + Moved `header-includes` before setting of title (Thomas Hodgson),
+      to match the LaTeX template (jgm/pandoc-templates#168).
+    + Added `section-titles` variable (defaults to true)
+      to enable/suppress section title pages in beamer
+      slide shows (Thomas Hodgson).
+    + Moved beamer themes after fonts, so that themes can
+      change fonts.  (Previously the fonts set were being
+      clobbered by lmodern.sty.) (Thomas Hodgson).
+
+  * Beamer/LaTeX template changes (Thomas Hodgson):
+    + Added `thanks` variable
+    + Use `parskip.sty` when `indent` isn't set (fall back to using
+      `setlength` as before if `parskip.sty` isn't available).
+    + Use `biblio-style` with biblatex.
+    + Added `biblatexoptions` variable.
+
+  * LaTeX template changes:
+
+    + Added `paper` after `$papersize$` variable in latex template.
+      Thus you can say `papersize: a4` and the latex will contain
+      `a4paper`.  This change may break some existing workflows; if
+      you currently specify `a4paper`, you'll get `a4paperpaper` which
+      is meaningless.  However, the change seems worth it, as it will
+      make the `papersize` variable work uniformly across ConTeXt, LaTeX,
+      and html->pdf via wkhtmltopdf.
+    + Only pass options to color package if `colorlinks` is set
+      (Andrew Dunning).
+    + Make definition of `\euro` conditional in xelatex/lualatex,
+      as it is already for pdflatex (Andrew Dunning).
+    + Removed setting of `subject` in PDF metadata.
+      This used to be set to the subtitle, but really the subtitle
+      need not give the subject.  Also, `subtitle` can contain formatting,
+      so we'd need, at least, a plain text version for this.
+    + Moved `header-includes` before setting of `\title`, `\author`,
+      etc.  This allows these macros to be redefined.
+    + Use `\subtitle` command for `subtitle`, instead of tacking it
+      on to the title as before.  We give a no-op fallback definition if it
+      is not defined.  This change should produce much better results
+      in classes that support `\subtitle`.  With the default article
+      class, which does not define `\subtitle`, subtitles will no
+      longer be printed unless the user defines `\subtitle` and
+      redefines `\maketitle`.
+    + Moved redefinitions of `\paragraph` and `\subparagraph` to
+      before header-includes.
+
+  * Context template:
+
+    + Use `simplefonts` for font loading (Paolo Rodríguez).  This is
+      needed for things to work on ConTeXt stable from TeXLive 2015.
+    + Revert use of `\setuphead` in title block (Andrew Dunning,
+      Rik Kabel).
+
+  * Update LaTeX/ConTeXt link colour usage (Andrew Dunning).
+
+  * Fixed man template so disabling hyphenation actually works.
+    The command needs to come after .TH.
+
+  * Added 'navigation' variable to beamer template (#2543).
+    Valid values are `empty` (the default), `horizontal`, `vertical`,
+    and `frame`.  Note that this changes the default behavior from
+    `horizontal` to `empty`.  Closes #2543.
+
+  * Added `toc` to HTML slide format templates (Andrew Dunning),
+    so that `--toc` creates a contents slide.
+
+  * Added `stack.full.yaml` to build `pandoc-citeproc` as well.
+
+  * Allow pipe tables with no body rows (#2556).
+    Previously this raised a runtime error.
+
+  * Shared: Improved `fetchItem` so that `C:/Blah/Blah.jpg` isn't treated
+    as URL.  The Haskell URI parsing routines will accept "C:" as a
+    scheme, so we rule that out manually.  This helps with
+    `--self-contained` and absolute Windows paths.
+
+  * Define a `meta-json` variable for all writers (#2019).  This contains
+    a JSON version of all the metadata, in the format selected for the
+    writer.  So, for example, to get just the YAML metadata, you can run
+    pandoc with the following custom template: `$meta-json$`.  The intent
+    is to make it easier for static site generators and other tools to get
+    at the metadata.
+
+  * Document limitations of --self-contained (#2553).
+
+  * Improved Citations section of README (#2551).  Added information
+    about `link-citations` and a link to the pandoc-citeproc man page.
+
+  * `ImageSize`: use `safeRead` instead of `readMaybe`, which isn't
+    in base < 4.6.
+
+  * Allow .adoc file extension for AsciiDoc (Andrew Dunning).
+
+  * Improved implicit pandoc-citeproc inclusion.
+    The filter pandoc-citeproc is automatically used when
+    `--bibliography` is specified on the command line, unless
+    `--natbib` or `--biblatex` is used.  However, previously this
+    only worked if `--bibliography` was spelled out in full, and not
+    if `--biblio` was used.
+
+  * reveal.js: Interpret pauses correctly for all headers (#2530).
+    Previously, when using headers below the slide level, pauses are left
+    uninterpreted into pauses. In my opinion, unexpected behavior but
+    intentional looking at the code.
+
+  * Remove redundant `center` variable for reveal.js (Andrew Dunning).
+
+  * Parsing: Add `extractIdClass`, modified type of `KeyTable` (Mauro
+    Bieg, API change).
+
+  * ImageSize:  Added functions for converting between image dimensions
+    (Mauro Bieg).
+
+  * Use lts-3.18 in stack.yaml.  This avoids Windows build
+    issues with the HTTP library.
+
+  * Bump version bounds for dependencies.
+
+pandoc (1.15.2.1)
+
+  * Added two missing test files, and `stack.yaml`, to
+    `extra-source-files` so they're included in the source tarball.
+
+  * reveal.js template: Fixed parallaxBackground options.
+    `parallaxBackgroundHorizontal` and `parallaxBackgroundVertical`
+    need integer values, not strings.  (Vaughn Iverson)
+
+pandoc (1.15.2)
+
+  * `pandoc my.md -t context -o my.pdf` will now create a PDF using
+    ConTeXt rather than LaTeX (#2463).
+
+  * Fixed omitted `url(...)` in CSS data-uri with `--self-contained` (#2489).
+
+  * Added `emoji` Markdown extension, enabled by default in `markdown_github`
+    (#2523).  Added `Ext_emoji` to `Extension` in `Text.Pandoc.Options`
+    (API change).
+
+  * `Text.Pandoc.Readers.HTML.parseTags`: Fixed over-eager raw HTML inline
+    parsing (#2469).  Tightened up the inline HTML parser so it disallows
+    TagWarnings.
+
+  * Derive `Generic` instances for the types in `Text.Pandoc.Options`.
+
+  * Org reader:
+
+    + Fix paragraph/list interaction (Albert Krewinkel, #2464).
+      Paragraphs can be followed by lists, even if there is no blank line
+      between the two blocks.  However, this should only be true if the
+      paragraph is not within a list, were the preceding block should be
+      parsed as a plain instead of paragraph (to allow for compact lists).
+      Thanks to @rgaiacs for bringing this up.
+    + Allow toggling header args (Albert Krewinkel, #2269).
+      Org-mode allows to skip the argument of a code block header argument if
+      it's toggling a value.  Argument-less headers are now recognized,
+      avoiding weird parsing errors.
+    + Fix markup parsing in headers (Albert Krewinkel, #2504).
+      Markup as the very first item in a header wasn't recognized.  This was
+      caused by an incorrect parser state: positions at which inline markup
+      can start need to be marked explicitly by changing the parser state.
+      This wasn't done for headers.  The proper function to update the state
+      is now called at the beginning of the header parser, fixing this issue.
+    + Fix emphasis rules for smart parsing (Albert Krewinkel, #2513).
+      Smart quotes, ellipses, and dashes should behave like normal quotes,
+      single dashes, and dots with respect to text markup parsing.
+    + Require whitespace around definition list markers (#2518).
+      This rule was not checked before, resulting in bugs with footnotes
+      and some link types.
+
+  * Markdown reader:
+
+    + Pipe tables with long lines now get relative cell widths (#2471).
+      If a pipe table contains a line longer than the column width (as set by
+      `--columns` or 80 by default), relative widths are computed based on the
+      widths of the separator lines relative to the column width.  This should
+      solve persistent problems with long pipe tables in LaTeX/PDF output, and
+      give more flexibility for determining relative column widths in other
+      formats, too.  For narrower pipe tables, column widths of 0 are used,
+      telling pandoc not to specify widths explicitly in output formats that
+      permit this.
+    + Improved parser for `mmd_title_block`.  We now allow blank metadata
+      fields.  These were explicitly disallowed before.
+    + Citation keys can now contain `://`, so URLs and DOIs can be used
+      as citation keys (jgm/pandoc-citeproc#166).
+
+  * Beamer template:  fix incompatibility of section slides with natbib.
+    Natbib (and presumably biblatex) bibliography commands create
+    their own section.  Since these are in frame environments,
+    we have an incompatibility with the `\AtBeginSection` macro
+    which creates a special frame when a new section occurs.
+    (We can't have a frame inside another frame.) This change disables
+    `\AtBeginSection` inside bibliography slides.  Thinks to Yihui Xie for
+    bringing the problem to my attention.  This supersedes #145.  See
+    discussion there.
+
+  * Textile reader:  don't do smart punctuation unless explicitly asked
+    (#2480).  Note that although smart punctuation is part of the textile
+    spec, it's not always wanted when converting from textile
+    to, say, Markdown.  So it seems better to make this an option.
+
+  * LaTeX reader: Handle `comment` environment (Arata Mizuki).
+    The `comment` environment is handled in a similar way to the
+    `verbatim` environment, except that its content is discarded.
+
+  * Docx reader:  Follow relationships correctly in foot/endnotes (#2258,
+    Jesse Rosenthal).  This fixes a problem with links in notes.
+
+  * LaTeX and ConTeXt writers: support `lang` attribute on divs and spans
+    (Mauro Bieg).  For LaTeX, also collect `lang` and `dir` attributes on
+    spans and divs to set the `lang`, `otherlangs` and `dir` variables if
+    they aren’t set already.  See #895.
+
+  * LaTeX writer:
+
+    + Use proper command for `\textarabic` (Mauro Bieg).
+    + Added `de-CH-1901`, fixed `el-polyton` in `toPloyglossia` (Nick Bart).
+    + Use `\hypertarget` and `\hyperlink` for links.  This works correctly
+      to link to Div or Span elements.  We now don't bother defining `\label`
+      for Div or Span elements.  Closes jgm/pandoc-citeproc#174.
+    + Avoid footnotes in list of figures (#1506).
+    + Properly handle footnotes in captions (#1506).
+    + Add `\protect` to `\hyperlink` (#2490).  Thanks to Hadrien Mary.
+    + Set `colorlinks` if `linkcolor`, `urlcolor`, `citecolor`, or
+      `toccolor` is set (#2508).
+
+  * Textile writer: support start number in ordered lists (#2465).
+
+  * OpenDocument writer:  Allow customization of opendocument
+    automatic styles.  Automatic styles can now be inserted in the
+    template, which now provides the enclosing `<office:automatic-styles>`
+    tags (#2520).
+
+  * Docx writer:  insert space between footnote reference and note (#2527).
+    This matches Word's default behavior.
+
+  * EPUB writer:  don't download linked media when `data-external` attribute
+    set (#2473).  By default pandoc downloads all linked media and includes it
+    in the EPUB container.  This can be disabled by setting `data-external` on
+    the tags linking to media that should not be downloaded.  Example:
+
+        <audio controls="1">
+          <source src="http://example.com/music/toccata.mp3"
+                  data-external="1" type="audio/mpeg">
+          </source>
+        </audio>
+
+  * HTML writer:  use width on whole table if col widths sum to < 100%.
+    Otherwise some browsers display the table with the columns
+    separated far apart.
+
+  * AsciiDoc template:  Fix `author` and `date`; add `keywords`,
+    `abstract` (Andrew Dunning).
+
+  * HTML-based templates (Andrew Dunning):
+
+    + Use en dash instead of hyphen between title prefix and title.
+    + Add `keywords` to metadata.
+    + Add `lang`, `dir`, `quotes` where missing.
+    + Always make author and date display conditional.
+    + Updated dzslides template from source.
+
+  * Man template: make "generated by" comment conditional.
+
+  * LaTeX, Beamer templates:
+
+    + Add `babel-otherlangs` for language divs/spans; `babel-newcommands`,
+      filled by commands that make babel understand the polyglossia-style
+      language directives (Mauro Bieg, #137).
+    + Improved formatting of conditionals; `$for$` is always provided to allow
+      multiple options (Andrew Dunning, #141).
+    + Use `Ligatures=TeX` rather than `Mapping=tex-text` with `fontspec`
+      to improve support for LuaTeX (Andrew Dunning, #135).
+    + Revise `hyperref` usage (Andrew Dunning, #139, #141):
+        - use same options for all LaTeX engines;
+        - add `subtitle` and `keywords` to PDF metadata;
+        - do not override `hyperref` link coloring without user input, effectively making
+          the `hidelinks` option the default (removed as a separate variable);
+        - link colors can be enabled (using a slightly darker version of the old
+          defaults) using a new `colorlinks` variable, automatically used by
+          the LaTeX writer when custom colors are specified;
+        - `pdfborder={0 0 0}` is automatically set by `hyperref` with
+          `colorlinks`, and is only applied if `colorlinks` is disabled.
+
+  * ConTeXt template (Andrew Dunning):
+
+    + New variables for controlling styles: `linkstyle`, `linkcolor`,
+      `linkcontrastcolor`, `layout`, `pagenumbering`, `whitespace`, `indenting`,
+      `interlinespace`, `headertext`, `footertext`, `mainfont`, `sansfont`,
+      `monofont`, `mathfont`, `fontsize`.
+    + Default template no longer supports MkII.
+    + Improve writing of title block (suppressing numbering of first page).
+    + Add `title` `subtitle`, `author`, `date`, `keywords` to PDF metadata.
+    + Support `subtitle`, `abstract`.
+    + Support list of figures (`lof`), list of tables (`lot`).
+    + Disable link styling by default.
+    + Define styles for all section types.
+    + Enable microtype.
+    + Improved formatting of conditionals.
+
+  * Beamer template:  added code to prevent slide breaks inside paragraphs
+    (#2422, thanks to Nick Bart).  This will matter, in practice, only when
+    `allowframebreaks` is used.  It is especially helpful for bibliography
+    slides.
+
+  * OpenDocument template:  Add `<office:automatic-styles>` tag around
+    automatic styles.  The writer now longer provides this (see #2520).
+
+  * Restored Text.Pandoc.Compat.Monoid.
+
+  * Do not export (<>) from custom Prelude.  The Prelude now matches
+    base 4.8 Prelude's API.
+
+  * Don't use custom prelude with ghc 7.10.  Use the custom prelude
+    only for earlier versions.  This change makes `stack ghci` and
+    `cabal repl` work (#2503), at least with ghc 7.10.
+
+  * Changed § to % in operators from Odt.Arrows.Utils (#2457).
+    This prevents problems building haddocks with "C" locale.
+
+  * Change default for old-locale flag to False.
+
+  * Use stack in deb, osx, and Windows package generators.
+
+  * Added Vagrantfile for building deb in vm.
+    This should help in automating binary package creation.  'make package'
+    will make the package.  'make package COMMIT=blah' will make the package
+    from commit blah.
+
+  * README:
+
+    + Consistent capitalization for pandoc and Markdown.
+    + Fixed `auto_identifiers` examples (Benoit Schweblin).
+    + Improved documentation of template variables (Andrew Dunning).
+
+pandoc (1.15.1.1)
+
+  * `Text.Pandoc.Data`:  store paths in dataFiles using posix separators.
+    This way we have uniform separators, whether on Windows or Linux.
+    This should solve a problem where on some Windows versions
+    the data files weren't being found (#2459).
+
 pandoc (1.15.1)
 
   * `pandocVersion` is now defined in `Text.Pandoc.Shared`
@@ -7,7 +762,7 @@ pandoc (1.15.1)
   * For `markdown_mmd`, add: `implicit_figures`, `superscripts`,
     `subscripts` (#2401).
 
-  * Added `odt` as input format (MarLinn).  Added new module
+  * Added `odt` as input format (Martin Linnemann).  Added new module
     `Text.Pandoc.Reader.ODT` (API change). Fully implemented features:
     Paragraphs, Headers, Basic styling, Unordered lists, Ordered lists,
     External Links, Internal Links, Footnotes, Endnotes, Blockquotes.
@@ -137,7 +892,7 @@ pandoc (1.15.1)
     + Correctly recognize book documentclass in metadata (#2395).
     + Set language-related variables automatically, depending
       on the value of the `lang` field, which is now always
-      assumed to be in BCP47 format (mb21, #1614, #2437).
+      assumed to be in BCP47 format (Mauro Bieg, #1614, #2437).
     + Add `\protect` to `\hyperdef` in inline context.  This way we
       don't get an error when this is used as a moveable argument (#2136).
     + Support all frame attributes in Beamer.
@@ -154,13 +909,13 @@ pandoc (1.15.1)
 
   * EPUB writer:
 
-    + In TOC, replace literal "<br/>" with space (#2105).
+    + In TOC, replace literal `<br/>` with space (#2105).
     + With `--webtex`, include image file rather than `data:` URI (#2363).
 
   * Native writer: format Div properly, with blocks separated.
 
   * Support bidirectional text output with XeLaTeX, ConTeXt and HTML
-    (#2191, mb21).
+    (#2191, Mauro Bieg).
 
   * Reference Docx:
 
@@ -177,7 +932,7 @@ pandoc (1.15.1)
     + LaTeX:  Add `mainfontoptions`, `sansfontoptions`,
       `monofontoptions`, `mathfontoptions`, `fontfamilyoptions`
       (Andrew Dunning, #122).  Support handling of bidirectional
-      text (mb21, #120). Improve reliability of superscripts/subscripts
+      text (Mauro Bieg, #120). Improve reliability of superscripts/subscripts
       under XeTeX and prevent letters and numbers from appearing on a
       different baseline by removing use of the `realscripts` package
       (via `xltxtra`).  To restore use of OpenType characters for these
@@ -188,17 +943,18 @@ pandoc (1.15.1)
       Allow use of `hidelinks` variable for `hyperref` package (Hugo Roy,
       #113).  Prevent package clash with `tufte-latex` and other classes that
       include `hyperref` or `color` (Xavier Olive, #115).
-    + ConTeXt:  Support handling of bidirectional text (mb21, #120).
+    + ConTeXt:  Support handling of bidirectional text (Mauro Bieg, #120).
     + LaTeX and ConTeXt: Use more specific language variables.
       Instead of directly using `lang`, we now use `babel-lang` and
       `polyglossia-lang` and `context-lang`.  These variables are set by
       the writers to the necessary values, based on the `lang` variable
-      (which now always takes a value in BCP47 format). (mb21, #114, #129).
-    + HTML:  Support handling of bidirectional text (mb21, #120).
+      (which now always takes a value in BCP47 format). (Mauro Bieg, #114,
+      #129).
+    + HTML:  Support handling of bidirectional text (Mauro Bieg, #120).
       Move HTML5 shiv after CSS and fix URL (Andrew Dunning).
       Add dir attribute in html5 (Andrew Dunning).
     + reveal.js: Add `controls`, `progress` variables (Grégoire Pineau, #127).
-      Add `width`, `height` variables (Anrew Dunning).  Update template
+      Add `width`, `height` variables (Andrew Dunning).  Update template
       from 3.1 source (Andrew Dunning).  All configuration options are now
       available as variables, but are only be included if set (reveal.js
       uses defaults otherwise).
@@ -351,7 +1107,7 @@ pandoc (1.15.0.5)
   * CommonMark writer: fixed tags used for super/subscript.
 
   * ConTeXt template:  activate hanging indent for definition lists
-    (mb21).
+    (Mauro Bieg).
 
   * Make cabal require `hsb2hs` >= 0.3.1 if `embed_data_files` specified.
     This is done by adding `hookedPrograms` in `Setup.hs`, which allows us
@@ -469,7 +1225,7 @@ pandoc (1.14.1)
 
   * HTML reader:  allow `<body>` to close `<head>`.
 
-  * DocBook reader: support `mediaobject`s and `figures` (#2184, mb21).
+  * DocBook reader: support `mediaobject`s and `figures` (#2184, Mauro Bieg).
 
   * RST reader: Fix reference names with special characters
     (Lars-Dominik Braun).
@@ -772,7 +1528,7 @@ pandoc (1.14)
   * HTML reader:
 
     + Improve self-closing tag detection in `htmlInBalanced` (#2146).
-    + Handle tables with `<th>` in body rows (#1859, mb21).
+    + Handle tables with `<th>` in body rows (#1859, Mauro Bieg).
     + Fixed `htmlTag` (#1820).  If the tag parses as a comment, we check
       to see if the input starts with `<!--`. If not, it's bogus comment
       mode and we fail `htmlTag`.
@@ -940,7 +1696,8 @@ pandoc (1.14)
 
   * `Text.Pandoc.PDF`
 
-    + Don't suggest "Try xelatex" if xelatex already in use (mb21, #1832).
+    + Don't suggest "Try xelatex" if xelatex already in use (Mauro Bieg,
+      #1832).
     + More comprehensible errors on image conversion (#2067).
       EPS can't be supported without shelling out to something like
       ImageMagick, but at least we can avoid mysterious error messages.
@@ -2193,7 +2950,7 @@ pandoc (1.12.4)
 
   * Added Emacs org-mode reader (Albert Krewinkel).
 
-  * Added InDesign ICML Writer (mb21).
+  * Added InDesign ICML Writer (Mauro Bieg).
 
   * MediaWiki reader:
 
@@ -4595,7 +5352,7 @@ pandoc (1.9.4.2)
     an hrule break.  This avoids creation of an empty H1 in these
     contexts.  Closes #484.
 
-  * Docbook reader: Added support for "bold" emphasis.  Thanks to mb21.
+  * Docbook reader: Added support for "bold" emphasis.  Thanks to Mauro Bieg.
 
   * In make_osx_package.sh, ensure citeproc-hs is built with the
     embed_data_files flag.
diff --git a/data/sample.lua b/data/sample.lua
index fa265d0..574f378 100644
--- a/data/sample.lua
+++ b/data/sample.lua
@@ -100,6 +100,10 @@ function Space()
   return " "
 end
 
+function SoftBreak()
+  return "\n"
+end
+
 function LineBreak()
   return "<br/>"
 end
@@ -128,12 +132,12 @@ function Strikeout(s)
   return '<del>' .. s .. '</del>'
 end
 
-function Link(s, src, tit)
+function Link(s, src, tit, attr)
   return "<a href='" .. escape(src,true) .. "' title='" ..
          escape(tit,true) .. "'>" .. s .. "</a>"
 end
 
-function Image(s, src, tit)
+function Image(s, src, tit, attr)
   return "<img src='" .. escape(src,true) .. "' title='" ..
          escape(tit,true) .. "'/>"
 end
@@ -251,7 +255,7 @@ function html_align(align)
   end
 end
 
-function CaptionedImage(src, tit, caption)
+function CaptionedImage(src, tit, caption, attr)
    return '<div class="figure">\n<img src="' .. escape(src,true) ..
       '" title="' .. escape(tit,true) .. '"/>\n' ..
       '<p class="caption">' .. caption .. '</p>\n</div>'
diff --git a/data/templates b/data/templates
index 319b641..d39b220 160000
--- a/data/templates
+++ b/data/templates
@@ -1 +1 @@
-Subproject commit 319b641365d23a3a5f84c569a35dbaeef4362b9b
+Subproject commit d39b2207f98e8a6c6f91b0498c183069a0aa7c97
diff --git a/deb/GlobalSignDomainValidationCA-SHA256-G2.pem b/deb/GlobalSignDomainValidationCA-SHA256-G2.pem
new file mode 100644
index 0000000..b9130c3
--- /dev/null
+++ b/deb/GlobalSignDomainValidationCA-SHA256-G2.pem
@@ -0,0 +1,26 @@
+-----BEGIN CERTIFICATE-----
+MIIEYzCCA0ugAwIBAgILBAAAAAABRE7wPiAwDQYJKoZIhvcNAQELBQAwVzELMAkG
+A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
+b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw0xNDAyMjAxMDAw
+MDBaFw0yNDAyMjAxMDAwMDBaMGAxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
+YWxTaWduIG52LXNhMTYwNAYDVQQDEy1HbG9iYWxTaWduIERvbWFpbiBWYWxpZGF0
+aW9uIENBIC0gU0hBMjU2IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
+AoIBAQCp3cwOs+IyOd1JIqgTaZOHiOEM7nF9vZCHll1Z8syz0lhXV/lG72wm2DZC
+jn4wsy+aPlN7H262okxFHzzTFZMcie089Ffeyr3sBppqKqAZUn9R0XQ5CJ+r69eG
+ExWXrjbDVGYOWvKgc4Ux47JkFGr/paKOJLu9hVIVonnu8LXuPbj0fYC82ZA1ZbgX
+qa2zmJ+gfn1u+z+tfMIbWTaW2jcyS0tdNQJjjtunz2LuzC7Ujcm9PGqRcqIip3It
+INH6yjfaGJjmFiRxJUvE5XuJUgkC/VkrBG7KB4HUs9ra2+PMgKhWBwZ8lgg3nds4
+tmI0kWIHdAE42HIw4uuQcSZiwFfzAgMBAAGjggElMIIBITAOBgNVHQ8BAf8EBAMC
+AQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQU6k581IAt5RWBhiaMgm3A
+mKTPlw8wRwYDVR0gBEAwPjA8BgRVHSAAMDQwMgYIKwYBBQUHAgEWJmh0dHBzOi8v
+d3d3Lmdsb2JhbHNpZ24uY29tL3JlcG9zaXRvcnkvMDMGA1UdHwQsMCowKKAmoCSG
+Imh0dHA6Ly9jcmwuZ2xvYmFsc2lnbi5uZXQvcm9vdC5jcmwwPQYIKwYBBQUHAQEE
+MTAvMC0GCCsGAQUFBzABhiFodHRwOi8vb2NzcC5nbG9iYWxzaWduLmNvbS9yb290
+cjEwHwYDVR0jBBgwFoAUYHtmGkUNl8qJUC99BM00qP/8/UswDQYJKoZIhvcNAQEL
+BQADggEBANdFnqDc4ONhWgt9d4QXLWVagpqNoycqhffJ7+mG/dRHzQFSlsVDvTex
+4bjyqdKKEYRxkRWJ3AKdC8tsM4U0KJ4gsrGX3G0LEME8zV/qXdeYMcU0mVwAYVXE
+GwJbxeOJyLS4bx448lYm6UHvPc2smU9ZSlctS32ux4j71pg79eXw6ImJuYsDy1oj
+H6T9uOr7Lp2uanMJvPzVoLVEgqtEkS5QLlfBQ9iRBIvpES5ftD953x77PzAAi1Pj
+tywdO02L3ORkHQRYM68bVeerDL8wBHTk8w4vMDmNSwSMHnVmZkngvkA0x1xaUZK6
+EjxS1QSCVS1npd+3lXzuP8MIugS+wEY=
+-----END CERTIFICATE-----
diff --git a/deb/Makefile b/deb/Makefile
new file mode 100644
index 0000000..a81dc3a
--- /dev/null
+++ b/deb/Makefile
@@ -0,0 +1,13 @@
+TREE?=HEAD
+DEBPKGVER?=1
+VAGRANTBOX?=debian/wheezy64
+
+.PHONY: package clean
+
+package:
+	VAGRANTBOX=$(VAGRANTBOX) vagrant up
+	vagrant ssh -c 'rm -rf pandoc && git clone https://github.com/jgm/pandoc && cd pandoc && git checkout -b work $(TREE) && git submodule update --init && DEBPKGVER=$(DEBPKGVER) sh -ev ./deb/make_deb.sh && cp *.deb /vagrant_data/'
+	vagrant halt
+
+clean:
+	vagrant destroy
diff --git a/deb/Vagrantfile b/deb/Vagrantfile
new file mode 100644
index 0000000..3a6ac14
--- /dev/null
+++ b/deb/Vagrantfile
@@ -0,0 +1,75 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# All Vagrant configuration is done below. The "2" in Vagrant.configure
+# configures the configuration version (we support older styles for
+# backwards compatibility). Please don't change it unless you know what
+# you're doing.
+Vagrant.configure(2) do |config|
+  # The most common configuration options are documented and commented below.
+  # For a complete reference, please see the online documentation at
+  # https://docs.vagrantup.com.
+
+  # Every Vagrant development environment requires a box. You can search for
+  # boxes at https://atlas.hashicorp.com/search.
+  config.vm.box = ENV['VAGRANTBOX'] || "ubuntu/precise64"
+
+  # Disable automatic box update checking. If you disable this, then
+  # boxes will only be checked for updates when the user runs
+  # `vagrant box outdated`. This is not recommended.
+  # config.vm.box_check_update = false
+
+  # Create a forwarded port mapping which allows access to a specific port
+  # within the machine from a port on the host machine. In the example below,
+  # accessing "localhost:8080" will access port 80 on the guest machine.
+  # config.vm.network "forwarded_port", guest: 80, host: 8080
+
+  # Create a private network, which allows host-only access to the machine
+  # using a specific IP.
+  # config.vm.network "private_network", ip: "192.168.33.10"
+
+  # Create a public network, which generally matched to bridged network.
+  # Bridged networks make the machine appear as another physical device on
+  # your network.
+  # config.vm.network "public_network"
+
+  # Share an additional folder to the guest VM. The first argument is
+  # the path on the host to the actual folder. The second argument is
+  # the path on the guest to mount the folder. And the optional third
+  # argument is a set of non-required options.
+  config.vm.synced_folder "..", "/vagrant_data"
+
+  # Provider-specific configuration so you can fine-tune various
+  # backing providers for Vagrant. These expose provider-specific options.
+  # Example for VirtualBox:
+  #
+  config.vm.provider "virtualbox" do |vb|
+    # Display the VirtualBox GUI when booting the machine
+    # vb.gui = true
+
+    # Customize the amount of memory on the VM:
+    vb.memory = "2048"
+  end
+  #
+  # View the documentation for the provider you are using for more
+  # information on available options.
+
+  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
+  # such as FTP and Heroku are also available. See the documentation at
+  # https://docs.vagrantup.com/v2/push/atlas.html for more information.
+  # config.push.define "atlas" do |push|
+  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
+  # end
+
+  # Enable provisioning with a shell script. Additional provisioners such as
+  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
+  # documentation for more information about their specific syntax and use.
+  config.vm.provision "shell", inline: <<-SHELL
+    wget -q https://s3.amazonaws.com/download.fpcomplete.com/debian/fpco.key
+    sudo apt-key add fpco.key
+    echo 'deb http://download.fpcomplete.com/ubuntu/precise stable main'|sudo tee /etc/apt/sources.list.d/fpco.list
+    sudo apt-get update
+    sudo apt-get install -y stack build-essential debhelper dh-make
+    sudo cp /vagrant_data/deb/*.pem /etc/ssl/certs/
+  SHELL
+end
diff --git a/deb/control.in b/deb/control.in
index 0aabf67..549f9c1 100644
--- a/deb/control.in
+++ b/deb/control.in
@@ -4,7 +4,7 @@ Section: text
 Priority: optional
 Architecture: ARCHITECTURE
 Installed-Size: INSTALLED_SIZE
-Depends: libc6 (>= 2.11), libgmp10, zlib1g (>= 1:1.1.4)
+Depends: libc6 (>= 2.13), libgmp10, zlib1g (>= 1:1.1.4)
 Maintainer: John MacFarlane <jgm@berkeley.edu>
 Description: general markup converter
  Pandoc is a Haskell library for converting from one markup
diff --git a/deb/haskell.org.pem b/deb/haskell.org.pem
new file mode 100644
index 0000000..05bdffb
--- /dev/null
+++ b/deb/haskell.org.pem
@@ -0,0 +1,30 @@
+-----BEGIN CERTIFICATE-----
+MIIFMjCCBBqgAwIBAgISESGwJtbMWHI+x6Mmm0FEK3WqMA0GCSqGSIb3DQEBCwUA
+MGAxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTYwNAYD
+VQQDEy1HbG9iYWxTaWduIERvbWFpbiBWYWxpZGF0aW9uIENBIC0gU0hBMjU2IC0g
+RzIwHhcNMTUxMTExMjE0NjUzWhcNMTYxMjE1MDYyODEwWjA7MSEwHwYDVQQLExhE
+b21haW4gQ29udHJvbCBWYWxpZGF0ZWQxFjAUBgNVBAMMDSouaGFza2VsbC5vcmcw
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNixwKSAJbYPGflK3nO/hH
+CxigkOiKQr9q47aY9S8l0vU9ISC0eiuKkFD42ia5GzeqyBsGF4HoSF0MtBivShJz
+oxt6xFtmagKRX6VB3Qo41+36IKnqmvWE5CAoNIyoy9+ZgfKQKOaIjQzFd4edYxfa
+AQgEypRjod/BjY4NlAOILXa1L7cNQp29QkouODU5oW9mT/TWh3gNIO7cjqq+GHxh
+7/itRt7I6CJOPhEZa3UaA27yNbDsJK8dxGXeGqkUVqdoff98zO4LygyNxwIguWbD
+ektP8472N9tR4G2e/f3tnWPFzmSFIUYQPQQZsWbMi5lBVAL1IX3kgO8qgyJOQeWN
+AgMBAAGjggIJMIICBTAOBgNVHQ8BAf8EBAMCBaAwSQYDVR0gBEIwQDA+BgZngQwB
+AgEwNDAyBggrBgEFBQcCARYmaHR0cHM6Ly93d3cuZ2xvYmFsc2lnbi5jb20vcmVw
+b3NpdG9yeS8wYgYDVR0RBFswWYINKi5oYXNrZWxsLm9yZ4IYYXV0b2Rpc2NvdmVy
+Lmhhc2tlbGwub3JnghBtYWlsLmhhc2tlbGwub3Jngg9vd2EuaGFza2VsbC5vcmeC
+C2hhc2tlbGwub3JnMAkGA1UdEwQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsG
+AQUFBwMCMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9jcmwuZ2xvYmFsc2lnbi5j
+b20vZ3MvZ3Nkb21haW52YWxzaGEyZzIuY3JsMIGUBggrBgEFBQcBAQSBhzCBhDBH
+BggrBgEFBQcwAoY7aHR0cDovL3NlY3VyZS5nbG9iYWxzaWduLmNvbS9jYWNlcnQv
+Z3Nkb21haW52YWxzaGEyZzJyMS5jcnQwOQYIKwYBBQUHMAGGLWh0dHA6Ly9vY3Nw
+Mi5nbG9iYWxzaWduLmNvbS9nc2RvbWFpbnZhbHNoYTJnMjAdBgNVHQ4EFgQUsWoN
+IkHc+WhdtDwGB4pRHYZu+x4wHwYDVR0jBBgwFoAU6k581IAt5RWBhiaMgm3AmKTP
+lw8wDQYJKoZIhvcNAQELBQADggEBADrupN5ncMzXJLUxtIkhZKJUOQByrkVqmlvO
+me3tsAQn2YccC1YPE7wlkMttV8h8JN3/CWlvcSwfncXPzDF4lV7tuunapmAJLTxz
+Iz4tCIMzKVaGaivxYe9dml9LtiicsAOo29ZGE4E+mTHXR0EBjylKn4RS5f6XLawC
+wvdzYEH6nw6XbD6PlvYjZekIcky1lZ99cqsBoYiht0PQEcj8LWcBW79o1UWYEaXv
+q8b47QhFYMQ+IKwfIo3PSWjotIBw35lnrfKlrWvqyRA5t+ollH+6X1vdYOibupts
+rUdXZCfeWcwhFiJVOrq7kxpQLNZsPq8nm55Ao2tRGsrDMwsuZhc=
+-----END CERTIFICATE-----
diff --git a/deb/make_deb.sh b/deb/make_deb.sh
new file mode 100755
index 0000000..46f73e4
--- /dev/null
+++ b/deb/make_deb.sh
@@ -0,0 +1,62 @@
+MACHINE=$(uname -m)
+case "$MACHINE" in
+  x86_64) ARCHITECTURE=amd64;;
+  i686)   ARCHITECTURE=i386;;
+  i386)   ARCHITECTURE=i386;;
+esac
+
+LOCAL=$HOME/.local
+VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
+DEBPKGVER=${DEBPKGVER:-1}
+DEBVER=$VERSION-$DEBPKGVER
+BASE=pandoc-$DEBVER-$ARCHITECTURE
+DIST=`pwd`/$BASE
+DEST=$DIST/usr
+ME=$(whoami)
+COPYRIGHT=$DEST/share/doc/pandoc/copyright
+TEMPDIR=make_binary_package.tmp.$$
+
+# We need this for hsb2hs:
+PATH=$LOCAL/bin:$PATH
+
+which hsb2hs || stack install --install-ghc --stack-yaml stack.hsb2hs.yaml
+
+stack install --install-ghc --stack-yaml deb/stack.yaml
+
+make man/pandoc.1
+# get pandoc-citeproc man page:
+PANDOC_CITEPROC_VERSION=`pandoc-citeproc --version | awk '{print $2;}'`
+PANDOC_CITEPROC_TARBALL=https://hackage.haskell.org/package/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}.tar.gz
+mkdir $TEMPDIR
+curl ${PANDOC_CITEPROC_TARBALL} | tar xzC $TEMPDIR
+PANDOC_CITEPROC_PATH=$TEMPDIR/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}
+
+strip $LOCAL/bin/pandoc
+strip $LOCAL/bin/pandoc-citeproc
+mkdir -p $DEST/bin
+mkdir -p $DEST/share/man/man1
+mkdir -p $DEST/share/doc/pandoc
+
+mkdir -p $DEST/share/doc/pandoc-citeproc
+find $DIST -type d | xargs chmod 755
+cp $LOCAL/bin/pandoc $DEST/bin/
+cp $LOCAL/bin/pandoc-citeproc $DEST/bin/
+cp man/pandoc.1 $DEST/share/man/man1/pandoc.1
+gzip -9 $DEST/share/man/man1/pandoc.1
+cp ${PANDOC_CITEPROC_PATH}/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/
+gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
+cp COPYRIGHT $COPYRIGHT
+echo "" >> $COPYRIGHT
+echo "pandoc-citeproc" >> $COPYRIGHT
+cat $PANDOC_CITEPROC_PATH/LICENSE >> $COPYRIGHT
+rm -rf $TEMPDIR
+
+INSTALLED_SIZE=$(du -B 1024 -s $DEST | awk '{print $1}')
+mkdir $DIST/DEBIAN
+perl -pe "s/VERSION/$DEBVER/" deb/control.in | \
+  perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \
+  perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
+  > $DIST/DEBIAN/control
+
+fakeroot dpkg-deb --build $DIST
+rm -rf $DIST
diff --git a/deb/stack.yaml b/deb/stack.yaml
new file mode 100644
index 0000000..bf320c1
--- /dev/null
+++ b/deb/stack.yaml
@@ -0,0 +1,21 @@
+flags:
+  pandoc:
+    trypandoc: false
+    https: true
+    embed_data_files: true
+    old-locale: false
+    network-uri: true
+  pandoc-citeproc:
+    bibutils: true
+    embed_data_files: true
+    unicode_collation: false
+    test_citeproc: false
+    debug: false
+packages:
+- '..'
+- 'https://hackage.haskell.org/package/pandoc-citeproc-0.9.1.1/pandoc-citeproc-0.9.1.1.tar.gz'
+extra-deps:
+- 'aeson-0.11.1.1'
+- 'texmath-0.8.5'
+- 'highlighting-kate-0.6.2'
+resolver: lts-5.8
diff --git a/extract-changes.hs b/extract-changes.hs
new file mode 100644
index 0000000..8c8160c
--- /dev/null
+++ b/extract-changes.hs
@@ -0,0 +1,9 @@
+-- Extract changes from latest version in changelog.
+import Text.Pandoc.JSON
+
+main = toJSONFilter extractFirst
+
+extractFirst :: Pandoc -> Pandoc
+extractFirst (Pandoc meta (Para{} : BulletList bs : _)) =
+  Pandoc meta [BulletList bs]
+extractFirst x = x
diff --git a/make_deb.sh b/make_deb.sh
deleted file mode 100755
index a5aaf15..0000000
--- a/make_deb.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash -e
-
-MACHINE=$(uname -m)
-case "$MACHINE" in
-  x86_64) ARCHITECTURE=amd64;;
-  i686)   ARCHITECTURE=i386;;
-  i386)   ARCHITECTURE=i386;;
-esac
-
-SANDBOX=`pwd`/.cabal-sandbox
-VERSION=$(grep -e '^Version' pandoc.cabal | awk '{print $2}')
-DEBPKGVER=1
-DEBVER=$VERSION-$DEBPKGVER
-BASE=pandoc-$DEBVER-$ARCHITECTURE
-DIST=`pwd`/$BASE
-DEST=$DIST/usr
-ME=$(whoami)
-COPYRIGHT=$DEST/share/doc/pandoc/copyright
-
-# echo Removing old files...
-rm -rf $DIST
-
-cabal sandbox init
-echo Updating database
-cabal update
-
-export PATH=`pwd`/.cabal-sandbox/bin:$PATH
-which hsb2hs || cabal install hsb2hs
-echo Building pandoc...
-cabal clean
-cabal install --force --reinstall --flags="embed_data_files make-pandoc-man-pages" . pandoc-citeproc
-
-# get pandoc-citeproc man page:
-PANDOC_CITEPROC_PATH=`cabal unpack -d make_binary_package.tmp.$$ pandoc-citeproc | awk '{print $3;}'`
-strip $SANDBOX/bin/pandoc
-strip $SANDBOX/bin/pandoc-citeproc
-mkdir -p $DEST/bin
-mkdir -p $DEST/share/man/man1
-mkdir -p $DEST/share/doc/pandoc
-
-mkdir -p $DEST/share/doc/pandoc-citeproc
-find $DIST -type d | xargs chmod 755
-cp $SANDBOX/bin/pandoc $DEST/bin/
-cp $SANDBOX/bin/pandoc-citeproc $DEST/bin/
-cp $SANDBOX/share/man/man1/pandoc.1 $DEST/share/man/man1/pandoc.1
-gzip -9 $DEST/share/man/man1/pandoc.1
-cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/
-gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
-cp COPYRIGHT $COPYRIGHT
-echo "" >> $COPYRIGHT
-echo "pandoc-citeproc" >> $COPYRIGHT
-cat $PANDOC_CITEPROC_PATH/LICENSE >> $COPYRIGHT
-rm -rf make_binary_package.tmp.$$
-
-INSTALLED_SIZE=$(du -B 1024 -s $DEST | awk '{print $1}')
-mkdir $DIST/DEBIAN
-perl -pe "s/VERSION/$DEBVER/" deb/control.in | \
-  perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \
-  perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
-  > $DIST/DEBIAN/control
-
-fakeroot dpkg-deb --build $DIST
-rm -rf $DIST
diff --git a/make_osx_package.sh b/make_osx_package.sh
index 835638c..4a9f03b 100755
--- a/make_osx_package.sh
+++ b/make_osx_package.sh
@@ -11,21 +11,35 @@ SCRIPTS=$OSX/osx-resources
 BASE=pandoc-$VERSION
 ME=$(whoami)
 PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
+DEVELOPER_ID_APPLICATION=${DEVELOPER_ID_APPLICATION:-Developer ID Application: John Macfarlane}
+DEVELOPER_ID_INSTALLER=${DEVELOPER_ID_INSTALLER:-Developer ID Installer: John Macfarlane}
+
+# We need this for hsb2hs:
+PATH=$LOCALBIN:$PATH
+export MACOSX_DEPLOYMENT_TARGET=10.7
 
 # echo Removing old files...
 rm -rf $DIST
+mkdir -p $DIST
 mkdir -p $RESOURCES
+stack setup
+which hsb2hs || stack install --stack-yaml=stack.hsb2hs.yaml
 
 echo Building pandoc...
-stack install --stack-yaml=stack.pkg.yaml
+stack clean
+stack install --stack-yaml=osx/stack.yaml
 
 echo Getting man pages...
 make man/pandoc.1
-PANDOC_CITEPROC_PATH=`cabal unpack -d $DIST pandoc-citeproc | awk '{print $3;}'`
+
+# get pandoc-citeproc man page:
+PANDOC_CITEPROC_VERSION=`pandoc-citeproc --version | awk '{print $2;}'`
+PANDOC_CITEPROC_TARBALL=https://hackage.haskell.org/package/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}.tar.gz
+curl ${PANDOC_CITEPROC_TARBALL} | tar xzC $DIST
+PANDOC_CITEPROC_PATH=$DIST/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}
 
 mkdir -p $DEST/bin
 mkdir -p $DEST/share/man/man1
-mkdir -p $DEST/share/man/man5
 for f in pandoc pandoc-citeproc; do
   cp $LOCALBIN/$f $DEST/bin/;
 done
@@ -39,7 +53,7 @@ $LOCALBIN/pandoc --data data -t html5 -s COPYING -o $RESOURCES/license.html
 
 echo Signing pandoc executable...
 
-codesign --force --sign "Developer ID Application: John Macfarlane" $DEST/bin/pandoc
+codesign --force --sign "${DEVELOPER_ID_APPLICATION}" $DEST/bin/pandoc
 # make sure it's valid... returns nonzero exit code if it isn't:
 spctl --assess --type execute $DEST/bin/pandoc
 
@@ -47,8 +61,10 @@ echo Creating OSX package...
 # remove old package first
 rm -rf $BASE.pkg
 
+sed -e "s/PANDOCVERSION/$VERSION/" osx/distribution.xml.in > osx/distribution.xml
+
 pkgbuild --root $DIST/pandoc --identifier net.johnmacfarlane.pandoc --version 1.13 --ownership recommended $DIST/pandoc.pkg
-productbuild --distribution osx/distribution.xml --resources $DIST/Resources --package-path $DIST --version 1.13 --sign "Developer ID Installer: John Macfarlane" $BASE-osx.pkg
+productbuild --distribution osx/distribution.xml --resources $DIST/Resources --package-path $DIST --version $VERSION --sign "${DEVELOPER_ID_INSTALLER}" $BASE-osx.pkg
 
 # verify signature
 spctl --assess --type install $BASE-osx.pkg
diff --git a/make_travis_yml.hs b/make_travis_yml.hs
index 91916c4..cd5f148 100644
--- a/make_travis_yml.hs
+++ b/make_travis_yml.hs
@@ -90,7 +90,7 @@ genTravisFromCabalFile fn xpkgs = do
         let cvs = disp' (lookupCabVer gv)
             gvs = disp' gv
             ghcopts = if gv >= Version [7,10,0] []
-                         then ""
+                         then "-Werror"
                          else "-Werror"
 
             xpkgs' = concatMap (',':) xpkgs
@@ -187,7 +187,7 @@ genTravisFromCabalFile fn xpkgs = do
                        , [7,4,1],  [7,4,2]
                        , [7,6,1],  [7,6,2], [7,6,3]
                        , [7,8,1],  [7,8,2], [7,8,3], [7,8,4]
-                       , [7,10,1], [7,10,2]
+                       , [7,10,1], [7,10,2], [7,10,3]
                        , [7,11] -- HEAD
                        ]
 
diff --git a/man/pandoc.1 b/man/pandoc.1
index 35ab666..58e8b31 100644
--- a/man/pandoc.1
+++ b/man/pandoc.1
@@ -1,5 +1,5 @@
 .\"t
-.TH PANDOC 1 "July 15, 2015" ""
+.TH PANDOC 1 "January 12, 2016" "pandoc 1.17.0.2"
 .SH NAME
 pandoc - general markup converter
 .SH SYNOPSIS
@@ -18,35 +18,36 @@ reStructuredText, XHTML, HTML5, LaTeX (including \f[C]beamer\f[] slide
 shows), ConTeXt, RTF, OPML, DocBook, OpenDocument, ODT, Word docx, GNU
 Texinfo, MediaWiki markup, DokuWiki markup, Haddock markup, EPUB (v2 or
 v3), FictionBook2, Textile, groff man pages, Emacs Org mode, AsciiDoc,
-InDesign ICML, and Slidy, Slideous, DZSlides, reveal.js or S5 HTML slide
-shows.
-It can also produce PDF output on systems where LaTeX is installed.
+InDesign ICML, TEI Simple, and Slidy, Slideous, DZSlides, reveal.js or
+S5 HTML slide shows.
+It can also produce PDF output on systems where LaTeX, ConTeXt, or
+\f[C]wkhtmltopdf\f[] is installed.
 .PP
-Pandoc\[aq]s enhanced version of markdown includes syntax for footnotes,
+Pandoc\[aq]s enhanced version of Markdown includes syntax for footnotes,
 tables, flexible ordered lists, definition lists, fenced code blocks,
 superscripts and subscripts, strikeout, metadata blocks, automatic
-tables of contents, embedded LaTeX math, citations, and markdown inside
+tables of contents, embedded LaTeX math, citations, and Markdown inside
 HTML block elements.
-(These enhancements, described below under Pandoc\[aq]s markdown, can be
+(These enhancements, described below under Pandoc\[aq]s Markdown, can be
 disabled using the \f[C]markdown_strict\f[] input or output format.)
 .PP
-In contrast to most existing tools for converting markdown to HTML,
-which use regex substitutions, Pandoc has a modular design: it consists
+In contrast to most existing tools for converting Markdown to HTML,
+which use regex substitutions, pandoc has a modular design: it consists
 of a set of readers, which parse text in a given format and produce a
 native representation of the document, and a set of writers, which
 convert this native representation into a target format.
 Thus, adding an input or output format requires only adding a reader or
 writer.
 .PP
-Because Pandoc\[aq]s intermediate representation of a document is less
+Because pandoc\[aq]s intermediate representation of a document is less
 expressive than many of the formats it converts between, one should not
 expect perfect conversions between every format and every other.
 Pandoc attempts to preserve the structural elements of a document, but
 not formatting details such as margin size.
 And some document elements, such as complex tables, may not fit into
-Pandoc\[aq]s simple document model.
-While conversions from Pandoc\[aq]s Markdown to all formats aspire to be
-perfect, conversions from formats more expressive than Pandoc\[aq]s
+pandoc\[aq]s simple document model.
+While conversions from pandoc\[aq]s Markdown to all formats aspire to be
+perfect, conversions from formats more expressive than pandoc\[aq]s
 Markdown can be expected to be lossy.
 .SS Using \f[C]pandoc\f[]
 .PP
@@ -98,7 +99,7 @@ command\-line options.
 The input format can be specified using the \f[C]\-r/\-\-read\f[] or
 \f[C]\-f/\-\-from\f[] options, the output format using the
 \f[C]\-w/\-\-write\f[] or \f[C]\-t/\-\-to\f[] options.
-Thus, to convert \f[C]hello.txt\f[] from markdown to LaTeX, you could
+Thus, to convert \f[C]hello.txt\f[] from Markdown to LaTeX, you could
 type:
 .IP
 .nf
@@ -107,7 +108,7 @@ pandoc\ \-f\ markdown\ \-t\ latex\ hello.txt
 \f[]
 .fi
 .PP
-To convert \f[C]hello.html\f[] from HTML to markdown:
+To convert \f[C]hello.html\f[] from HTML to Markdown:
 .IP
 .nf
 \f[C]
@@ -134,13 +135,13 @@ pandoc\ \-o\ hello.tex\ hello.txt
 \f[]
 .fi
 .PP
-will convert \f[C]hello.txt\f[] from markdown to LaTeX.
+will convert \f[C]hello.txt\f[] from Markdown to LaTeX.
 If no output file is specified (so that output goes to \f[I]stdout\f[]),
 or if the output file\[aq]s extension is unknown, the output format will
 default to HTML.
 If no input file is specified (so that input comes from \f[I]stdin\f[]),
 or if the input files\[aq] extensions are unknown, the input format will
-be assumed to be markdown unless explicitly specified.
+be assumed to be Markdown unless explicitly specified.
 .PP
 Pandoc uses the UTF\-8 character encoding for both input and output.
 If your local character encoding is not UTF\-8, you should pipe input
@@ -160,7 +161,7 @@ the \f[C]\-s/\-\-standalone\f[] option.
 .PP
 To produce a PDF, specify an output file with a \f[C]\&.pdf\f[]
 extension.
-Pandoc will use LaTeX to convert it to PDF:
+By default, pandoc will use LaTeX to convert it to PDF:
 .IP
 .nf
 \f[C]
@@ -173,35 +174,34 @@ Production of a PDF requires that a LaTeX engine be installed (see
 packages are available: \f[C]amsfonts\f[], \f[C]amsmath\f[],
 \f[C]lm\f[], \f[C]ifxetex\f[], \f[C]ifluatex\f[], \f[C]eurosym\f[],
 \f[C]listings\f[] (if the \f[C]\-\-listings\f[] option is used),
-\f[C]fancyvrb\f[], \f[C]longtable\f[], \f[C]booktabs\f[], \f[C]url\f[],
+\f[C]fancyvrb\f[], \f[C]longtable\f[], \f[C]booktabs\f[],
 \f[C]graphicx\f[] and \f[C]grffile\f[] (if the document contains
-images), \f[C]color\f[], \f[C]hyperref\f[], \f[C]ulem\f[],
-\f[C]geometry\f[] (with the \f[C]geometry\f[] variable set),
-\f[C]setspace\f[] (with \f[C]linestretch\f[]), and \f[C]babel\f[] (with
-\f[C]lang\f[]).
+images), \f[C]hyperref\f[], \f[C]ulem\f[], \f[C]geometry\f[] (with the
+\f[C]geometry\f[] variable set), \f[C]setspace\f[] (with
+\f[C]linestretch\f[]), and \f[C]babel\f[] (with \f[C]lang\f[]).
 The use of \f[C]xelatex\f[] or \f[C]lualatex\f[] as the LaTeX engine
 requires \f[C]fontspec\f[]; \f[C]xelatex\f[] uses \f[C]mathspec\f[],
 \f[C]polyglossia\f[] (with \f[C]lang\f[]), \f[C]xecjk\f[], and
 \f[C]bidi\f[] (with the \f[C]dir\f[] variable set).
 The \f[C]upquote\f[] and \f[C]microtype\f[] packages are used if
 available, and \f[C]csquotes\f[] will be used for smart punctuation if
-added to the template.
+added to the template or included in any header file.
 The \f[C]natbib\f[], \f[C]biblatex\f[], \f[C]bibtex\f[], and
 \f[C]biber\f[] packages can optionally be used for citation rendering.
 These are included with all recent versions of TeX Live.
 .PP
-PDF output can be controlled using variables for LaTeX.
-.SS \f[C]hsmarkdown\f[]
-.PP
-A user who wants a drop\-in replacement for \f[C]Markdown.pl\f[] may
-create a symbolic link to the \f[C]pandoc\f[] executable called
-\f[C]hsmarkdown\f[].
-When invoked under the name \f[C]hsmarkdown\f[], \f[C]pandoc\f[] will
-behave as if invoked with
-\f[C]\-f\ markdown_strict\ \-\-email\-obfuscation=references\f[], and
-all command\-line options will be treated as regular arguments.
-This approach does not work under Cygwin, due to problems with its
-simulation of symbolic links.
+Alternatively, pandoc can use ConTeXt or \f[C]wkhtmltopdf\f[] to create
+a PDF.
+To do this, specify an output file with a \f[C]\&.pdf\f[] extension, as
+before, but add \f[C]\-t\ context\f[] or \f[C]\-t\ html5\f[] to the
+command line.
+.PP
+PDF output can be controlled using variables for LaTeX (if LaTeX is
+used) and variables for ConTeXt (if ConTeXt is used).
+If \f[C]wkhtmltopdf\f[] is used, then the variables
+\f[C]margin\-left\f[], \f[C]margin\-right\f[], \f[C]margin\-top\f[],
+\f[C]margin\-bottom\f[], and \f[C]papersize\f[] will affect the output,
+as will \f[C]\-\-css\f[].
 .SH OPTIONS
 .SS General options
 .TP
@@ -209,10 +209,10 @@ simulation of symbolic links.
 Specify input format.
 \f[I]FORMAT\f[] can be \f[C]native\f[] (native Haskell), \f[C]json\f[]
 (JSON version of native AST), \f[C]markdown\f[] (pandoc\[aq]s extended
-markdown), \f[C]markdown_strict\f[] (original unextended markdown),
+Markdown), \f[C]markdown_strict\f[] (original unextended Markdown),
 \f[C]markdown_phpextra\f[] (PHP Markdown Extra),
 \f[C]markdown_github\f[] (GitHub\-Flavored Markdown),
-\f[C]commonmark\f[] (CommonMark markdown), \f[C]textile\f[] (Textile),
+\f[C]commonmark\f[] (CommonMark Markdown), \f[C]textile\f[] (Textile),
 \f[C]rst\f[] (reStructuredText), \f[C]html\f[] (HTML), \f[C]docbook\f[]
 (DocBook), \f[C]t2t\f[] (txt2tags), \f[C]docx\f[] (docx), \f[C]odt\f[]
 (ODT), \f[C]epub\f[] (EPUB), \f[C]opml\f[] (OPML), \f[C]org\f[] (Emacs
@@ -225,10 +225,10 @@ Markdown syntax extensions can be individually enabled or disabled by
 appending \f[C]+EXTENSION\f[] or \f[C]\-EXTENSION\f[] to the format
 name.
 So, for example, \f[C]markdown_strict+footnotes+definition_lists\f[] is
-strict markdown with footnotes and definition lists enabled, and
-\f[C]markdown\-pipe_tables+hard_line_breaks\f[] is pandoc\[aq]s markdown
+strict Markdown with footnotes and definition lists enabled, and
+\f[C]markdown\-pipe_tables+hard_line_breaks\f[] is pandoc\[aq]s Markdown
 without pipe tables and with hard line breaks.
-See Pandoc\[aq]s markdown, below, for a list of extensions and their
+See Pandoc\[aq]s Markdown, below, for a list of extensions and their
 names.
 .RS
 .RE
@@ -237,11 +237,11 @@ names.
 Specify output format.
 \f[I]FORMAT\f[] can be \f[C]native\f[] (native Haskell), \f[C]json\f[]
 (JSON version of native AST), \f[C]plain\f[] (plain text),
-\f[C]markdown\f[] (pandoc\[aq]s extended markdown),
-\f[C]markdown_strict\f[] (original unextended markdown),
+\f[C]markdown\f[] (pandoc\[aq]s extended Markdown),
+\f[C]markdown_strict\f[] (original unextended Markdown),
 \f[C]markdown_phpextra\f[] (PHP Markdown Extra),
 \f[C]markdown_github\f[] (GitHub\-Flavored Markdown),
-\f[C]commonmark\f[] (CommonMark markdown), \f[C]rst\f[]
+\f[C]commonmark\f[] (CommonMark Markdown), \f[C]rst\f[]
 (reStructuredText), \f[C]html\f[] (XHTML), \f[C]html5\f[] (HTML5),
 \f[C]latex\f[] (LaTeX), \f[C]beamer\f[] (LaTeX beamer slide show),
 \f[C]context\f[] (ConTeXt), \f[C]man\f[] (groff man), \f[C]mediawiki\f[]
@@ -253,11 +253,12 @@ Specify output format.
 (Haddock markup), \f[C]rtf\f[] (rich text format), \f[C]epub\f[] (EPUB
 v2 book), \f[C]epub3\f[] (EPUB v3), \f[C]fb2\f[] (FictionBook2 e\-book),
 \f[C]asciidoc\f[] (AsciiDoc), \f[C]icml\f[] (InDesign ICML),
-\f[C]slidy\f[] (Slidy HTML and javascript slide show), \f[C]slideous\f[]
-(Slideous HTML and javascript slide show), \f[C]dzslides\f[] (DZSlides
-HTML5 + javascript slide show), \f[C]revealjs\f[] (reveal.js HTML5 +
-javascript slide show), \f[C]s5\f[] (S5 HTML and javascript slide show),
-or the path of a custom lua writer (see Custom writers, below).
+\f[C]tei\f[] (TEI Simple), \f[C]slidy\f[] (Slidy HTML and javascript
+slide show), \f[C]slideous\f[] (Slideous HTML and javascript slide
+show), \f[C]dzslides\f[] (DZSlides HTML5 + javascript slide show),
+\f[C]revealjs\f[] (reveal.js HTML5 + javascript slide show), \f[C]s5\f[]
+(S5 HTML and javascript slide show), or the path of a custom lua writer
+(see Custom writers, below).
 Note that \f[C]odt\f[], \f[C]epub\f[], and \f[C]epub3\f[] output will
 not be directed to \f[I]stdout\f[]; an output filename must be specified
 using the \f[C]\-o/\-\-output\f[] option.
@@ -350,9 +351,9 @@ Show usage message.
 Parse untranslatable HTML codes and LaTeX environments as raw HTML or
 LaTeX, instead of ignoring them.
 Affects only HTML and LaTeX input.
-Raw HTML can be printed in markdown, reStructuredText, HTML, Slidy,
+Raw HTML can be printed in Markdown, reStructuredText, HTML, Slidy,
 Slideous, DZSlides, reveal.js, and S5 output; raw LaTeX can be printed
-in markdown, reStructuredText, LaTeX, and ConTeXt output.
+in Markdown, reStructuredText, LaTeX, and ConTeXt output.
 The default is for the readers to omit untranslatable HTML codes and
 LaTeX environments.
 (The LaTeX reader does pass through untranslatable LaTeX
@@ -365,12 +366,10 @@ Produce typographically correct output, converting straight quotes to
 curly quotes, \f[C]\-\-\-\f[] to em\-dashes, \f[C]\-\-\f[] to
 en\-dashes, and \f[C]\&...\f[] to ellipses.
 Nonbreaking spaces are inserted after certain abbreviations, such as
-"Mr." (Note: This option is significant only when the input format is
-\f[C]markdown\f[], \f[C]markdown_strict\f[], \f[C]textile\f[] or
-\f[C]twiki\f[].
-It is selected automatically when the input format is \f[C]textile\f[]
-or the output format is \f[C]latex\f[] or \f[C]context\f[], unless
-\f[C]\-\-no\-tex\-ligatures\f[] is used.)
+"Mr." (Note: This option is selected automatically when the output
+format is \f[C]latex\f[] or \f[C]context\f[], unless
+\f[C]\-\-no\-tex\-ligatures\f[] is used.
+It has no effect for \f[C]latex\f[] input.)
 .RS
 .RE
 .TP
@@ -399,12 +398,21 @@ Specify a default extension to use when image paths/URLs have no
 extension.
 This allows you to use the same source for formats that require
 different kinds of images.
-Currently this option only affects the markdown and LaTeX readers.
+Currently this option only affects the Markdown and LaTeX readers.
+.RS
+.RE
+.TP
+.B \f[C]\-\-file\-scope\f[]
+Parse each file individually before combining for multifile documents.
+This will allow footnotes in different files with the same identifiers
+to work as expected.
+If this option is set, footnotes and links will not work across files.
+Reading binary files (docx, odt, epub) implies \f[C]\-\-file\-scope\f[].
 .RS
 .RE
 .TP
 .B \f[C]\-\-filter=\f[]\f[I]EXECUTABLE\f[]
-Specify an executable to be used as a filter transforming the Pandoc AST
+Specify an executable to be used as a filter transforming the pandoc AST
 after the input is parsed and before the output is written.
 The executable should read JSON from stdin and write JSON to stdout.
 The JSON must be formatted like pandoc\[aq]s own JSON input and output.
@@ -503,7 +511,7 @@ This option only affects the docx and epub readers.
 .TP
 .B \f[C]\-s\f[], \f[C]\-\-standalone\f[]
 Produce output with an appropriate header and footer (e.g.
-a standalone HTML, LaTeX, or RTF file, not a fragment).
+a standalone HTML, LaTeX, TEI, or RTF file, not a fragment).
 This option is set automatically for \f[C]pdf\f[], \f[C]epub\f[],
 \f[C]epub3\f[], \f[C]fb2\f[], \f[C]docx\f[], and \f[C]odt\f[] output.
 .RS
@@ -549,24 +557,45 @@ Files in the user data directory are ignored.
 .RS
 .RE
 .TP
+.B \f[C]\-\-dpi\f[]=\f[I]NUMBER\f[]
+Specify the dpi (dots per inch) value for conversion from pixels to
+inch/centimeters and vice versa.
+The default is 96dpi.
+Technically, the correct term would be ppi (pixels per inch).
+.RS
+.RE
+.TP
+.B \f[C]\-\-wrap=[auto|none|preserve]\f[]
+Determine how text is wrapped in the output (the source code, not the
+rendered version).
+With \f[C]auto\f[] (the default), pandoc will attempt to wrap lines to
+the column width specified by \f[C]\-\-columns\f[] (default 80).
+With \f[C]none\f[], pandoc will not wrap lines at all.
+With \f[C]preserve\f[], pandoc will attempt to preserve the wrapping
+from the source document (that is, where there are nonsemantic newlines
+in the source, there will be nonsemantic newlines in the output as
+well).
+.RS
+.RE
+.TP
 .B \f[C]\-\-no\-wrap\f[]
-Disable text wrapping in output.
-By default, text is wrapped appropriately for the output format.
+Deprecated synonym for \f[C]\-\-wrap=none\f[].
 .RS
 .RE
 .TP
 .B \f[C]\-\-columns=\f[]\f[I]NUMBER\f[]
 Specify length of lines in characters (for text wrapping).
+This affects only the generated source code, not the layout on the
+rendered page.
 .RS
 .RE
 .TP
 .B \f[C]\-\-toc\f[], \f[C]\-\-table\-of\-contents\f[]
 Include an automatically generated table of contents (or, in the case of
-\f[C]latex\f[], \f[C]context\f[], and \f[C]rst\f[], an instruction to
-create one) in the output document.
+\f[C]latex\f[], \f[C]context\f[], \f[C]docx\f[], and \f[C]rst\f[], an
+instruction to create one) in the output document.
 This option has no effect on \f[C]man\f[], \f[C]docbook\f[],
-\f[C]slidy\f[], \f[C]slideous\f[], \f[C]s5\f[], \f[C]docx\f[], or
-\f[C]odt\f[] output.
+\f[C]slidy\f[], \f[C]slideous\f[], \f[C]s5\f[], or \f[C]odt\f[] output.
 .RS
 .RE
 .TP
@@ -622,7 +651,7 @@ Implies \f[C]\-\-standalone\f[].
 Include contents of \f[I]FILE\f[], verbatim, at the end of the document
 body (before the \f[C]</body>\f[] tag in HTML, or the
 \f[C]\\end{document}\f[] command in LaTeX).
-This option can be be used repeatedly to include multiple files.
+This option can be used repeatedly to include multiple files.
 They will be included in the order specified.
 Implies \f[C]\-\-standalone\f[].
 .RS
@@ -644,19 +673,11 @@ Scripts, images, and stylesheets at absolute URLs will be downloaded;
 those at relative URLs will be sought relative to the working directory
 (if the first source file is local) or relative to the base URL (if the
 first source file is remote).
-\f[C]\-\-self\-contained\f[] does not work with \f[C]\-\-mathjax\f[].
-.RS
-.RE
-.TP
-.B \f[C]\-\-offline\f[]
-Deprecated synonym for \f[C]\-\-self\-contained\f[].
-.RS
-.RE
-.TP
-.B \f[C]\-5\f[], \f[C]\-\-html5\f[]
-Produce HTML5 instead of HTML4.
-This option has no effect for writers other than \f[C]html\f[].
-(\f[I]Deprecated:\f[] Use the \f[C]html5\f[] output format instead.)
+Limitation: resources that are loaded dynamically through JavaScript
+cannot be incorporated; as a result, \f[C]\-\-self\-contained\f[] does
+not work with \f[C]\-\-mathjax\f[], and some advanced features (e.g.
+zoom or speaker notes) may not work in an offline "self\-contained"
+\f[C]reveal.js\f[] slide show.
 .RS
 .RE
 .TP
@@ -674,13 +695,13 @@ instead of UTF\-8 when this option is selected).
 .TP
 .B \f[C]\-\-reference\-links\f[]
 Use reference\-style links, rather than inline links, in writing
-markdown or reStructuredText.
+Markdown or reStructuredText.
 By default inline links are used.
 .RS
 .RE
 .TP
 .B \f[C]\-\-atx\-headers\f[]
-Use ATX\-style headers in markdown and asciidoc output.
+Use ATX\-style headers in Markdown and asciidoc output.
 The default is to use setext\-style headers for levels 1\-2, and then
 ATX headers.
 .RS
@@ -690,7 +711,8 @@ ATX headers.
 Treat top\-level headers as chapters in LaTeX, ConTeXt, and DocBook
 output.
 When the LaTeX document class is set to \f[C]report\f[], \f[C]book\f[],
-or \f[C]memoir\f[], this option is implied.
+or \f[C]memoir\f[] (unless the \f[C]article\f[] option is specified),
+this option is implied.
 If \f[C]beamer\f[] is the output format, top\-level headers will become
 \f[C]\\part{..}\f[].
 .RS
@@ -719,11 +741,15 @@ Implies \f[C]\-\-number\-sections\f[].
 .RE
 .TP
 .B \f[C]\-\-no\-tex\-ligatures\f[]
-Do not convert quotation marks, apostrophes, and dashes to the TeX
-ligatures when writing LaTeX or ConTeXt.
-Instead, just use literal unicode characters.
-This is needed for using advanced OpenType features with
-\f[C]xelatex\f[] and \f[C]lualatex\f[].
+Do not use the TeX ligatures for quotation marks, apostrophes, and
+dashes (\f[C]`...\[aq]\f[], \f[C]``..\[aq]\[aq]\f[], \f[C]\-\-\f[],
+\f[C]\-\-\-\f[]) when writing or reading LaTeX or ConTeXt.
+In reading LaTeX, parse the characters \f[C]`\f[], \f[C]\[aq]\f[], and
+\f[C]\-\f[] literally, rather than parsing ligatures for quotation marks
+and dashes.
+In writing LaTeX or ConTeXt, print unicode quotation mark and dash
+characters literally, rather than converting them to the standard ASCII
+TeX ligatures.
 Note: normally \f[C]\-\-smart\f[] is selected automatically for LaTeX
 and ConTeXt output, but it must be specified explicitly if
 \f[C]\-\-no\-tex\-ligatures\f[] is selected.
@@ -771,12 +797,13 @@ documents.
 \f[C]javascript\f[] obfuscates them using javascript.
 \f[C]references\f[] obfuscates them by printing their letters as decimal
 or hexadecimal character references.
+The default is \f[C]javascript\f[].
 .RS
 .RE
 .TP
 .B \f[C]\-\-id\-prefix=\f[]\f[I]STRING\f[]
 Specify a prefix to be added to all automatically generated identifiers
-in HTML and DocBook output, and to footnote numbers in markdown output.
+in HTML and DocBook output, and to footnote numbers in Markdown output.
 This is useful for preventing duplicate identifiers when generating
 fragments to be included in other pages.
 .RS
@@ -792,7 +819,7 @@ Implies \f[C]\-\-standalone\f[].
 .TP
 .B \f[C]\-c\f[] \f[I]URL\f[], \f[C]\-\-css=\f[]\f[I]URL\f[]
 Link to a CSS style sheet.
-This option can be be used repeatedly to include multiple files.
+This option can be used repeatedly to include multiple files.
 They will be included in the order specified.
 .RS
 .RE
@@ -844,7 +871,7 @@ If it is not found there, sensible defaults will be used.
 Use the specified image as the EPUB cover.
 It is recommended that the image be less than 1000px in width and
 height.
-Note that in a markdown source document you can also specify
+Note that in a Markdown source document you can also specify
 \f[C]cover\-image\f[] in a YAML metadata block (see EPUB Metadata,
 below).
 .RS
@@ -871,7 +898,7 @@ which should be in ISO 8601 format), \f[C]<dc:language>\f[] (from the
 \f[C]<dc:identifier\ id="BookId">\f[] (a randomly generated UUID).
 Any of these may be overridden by elements in the metadata file.
 .PP
-Note: if the source document is markdown, a YAML metadata block in the
+Note: if the source document is Markdown, a YAML metadata block in the
 document can be used instead.
 See below under EPUB Metadata.
 .RE
@@ -1086,7 +1113,7 @@ with the \f[C]\-o\f[] option, or \f[C]\-\f[] (for \f[I]stdout\f[]) if no
 output file was specified.
 The remaining lines contain the command\-line arguments, one per line,
 in the order they appear.
-These do not include regular Pandoc options and their arguments, but do
+These do not include regular pandoc options and their arguments, but do
 include any options appearing after a \f[C]\-\-\f[] separator at the end
 of the line.
 .RS
@@ -1094,7 +1121,7 @@ of the line.
 .TP
 .B \f[C]\-\-ignore\-args\f[]
 Ignore command\-line arguments (for use in wrapper scripts).
-Regular Pandoc options are not ignored.
+Regular pandoc options are not ignored.
 Thus, for example,
 .RS
 .IP
@@ -1132,9 +1159,18 @@ You can also override the system default templates for a given output
 format \f[I]FORMAT\f[] by putting a file
 \f[C]templates/default.*FORMAT*\f[] in the user data directory (see
 \f[C]\-\-data\-dir\f[], above).
-\f[I]Exceptions:\f[] For \f[C]odt\f[] output, customize the
-\f[C]default.opendocument\f[] template.
-For \f[C]pdf\f[] output, customize the \f[C]default.latex\f[] template.
+\f[I]Exceptions:\f[]
+.IP \[bu] 2
+For \f[C]odt\f[] output, customize the \f[C]default.opendocument\f[]
+template.
+.IP \[bu] 2
+For \f[C]pdf\f[] output, customize the \f[C]default.latex\f[] template
+(or the \f[C]default.beamer\f[] template, if you use
+\f[C]\-t\ beamer\f[], or the \f[C]default.context\f[] template, if you
+use \f[C]\-t\ context\f[]).
+.IP \[bu] 2
+\f[C]docx\f[] has no template (however, you can use
+\f[C]\-\-reference\-docx\f[] to customize the output).
 .PP
 Templates contain \f[I]variables\f[], which allow for the inclusion of
 arbitrary information at any point in the file.
@@ -1150,7 +1186,7 @@ fields as well as the following:
 .TP
 .B \f[C]title\f[], \f[C]author\f[], \f[C]date\f[]
 allow identification of basic aspects of the document.
-Included in PDF metadata through LaTeX.
+Included in PDF metadata through LaTeX and ConTeXt.
 These can be set through a pandoc title block, which allows for multiple
 authors, or through a YAML metadata block:
 .RS
@@ -1166,8 +1202,28 @@ author:
 .fi
 .RE
 .TP
+.B \f[C]subtitle\f[]
+document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word
+docx; renders in LaTeX only when using a document class that supports
+\f[C]\\subtitle\f[], such as \f[C]beamer\f[] or the KOMA\-Script series
+(\f[C]scrartcl\f[], \f[C]scrreprt\f[], \f[C]scrbook\f[]).
+.RS
+.RE
+.TP
+.B \f[C]institute\f[]
+author affiliations (in LaTeX and Beamer only).
+Can be a list, when there are multiple authors.
+.RS
+.RE
+.TP
 .B \f[C]abstract\f[]
-allows for specification of document summary in LaTeX and Word docx
+document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
+.RS
+.RE
+.TP
+.B \f[C]keywords\f[]
+list of keywords to be included in HTML, PDF, and AsciiDoc metadata; may
+be repeated as for \f[C]author\f[], above
 .RS
 .RE
 .TP
@@ -1183,6 +1239,11 @@ specified
 .RS
 .RE
 .TP
+.B \f[C]toc\-title\f[]
+title of table of contents (works only with EPUB and docx)
+.RS
+.RE
+.TP
 .B \f[C]include\-before\f[]
 contents specified by \f[C]\-B/\-\-include\-before\-body\f[] (may have
 multiple values)
@@ -1199,6 +1260,11 @@ multiple values)
 body of document
 .RS
 .RE
+.TP
+.B \f[C]meta\-json\f[]
+JSON representation of all of the document\[aq]s metadata
+.RS
+.RE
 .SS Language variables
 .TP
 .B \f[C]lang\f[]
@@ -1209,14 +1275,23 @@ For some output formats, pandoc will convert it to an appropriate format
 stored in the additional variables \f[C]babel\-lang\f[],
 \f[C]polyglossia\-lang\f[] (LaTeX) and \f[C]context\-lang\f[] (ConTeXt).
 .RS
+.PP
+Native pandoc \f[C]span\f[]s and \f[C]div\f[]s with the lang attribute
+(value in BCP 47) can be used to switch the language in that range.
 .RE
 .TP
 .B \f[C]otherlangs\f[]
 a list of other languages used in the document in the YAML metadata,
 according to BCP 47.
 For example: \f[C]otherlangs:\ [en\-GB,\ fr]\f[].
-Currently only used by \f[C]xelatex\f[] through the generated
-\f[C]polyglossia\-otherlangs\f[] variable.
+This is automatically generated from the \f[C]lang\f[] attributes in all
+\f[C]span\f[]s and \f[C]div\f[]s but can be overridden.
+Currently only used by LaTeX through the generated
+\f[C]babel\-otherlangs\f[] and \f[C]polyglossia\-otherlangs\f[]
+variables.
+The LaTeX writer outputs polyglossia commands in the text but the
+\f[C]babel\-newcommands\f[] variable contains mappings for them to the
+corresponding babel.
 .RS
 .RE
 .TP
@@ -1233,11 +1308,6 @@ This may not always be necessary if the final renderer (e.g.
 the browser, when generating HTML) supports the Unicode Bidirectional
 Algorithm.
 .PP
-LaTeX and ConTeXt assume by default that all text is left\-to\-right.
-Setting \f[C]dir:\ ltr\f[] enables bidirectional text handling in a
-document whose base direction is left\-to\-right but contains some
-right\-to\-left script.
-.PP
 When using LaTeX for bidirectional documents, only the \f[C]xelatex\f[]
 engine is fully supported (use \f[C]\-\-latex\-engine=xelatex\f[]).
 .RE
@@ -1271,44 +1341,68 @@ base URL for reveal.js documents (defaults to \f[C]reveal.js\f[])
 themes for LaTeX \f[C]beamer\f[] documents
 .RS
 .RE
+.TP
+.B \f[C]navigation\f[]
+controls navigation symbols in \f[C]beamer\f[] documents (default is
+\f[C]empty\f[] for no navigation symbols; other valid values are
+\f[C]frame\f[], \f[C]vertical\f[], and \f[C]horizontal\f[]).
+.RS
+.RE
+.TP
+.B \f[C]section\-titles\f[]
+enables on "title pages" for new sections in \f[C]beamer\f[] documents
+(default = true).
+.RS
+.RE
 .SS Variables for LaTeX
 .PP
 LaTeX variables are used when creating a PDF.
 .TP
+.B \f[C]papersize\f[]
+paper size, e.g.
+\f[C]letter\f[], \f[C]A4\f[]
+.RS
+.RE
+.TP
 .B \f[C]fontsize\f[]
-font size (e.g.
-\f[C]10pt\f[], \f[C]12pt\f[]) for LaTeX documents
+font size for body text (e.g.
+\f[C]10pt\f[], \f[C]12pt\f[])
 .RS
 .RE
 .TP
 .B \f[C]documentclass\f[]
-document class for LaTeX documents, e.g.
+document class, e.g.
 \f[C]article\f[], \f[C]report\f[], \f[C]book\f[], \f[C]memoir\f[]
 .RS
 .RE
 .TP
 .B \f[C]classoption\f[]
-option for LaTeX document class, e.g.
+option for document class, e.g.
 \f[C]oneside\f[]; may be repeated for multiple options
 .RS
 .RE
 .TP
 .B \f[C]geometry\f[]
-option for LaTeX \f[C]geometry\f[] package, e.g.
+option for \f[C]geometry\f[] package, e.g.
 \f[C]margin=1in\f[]; may be repeated for multiple options
 .RS
 .RE
 .TP
+.B \f[C]margin\-left\f[], \f[C]margin\-right\f[], \f[C]margin\-top\f[], \f[C]margin\-bottom\f[]
+sets margins, if \f[C]geometry\f[] is not used (otherwise
+\f[C]geometry\f[] overrides these)
+.RS
+.RE
+.TP
 .B \f[C]linestretch\f[]
-adjusts line spacing in LaTeX documents using the \f[C]setspace\f[]
-package, e.g.
+adjusts line spacing using the \f[C]setspace\f[] package, e.g.
 \f[C]1.25\f[], \f[C]1.5\f[]
 .RS
 .RE
 .TP
 .B \f[C]fontfamily\f[]
-font package for LaTeX documents (with \f[C]pdflatex\f[]): TeX Live
-includes many options, documented in the LaTeX Font Catalogue.
+font package for use with \f[C]pdflatex\f[]: TeX Live includes many
+options, documented in the LaTeX Font Catalogue.
 The default is Latin Modern.
 .RS
 .RE
@@ -1316,14 +1410,14 @@ The default is Latin Modern.
 .B \f[C]fontfamilyoptions\f[]
 options for package used as \f[C]fontfamily\f[]: e.g.
 \f[C]osf,sc\f[] with \f[C]fontfamily\f[] set to \f[C]mathpazo\f[]
-provides Palatino with old\-style figures and true small caps
+provides Palatino with old\-style figures and true small caps; may be
+repeated for multiple options
 .RS
 .RE
 .TP
 .B \f[C]mainfont\f[], \f[C]sansfont\f[], \f[C]monofont\f[], \f[C]mathfont\f[], \f[C]CJKmainfont\f[]
-fonts for LaTeX documents (works only with \f[C]xelatex\f[] and
-\f[C]lualatex\f[]): takes the name of any system font, using the
-\f[C]fontspec\f[] package.
+font families for use with \f[C]xelatex\f[] or \f[C]lualatex\f[]: take
+the name of any system font, using the \f[C]fontspec\f[] package.
 Note that if \f[C]CJKmainfont\f[] is used, the \f[C]xecjk\f[] package
 must be available.
 .RS
@@ -1333,8 +1427,9 @@ must be available.
 options to use with \f[C]mainfont\f[], \f[C]sansfont\f[],
 \f[C]monofont\f[], \f[C]mathfont\f[], \f[C]CJKmainfont\f[] in
 \f[C]xelatex\f[] and \f[C]lualatex\f[].
-Allows for any choices available through \f[C]fontspec\f[], such as the
+Allow for any choices available through \f[C]fontspec\f[], such as the
 OpenType features \f[C]Numbers=OldStyle,Numbers=Proportional\f[].
+May be repeated for multiple options.
 .RS
 .RE
 .TP
@@ -1345,23 +1440,21 @@ font encodings)
 .RS
 .RE
 .TP
-.B \f[C]linkcolor\f[], \f[C]toccolor\f[], \f[C]urlcolor\f[], \f[C]citecolor\f[]
-color for internal links, links in table of contents, external links,
-and citation links in LaTeX documents, using options available through
-\f[C]color\f[] package, e.g.
-\f[C]red\f[], \f[C]green\f[], \f[C]magenta\f[], \f[C]cyan\f[],
-\f[C]blue\f[], \f[C]black\f[]
+.B \f[C]colorlinks\f[]
+add color to link text; automatically enabled if any of
+\f[C]linkcolor\f[], \f[C]citecolor\f[], \f[C]urlcolor\f[], or
+\f[C]toccolor\f[] are set
 .RS
 .RE
 .TP
-.B \f[C]hidelinks\f[]
-enables \f[C]hidelinks\f[] option for \f[C]hyperref\f[], disabling link
-color
+.B \f[C]linkcolor\f[], \f[C]citecolor\f[], \f[C]urlcolor\f[], \f[C]toccolor\f[]
+color for internal links, citation links, external links, and links in
+table of contents: uses any of the predefined LaTeX colors
 .RS
 .RE
 .TP
 .B \f[C]links\-as\-notes\f[]
-causes links to be printed as footnotes in LaTeX documents
+causes links to be printed as footnotes
 .RS
 .RE
 .TP
@@ -1378,38 +1471,128 @@ in some classes
 .RS
 .RE
 .TP
+.B \f[C]thanks\f[]
+specifies contents of acknowledgments footnote after document title.
+.RS
+.RE
+.TP
 .B \f[C]toc\f[]
-include table of contents in LaTeX documents
+include table of contents (can also be set using
+\f[C]\-\-toc/\-\-table\-of\-contents\f[])
 .RS
 .RE
 .TP
 .B \f[C]toc\-depth\f[]
-level of section to include in table of contents in LaTeX documents
+level of section to include in table of contents
 .RS
 .RE
 .TP
-.B \f[C]toc\-title\f[]
-title of table of contents (works only with EPUB and docx)
+.B \f[C]lof\f[], \f[C]lot\f[]
+include list of figures, list of tables
 .RS
 .RE
 .TP
-.B \f[C]lof\f[]
-include list of figures in LaTeX documents
+.B \f[C]bibliography\f[]
+bibliography to use for resolving references
 .RS
 .RE
 .TP
-.B \f[C]lot\f[]
-include list of tables in LaTeX documents
+.B \f[C]biblio\-style\f[]
+bibliography style, when used with \f[C]\-\-natbib\f[] and
+\f[C]\-\-biblatex\f[].
 .RS
 .RE
 .TP
-.B \f[C]bibliography\f[]
-bibliography to use for resolving references
+.B \f[C]biblatexoptions\f[]
+list of options for biblatex.
 .RS
 .RE
+.SS Variables for ConTeXt
 .TP
-.B \f[C]biblio\-style\f[]
-bibliography style in LaTeX, when used with \f[C]\-\-natbib\f[]
+.B \f[C]papersize\f[]
+paper size, e.g.
+\f[C]letter\f[], \f[C]A4\f[], \f[C]landscape\f[] (see ConTeXt Paper
+Setup); may be repeated for multiple options
+.RS
+.RE
+.TP
+.B \f[C]layout\f[]
+options for page margins and text arrangement (see ConTeXt Layout); may
+be repeated for multiple options
+.RS
+.RE
+.TP
+.B \f[C]margin\-left\f[], \f[C]margin\-right\f[], \f[C]margin\-top\f[], \f[C]margin\-bottom\f[]
+sets margins, if \f[C]layout\f[] is not used (otherwise \f[C]layout\f[]
+overrides these)
+.RS
+.RE
+.TP
+.B \f[C]fontsize\f[]
+font size for body text (e.g.
+\f[C]10pt\f[], \f[C]12pt\f[])
+.RS
+.RE
+.TP
+.B \f[C]mainfont\f[], \f[C]sansfont\f[], \f[C]monofont\f[], \f[C]mathfont\f[]
+font families: take the name of any system font (see ConTeXt Font
+Switching)
+.RS
+.RE
+.TP
+.B \f[C]linkcolor\f[], \f[C]contrastcolor\f[]
+color for links outside and inside a page, e.g.
+\f[C]red\f[], \f[C]blue\f[] (see ConTeXt Color)
+.RS
+.RE
+.TP
+.B \f[C]linkstyle\f[]
+typeface style for links, e.g.
+\f[C]normal\f[], \f[C]bold\f[], \f[C]slanted\f[], \f[C]boldslanted\f[],
+\f[C]type\f[], \f[C]cap\f[], \f[C]small\f[]
+.RS
+.RE
+.TP
+.B \f[C]indenting\f[]
+controls indentation of paragraphs, e.g.
+\f[C]yes,small,next\f[] (see ConTeXt Indentation); may be repeated for
+multiple options
+.RS
+.RE
+.TP
+.B \f[C]whitespace\f[]
+spacing between paragraphs, e.g.
+\f[C]none\f[], \f[C]small\f[] (using \f[C]setupwhitespace\f[])
+.RS
+.RE
+.TP
+.B \f[C]interlinespace\f[]
+adjusts line spacing, e.g.
+\f[C]4ex\f[] (using \f[C]setupinterlinespace\f[]); may be repeated for
+multiple options
+.RS
+.RE
+.TP
+.B \f[C]headertext\f[], \f[C]footertext\f[]
+text to be placed in running header or footer (see ConTeXt Headers and
+Footers); may be repeated up to four times for different placement
+.RS
+.RE
+.TP
+.B \f[C]pagenumbering\f[]
+page number style and location (using \f[C]setuppagenumbering\f[]); may
+be repeated for multiple options
+.RS
+.RE
+.TP
+.B \f[C]toc\f[]
+include table of contents (can also be set using
+\f[C]\-\-toc/\-\-table\-of\-contents\f[])
+.RS
+.RE
+.TP
+.B \f[C]lof\f[], \f[C]lot\f[]
+include list of figures, list of tables
 .RS
 .RE
 .SS Variables for man pages
@@ -1515,16 +1698,16 @@ merge in changes after each pandoc release.
 .SH PANDOC\[aq]S MARKDOWN
 .PP
 Pandoc understands an extended and slightly revised version of John
-Gruber\[aq]s markdown syntax.
+Gruber\[aq]s Markdown syntax.
 This document explains the syntax, noting differences from standard
-markdown.
+Markdown.
 Except where noted, these differences can be suppressed by using the
 \f[C]markdown_strict\f[] format instead of \f[C]markdown\f[].
 An extensions can be enabled by adding \f[C]+EXTENSION\f[] to the format
 name and disabled by adding \f[C]\-EXTENSION\f[].
-For example, \f[C]markdown_strict+footnotes\f[] is strict markdown with
+For example, \f[C]markdown_strict+footnotes\f[] is strict Markdown with
 footnotes enabled, while \f[C]markdown\-footnotes\-pipe_tables\f[] is
-pandoc\[aq]s markdown without footnotes or pipe tables.
+pandoc\[aq]s Markdown without footnotes or pipe tables.
 .SS Philosophy
 .PP
 Markdown is designed to be easy to write, and, even more importantly,
@@ -1541,8 +1724,8 @@ This principle has guided pandoc\[aq]s decisions in finding syntax for
 tables, footnotes, and other extensions.
 .PP
 There is, however, one respect in which pandoc\[aq]s aims are different
-from the original aims of markdown.
-Whereas markdown was originally designed with HTML generation in mind,
+from the original aims of Markdown.
+Whereas Markdown was originally designed with HTML generation in mind,
 pandoc is designed for multiple output formats.
 Thus, while pandoc allows the embedding of raw HTML, it discourages it,
 and provides other, non\-HTMLish ways of representing important document
@@ -1605,7 +1788,7 @@ As with setext\-style headers, the header text can contain formatting:
 .fi
 .SS Extension: \f[C]blank_before_header\f[]
 .PP
-Standard markdown syntax does not require a blank line before a header.
+Standard Markdown syntax does not require a blank line before a header.
 Pandoc does require this (except, of course, at the beginning of the
 document).
 The reason for the requirement is that it is all too easy for a
@@ -1707,28 +1890,27 @@ Identifier
 T}
 _
 T{
-Header identifiers in HTML
+\f[C]Header\ identifiers\ in\ HTML\f[]
 T}@T{
 \f[C]header\-identifiers\-in\-html\f[]
 T}
 T{
-\f[I]Dogs\f[]?\-\-in \f[I]my\f[] house?
+\f[C]*Dogs*?\-\-in\ *my*\ house?\f[]
 T}@T{
 \f[C]dogs\-\-in\-my\-house\f[]
 T}
 T{
-HTML, S5, or RTF?
+\f[C][HTML],\ [S5],\ or\ [RTF]?\f[]
 T}@T{
 \f[C]html\-s5\-or\-rtf\f[]
 T}
 T{
-3.
-Applications
+\f[C]3.\ Applications\f[]
 T}@T{
 \f[C]applications\f[]
 T}
 T{
-33
+\f[C]33\f[]
 T}@T{
 \f[C]section\f[]
 T}
@@ -1877,7 +2059,7 @@ spaces after the \f[C]>\f[]:
 .fi
 .SS Extension: \f[C]blank_before_blockquote\f[]
 .PP
-Standard markdown syntax does not require a blank line before a block
+Standard Markdown syntax does not require a blank line before a block
 quote.
 Pandoc does require this (except, of course, at the beginning of the
 document).
@@ -1916,7 +2098,7 @@ Note: blank lines in the verbatim text need not begin with four spaces.
 .SS Fenced code blocks
 .SS Extension: \f[C]fenced_code_blocks\f[]
 .PP
-In addition to standard indented code blocks, Pandoc supports
+In addition to standard indented code blocks, pandoc supports
 \f[I]fenced\f[] code blocks.
 These begin with a row of three or more tildes (\f[C]~\f[]) and end with
 a row of tildes that must be at least as long as the starting row.
@@ -2022,7 +2204,7 @@ For more information on highlighting, see Syntax highlighting, below.
 A line block is a sequence of lines beginning with a vertical bar
 (\f[C]|\f[]) followed by a space.
 The division into lines will be preserved in the output, as will any
-leading spaces; otherwise, the lines will be formatted as markdown.
+leading spaces; otherwise, the lines will be formatted as Markdown.
 This is useful for verse and addresses:
 .IP
 .nf
@@ -2096,7 +2278,7 @@ List items look best if subsequent lines are flush with the first line
 \f[]
 .fi
 .PP
-But markdown also allows a "lazy" format:
+But Markdown also allows a "lazy" format:
 .IP
 .nf
 \f[C]
@@ -2145,7 +2327,7 @@ The nested list must be indented four spaces or one tab:
 \f[]
 .fi
 .PP
-As noted above, markdown allows you to write list items "lazily,"
+As noted above, Markdown allows you to write list items "lazily,"
 instead of indenting continuation lines.
 However, if there are multiple paragraphs or other blocks in a list
 item, the first line of each must be indented.
@@ -2164,12 +2346,12 @@ list\ item.
 .fi
 .PP
 \f[B]Note:\f[] Although the four\-space rule for continuation paragraphs
-comes from the official markdown syntax guide, the reference
+comes from the official Markdown syntax guide, the reference
 implementation, \f[C]Markdown.pl\f[], does not follow it.
 So pandoc will give different results than \f[C]Markdown.pl\f[] when
 authors have indented continuation paragraphs fewer than four spaces.
 .PP
-The markdown syntax guide is not explicit whether the four\-space rule
+The Markdown syntax guide is not explicit whether the four\-space rule
 applies to \f[I]all\f[] block\-level content in a list item; it only
 mentions paragraphs and code blocks.
 But it implies that the rule applies to all block\-level content
@@ -2179,7 +2361,7 @@ But it implies that the rule applies to all block\-level content
 Ordered lists work just like bulleted lists, except that the items begin
 with enumerators rather than bullets.
 .PP
-In standard markdown, enumerators are decimal numbers followed by a
+In standard Markdown, enumerators are decimal numbers followed by a
 period and a space.
 The numbers themselves are ignored, so there is no difference between
 this list:
@@ -2203,7 +2385,7 @@ and this one:
 .fi
 .SS Extension: \f[C]fancy_lists\f[]
 .PP
-Unlike standard markdown, Pandoc allows ordered list items to be marked
+Unlike standard Markdown, pandoc allows ordered list items to be marked
 with uppercase and lowercase letters and roman numerals, in addition to
 arabic numerals.
 List markers may be enclosed in parentheses or followed by a single
@@ -2295,7 +2477,7 @@ 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 other markdown lists, you can "lazily" omit indentation
+However, as with other Markdown lists, you can "lazily" omit indentation
 except at the beginning of a paragraph or other block element:
 .IP
 .nf
@@ -2385,7 +2567,7 @@ Consider this source:
 .fi
 .PP
 Pandoc transforms this into a "compact list" (with no \f[C]<p>\f[] tags
-around "First", "Second", or "Third"), while markdown puts \f[C]<p>\f[]
+around "First", "Second", or "Third"), while Markdown puts \f[C]<p>\f[]
 tags around "Second" and "Third" (but not "First"), because of the blank
 space around "Third".
 Pandoc follows a simple rule: if the text is followed by a blank line,
@@ -2395,7 +2577,7 @@ treated as a paragraph.
 The fact that the list is followed by a blank line is irrelevant.
 (Note: Pandoc works this way even when the \f[C]markdown_strict\f[]
 format is specified.
-This behavior is consistent with the official markdown syntax
+This behavior is consistent with the official Markdown syntax
 description, even though it is different from that of
 \f[C]Markdown.pl\f[].)
 .SS Ending a list
@@ -2411,7 +2593,7 @@ What if you want to put an indented code block after a list?
 \f[]
 .fi
 .PP
-Trouble! Here pandoc (like other markdown implementations) will treat
+Trouble! Here pandoc (like other Markdown implementations) will treat
 \f[C]{\ my\ code\ block\ }\f[] as the second paragraph of item two, and
 not as a code block.
 .PP
@@ -2565,7 +2747,7 @@ In multiline tables, the table parser pays attention to the widths of
 the columns, and the writers try to reproduce these relative widths in
 the output.
 So, if you find that one of the columns is too narrow in the output, try
-widening it in the markdown source.
+widening it in the Markdown source.
 .PP
 Headers may be omitted in multiline tables as well as simple tables:
 .IP
@@ -2653,12 +2835,12 @@ orange|3.09
 .PP
 The cells of pipe tables cannot contain block elements like paragraphs
 and lists, and cannot span multiple lines.
-Note also that in LaTeX/PDF output, the cells produced by pipe tables
-will not wrap, since there is no information available about relative
-widths.
-If you want content to wrap within cells, use multiline or grid tables.
+If a pipe table contains a row whose printable content is wider than the
+column width (see \f[C]\-\-columns\f[]), then the cell contents will
+wrap, with the relative cell widths determined by the widths of the
+separator lines.
 .PP
-Note: Pandoc also recognizes pipe tables of the following form, as can
+Note: pandoc also recognizes pipe tables of the following form, as can
 be produced by Emacs\[aq] orgtbl\-mode:
 .IP
 .nf
@@ -2791,7 +2973,7 @@ A YAML metadata block may occur anywhere in the document, but if it is
 not at the beginning, it must be preceded by a blank line.
 (Note that, because of the way pandoc concatenates input files when
 several are provided, you may also keep the metadata in a separate YAML
-file and pass it to pandoc as an argument, along with your markdown
+file and pass it to pandoc as an argument, along with your Markdown
 files:
 .IP
 .nf
@@ -2806,7 +2988,7 @@ with \f[C]\-\-\-\f[] or \f[C]\&...\f[].)
 Metadata will be taken from the fields of the YAML object and added to
 any existing document metadata.
 Metadata can contain lists and objects (nested arbitrarily), but all
-string scalars will be interpreted as markdown.
+string scalars will be interpreted as Markdown.
 Fields with names ending in an underscore will be ignored by pandoc.
 (They may be given a role by external processors.)
 .PP
@@ -2815,7 +2997,7 @@ The metadata fields will be combined through a \f[I]left\-biased
 union\f[]: if two metadata blocks attempt to set the same field, the
 value from the first block will be taken.
 .PP
-When pandoc is used with \f[C]\-t\ markdown\f[] to create a markdown
+When pandoc is used with \f[C]\-t\ markdown\f[] to create a Markdown
 document, a YAML metadata block will be produced only if the
 \f[C]\-s/\-\-standalone\f[] option is used.
 All of the metadata will appear in a single block at the beginning of
@@ -2847,7 +3029,7 @@ abstract:\ |
 .PP
 Template variables will be set automatically from the metadata.
 Thus, for example, in writing HTML, the variable \f[C]abstract\f[] will
-be set to the HTML equivalent of the markdown in the \f[C]abstract\f[]
+be set to the HTML equivalent of the Markdown in the \f[C]abstract\f[]
 field:
 .IP
 .nf
@@ -2904,7 +3086,7 @@ instead of
 \f[]
 .fi
 .PP
-This rule is easier to remember than standard markdown\[aq]s rule, which
+This rule is easier to remember than standard Markdown\[aq]s rule, which
 allows only the following characters to be backslash\-escaped:
 .IP
 .nf
@@ -2914,7 +3096,7 @@ allows only the following characters to be backslash\-escaped:
 .fi
 .PP
 (However, if the \f[C]markdown_strict\f[] format is used, the standard
-markdown rule will be used.)
+Markdown rule will be used.)
 .PP
 A backslash\-escaped space is parsed as a nonbreaking space.
 It will appear in TeX output as \f[C]~\f[] and in HTML and XML as
@@ -2925,7 +3107,7 @@ a backslash occurring at the end of a line) is parsed as a hard line
 break.
 It will appear in TeX output as \f[C]\\\\\f[] and in HTML as
 \f[C]<br\ />\f[].
-This is a nice alternative to markdown\[aq]s "invisible" way of
+This is a nice alternative to Markdown\[aq]s "invisible" way of
 indicating hard line breaks using two trailing spaces on a line.
 .PP
 Backslash escapes do not work in verbatim contexts.
@@ -2939,9 +3121,9 @@ quotes, \f[C]\-\-\-\f[] to em\-dashes, \f[C]\-\-\f[] to en\-dashes, and
 Nonbreaking spaces are inserted after certain abbreviations, such as
 "Mr."
 .PP
-Note: if your LaTeX template calls for the \f[C]csquotes\f[] package,
-pandoc will detect this automatically and use \f[C]\\enquote{...}\f[]
-for quoted text.
+Note: if your LaTeX template or any included header file call for the
+\f[C]csquotes\f[] package, pandoc will detect this automatically and use
+\f[C]\\enquote{...}\f[] for quoted text.
 .SS Inline formatting
 .SS Emphasis
 .PP
@@ -3040,7 +3222,7 @@ The general rule is that a verbatim span starts with a string of
 consecutive backticks (optionally followed by a space) and ends with a
 string of the same number of backticks (optionally preceded by a space).
 .PP
-Note that backslash\-escapes (and other markdown constructs) do not work
+Note that backslash\-escapes (and other Markdown constructs) do not work
 in verbatim contexts:
 .IP
 .nf
@@ -3212,7 +3394,7 @@ The MathJax script will be used to render it as formulas.
 Markdown allows you to insert raw HTML (or DocBook) anywhere in a
 document (except verbatim contexts, where \f[C]<\f[], \f[C]>\f[], and
 \f[C]&\f[] are interpreted literally).
-(Technically this is not an extension, since standard markdown allows
+(Technically this is not an extension, since standard Markdown allows
 it, but it has been made an extension so that it can be disabled if
 desired.)
 .PP
@@ -3221,16 +3403,16 @@ DZSlides, EPUB, Markdown, and Textile output, and suppressed in other
 formats.
 .SS Extension: \f[C]markdown_in_html_blocks\f[]
 .PP
-Standard markdown allows you to include HTML "blocks": blocks of HTML
+Standard Markdown allows you to include HTML "blocks": blocks of HTML
 between balanced tags that are separated from the surrounding text with
 blank lines, and start and end at the left margin.
-Within these blocks, everything is interpreted as HTML, not markdown; so
+Within these blocks, everything is interpreted as HTML, not Markdown; so
 (for example), \f[C]*\f[] does not signify emphasis.
 .PP
 Pandoc behaves this way when the \f[C]markdown_strict\f[] format is
 used; but by default, pandoc interprets material between HTML block tags
-as markdown.
-Thus, for example, Pandoc will turn
+as Markdown.
+Thus, for example, pandoc will turn
 .IP
 .nf
 \f[C]
@@ -3259,13 +3441,13 @@ into
 whereas \f[C]Markdown.pl\f[] will preserve it as is.
 .PP
 There is one exception to this rule: text between \f[C]<script>\f[] and
-\f[C]<style>\f[] tags is not interpreted as markdown.
+\f[C]<style>\f[] tags is not interpreted as Markdown.
 .PP
-This departure from standard markdown should make it easier to mix
-markdown with HTML block elements.
-For example, one can surround a block of markdown text with
+This departure from standard Markdown should make it easier to mix
+Markdown with HTML block elements.
+For example, one can surround a block of Markdown text with
 \f[C]<div>\f[] tags without preventing it from being interpreted as
-markdown.
+Markdown.
 .SS Extension: \f[C]native_divs\f[]
 .PP
 Use native pandoc \f[C]Div\f[] blocks for content inside \f[C]<div>\f[]
@@ -3309,7 +3491,7 @@ Age\ &\ Frequency\ \\\\\ \\hline
 .fi
 .PP
 the material between the begin and end tags will be interpreted as raw
-LaTeX, not as markdown.
+LaTeX, not as Markdown.
 .PP
 Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
 and ConTeXt.
@@ -3321,8 +3503,14 @@ For output formats other than LaTeX, pandoc will parse LaTeX
 the resulting macros to all LaTeX math.
 So, for example, the following will work in all output formats, not just
 LaTeX:
-.PP
-⟨\f[I]a\f[], \f[I]b\f[], \f[I]c\f[]⟩
+.IP
+.nf
+\f[C]
+\\newcommand{\\tuple}[1]{\\langle\ #1\ \\rangle}
+
+$\\tuple{a,\ b,\ c}$
+\f[]
+.fi
 .PP
 In LaTeX output, the \f[C]\\newcommand\f[] definition will simply be
 passed unchanged to the output.
@@ -3432,7 +3620,7 @@ See\ [my\ website][].
 \f[]
 .fi
 .PP
-Note: In \f[C]Markdown.pl\f[] and most other markdown implementations,
+Note: In \f[C]Markdown.pl\f[] and most other Markdown implementations,
 reference link definitions cannot occur in nested constructions such as
 list items or block quotes.
 Pandoc lifts this arbitrary seeming restriction.
@@ -3519,10 +3707,65 @@ One way to do this is to insert a nonbreaking space after the image:
 ![This\ image\ won\[aq]t\ be\ a\ figure](/url/of/image.png)\\\ 
 \f[]
 .fi
+.SS Extension: \f[C]link_attributes\f[]
+.PP
+Attributes can be set on links and images:
+.IP
+.nf
+\f[C]
+An\ inline\ ![image](foo.jpg){#id\ .class\ width=30\ height=20px}
+and\ a\ reference\ ![image][ref]\ with\ attributes.
+
+[ref]:\ foo.jpg\ "optional\ title"\ {#id\ .class\ key=val\ key2="val\ 2"}
+\f[]
+.fi
+.PP
+(This syntax is compatible with PHP Markdown Extra when only
+\f[C]#id\f[] and \f[C]\&.class\f[] are used.)
+.PP
+For HTML and EPUB, all attributes except \f[C]width\f[] and
+\f[C]height\f[] (but including \f[C]srcset\f[] and \f[C]sizes\f[]) are
+passed through as is.
+The other writers ignore attributes that are not supported by their
+output format.
+.PP
+The \f[C]width\f[] and \f[C]height\f[] attributes on images are treated
+specially.
+When used without a unit, the unit is assumed to be pixels.
+However, any of the following unit identifiers can be used: \f[C]px\f[],
+\f[C]cm\f[], \f[C]mm\f[], \f[C]in\f[], \f[C]inch\f[] and \f[C]%\f[].
+There must not be any spaces between the number and the unit.
+For example:
+.IP
+.nf
+\f[C]
+![](file.jpg){\ width=50%\ }
+\f[]
+.fi
+.IP \[bu] 2
+Dimensions are converted to inches for output in page\-based formats
+like LaTeX.
+Dimensions are converted to pixels for output in HTML\-like formats.
+Use the \f[C]\-\-dpi\f[] option to specify the number of pixels per
+inch.
+The default is 96dpi.
+.IP \[bu] 2
+The \f[C]%\f[] unit is generally relative to some available space.
+For example the above example will render to
+\f[C]<img\ href="file.jpg"\ style="width:\ 50%;"\ />\f[] (HTML),
+\f[C]\\includegraphics[width=0.5\\textwidth]{file.jpg}\f[] (LaTeX), or
+\f[C]\\externalfigure[file.jpg][width=0.5\\textwidth]\f[] (ConTeXt).
+.IP \[bu] 2
+Some output formats have a notion of a class (ConTeXt) or a unique
+identifier (LaTeX \f[C]\\caption\f[]), or both (HTML).
+.IP \[bu] 2
+When no \f[C]width\f[] or \f[C]height\f[] attributes are specified, the
+fallback is to look at the image resolution and the dpi metadata
+embedded in the image file.
 .SS Footnotes
 .SS Extension: \f[C]footnotes\f[]
 .PP
-Pandoc\[aq]s markdown allows footnotes, using the following syntax:
+Pandoc\[aq]s Markdown allows footnotes, using the following syntax:
 .IP
 .nf
 \f[C]
@@ -3665,7 +3908,7 @@ Note that \f[C]pandoc\-citeproc\ \-\-bib2json\f[] and
 \f[C]\&.yaml\f[] files from any of the supported formats.
 .PP
 In\-field markup: In BibTeX and BibLaTeX databases, pandoc\-citeproc
-parses a subset of LaTeX markup; in CSL YAML databases, pandoc markdown;
+parses a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown;
 and in CSL JSON databases, an HTML\-like markup:
 .TP
 .B \f[C]<i>...</i>\f[]
@@ -3701,9 +3944,10 @@ prevent a phrase from being capitalized as title case
 \f[C]pandoc\-citeproc\ \-j\f[] and \f[C]\-y\f[] interconvert the CSL
 JSON and CSL YAML formats as far as possible.
 .PP
-As an alternative to specifying a bibliography file, you can include the
-citation data directly in the \f[C]references\f[] field of the
-document\[aq]s YAML metadata.
+As an alternative to specifying a bibliography file using
+\f[C]\-\-bibliography\f[] or the YAML metadata field
+\f[C]bibliography\f[], you can include the citation data directly in the
+\f[C]references\f[] field of the document\[aq]s YAML metadata.
 The field should contain an array of YAML\-encoded references, for
 example:
 .IP
@@ -3749,6 +3993,9 @@ Style author\-date format.
 The CSL project provides further information on finding and editing
 styles.
 .PP
+To make your citations hyperlinks to the corresponding bibliography
+entries, add \f[C]link\-citations:\ true\f[] to your YAML metadata.
+.PP
 Citations go inside square brackets and are separated by semicolons.
 Each citation must have a key, composed of \[aq]\@\[aq] + the citation
 identifier from the database, and may optionally have a prefix, a
@@ -3849,12 +4096,14 @@ In order to do so, specify bibliography files as outlined above, and add
 invocation.
 Bear in mind that bibliography files have to be in respective format
 (either BibTeX or BibLaTeX).
+.PP
+For more information, see the pandoc\-citeproc man page.
 .SS Non\-pandoc extensions
 .PP
-The following markdown syntax extensions are not enabled by default in
+The following Markdown syntax extensions are not enabled by default in
 pandoc, but may be enabled by adding \f[C]+EXTENSION\f[] to the format
 name, where \f[C]EXTENSION\f[] is the name of the extension.
-Thus, for example, \f[C]markdown+hard_line_breaks\f[] is markdown with
+Thus, for example, \f[C]markdown+hard_line_breaks\f[] is Markdown with
 hard line breaks.
 .SS Extension: \f[C]lists_without_preceding_blankline\f[]
 .PP
@@ -3871,6 +4120,16 @@ treated as spaces or as hard line breaks.
 This option is intended for use with East Asian languages where spaces
 are not used between words, but text is divided into lines for
 readability.
+.SS Extension: \f[C]east_asian_line_breaks\f[]
+.PP
+Causes newlines within a paragraph to be ignored, rather than being
+treated as spaces or as hard line breaks, when they occur between two
+East Asian wide characters.
+This is a better choice than \f[C]ignore_line_breaks\f[] for texts that
+include a mix of East Asian wide characters and other characters.
+.SS Extension: \f[C]emoji\f[]
+.PP
+Parses textual emojis like \f[C]:smile:\f[] as Unicode emoticons.
 .SS Extension: \f[C]tex_math_single_backslash\f[]
 .PP
 Causes anything between \f[C]\\(\f[] and \f[C]\\)\f[] to be interpreted
@@ -3886,8 +4145,8 @@ interpreted as inline TeX math, and anything between \f[C]\\\\[\f[] and
 .SS Extension: \f[C]markdown_attribute\f[]
 .PP
 By default, pandoc interprets material inside block\-level tags as
-markdown.
-This extension changes the behavior so that markdown is only parsed
+Markdown.
+This extension changes the behavior so that Markdown is only parsed
 inside block\-level tags if the tags have the attribute
 \f[C]markdown=1\f[].
 .SS Extension: \f[C]mmd_title_block\f[]
@@ -3931,12 +4190,21 @@ Causes the identifiers produced by \f[C]auto_identifiers\f[] to be pure
 ASCII.
 Accents are stripped off of accented latin letters, and non\-latin
 letters are omitted.
-.SS Extension: \f[C]link_attributes\f[]
+.SS Extension: \f[C]mmd_link_attributes\f[]
 .PP
 Parses multimarkdown style key\-value attributes on link and image
 references.
-Note that pandoc\[aq]s internal document model provides nowhere to put
-these, so they are presently just ignored.
+This extension should not be confused with the \f[C]link_attributes\f[]
+extension.
+.IP
+.nf
+\f[C]
+This\ is\ a\ reference\ ![image][ref]\ with\ multimarkdown\ attributes.
+
+[ref]:\ http://path.to/image\ "Image\ title"\ width=20px\ height=30px
+\ \ \ \ \ \ \ id=myId\ class="myClass1\ myClass2"
+\f[]
+.fi
 .SS Extension: \f[C]mmd_header_identifiers\f[]
 .PP
 Parses multimarkdown style header identifiers (in square brackets, after
@@ -3958,31 +4226,31 @@ Lazy wrapping of paragraphs is not allowed: the entire definition must
 be indented four spaces.
 .SS Markdown variants
 .PP
-In addition to pandoc\[aq]s extended markdown, the following markdown
+In addition to pandoc\[aq]s extended Markdown, the following Markdown
 variants are supported:
 .TP
 .B \f[C]markdown_phpextra\f[] (PHP Markdown Extra)
 \f[C]footnotes\f[], \f[C]pipe_tables\f[], \f[C]raw_html\f[],
 \f[C]markdown_attribute\f[], \f[C]fenced_code_blocks\f[],
 \f[C]definition_lists\f[], \f[C]intraword_underscores\f[],
-\f[C]header_attributes\f[], \f[C]abbreviations\f[],
-\f[C]shortcut_reference_links\f[].
+\f[C]header_attributes\f[], \f[C]link_attributes\f[],
+\f[C]abbreviations\f[], \f[C]shortcut_reference_links\f[].
 .RS
 .RE
 .TP
 .B \f[C]markdown_github\f[] (GitHub\-Flavored Markdown)
-\f[C]pipe_tables\f[], \f[C]raw_html\f[],
-\f[C]tex_math_single_backslash\f[], \f[C]fenced_code_blocks\f[],
+\f[C]pipe_tables\f[], \f[C]raw_html\f[], \f[C]fenced_code_blocks\f[],
 \f[C]auto_identifiers\f[], \f[C]ascii_identifiers\f[],
 \f[C]backtick_code_blocks\f[], \f[C]autolink_bare_uris\f[],
 \f[C]intraword_underscores\f[], \f[C]strikeout\f[],
-\f[C]hard_line_breaks\f[], \f[C]shortcut_reference_links\f[].
+\f[C]hard_line_breaks\f[], \f[C]emoji\f[],
+\f[C]shortcut_reference_links\f[].
 .RS
 .RE
 .TP
 .B \f[C]markdown_mmd\f[] (MultiMarkdown)
-\f[C]pipe_tables\f[] \f[C]raw_html\f[], \f[C]markdown_attribute\f[],
-\f[C]link_attributes\f[], \f[C]raw_tex\f[],
+\f[C]pipe_tables\f[], \f[C]raw_html\f[], \f[C]markdown_attribute\f[],
+\f[C]mmd_link_attributes\f[], \f[C]raw_tex\f[],
 \f[C]tex_math_double_backslash\f[], \f[C]intraword_underscores\f[],
 \f[C]mmd_title_block\f[], \f[C]footnotes\f[], \f[C]definition_lists\f[],
 \f[C]all_symbols_escapable\f[], \f[C]implicit_header_references\f[],
@@ -3995,10 +4263,10 @@ variants are supported:
 \f[C]raw_html\f[]
 .RS
 .RE
-.SS Extensions with formats other than markdown
+.SS Extensions with formats other than Markdown
 .PP
 Some of the extensions discussed above can be used with formats other
-than markdown:
+than Markdown:
 .IP \[bu] 2
 \f[C]auto_identifiers\f[] can be used with \f[C]latex\f[], \f[C]rst\f[],
 \f[C]mediawiki\f[], and \f[C]textile\f[] input (and is used by default).
@@ -4009,13 +4277,13 @@ than markdown:
 example.)
 .SH PRODUCING SLIDE SHOWS WITH PANDOC
 .PP
-You can use Pandoc to produce an HTML + javascript slide presentation
+You can use pandoc to produce an HTML + javascript slide presentation
 that can be viewed via a web browser.
 There are five ways to do this, using S5, DZSlides, Slidy, Slideous, or
 reveal.js.
 You can also produce a PDF slide show using LaTeX \f[C]beamer\f[].
 .PP
-Here\[aq]s the markdown source for a simple slide show,
+Here\[aq]s the Markdown source for a simple slide show,
 \f[C]habits.txt\f[]:
 .IP
 .nf
@@ -4219,14 +4487,14 @@ This is recommended especially for bibliographies:
 .SS Speaker notes
 .PP
 reveal.js has good support for speaker notes.
-You can add notes to your markdown document thus:
+You can add notes to your Markdown document thus:
 .IP
 .nf
 \f[C]
 <div\ class="notes">
 This\ is\ my\ note.
 
-\-\ It\ can\ contain\ markdown
+\-\ It\ can\ contain\ Markdown
 \-\ like\ this\ list
 
 </div>
@@ -4237,7 +4505,7 @@ To show the notes window, press \f[C]s\f[] while viewing the
 presentation.
 Notes are not yet supported for other slide formats, but the notes will
 not appear on the slides themselves.
-.SS Marking frames "fragile" in beamer
+.SS Frame attributes in beamer
 .PP
 Sometimes it is necessary to add the LaTeX \f[C][fragile]\f[] option to
 a frame in beamer (for example, when using the \f[C]minted\f[]
@@ -4250,10 +4518,16 @@ introducing the slide:
 #\ Fragile\ slide\ {.fragile}
 \f[]
 .fi
-.SH EPUB METADATA
+.PP
+All of the other frame attributes described in Section 8.1 of the Beamer
+User\[aq]s Guide may also be used: \f[C]allowdisplaybreaks\f[],
+\f[C]allowframebreaks\f[], \f[C]b\f[], \f[C]c\f[], \f[C]t\f[],
+\f[C]environment\f[], \f[C]label\f[], \f[C]plain\f[], \f[C]shrink\f[].
+.SH CREATING EPUBS WITH PANDOC
+.SS EPUB Metadata
 .PP
 EPUB metadata may be specified using the \f[C]\-\-epub\-metadata\f[]
-option, but if the source document is markdown, it is better to use a
+option, but if the source document is Markdown, it is better to use a
 YAML metadata block.
 Here is an example:
 .IP
@@ -4379,6 +4653,25 @@ Specifies the \f[C]page\-progression\-direction\f[] attribute for the
 \f[C]spine\f[] element.
 .RS
 .RE
+.SS Linked media
+.PP
+By default, pandoc will download linked media (including audio and
+video) and include it in the EPUB container, yielding a completely
+self\-contained EPUB.
+If you want to link to external media resources instead, use raw HTML in
+your source and add \f[C]data\-external="1"\f[] to the tag with the
+\f[C]src\f[] attribute.
+For example:
+.IP
+.nf
+\f[C]
+<audio\ controls="1">
+\ \ <source\ src="http://example.com/music/toccata.mp3"
+\ \ \ \ \ \ \ \ \ \ data\-external="1"\ type="audio/mpeg">
+\ \ </source>
+</audio>
+\f[]
+.fi
 .SH LITERATE HASKELL SUPPORT
 .PP
 If you append \f[C]+lhs\f[] (or \f[C]+literate_haskell\f[]) to an
@@ -4388,14 +4681,14 @@ output; \f[C]beamer\f[], \f[C]html\f[] or \f[C]html5\f[] for output
 only), pandoc will treat the document as literate Haskell source.
 This means that
 .IP \[bu] 2
-In markdown input, "bird track" sections will be parsed as Haskell code
+In Markdown input, "bird track" sections will be parsed as Haskell code
 rather than block quotations.
 Text between \f[C]\\begin{code}\f[] and \f[C]\\end{code}\f[] will also
 be treated as Haskell code.
 For ATX\-style headers the character \[aq]=\[aq] will be used instead of
 \[aq]#\[aq].
 .IP \[bu] 2
-In markdown output, code blocks with classes \f[C]haskell\f[] and
+In Markdown output, code blocks with classes \f[C]haskell\f[] and
 \f[C]literate\f[] will be rendered using bird tracks, and block
 quotations will be indented one space, so they will not be treated as
 Haskell code.
@@ -4427,7 +4720,7 @@ pandoc\ \-f\ markdown+lhs\ \-t\ html
 \f[]
 .fi
 .PP
-reads literate Haskell source formatted with markdown conventions and
+reads literate Haskell source formatted with Markdown conventions and
 writes ordinary HTML (without bird tracks).
 .IP
 .nf
@@ -4489,9 +4782,10 @@ This software carries no warranty of any kind.
 .PP
 Contributors include Aaron Wolen, Albert Krewinkel, Alexander
 Kondratskiy, Alexander Sulfrian, Alexander V Vershilov, Alfred
-Wechselberger, Andreas Lööw, Andrew Dunning, Antoine Latter, Arlo
-O\[aq]Keeffe, Artyom Kazak, Ben Gamari, Beni Cherniavsky\-Paskin, Bjorn
-Buckwalter, Bradley Kuhn, Brent Yorgey, Bryan O\[aq]Sullivan, B.
+Wechselberger, Andreas Lööw, Andrew Dunning, Antoine Latter, Arata
+Mizuki, Arlo O\[aq]Keeffe, Artyom Kazak, Ben Gamari, Beni
+Cherniavsky\-Paskin, Bjorn Buckwalter, Bradley Kuhn, Brent Yorgey, Bryan
+O\[aq]Sullivan, B.
 Scott Michel, Caleb McDaniel, Calvin Beck, Christoffer Ackelman,
 Christoffer Sawicki, Clare Macrae, Clint Adams, Conal Elliott, Craig S.
 Bosma, Daniel Bergey, Daniel T.
@@ -4510,7 +4804,7 @@ Bogner, Kelsey Hightower, Konstantin Zudov, Lars\-Dominik Braun, Luke
 Plant, Mark Szepieniec, Mark Wright, Masayoshi Takahashi, Matej Kollar,
 Mathias Schenner, Matthew Pickering, Matthias C.
 M.
-Troffaes, Max Bolingbroke, Max Rydahl Andersen, mb21, Merijn
+Troffaes, Mauro Bieg, Max Bolingbroke, Max Rydahl Andersen, Merijn
 Verstraaten, Michael Snoyman, Michael Thompson, MinRK, Nathan Gass, Neil
 Mayhew, Nick Bart, Nicolas Kaiser, Nikolay Yakimov, nkalvi, Paulo
 Tanimoto, Paul Rivier, Peter Wang, Philippe Ombredanne, Phillip Alday,
diff --git a/man/removeLinks.hs b/man/removeLinks.hs
index d4508e7..52414eb 100644
--- a/man/removeLinks.hs
+++ b/man/removeLinks.hs
@@ -4,6 +4,6 @@ main :: IO ()
 main = toJSONFilter removeLinks
 
 removeLinks :: Inline -> [Inline]
-removeLinks (Link l _) = l
+removeLinks (Link _ l _) = l
 removeLinks x = [x]
 
diff --git a/osx/distribution.xml b/osx/distribution.xml
deleted file mode 100644
index 024a25b..0000000
--- a/osx/distribution.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="no"?>
-<installer-gui-script minSpecVersion="1">
-    <title>pandoc</title>
-    <organization>net.johnmacfarlane.pandoc</organization>
-    <domains enable_localSystem="true"/>
-    <options customize="never" require-scripts="true" rootVolumeOnly="true" />
-    <!-- Define documents displayed at various steps -->
-    <!-- <welcome    file="welcome.html"    mime-type="text/html" /> -->
-    <license    file="license.html"    mime-type="text/html" />
-    <!-- <conclusion file="conclusion.html" mime-type="text/html" /> -->
-    <options hostArchitectures="x86_64" />
-    <!-- List all component packages -->
-    <pkg-ref id="net.johnmacfarlane.pandoc"
-             version="1.13"
-             auth="root">pandoc.pkg</pkg-ref>
-    <!-- List them again here. They can now be organized
-         as a hierarchy if you want. -->
-    <choices-outline>
-        <line choice="net.johnmacfarlane.pandoc"/>
-    </choices-outline>
-    <!-- Define each choice above -->
-    <choice
-        id="net.johnmacfarlane.pandoc"
-        visible="false"
-        title="pandoc"
-        description="pandoc - universal text converter"
-        start_selected="true">
-      <pkg-ref id="net.johnmacfarlane.pandoc"/>
-    </choice>
-</installer-gui-script>
diff --git a/osx/distribution.xml.in b/osx/distribution.xml.in
new file mode 100644
index 0000000..145fc0f
--- /dev/null
+++ b/osx/distribution.xml.in
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<installer-gui-script minSpecVersion="1">
+    <title>pandoc</title>
+    <organization>net.johnmacfarlane.pandoc</organization>
+    <domains enable_localSystem="true" enable_anywhere="true" />
+    <options customize="allow" require-scripts="false" rootVolumeOnly="false" />
+    <!-- Define documents displayed at various steps -->
+    <!-- <welcome    file="welcome.html"    mime-type="text/html" /> -->
+    <license    file="license.html"    mime-type="text/html" />
+    <!-- <conclusion file="conclusion.html" mime-type="text/html" /> -->
+    <options hostArchitectures="x86_64" />
+    <!-- List all component packages -->
+    <pkg-ref id="net.johnmacfarlane.pandoc"
+             version="PANDOCVERSION"
+             auth="root">pandoc.pkg</pkg-ref>
+    <!-- List them again here. They can now be organized
+         as a hierarchy if you want. -->
+    <choices-outline>
+        <line choice="net.johnmacfarlane.pandoc"/>
+    </choices-outline>
+    <!-- Define each choice above -->
+    <choice
+        id="net.johnmacfarlane.pandoc"
+        visible="false"
+        title="pandoc"
+        description="pandoc - universal text converter"
+        start_selected="true">
+      <pkg-ref id="net.johnmacfarlane.pandoc"/>
+    </choice>
+</installer-gui-script>
diff --git a/osx/stack.yaml b/osx/stack.yaml
new file mode 100644
index 0000000..c29a7f4
--- /dev/null
+++ b/osx/stack.yaml
@@ -0,0 +1,24 @@
+flags:
+  pandoc:
+    trypandoc: false
+    https: true
+    embed_data_files: true
+    old-locale: false
+    network-uri: true
+  pandoc-citeproc:
+    bibutils: true
+    embed_data_files: true
+    unicode_collation: false
+    test_citeproc: false
+    debug: false
+ghc-options:
+  pandoc-citeproc:  '-pgmP cpphs -optP--cpp'
+  highlighting-kate: '-pgmP cpphs -optP--cpp'
+packages:
+- '..'
+- 'https://hackage.haskell.org/package/pandoc-citeproc-0.9.1.1/pandoc-citeproc-0.9.1.1.tar.gz'
+extra-deps:
+- 'aeson-0.11.1.1'
+- 'texmath-0.8.5'
+- 'highlighting-kate-0.6.2'
+resolver: lts-5.8
diff --git a/pandoc.cabal b/pandoc.cabal
index a4ffeb0..08f1950 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,10 +1,10 @@
 Name:            pandoc
-Version:         1.15.1
+Version:         1.17.0.2
 Cabal-Version:   >= 1.10
 Build-Type:      Custom
 License:         GPL
 License-File:    COPYING
-Copyright:       (c) 2006-2015 John MacFarlane
+Copyright:       (c) 2006-2016 John MacFarlane
 Author:          John MacFarlane <jgm@berkeley.edu>
 Maintainer:      John MacFarlane <jgm@berkeley.edu>
 Bug-Reports:     https://github.com/jgm/pandoc/issues
@@ -15,28 +15,22 @@ Tested-With:     GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2
 Synopsis:        Conversion between markup formats
 Description:     Pandoc is a Haskell library for converting from one markup
                  format to another, and a command-line tool that uses
-                 this library. It can read markdown and (subsets of) HTML,
-                 reStructuredText, LaTeX, DocBook, MediaWiki markup, TWiki
-                 markup, Haddock markup, OPML, Emacs Org-Mode, txt2tags,
-                 Word Docx, ODT, and Textile, and it can write
-                 Markdown, reStructuredText, XHTML, HTML 5, LaTeX,
-                 ConTeXt, DocBook, OPML, OpenDocument, ODT,
+                 this library. It can read several dialects of Markdown and
+                 (subsets of) HTML, reStructuredText, LaTeX, DocBook,
+                 MediaWiki markup, TWiki markup, Haddock markup, OPML,
+                 Emacs Org-Mode, txt2tags, Word Docx, ODT, and Textile, and
+                 it can write Markdown, reStructuredText, XHTML, HTML 5,
+                 LaTeX, ConTeXt, DocBook, OPML, TEI, OpenDocument, ODT,
                  Word docx, RTF, MediaWiki, DokuWiki, Textile, groff man
                  pages, plain text, Emacs Org-Mode, AsciiDoc, Haddock markup,
                  EPUB (v2 and v3), FictionBook2, InDesign ICML, and several
                  kinds of HTML/javascript slide shows (S5, Slidy, Slideous,
                  DZSlides, reveal.js).
                  .
-                 Pandoc extends standard markdown syntax with footnotes,
-                 embedded LaTeX, definition lists, tables, and other
-                 features. A compatibility mode is provided for those
-                 who need a drop-in replacement for Markdown.pl.
-                 .
-                 In contrast to existing tools for converting markdown
-                 to HTML, which use regex substitutions, pandoc has
-                 a modular design: it consists of a set of readers,
-                 which parse text in a given format and produce a native
-                 representation of the document, and a set of writers,
+                 In contrast to most existing tools for converting Markdown
+                 to HTML, pandoc has a modular design: it consists of a set of
+                 readers, which parse text in a given format and produce a
+                 native representation of the document, and a set of writers,
                  which convert this native representation into a target
                  format. Thus, adding an input or output format requires
                  only adding a reader or writer.
@@ -45,6 +39,7 @@ Data-Files:
                  data/templates/default.html
                  data/templates/default.html5
                  data/templates/default.docbook
+                 data/templates/default.tei
                  data/templates/default.beamer
                  data/templates/default.opendocument
                  data/templates/default.icml
@@ -113,6 +108,8 @@ Extra-Source-Files:
                  -- documentation
                  INSTALL, BUGS, CONTRIBUTING.md, changelog
                  man/pandoc.1
+                 -- stack build plan
+                 stack.yaml
                  -- files needed to build man page
                  man/capitalizeHeaders.hs
                  man/removeNotes.hs
@@ -187,6 +184,8 @@ Extra-Source-Files:
                  tests/writer.fb2
                  tests/writer.opml
                  tests/writer.dokuwiki
+                 tests/writers-lang-and-dir.latex
+                 tests/writers-lang-and-dir.context
                  tests/dokuwiki_inline_formatting.dokuwiki
                  tests/lhs-test.markdown
                  tests/lhs-test.markdown+lhs
@@ -239,7 +238,7 @@ Flag network-uri
 
 Flag old-locale
   Description:   Use old-locale and time < 1.5
-  Default:       True
+  Default:       False
 
 Library
   Build-Depends: base >= 4.2 && <5,
@@ -250,22 +249,22 @@ Library
                  parsec >= 3.1 && < 3.2,
                  mtl >= 1.1 && < 2.3,
                  filepath >= 1.1 && < 1.5,
-                 process >= 1 && < 1.3,
+                 process >= 1 && < 1.5,
                  directory >= 1 && < 1.3,
                  bytestring >= 0.9 && < 0.11,
                  text >= 0.11 && < 1.3,
-                 zip-archive >= 0.2.3.4 && < 0.3,
-                 HTTP >= 4000.0.5 && < 4000.3,
-                 texmath >= 0.8.1 && < 0.9,
+                 zip-archive >= 0.2.3.4 && < 0.4,
+                 HTTP >= 4000.0.5 && < 4000.4,
+                 texmath >= 0.8.4.1 && < 0.9,
                  xml >= 1.3.12 && < 1.4,
                  random >= 1 && < 1.2,
                  extensible-exceptions >= 0.1 && < 0.2,
-                 pandoc-types >= 1.12.4 && < 1.13,
-                 aeson >= 0.7 && < 0.11,
-                 tagsoup >= 0.13.1 && < 0.14,
+                 pandoc-types >= 1.16 && < 1.17,
+                 aeson >= 0.7 && < 0.12,
+                 tagsoup >= 0.13.7 && < 0.14,
                  base64-bytestring >= 0.1 && < 1.1,
                  zlib >= 0.5 && < 0.7,
-                 highlighting-kate >= 0.6 && < 0.7,
+                 highlighting-kate >= 0.6.1 && < 0.7,
                  data-default >= 0.4 && < 0.6,
                  temporary >= 1.1 && < 1.3,
                  blaze-html >= 0.5 && < 0.9,
@@ -274,14 +273,14 @@ Library
                  scientific >= 0.2 && < 0.4,
                  vector >= 0.10 && < 0.12,
                  hslua >= 0.3 && < 0.5,
-                 binary >= 0.5 && < 0.8,
+                 binary >= 0.5 && < 0.9,
                  SHA >= 1.6 && < 1.7,
                  haddock-library >= 1.1 && < 1.3,
                  old-time,
-                 deepseq-generics >= 0.1 && < 0.2,
+                 deepseq >= 1.3 && < 1.5,
                  JuicyPixels >= 3.1.6.1 && < 3.3,
                  filemanip >= 0.3 && < 0.4,
-                 cmark >= 0.4.0.1 && < 0.5,
+                 cmark >= 0.5 && < 0.6,
                  ghc-prim >= 0.2
   if flag(old-locale)
      Build-Depends: old-locale >= 1 && < 1.1,
@@ -310,7 +309,10 @@ Library
                       ScopedTypeVariables, GeneralizedNewtypeDeriving,
                       RelaxedPolyRec, DeriveDataTypeable, TypeSynonymInstances,
                       FlexibleInstances
-  Hs-Source-Dirs:  src, prelude
+  Hs-Source-Dirs:  src
+  if impl(ghc < 7.10)
+     Hs-Source-Dirs: prelude
+     Other-Modules:  Prelude
 
   Exposed-Modules: Text.Pandoc,
                    Text.Pandoc.Options,
@@ -361,6 +363,7 @@ Library
                    Text.Pandoc.Writers.Docx,
                    Text.Pandoc.Writers.EPUB,
                    Text.Pandoc.Writers.FB2,
+                   Text.Pandoc.Writers.TEI,
                    Text.Pandoc.PDF,
                    Text.Pandoc.UTF8,
                    Text.Pandoc.Templates,
@@ -369,7 +372,7 @@ Library
                    Text.Pandoc.Process,
                    Text.Pandoc.CSS
   Other-Modules:   Text.Pandoc.Readers.Docx.Lists,
-                   Text.Pandoc.Readers.Docx.Reducible,
+                   Text.Pandoc.Readers.Docx.Combine,
                    Text.Pandoc.Readers.Docx.Parse,
                    Text.Pandoc.Readers.Docx.Fonts,
                    Text.Pandoc.Readers.Docx.Util,
@@ -388,6 +391,7 @@ Library
                    Text.Pandoc.Writers.Shared,
                    Text.Pandoc.Asciify,
                    Text.Pandoc.MIME,
+                   Text.Pandoc.Emoji,
                    Text.Pandoc.Parsing,
                    Text.Pandoc.UUID,
                    Text.Pandoc.ImageSize,
@@ -396,26 +400,26 @@ Library
                    Text.Pandoc.Compat.Time,
                    Text.Pandoc.Compat.Except,
                    Text.Pandoc.Compat.TagSoupEntity,
-                   Text.Pandoc.Compat.Directory
+                   Text.Pandoc.Compat.Directory,
+                   Text.Pandoc.Compat.Monoid,
                    Paths_pandoc
-                   Prelude
 
   Buildable:       True
 
 Executable pandoc
   Build-Depends: pandoc,
-                 pandoc-types >= 1.12.4 && < 1.13,
+                 pandoc-types >= 1.16 && < 1.17,
                  base >= 4.2 && <5,
                  directory >= 1 && < 1.3,
                  filepath >= 1.1 && < 1.5,
                  text >= 0.11 && < 1.3,
                  bytestring >= 0.9 && < 0.11,
                  extensible-exceptions >= 0.1 && < 0.2,
-                 highlighting-kate >= 0.6 && < 0.7,
-                 aeson >= 0.7.0.5 && < 0.11,
+                 highlighting-kate >= 0.6.1 && < 0.7,
+                 aeson >= 0.7.0.5 && < 0.12,
                  yaml >= 0.8.8.2 && < 0.9,
                  containers >= 0.1 && < 0.6,
-                 HTTP >= 4000.0.5 && < 4000.3
+                 HTTP >= 4000.0.5 && < 4000.4
   if flag(network-uri)
      Build-Depends: network-uri >= 2.6 && < 2.7, network >= 2.6
   else
@@ -429,14 +433,20 @@ Executable pandoc
                     ScopedTypeVariables, GeneralizedNewtypeDeriving,
                     RelaxedPolyRec, DeriveDataTypeable, TypeSynonymInstances,
                     FlexibleInstances
-  Hs-Source-Dirs:  ., prelude
+  Hs-Source-Dirs:  .
+  if impl(ghc < 7.10)
+     Hs-Source-Dirs: prelude
+     Other-Modules:  Prelude
   Main-Is:         pandoc.hs
   Buildable:       True
-  Other-Modules: Prelude
+  Other-Modules:   Paths_pandoc
 
 Executable trypandoc
   Main-Is:         trypandoc.hs
-  Hs-Source-Dirs:  trypandoc, prelude
+  Hs-Source-Dirs:  trypandoc
+  if impl(ghc < 7.10)
+     Hs-Source-Dirs: prelude
+     Other-Modules:  Prelude
   default-language: Haskell2010
   if flag(trypandoc)
     Build-Depends: base, aeson, pandoc, highlighting-kate,
@@ -444,22 +454,24 @@ Executable trypandoc
     Buildable:     True
   else
     Buildable:     False
-  Other-Modules: Prelude
 
 Test-Suite test-pandoc
   Type:           exitcode-stdio-1.0
   Main-Is:        test-pandoc.hs
-  Hs-Source-Dirs: tests, prelude
+  Hs-Source-Dirs: tests
+  if impl(ghc < 7.10)
+     Hs-Source-Dirs: prelude
+     Other-Modules:  Prelude
   Build-Depends:  base >= 4.2 && < 5,
                   syb >= 0.1 && < 0.7,
                   pandoc,
-                  pandoc-types >= 1.12.4 && < 1.13,
+                  pandoc-types >= 1.16 && < 1.17,
                   bytestring >= 0.9 && < 0.11,
                   text >= 0.11 && < 1.3,
                   directory >= 1 && < 1.3,
                   filepath >= 1.1 && < 1.5,
-                  process >= 1 && < 1.3,
-                  highlighting-kate >= 0.6 && < 0.7,
+                  process >= 1 && < 1.5,
+                  highlighting-kate >= 0.6.1 && < 0.7,
                   Diff >= 0.2 && < 0.4,
                   test-framework >= 0.3 && < 0.9,
                   test-framework-hunit >= 0.2 && < 0.4,
@@ -469,7 +481,7 @@ Test-Suite test-pandoc
                   containers >= 0.1 && < 0.6,
                   ansi-terminal >= 0.5 && < 0.7,
                   executable-path >= 0.0 && < 0.1,
-                  zip-archive >= 0.2.3.4 && < 0.3
+                  zip-archive >= 0.2.3.4 && < 0.4
   Other-Modules:  Tests.Old
                   Tests.Helpers
                   Tests.Arbitrary
@@ -494,18 +506,20 @@ Test-Suite test-pandoc
                   Tests.Writers.LaTeX
                   Tests.Writers.Docx
                   Tests.Writers.RST
-                  Prelude
+                  Tests.Writers.TEI
   Ghc-Options:  -rtsopts -Wall -fno-warn-unused-do-bind -threaded
   Default-Language: Haskell98
 
 benchmark benchmark-pandoc
   Type:            exitcode-stdio-1.0
   Main-Is:         benchmark-pandoc.hs
-  Hs-Source-Dirs:  benchmark, prelude
+  Hs-Source-Dirs:  benchmark
+  if impl(ghc < 7.10)
+     Hs-Source-Dirs: prelude
+     Other-Modules:  Prelude
   Build-Depends:   pandoc,
                    base >= 4.2 && < 5,
                    syb >= 0.1 && < 0.7,
                    criterion >= 1.0 && < 1.2
   Ghc-Options:   -rtsopts -Wall -fno-warn-unused-do-bind
   Default-Language: Haskell98
-  Other-Modules:   Prelude
diff --git a/pandoc.hs b/pandoc.hs
index ecf19db..e8a971d 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -1,6 +1,6 @@
 {-# LANGUAGE CPP, TupleSections #-}
 {-
-Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Main
-   Copyright   : Copyright (C) 2006-2015 John MacFarlane
+   Copyright   : Copyright (C) 2006-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley@edu>
@@ -45,10 +45,10 @@ import Text.Pandoc.Process (pipeProcess)
 import Text.Highlighting.Kate ( languages, Style, tango, pygments,
          espresso, zenburn, kate, haddock, monochrome )
 import System.Environment ( getArgs, getProgName )
-import System.Exit ( exitWith, ExitCode (..) )
+import System.Exit ( ExitCode (..), exitSuccess )
 import System.FilePath
 import System.Console.GetOpt
-import Data.Char ( toLower )
+import Data.Char ( toLower, toUpper )
 import Data.List ( delete, intercalate, isPrefixOf, isSuffixOf, sort )
 import System.Directory ( getAppUserDataDirectory, findExecutable,
                           doesFileExist, Permissions(..), getPermissions )
@@ -58,7 +58,7 @@ import qualified Control.Exception as E
 import Control.Exception.Extensible ( throwIO )
 import qualified Text.Pandoc.UTF8 as UTF8
 import Control.Monad (when, unless, (>=>))
-import Data.Maybe (fromMaybe, isNothing)
+import Data.Maybe (fromMaybe, isNothing, isJust)
 import Data.Foldable (foldrM)
 import Network.URI (parseURI, isURI, URI(..))
 import qualified Data.ByteString.Lazy as B
@@ -79,7 +79,7 @@ type Transform = Pandoc -> Pandoc
 copyrightMessage :: String
 copyrightMessage = intercalate "\n" [
   "",
-  "Copyright (C) 2006-2015 John MacFarlane",
+  "Copyright (C) 2006-2016 John MacFarlane",
   "Web:  http://pandoc.org",
   "This is free software; see the source for copying conditions.",
   "There is no warranty, not even for merchantability or fitness",
@@ -110,8 +110,7 @@ wrapWords indent c = wrap' (c - indent) (c - indent)
             wrap' cols (remaining - length x - 2) xs
 
 isTextFormat :: String -> Bool
-isTextFormat s = takeWhile (`notElem` "+-") s `notElem` binaries
-  where binaries = ["odt","docx","epub","epub3"]
+isTextFormat s = s `notElem` ["odt","docx","epub","epub3"]
 
 externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc
 externalFilter f args' d = do
@@ -149,7 +148,7 @@ externalFilter f args' d = do
                       show f' ++ " not found in path."
       (exitcode, outbs, errbs) <- E.handle filterException $
                                     pipeProcess Nothing f' args'' $ encode d
-      when (not $ B.null errbs) $ B.hPutStr stderr errbs
+      unless (B.null errbs) $ B.hPutStr stderr errbs
       case exitcode of
            ExitSuccess    -> return $ either error id $ eitherDecode' outbs
            ExitFailure ec -> err 83 $ "Error running filter " ++ f ++ "\n" ++
@@ -196,7 +195,8 @@ data Opt = Opt
     , optIgnoreArgs        :: Bool    -- ^ Ignore command-line arguments
     , optVerbose           :: Bool    -- ^ Verbose diagnostic output
     , optReferenceLinks    :: Bool    -- ^ Use reference links in writing markdown, rst
-    , optWrapText          :: Bool    -- ^ Wrap text
+    , optDpi               :: Int     -- ^ Dpi
+    , optWrapText          :: WrapOption  -- ^ Options for wrapping text
     , optColumns           :: Int     -- ^ Line length in characters
     , optFilters           :: [FilePath] -- ^ Filters to apply
     , optEmailObfuscation  :: ObfuscationMethod
@@ -215,6 +215,7 @@ data Opt = Opt
     , optExtractMedia      :: Maybe FilePath -- ^ Path to extract embedded media
     , optTrace             :: Bool       -- ^ Print debug information
     , optTrackChanges      :: TrackChanges -- ^ Accept or reject MS Word track-changes.
+    , optFileScope        :: Bool         -- ^ Parse input files before combining
     , optKaTeXStylesheet   :: Maybe String     -- ^ Path to stylesheet for KaTeX
     , optKaTeXJS           :: Maybe String     -- ^ Path to js file for KaTeX
     }
@@ -258,7 +259,8 @@ defaultOpts = Opt
     , optIgnoreArgs            = False
     , optVerbose               = False
     , optReferenceLinks        = False
-    , optWrapText              = True
+    , optDpi                   = 96
+    , optWrapText              = WrapAuto
     , optColumns               = 72
     , optFilters               = []
     , optEmailObfuscation      = JavascriptObfuscation
@@ -277,6 +279,7 @@ defaultOpts = Opt
     , optExtractMedia          = Nothing
     , optTrace                 = False
     , optTrackChanges          = AcceptChanges
+    , optFileScope            = False
     , optKaTeXStylesheet       = Nothing
     , optKaTeXJS               = Nothing
     }
@@ -309,14 +312,6 @@ options =
                  "DIRECTORY") -- "Directory containing pandoc data files."
                 ""
 
-    , Option "" ["strict"]
-                 (NoArg
-                  (\opt -> do
-                      err 59 $ "The --strict option has been removed.\n" ++
-                               "Use `markdown_strict' input or output format instead."
-                      return opt ))
-                 "" -- "Disable markdown syntax extensions"
-
     , Option "R" ["parse-raw"]
                  (NoArg
                   (\opt -> return opt { optParseRaw = True }))
@@ -394,9 +389,14 @@ options =
                   "accept|reject|all")
                  "" -- "Accepting or reject MS Word track-changes.""
 
+    , Option "" ["file-scope"]
+                 (NoArg
+                  (\opt -> return opt { optFileScope = True }))
+                 "" -- "Parse input files before combining"
+
     , Option "" ["extract-media"]
                  (ReqArg
-                  (\arg opt -> do
+                  (\arg opt ->
                     return opt { optExtractMedia = Just arg })
                   "PATH")
                  "" -- "Directory to which to extract embedded media"
@@ -408,7 +408,7 @@ options =
 
     , Option "" ["template"]
                  (ReqArg
-                  (\arg opt -> do
+                  (\arg opt ->
                      return opt{ optTemplate = Just arg,
                                  optStandalone = True })
                   "FILENAME")
@@ -442,7 +442,7 @@ options =
                      case templ of
                           Right t -> UTF8.hPutStr stdout t
                           Left e  -> error $ show e
-                     exitWith ExitSuccess)
+                     exitSuccess)
                   "FORMAT")
                  "" -- "Print default template for FORMAT"
 
@@ -450,21 +450,42 @@ options =
                  (ReqArg
                   (\arg _ -> do
                      readDataFile Nothing arg >>= BS.hPutStr stdout
-                     exitWith ExitSuccess)
+                     exitSuccess)
                   "FILE")
                   "" -- "Print default data file"
 
+    , Option "" ["dpi"]
+                 (ReqArg
+                  (\arg opt ->
+                    case safeRead arg of
+                         Just t | t > 0 -> return opt { optDpi = t }
+                         _              -> err 31
+                                        "dpi must be a number greater than 0")
+                  "NUMBER")
+                 "" -- "Dpi (default 96)"
+
     , Option "" ["no-wrap"]
                  (NoArg
-                  (\opt -> return opt { optWrapText = False }))
-                 "" -- "Do not wrap text in output"
+                  (\opt -> do warn $ "--no-wrap is deprecated. " ++
+                                     "Use --wrap=none or --wrap=preserve instead."
+                              return opt { optWrapText = WrapNone }))
+                 ""
+
+    , Option "" ["wrap"]
+                 (ReqArg
+                  (\arg opt ->
+                    case safeRead ("Wrap" ++ uppercaseFirstLetter arg) of
+                          Just o   -> return opt { optWrapText = o }
+                          Nothing  -> err 77 "--wrap must be auto, none, or preserve")
+                 "[auto|none|preserve]")
+                 "" -- "Option for wrapping text in output"
 
     , Option "" ["columns"]
                  (ReqArg
                   (\arg opt ->
                       case safeRead arg of
                            Just t | t > 0 -> return opt { optColumns = t }
-                           _              -> err 33 $
+                           _              -> err 33
                                    "columns must be a number greater than 0")
                  "NUMBER")
                  "" -- "Length of line in characters"
@@ -476,11 +497,11 @@ options =
 
     , Option "" ["toc-depth"]
                  (ReqArg
-                  (\arg opt -> do
+                  (\arg opt ->
                       case safeRead arg of
                            Just t | t >= 1 && t <= 6 ->
                                     return opt { optTOCDepth = t }
-                           _      -> err 57 $
+                           _      -> err 57
                                     "TOC level must be a number between 1 and 6")
                  "NUMBER")
                  "" -- "Number of levels to include in TOC"
@@ -546,25 +567,9 @@ options =
                                         optStandalone = True }))
                  "" -- "Make slide shows include all the needed js and css"
 
-    , Option "" ["offline"]
-                 (NoArg
-                  (\opt -> do warn $ "--offline is deprecated. Use --self-contained instead."
-                              return opt { optSelfContained = True,
-                                           optStandalone = True }))
-                 "" -- "Make slide shows include all the needed js and css"
-                 -- deprecated synonym for --self-contained
-
-    , Option "5" ["html5"]
-                 (NoArg
-                  (\opt -> do
-                     warn $ "--html5 is deprecated. "
-                       ++ "Use the html5 output format instead."
-                     return opt { optHtml5 = True }))
-                 "" -- "Produce HTML5 in HTML output"
-
     , Option "" ["html-q-tags"]
                  (NoArg
-                  (\opt -> do
+                  (\opt ->
                      return opt { optHtmlQTags = True }))
                  "" -- "Use <q> tags for quotes in HTML"
 
@@ -620,11 +625,11 @@ options =
 
     , Option "" ["slide-level"]
                  (ReqArg
-                  (\arg opt -> do
+                  (\arg opt ->
                       case safeRead arg of
                            Just t | t >= 1 && t <= 6 ->
                                     return opt { optSlideLevel = Just t }
-                           _      -> err 39 $
+                           _      -> err 39
                                     "slide level must be a number between 1 and 6")
                  "NUMBER")
                  "" -- "Force header level for slides"
@@ -680,14 +685,14 @@ options =
 
     , Option "" ["reference-odt"]
                  (ReqArg
-                  (\arg opt -> do
+                  (\arg opt ->
                     return opt { optReferenceODT = Just arg })
                   "FILENAME")
                  "" -- "Path of custom reference.odt"
 
     , Option "" ["reference-docx"]
                  (ReqArg
-                  (\arg opt -> do
+                  (\arg opt ->
                     return opt { optReferenceDocx = Just arg })
                   "FILENAME")
                  "" -- "Path of custom reference.docx"
@@ -718,18 +723,18 @@ options =
 
     , Option "" ["epub-embed-font"]
                  (ReqArg
-                  (\arg opt -> do
+                  (\arg opt ->
                      return opt{ optEpubFonts = arg : optEpubFonts opt })
                   "FILE")
                  "" -- "Directory of fonts to embed"
 
     , Option "" ["epub-chapter-level"]
                  (ReqArg
-                  (\arg opt -> do
+                  (\arg opt ->
                       case safeRead arg of
                            Just t | t >= 1 && t <= 6 ->
                                     return opt { optEpubChapterLevel = t }
-                           _      -> err 59 $
+                           _      -> err 59
                                     "chapter level must be a number between 1 and 6")
                  "NUMBER")
                  "" -- "Header level at which to split chapters in EPUB"
@@ -817,9 +822,7 @@ options =
     , Option "" ["webtex"]
                  (OptArg
                   (\arg opt -> do
-                      let url' = case arg of
-                                      Just u   -> u
-                                      Nothing  -> "http://chart.apis.google.com/chart?cht=tx&chl="
+                      let url' = fromMaybe "http://chart.apis.google.com/chart?cht=tx&chl=" arg
                       return opt { optHTMLMathMethod = WebTeX url' })
                   "URL")
                  "" -- "Use web service for HTML math"
@@ -833,9 +836,7 @@ options =
     , Option "" ["mathjax"]
                  (OptArg
                   (\arg opt -> do
-                      let url' = case arg of
-                                      Just u   -> u
-                                      Nothing  -> "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
+                      let url' = fromMaybe "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" arg
                       return opt { optHTMLMathMethod = MathJax url'})
                   "URL")
                  "" -- "Use MathJax for HTML math"
@@ -893,7 +894,7 @@ options =
                          (unwords (map fst readers))
                          (unwords ("pdf": map fst writers))
                          ddir
-                     exitWith ExitSuccess ))
+                     exitSuccess ))
                  "" -- "Print bash completion script"
 
     , Option "v" ["version"]
@@ -904,7 +905,7 @@ options =
                      UTF8.hPutStrLn stdout (prg ++ " " ++ pandocVersion ++
                        compileInfo ++ "\nDefault user data directory: " ++
                        defaultDatadir ++ copyrightMessage)
-                     exitWith ExitSuccess ))
+                     exitSuccess ))
                  "" -- "Print version"
 
     , Option "h" ["help"]
@@ -912,7 +913,7 @@ options =
                   (\_ -> do
                      prg <- getProgName
                      UTF8.hPutStr stdout (usageMessage prg options)
-                     exitWith ExitSuccess ))
+                     exitSuccess ))
                  "" -- "Show help"
 
     ]
@@ -936,10 +937,10 @@ readMetaValue s = case decode (UTF8.fromString s) of
 usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String
 usageMessage programName = usageInfo
   (programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats:  " ++
-  (wrapWords 16 78 $ readers'names) ++
+  wrapWords 16 78 readers'names ++
      '\n' : replicate 16 ' ' ++
      "[ *only Pandoc's JSON version of native AST]" ++ "\nOutput formats: " ++
-  (wrapWords 16 78 $ writers'names) ++
+  wrapWords 16 78 writers'names ++
      '\n' : replicate 16 ' ' ++
      "[**for pdf output, use latex or beamer and -o FILENAME.pdf]\nOptions:")
   where
@@ -1010,10 +1011,13 @@ defaultWriterName x =
     ".epub"     -> "epub"
     ".org"      -> "org"
     ".asciidoc" -> "asciidoc"
+    ".adoc"     -> "asciidoc"
     ".pdf"      -> "latex"
     ".fb2"      -> "fb2"
     ".opml"     -> "opml"
     ".icml"     -> "icml"
+    ".tei.xml"  -> "tei"
+    ".tei"      -> "tei"
     ['.',y] | y `elem` ['1'..'9'] -> "man"
     _           -> "html"
 
@@ -1028,8 +1032,8 @@ extractMedia media dir d =
           return $ walk (adjustImagePath dir fps) d
 
 adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline
-adjustImagePath dir paths (Image lab (src, tit))
-   | src `elem` paths = Image lab (dir ++ "/" ++ src, tit)
+adjustImagePath dir paths (Image attr lab (src, tit))
+   | src `elem` paths = Image attr lab (dir ++ "/" ++ src, tit)
 adjustImagePath _ _ x = x
 
 adjustMetadata :: M.Map String MetaValue -> Pandoc -> IO Pandoc
@@ -1042,31 +1046,28 @@ applyFilters :: [FilePath] -> [String] -> Pandoc -> IO Pandoc
 applyFilters filters args d =
   foldrM ($) d $ map (flip externalFilter args) filters
 
+uppercaseFirstLetter :: String -> String
+uppercaseFirstLetter (c:cs) = toUpper c : cs
+uppercaseFirstLetter [] = []
+
 main :: IO ()
 main = do
 
   rawArgs <- map UTF8.decodeArg <$> getArgs
   prg <- getProgName
-  let compatMode = (prg == "hsmarkdown")
 
-  let (actions, args, errors) = if compatMode
-                                  then ([], rawArgs, [])
-                                  else getOpt Permute options rawArgs
+  let (actions, args, errors) = getOpt Permute options rawArgs
 
   unless (null errors) $
      err 2 $ concat $ errors ++
         ["Try " ++ prg ++ " --help for more information."]
 
-  let defaultOpts' = if compatMode
-                       then defaultOpts { optReader = "markdown_strict"
-                                        , optWriter = "html"
-                                        , optEmailObfuscation =
-                                           ReferenceObfuscation }
-                       else defaultOpts
-
   -- thread option data structure through all supplied option actions
-  opts <- foldl (>>=) (return defaultOpts') actions
+  opts <- foldl (>>=) (return defaultOpts) actions
+  convertWithOpts opts args
 
+convertWithOpts :: Opt -> [FilePath] -> IO ()
+convertWithOpts opts args = do
   let Opt    {  optTabStop               = tabStop
               , optPreserveTabs          = preserveTabs
               , optStandalone            = standalone
@@ -1103,6 +1104,7 @@ main = do
               , optIgnoreArgs            = ignoreArgs
               , optVerbose               = verbose
               , optReferenceLinks        = referenceLinks
+              , optDpi                   = dpi
               , optWrapText              = wrap
               , optColumns               = columns
               , optFilters               = filters
@@ -1122,14 +1124,15 @@ main = do
               , optExtractMedia          = mbExtractMedia
               , optTrace                 = trace
               , optTrackChanges          = trackChanges
+              , optFileScope            = fileScope
               , optKaTeXStylesheet       = katexStylesheet
               , optKaTeXJS               = katexJS
              } = opts
 
   when dumpArgs $
     do UTF8.hPutStrLn stdout outputFile
-       mapM_ (\arg -> UTF8.hPutStrLn stdout arg) args
-       exitWith ExitSuccess
+       mapM_ (UTF8.hPutStrLn stdout) args
+       exitSuccess
 
   let csscdn = "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.css"
   let mathMethod =
@@ -1139,7 +1142,7 @@ main = do
 
 
   -- --bibliography implies -F pandoc-citeproc for backwards compatibility:
-  let needsCiteproc = any ("--bibliography" `isPrefixOf`) rawArgs &&
+  let needsCiteproc = isJust (M.lookup "bibliography" (optMetadata opts)) &&
                       optCiteMethod opts `notElem` [Natbib, Biblatex] &&
                       "pandoc-citeproc" `notElem` map takeBaseName filters
   let filters' = if needsCiteproc then "pandoc-citeproc" : filters
@@ -1168,18 +1171,24 @@ main = do
                           "epub2"   -> "epub"
                           "html4"   -> "html"
                           x         -> x
+  let format = takeWhile (`notElem` ['+','-'])
+                       $ takeFileName writerName'  -- in case path to lua script
 
   let pdfOutput = map toLower (takeExtension outputFile) == ".pdf"
 
-  let laTeXOutput = "latex" `isPrefixOf` writerName' ||
-                    "beamer" `isPrefixOf` writerName'
+  let laTeXOutput = format `elem` ["latex", "beamer"]
+  let conTeXtOutput = format == "context"
+  let html5Output = format == "html5"
 
-  writer <- if ".lua" `isSuffixOf` writerName'
+  let laTeXInput = "latex" `isPrefixOf` readerName' ||
+                    "beamer" `isPrefixOf` readerName'
+
+  writer <- if ".lua" `isSuffixOf` format
                -- note:  use non-lowercased version writerName
                then return $ IOStringWriter $ writeCustom writerName
                else case getWriter writerName' of
                          Left e  -> err 9 $
-                           if writerName' == "pdf"
+                           if format == "pdf"
                               then e ++
                                "\nTo create a pdf with pandoc, use " ++
                                "the latex or beamer writer and specify\n" ++
@@ -1191,7 +1200,7 @@ main = do
   reader <- if "t2t" == readerName'
               then (mkStringReader .
                     readTxt2Tags) <$>
-                      (getT2TMeta sources outputFile)
+                      getT2TMeta sources outputFile
               else case getReader readerName' of
                 Right r  -> return r
                 Left e   -> err 7 e'
@@ -1202,18 +1211,17 @@ main = do
                                      "\nPandoc can convert from DOCX, but not from DOC.\nTry using Word to save your DOC file as DOCX, and convert that with pandoc."
                                   _ -> e
 
-  let standalone' = standalone || not (isTextFormat writerName') || pdfOutput
+  let standalone' = standalone || not (isTextFormat format) || pdfOutput
 
   templ <- case templatePath of
                 _ | not standalone' -> return ""
                 Nothing -> do
-                           deftemp <- getDefaultTemplate datadir writerName'
+                           deftemp <- getDefaultTemplate datadir format
                            case deftemp of
                                  Left e   -> throwIO e
                                  Right t  -> return t
                 Just tp -> do
                            -- strip off extensions
-                           let format = takeWhile (`notElem` "+-") writerName'
                            let tp' = case takeExtension tp of
                                           ""   -> tp <.> format
                                           _    -> tp
@@ -1235,7 +1243,7 @@ main = do
                          return $ ("mathml-script", s) : variables
                       _ -> return variables
 
-  variables'' <- if "dzslides" `isPrefixOf` writerName'
+  variables'' <- if format == "dzslides"
                     then do
                         dztempl <- readDataFileUTF8 datadir
                                      ("dzslides" </> "template.html")
@@ -1255,8 +1263,10 @@ main = do
                                                      uriFragment = "" }
                                 _ -> Nothing
 
-  let readerOpts = def{ readerSmart = smart || (texLigatures &&
-                          (laTeXOutput || "context" `isPrefixOf` writerName'))
+  let readerOpts = def{ readerSmart = if laTeXInput
+                                         then texLigatures
+                                         else smart || (texLigatures &&
+                                               (laTeXOutput || conTeXtOutput))
                       , readerStandalone = standalone'
                       , readerParseRaw = parseRaw
                       , readerColumns = columns
@@ -1267,10 +1277,11 @@ main = do
                       , readerDefaultImageExtension = defaultImageExtension
                       , readerTrace = trace
                       , readerTrackChanges = trackChanges
+                      , readerFileScope   = fileScope
                       }
 
-  when (not (isTextFormat writerName') && outputFile == "-") $
-    err 5 $ "Cannot write " ++ writerName' ++ " output to stdout.\n" ++
+  when (not (isTextFormat format) && outputFile == "-") $
+    err 5 $ "Cannot write " ++ format ++ " output to stdout.\n" ++
             "Specify an output file using the -o option."
 
   let readSources [] = mapM readSource ["-"]
@@ -1288,7 +1299,7 @@ main = do
 
   let readFiles [] = error "Cannot read archive from stdin"
       readFiles [x] = B.readFile x
-      readFiles (x:xs) = mapM (warn . ("Ignoring: " ++)) xs >> B.readFile x
+      readFiles (x:xs) = mapM_ (warn . ("Ignoring: " ++)) xs >> B.readFile x
 
   let convertTabs = tabFilter (if preserveTabs || readerName' == "t2t"
                                  then 0
@@ -1299,13 +1310,26 @@ main = do
                                then handleIncludes
                                else return . Right
 
-  (doc, media) <- fmap handleError $
-      case reader of
+  let sourceToDoc :: [FilePath] -> IO (Pandoc, MediaBag)
+      sourceToDoc sources' = fmap handleError $
+        case reader of
           StringReader r-> do
-            srcs <- convertTabs . intercalate "\n" <$> readSources sources
+            srcs <- convertTabs . intercalate "\n" <$> readSources sources'
             doc <- handleIncludes' srcs
             either (return . Left) (\s -> fmap (,mempty) <$> r readerOpts s) doc
-          ByteStringReader r -> readFiles sources >>= r readerOpts
+          ByteStringReader r -> readFiles sources' >>= r readerOpts
+
+  -- We parse first if (1) fileScope is set, (2), it's a binary
+  -- reader, or (3) we're reading JSON. This is easier to do of an AND
+  -- of negatives as opposed to an OR of positives, so we do default
+  -- parsing if it's a StringReader AND (fileScope is set AND it's not
+  -- a JSON reader).
+  (doc, media) <- case reader of
+    (StringReader _) | not fileScope && readerName' /= "json" ->
+                         sourceToDoc sources
+    _ | null sources -> sourceToDoc sources
+    _  -> do pairs <- mapM (\s -> sourceToDoc [s]) sources
+             return (mconcat $ map fst pairs, mconcat $ map snd pairs)
 
   let writerOptions = def { writerStandalone       = standalone',
                             writerTemplate         = templ,
@@ -1320,6 +1344,7 @@ main = do
                             writerNumberOffset     = numberFrom,
                             writerSectionDivs      = sectionDivs,
                             writerReferenceLinks   = referenceLinks,
+                            writerDpi              = dpi,
                             writerWrapText         = wrap,
                             writerColumns          = columns,
                             writerEmailObfuscation = obfuscationMethod,
@@ -1352,7 +1377,7 @@ main = do
   doc' <- (maybe return (extractMedia media) mbExtractMedia >=>
            adjustMetadata metadata >=>
            applyTransforms transforms >=>
-           applyFilters filters' [writerName']) doc
+           applyFilters filters' [format]) doc
 
   let writeBinary :: B.ByteString -> IO ()
       writeBinary = B.writeFile (UTF8.encodePath outputFile)
@@ -1366,30 +1391,33 @@ main = do
     IOByteStringWriter f -> f writerOptions doc' >>= writeBinary
     PureStringWriter f
       | pdfOutput -> do
-              -- make sure writer is latex or beamer
-              unless laTeXOutput $
-                err 47 $ "cannot produce pdf output with " ++ writerName' ++
+              -- make sure writer is latex or beamer or context or html5
+              unless (laTeXOutput || conTeXtOutput || html5Output) $
+                err 47 $ "cannot produce pdf output with " ++ format ++
                          " writer"
 
-              -- check for latex program
-              mbLatex <- findExecutable latexEngine
-              when (mbLatex == Nothing) $
-                   err 41 $ latexEngine ++ " not found. " ++
-                     latexEngine ++ " is needed for pdf output."
-
-              res <- makePDF latexEngine f writerOptions doc'
+              let pdfprog = case () of
+                              _ | conTeXtOutput -> "context"
+                              _ | html5Output   -> "wkhtmltopdf"
+                              _                 -> latexEngine
+              -- check for pdf creating program
+              mbPdfProg <- findExecutable pdfprog
+              when (isNothing mbPdfProg) $
+                   err 41 $ pdfprog ++ " not found. " ++
+                     pdfprog ++ " is needed for pdf output."
+
+              res <- makePDF pdfprog f writerOptions doc'
               case res of
                    Right pdf -> writeBinary pdf
                    Left err' -> do
-                     B.hPutStr stderr $ err'
+                     B.hPutStr stderr err'
                      B.hPut stderr $ B.pack [10]
-                     err 43 "Error producing PDF from TeX source"
+                     err 43 "Error producing PDF"
       | otherwise -> selfcontain (f writerOptions doc' ++
                                   ['\n' | not standalone'])
                       >>= writerFn outputFile . handleEntities
-          where htmlFormat = writerName' `elem`
-                               ["html","html+lhs","html5","html5+lhs",
-                               "s5","slidy","slideous","dzslides","revealjs"]
+          where htmlFormat = format `elem`
+                  ["html","html5","s5","slidy","slideous","dzslides","revealjs"]
                 selfcontain = if selfContained && htmlFormat
                                  then makeSelfContained writerOptions
                                  else return
diff --git a/prelude/Prelude.hs b/prelude/Prelude.hs
index ca5c687..50e86a7 100644
--- a/prelude/Prelude.hs
+++ b/prelude/Prelude.hs
@@ -1,23 +1,24 @@
 {-# LANGUAGE PackageImports #-}
 {-# LANGUAGE CPP #-}
 
+-- This custom Prelude emulates the API of the prelude
+-- with base 4.8.
+
 module Prelude
 (
   module P
-, Monoid(..)
-, Applicative(..)
 #if MIN_VERSION_base(4,8,0)
 #else
+, Monoid(..)
+, Applicative(..)
 , (<$>)
 , (<$)
 #endif
-, (<>)
 )
 where
 
 #if MIN_VERSION_base(4,8,0)
 import "base" Prelude as P
-import Data.Monoid ((<>))
 #elif MIN_VERSION_base(4,6,0)
 import "base" Prelude as P
 import Control.Applicative
@@ -27,13 +28,3 @@ import "base" Prelude as P hiding (catch)
 import Control.Applicative
 import Data.Monoid
 #endif
-
-#if MIN_VERSION_base(4,5,0)
-#else
-infixr 6 <>
-
--- | An infix synonym for 'mappend'.
-(<>) :: Monoid m => m -> m -> m
-(<>) = mappend
-{-# INLINE (<>) #-}
-#endif
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
index e49fef3..b67a53f 100644
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -1,6 +1,6 @@
 {-# LANGUAGE ScopedTypeVariables, FlexibleInstances #-}
 {-
-Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc
-   Copyright   : Copyright (C) 2006-2015 John MacFarlane
+   Copyright   : Copyright (C) 2006-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -115,6 +115,7 @@ module Text.Pandoc
                , writeHaddock
                , writeCommonMark
                , writeCustom
+               , writeTEI
                -- * Rendering templates and default templates
                , module Text.Pandoc.Templates
                -- * Miscellaneous
@@ -169,6 +170,7 @@ import Text.Pandoc.Writers.AsciiDoc
 import Text.Pandoc.Writers.Haddock
 import Text.Pandoc.Writers.CommonMark
 import Text.Pandoc.Writers.Custom
+import Text.Pandoc.Writers.TEI
 import Text.Pandoc.Templates
 import Text.Pandoc.Options
 import Text.Pandoc.Shared (safeRead, warn, mapLeft, pandocVersion)
@@ -207,20 +209,28 @@ parseFormatSpec = parse formatSpec ""
 data Reader = StringReader (ReaderOptions -> String -> IO (Either PandocError Pandoc))
               | ByteStringReader (ReaderOptions -> BL.ByteString -> IO (Either PandocError (Pandoc,MediaBag)))
 
-mkStringReader :: (ReaderOptions -> String -> (Either PandocError Pandoc)) -> Reader
+mkStringReader :: (ReaderOptions -> String -> Either PandocError Pandoc) -> Reader
 mkStringReader r = StringReader (\o s -> return $ r o s)
 
 mkStringReaderWithWarnings :: (ReaderOptions -> String -> Either PandocError (Pandoc, [String])) -> Reader
-mkStringReaderWithWarnings r  = StringReader $ \o s -> do
+mkStringReaderWithWarnings r  = StringReader $ \o s ->
   case r o s of
     Left err -> return $ Left err
     Right (doc, warnings) -> do
       mapM_ warn warnings
       return (Right doc)
 
-mkBSReader :: (ReaderOptions -> BL.ByteString -> (Either PandocError (Pandoc, MediaBag))) -> Reader
+mkBSReader :: (ReaderOptions -> BL.ByteString -> Either PandocError (Pandoc, MediaBag)) -> Reader
 mkBSReader r = ByteStringReader (\o s -> return $ r o s)
 
+mkBSReaderWithWarnings :: (ReaderOptions -> BL.ByteString -> Either PandocError (Pandoc, MediaBag, [String])) -> Reader
+mkBSReaderWithWarnings r = ByteStringReader $ \o s ->
+  case r o s of
+    Left err -> return $ Left err
+    Right (doc, mediaBag, warnings) -> do
+      mapM_ warn warnings
+      return $ Right (doc, mediaBag)
+
 -- | Association list of formats and readers.
 readers :: [(String, Reader)]
 readers = [ ("native"       , StringReader $ \_ s -> return $ readNative s)
@@ -241,7 +251,7 @@ readers = [ ("native"       , StringReader $ \_ s -> return $ readNative s)
            ,("latex"        , mkStringReader readLaTeX)
            ,("haddock"      , mkStringReader readHaddock)
            ,("twiki"        , mkStringReader readTWiki)
-           ,("docx"         , mkBSReader readDocx)
+           ,("docx"         , mkBSReaderWithWarnings readDocxWithWarnings)
            ,("odt"          , mkBSReader readOdt)
            ,("t2t"          , mkStringReader readTxt2TagsNoMacros)
            ,("epub"         , mkBSReader readEPUB)
@@ -266,7 +276,7 @@ writers = [
   ,("html"         , PureStringWriter writeHtmlString)
   ,("html5"        , PureStringWriter $ \o ->
      writeHtmlString o{ writerHtml5 = True })
-  ,("icml"         , PureStringWriter writeICML)
+  ,("icml"         , IOStringWriter writeICML)
   ,("s5"           , PureStringWriter $ \o ->
      writeHtmlString o{ writerSlideVariant = S5Slides
                       , writerTableOfContents = False })
@@ -304,6 +314,7 @@ writers = [
   ,("asciidoc"     , PureStringWriter writeAsciiDoc)
   ,("haddock"      , PureStringWriter writeHaddock)
   ,("commonmark"   , PureStringWriter writeCommonMark)
+  ,("tei"          , PureStringWriter writeTEI)
   ]
 
 getDefaultExtensions :: String -> Set Extension
@@ -330,7 +341,7 @@ getDefaultExtensions _                 = Set.fromList [Ext_auto_identifiers]
 getReader :: String -> Either String Reader
 getReader s =
   case parseFormatSpec s of
-       Left e  -> Left $ intercalate "\n" $ [m | Message m <- errorMessages e]
+       Left e  -> Left $ intercalate "\n" [m | Message m <- errorMessages e]
        Right (readerName, setExts) ->
            case lookup readerName readers of
                    Nothing  -> Left $ "Unknown reader: " ++ readerName
@@ -345,7 +356,7 @@ getReader s =
 getWriter :: String -> Either String Writer
 getWriter s
   = case parseFormatSpec s of
-         Left e  -> Left $ intercalate "\n" $ [m | Message m <- errorMessages e]
+         Left e  -> Left $ intercalate "\n" [m | Message m <- errorMessages e]
          Right (writerName, setExts) ->
              case lookup writerName writers of
                      Nothing -> Left $ "Unknown writer: " ++ writerName
diff --git a/src/Text/Pandoc/Asciify.hs b/src/Text/Pandoc/Asciify.hs
index c183458..8eb1ba6 100644
--- a/src/Text/Pandoc/Asciify.hs
+++ b/src/Text/Pandoc/Asciify.hs
@@ -1,5 +1,5 @@
 {-
-Copyright (C) 2013-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2013-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.Asciify
-   Copyright   : Copyright (C) 2013-2015 John MacFarlane
+   Copyright   : Copyright (C) 2013-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
diff --git a/src/Text/Pandoc/CSS.hs b/src/Text/Pandoc/CSS.hs
index 9d0c842..f479ed9 100644
--- a/src/Text/Pandoc/CSS.hs
+++ b/src/Text/Pandoc/CSS.hs
@@ -1,5 +1,6 @@
-module Text.Pandoc.CSS ( foldOrElse,
-                         pickStyleAttrProps
+module Text.Pandoc.CSS ( foldOrElse
+                       , pickStyleAttrProps
+                       , pickStylesToKVs
                        )
 where
 
@@ -10,13 +11,11 @@ import Text.Parsec.String
 ruleParser :: Parser (String, String)
 ruleParser = do
     p <- many1 (noneOf ":")  <* char ':'
-    v <- many1 (noneOf ":;") <* char ';' <* spaces
+    v <- many1 (noneOf ":;") <* (optional $ char ';') <* spaces
     return (trim p, trim v)
 
 styleAttrParser :: Parser [(String, String)]
-styleAttrParser = do
-    p <- many1 ruleParser
-    return p
+styleAttrParser = many1 ruleParser
 
 orElse :: Eq a => a -> a -> a -> a
 orElse v x y = if v == x then y else x
@@ -28,6 +27,16 @@ eitherToMaybe :: Either a b -> Maybe b
 eitherToMaybe (Right x) = Just x
 eitherToMaybe _ = Nothing
 
+-- | takes a list of keys/properties and a CSS string and
+-- returns the corresponding key-value-pairs.
+pickStylesToKVs :: [String] -> String -> [(String, String)]
+pickStylesToKVs props styleAttr =
+  case parse styleAttrParser "" styleAttr of
+    Left _ -> []
+    Right styles -> filter (\s -> fst s `elem` props) styles
+
+-- | takes a list of key/property synonyms and a CSS string and maybe
+-- returns the value of the first match (in order of the supplied list)
 pickStyleAttrProps :: [String] -> String -> Maybe String
 pickStyleAttrProps lookupProps styleAttr = do
     styles <- eitherToMaybe $ parse styleAttrParser "" styleAttr
diff --git a/src/Text/Pandoc/Compat/Monoid.hs b/src/Text/Pandoc/Compat/Monoid.hs
new file mode 100644
index 0000000..4daceb8
--- /dev/null
+++ b/src/Text/Pandoc/Compat/Monoid.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE CPP #-}
+module Text.Pandoc.Compat.Monoid ( (<>) )
+       where
+
+#if MIN_VERSION_base(4,5,0)
+import Data.Monoid ((<>))
+
+#else
+import Data.Monoid
+
+infixr 6 <>
+
+--- | An infix synonym for 'mappend'.
+(<>) :: Monoid m => m -> m -> m
+(<>) = mappend
+{-# INLINE (<>) #-}
+#endif
diff --git a/src/Text/Pandoc/Data.hsb b/src/Text/Pandoc/Data.hsb
index 3a0bf8a..d408bf5 100644
--- a/src/Text/Pandoc/Data.hsb
+++ b/src/Text/Pandoc/Data.hsb
@@ -2,6 +2,14 @@
 -- to be processed using hsb2hs
 module Text.Pandoc.Data (dataFiles) where
 import qualified Data.ByteString as B
+import System.FilePath (splitDirectories)
+import qualified System.FilePath.Posix as Posix
 
+-- We ensure that the data files are stored using Posix
+-- path separators (/), even on Windows.
 dataFiles :: [(FilePath, B.ByteString)]
-dataFiles = ("README", %blob "README") : %blobs "data"
\ No newline at end of file
+dataFiles = map (\(fp, contents) ->
+  (Posix.joinPath (splitDirectories fp), contents)) dataFiles'
+
+dataFiles' :: [(FilePath, B.ByteString)]
+dataFiles' = ("README", %blob "README") : %blobs "data"
diff --git a/src/Text/Pandoc/Emoji.hs b/src/Text/Pandoc/Emoji.hs
new file mode 100644
index 0000000..c9f368a
--- /dev/null
+++ b/src/Text/Pandoc/Emoji.hs
@@ -0,0 +1,906 @@
+{-
+Copyright (C) 2015 John MacFarlane <jgm@berkeley.edu>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+-}
+
+{- |
+   Module      : Text.Pandoc.Emoji
+   Copyright   : Copyright (C) 2015 John MacFarlane
+   License     : GNU GPL, version 2 or above
+
+   Maintainer  : John MacFarlane <jgm@berkeley.edu>
+   Stability   : alpha
+   Portability : portable
+
+Emoji symbol lookup from canonical string identifier.
+-}
+module Text.Pandoc.Emoji ( emojis ) where
+import qualified Data.Map as M
+
+emojis :: M.Map String String
+emojis = M.fromList
+  [("+1","\128077")
+  ,("-1","\128078")
+  ,("100","\128175")
+  ,("1234","\128290")
+  ,("8ball","\127921")
+  ,("a","\127344\65039")
+  ,("ab","\127374")
+  ,("abc","\128292")
+  ,("abcd","\128289")
+  ,("accept","\127569")
+  ,("aerial_tramway","\128673")
+  ,("airplane","\9992\65039")
+  ,("alarm_clock","\9200")
+  ,("alien","\128125")
+  ,("ambulance","\128657")
+  ,("anchor","\9875")
+  ,("angel","\128124")
+  ,("anger","\128162")
+  ,("angry","\128544")
+  ,("anguished","\128551")
+  ,("ant","\128028")
+  ,("apple","\127822")
+  ,("aquarius","\9810")
+  ,("aries","\9800")
+  ,("arrow_backward","\9664\65039")
+  ,("arrow_double_down","\9196")
+  ,("arrow_double_up","\9195")
+  ,("arrow_down","\11015\65039")
+  ,("arrow_down_small","\128317")
+  ,("arrow_forward","\9654\65039")
+  ,("arrow_heading_down","\10549\65039")
+  ,("arrow_heading_up","\10548\65039")
+  ,("arrow_left","\11013\65039")
+  ,("arrow_lower_left","\8601\65039")
+  ,("arrow_lower_right","\8600\65039")
+  ,("arrow_right","\10145\65039")
+  ,("arrow_right_hook","\8618\65039")
+  ,("arrow_up","\11014\65039")
+  ,("arrow_up_down","\8597\65039")
+  ,("arrow_up_small","\128316")
+  ,("arrow_upper_left","\8598\65039")
+  ,("arrow_upper_right","\8599\65039")
+  ,("arrows_clockwise","\128259")
+  ,("arrows_counterclockwise","\128260")
+  ,("art","\127912")
+  ,("articulated_lorry","\128667")
+  ,("astonished","\128562")
+  ,("athletic_shoe","\128095")
+  ,("atm","\127975")
+  ,("b","\127345\65039")
+  ,("baby","\128118")
+  ,("baby_bottle","\127868")
+  ,("baby_chick","\128036")
+  ,("baby_symbol","\128700")
+  ,("back","\128281")
+  ,("baggage_claim","\128708")
+  ,("balloon","\127880")
+  ,("ballot_box_with_check","\9745\65039")
+  ,("bamboo","\127885")
+  ,("banana","\127820")
+  ,("bangbang","\8252\65039")
+  ,("bank","\127974")
+  ,("bar_chart","\128202")
+  ,("barber","\128136")
+  ,("baseball","\9918\65039")
+  ,("basketball","\127936")
+  ,("bath","\128704")
+  ,("bathtub","\128705")
+  ,("battery","\128267")
+  ,("bear","\128059")
+  ,("bee","\128029")
+  ,("beer","\127866")
+  ,("beers","\127867")
+  ,("beetle","\128030")
+  ,("beginner","\128304")
+  ,("bell","\128276")
+  ,("bento","\127857")
+  ,("bicyclist","\128692")
+  ,("bike","\128690")
+  ,("bikini","\128089")
+  ,("bird","\128038")
+  ,("birthday","\127874")
+  ,("black_circle","\9899")
+  ,("black_joker","\127183")
+  ,("black_large_square","\11035")
+  ,("black_medium_small_square","\9726")
+  ,("black_medium_square","\9724\65039")
+  ,("black_nib","\10002\65039")
+  ,("black_small_square","\9642\65039")
+  ,("black_square_button","\128306")
+  ,("blossom","\127804")
+  ,("blowfish","\128033")
+  ,("blue_book","\128216")
+  ,("blue_car","\128665")
+  ,("blue_heart","\128153")
+  ,("blush","\128522")
+  ,("boar","\128023")
+  ,("boat","\9973")
+  ,("bomb","\128163")
+  ,("book","\128214")
+  ,("bookmark","\128278")
+  ,("bookmark_tabs","\128209")
+  ,("books","\128218")
+  ,("boom","\128165")
+  ,("boot","\128098")
+  ,("bouquet","\128144")
+  ,("bow","\128583")
+  ,("bowling","\127923")
+  ,("boy","\128102")
+  ,("bread","\127838")
+  ,("bride_with_veil","\128112")
+  ,("bridge_at_night","\127753")
+  ,("briefcase","\128188")
+  ,("broken_heart","\128148")
+  ,("bug","\128027")
+  ,("bulb","\128161")
+  ,("bullettrain_front","\128645")
+  ,("bullettrain_side","\128644")
+  ,("bus","\128652")
+  ,("busstop","\128655")
+  ,("bust_in_silhouette","\128100")
+  ,("busts_in_silhouette","\128101")
+  ,("cactus","\127797")
+  ,("cake","\127856")
+  ,("calendar","\128198")
+  ,("calling","\128242")
+  ,("camel","\128043")
+  ,("camera","\128247")
+  ,("cancer","\9803")
+  ,("candy","\127852")
+  ,("capital_abcd","\128288")
+  ,("capricorn","\9809")
+  ,("car","\128663")
+  ,("card_index","\128199")
+  ,("carousel_horse","\127904")
+  ,("cat","\128049")
+  ,("cat2","\128008")
+  ,("cd","\128191")
+  ,("chart","\128185")
+  ,("chart_with_downwards_trend","\128201")
+  ,("chart_with_upwards_trend","\128200")
+  ,("checkered_flag","\127937")
+  ,("cherries","\127826")
+  ,("cherry_blossom","\127800")
+  ,("chestnut","\127792")
+  ,("chicken","\128020")
+  ,("children_crossing","\128696")
+  ,("chocolate_bar","\127851")
+  ,("christmas_tree","\127876")
+  ,("church","\9962")
+  ,("cinema","\127910")
+  ,("circus_tent","\127914")
+  ,("city_sunrise","\127751")
+  ,("city_sunset","\127750")
+  ,("cl","\127377")
+  ,("clap","\128079")
+  ,("clapper","\127916")
+  ,("clipboard","\128203")
+  ,("clock1","\128336")
+  ,("clock10","\128345")
+  ,("clock1030","\128357")
+  ,("clock11","\128346")
+  ,("clock1130","\128358")
+  ,("clock12","\128347")
+  ,("clock1230","\128359")
+  ,("clock130","\128348")
+  ,("clock2","\128337")
+  ,("clock230","\128349")
+  ,("clock3","\128338")
+  ,("clock330","\128350")
+  ,("clock4","\128339")
+  ,("clock430","\128351")
+  ,("clock5","\128340")
+  ,("clock530","\128352")
+  ,("clock6","\128341")
+  ,("clock630","\128353")
+  ,("clock7","\128342")
+  ,("clock730","\128354")
+  ,("clock8","\128343")
+  ,("clock830","\128355")
+  ,("clock9","\128344")
+  ,("clock930","\128356")
+  ,("closed_book","\128213")
+  ,("closed_lock_with_key","\128272")
+  ,("closed_umbrella","\127746")
+  ,("cloud","\9729\65039")
+  ,("clubs","\9827\65039")
+  ,("cn","\127464\127475")
+  ,("cocktail","\127864")
+  ,("coffee","\9749")
+  ,("cold_sweat","\128560")
+  ,("collision","\128165")
+  ,("computer","\128187")
+  ,("confetti_ball","\127882")
+  ,("confounded","\128534")
+  ,("confused","\128533")
+  ,("congratulations","\12951\65039")
+  ,("construction","\128679")
+  ,("construction_worker","\128119")
+  ,("convenience_store","\127978")
+  ,("cookie","\127850")
+  ,("cool","\127378")
+  ,("cop","\128110")
+  ,("copyright","\169\65039")
+  ,("corn","\127805")
+  ,("couple","\128107")
+  ,("couple_with_heart","\128145")
+  ,("couplekiss","\128143")
+  ,("cow","\128046")
+  ,("cow2","\128004")
+  ,("credit_card","\128179")
+  ,("crescent_moon","\127769")
+  ,("crocodile","\128010")
+  ,("crossed_flags","\127884")
+  ,("crown","\128081")
+  ,("cry","\128546")
+  ,("crying_cat_face","\128575")
+  ,("crystal_ball","\128302")
+  ,("cupid","\128152")
+  ,("curly_loop","\10160")
+  ,("currency_exchange","\128177")
+  ,("curry","\127835")
+  ,("custard","\127854")
+  ,("customs","\128707")
+  ,("cyclone","\127744")
+  ,("dancer","\128131")
+  ,("dancers","\128111")
+  ,("dango","\127841")
+  ,("dart","\127919")
+  ,("dash","\128168")
+  ,("date","\128197")
+  ,("de","\127465\127466")
+  ,("deciduous_tree","\127795")
+  ,("department_store","\127980")
+  ,("diamond_shape_with_a_dot_inside","\128160")
+  ,("diamonds","\9830\65039")
+  ,("disappointed","\128542")
+  ,("disappointed_relieved","\128549")
+  ,("dizzy","\128171")
+  ,("dizzy_face","\128565")
+  ,("do_not_litter","\128687")
+  ,("dog","\128054")
+  ,("dog2","\128021")
+  ,("dollar","\128181")
+  ,("dolls","\127886")
+  ,("dolphin","\128044")
+  ,("door","\128682")
+  ,("doughnut","\127849")
+  ,("dragon","\128009")
+  ,("dragon_face","\128050")
+  ,("dress","\128087")
+  ,("dromedary_camel","\128042")
+  ,("droplet","\128167")
+  ,("dvd","\128192")
+  ,("e-mail","\128231")
+  ,("ear","\128066")
+  ,("ear_of_rice","\127806")
+  ,("earth_africa","\127757")
+  ,("earth_americas","\127758")
+  ,("earth_asia","\127759")
+  ,("egg","\127859")
+  ,("eggplant","\127814")
+  ,("eight","8\65039\8419")
+  ,("eight_pointed_black_star","\10036\65039")
+  ,("eight_spoked_asterisk","\10035\65039")
+  ,("electric_plug","\128268")
+  ,("elephant","\128024")
+  ,("email","\9993\65039")
+  ,("end","\128282")
+  ,("envelope","\9993\65039")
+  ,("envelope_with_arrow","\128233")
+  ,("es","\127466\127480")
+  ,("euro","\128182")
+  ,("european_castle","\127984")
+  ,("european_post_office","\127972")
+  ,("evergreen_tree","\127794")
+  ,("exclamation","\10071")
+  ,("expressionless","\128529")
+  ,("eyeglasses","\128083")
+  ,("eyes","\128064")
+  ,("facepunch","\128074")
+  ,("factory","\127981")
+  ,("fallen_leaf","\127810")
+  ,("family","\128106")
+  ,("fast_forward","\9193")
+  ,("fax","\128224")
+  ,("fearful","\128552")
+  ,("feet","\128062")
+  ,("ferris_wheel","\127905")
+  ,("file_folder","\128193")
+  ,("fire","\128293")
+  ,("fire_engine","\128658")
+  ,("fireworks","\127878")
+  ,("first_quarter_moon","\127763")
+  ,("first_quarter_moon_with_face","\127771")
+  ,("fish","\128031")
+  ,("fish_cake","\127845")
+  ,("fishing_pole_and_fish","\127907")
+  ,("fist","\9994")
+  ,("five","5\65039\8419")
+  ,("flags","\127887")
+  ,("flashlight","\128294")
+  ,("flipper","\128044")
+  ,("floppy_disk","\128190")
+  ,("flower_playing_cards","\127924")
+  ,("flushed","\128563")
+  ,("foggy","\127745")
+  ,("football","\127944")
+  ,("footprints","\128099")
+  ,("fork_and_knife","\127860")
+  ,("fountain","\9970")
+  ,("four","4\65039\8419")
+  ,("four_leaf_clover","\127808")
+  ,("fr","\127467\127479")
+  ,("free","\127379")
+  ,("fried_shrimp","\127844")
+  ,("fries","\127839")
+  ,("frog","\128056")
+  ,("frowning","\128550")
+  ,("fuelpump","\9981")
+  ,("full_moon","\127765")
+  ,("full_moon_with_face","\127773")
+  ,("game_die","\127922")
+  ,("gb","\127468\127463")
+  ,("gem","\128142")
+  ,("gemini","\9802")
+  ,("ghost","\128123")
+  ,("gift","\127873")
+  ,("gift_heart","\128157")
+  ,("girl","\128103")
+  ,("globe_with_meridians","\127760")
+  ,("goat","\128016")
+  ,("golf","\9971")
+  ,("grapes","\127815")
+  ,("green_apple","\127823")
+  ,("green_book","\128215")
+  ,("green_heart","\128154")
+  ,("grey_exclamation","\10069")
+  ,("grey_question","\10068")
+  ,("grimacing","\128556")
+  ,("grin","\128513")
+  ,("grinning","\128512")
+  ,("guardsman","\128130")
+  ,("guitar","\127928")
+  ,("gun","\128299")
+  ,("haircut","\128135")
+  ,("hamburger","\127828")
+  ,("hammer","\128296")
+  ,("hamster","\128057")
+  ,("hand","\9995")
+  ,("handbag","\128092")
+  ,("hankey","\128169")
+  ,("hash","#\65039\8419")
+  ,("hatched_chick","\128037")
+  ,("hatching_chick","\128035")
+  ,("headphones","\127911")
+  ,("hear_no_evil","\128585")
+  ,("heart","\10084\65039")
+  ,("heart_decoration","\128159")
+  ,("heart_eyes","\128525")
+  ,("heart_eyes_cat","\128571")
+  ,("heartbeat","\128147")
+  ,("heartpulse","\128151")
+  ,("hearts","\9829\65039")
+  ,("heavy_check_mark","\10004\65039")
+  ,("heavy_division_sign","\10135")
+  ,("heavy_dollar_sign","\128178")
+  ,("heavy_exclamation_mark","\10071")
+  ,("heavy_minus_sign","\10134")
+  ,("heavy_multiplication_x","\10006\65039")
+  ,("heavy_plus_sign","\10133")
+  ,("helicopter","\128641")
+  ,("herb","\127807")
+  ,("hibiscus","\127802")
+  ,("high_brightness","\128262")
+  ,("high_heel","\128096")
+  ,("hocho","\128298")
+  ,("honey_pot","\127855")
+  ,("honeybee","\128029")
+  ,("horse","\128052")
+  ,("horse_racing","\127943")
+  ,("hospital","\127973")
+  ,("hotel","\127976")
+  ,("hotsprings","\9832\65039")
+  ,("hourglass","\8987")
+  ,("hourglass_flowing_sand","\9203")
+  ,("house","\127968")
+  ,("house_with_garden","\127969")
+  ,("hushed","\128559")
+  ,("ice_cream","\127848")
+  ,("icecream","\127846")
+  ,("id","\127380")
+  ,("ideograph_advantage","\127568")
+  ,("imp","\128127")
+  ,("inbox_tray","\128229")
+  ,("incoming_envelope","\128232")
+  ,("information_desk_person","\128129")
+  ,("information_source","\8505\65039")
+  ,("innocent","\128519")
+  ,("interrobang","\8265\65039")
+  ,("iphone","\128241")
+  ,("it","\127470\127481")
+  ,("izakaya_lantern","\127982")
+  ,("jack_o_lantern","\127875")
+  ,("japan","\128510")
+  ,("japanese_castle","\127983")
+  ,("japanese_goblin","\128122")
+  ,("japanese_ogre","\128121")
+  ,("jeans","\128086")
+  ,("joy","\128514")
+  ,("joy_cat","\128569")
+  ,("jp","\127471\127477")
+  ,("key","\128273")
+  ,("keycap_ten","\128287")
+  ,("kimono","\128088")
+  ,("kiss","\128139")
+  ,("kissing","\128535")
+  ,("kissing_cat","\128573")
+  ,("kissing_closed_eyes","\128538")
+  ,("kissing_heart","\128536")
+  ,("kissing_smiling_eyes","\128537")
+  ,("knife","\128298")
+  ,("koala","\128040")
+  ,("koko","\127489")
+  ,("kr","\127472\127479")
+  ,("lantern","\127982")
+  ,("large_blue_circle","\128309")
+  ,("large_blue_diamond","\128311")
+  ,("large_orange_diamond","\128310")
+  ,("last_quarter_moon","\127767")
+  ,("last_quarter_moon_with_face","\127772")
+  ,("laughing","\128518")
+  ,("leaves","\127811")
+  ,("ledger","\128210")
+  ,("left_luggage","\128709")
+  ,("left_right_arrow","\8596\65039")
+  ,("leftwards_arrow_with_hook","\8617\65039")
+  ,("lemon","\127819")
+  ,("leo","\9804")
+  ,("leopard","\128006")
+  ,("libra","\9806")
+  ,("light_rail","\128648")
+  ,("link","\128279")
+  ,("lips","\128068")
+  ,("lipstick","\128132")
+  ,("lock","\128274")
+  ,("lock_with_ink_pen","\128271")
+  ,("lollipop","\127853")
+  ,("loop","\10175")
+  ,("loud_sound","\128266")
+  ,("loudspeaker","\128226")
+  ,("love_hotel","\127977")
+  ,("love_letter","\128140")
+  ,("low_brightness","\128261")
+  ,("m","\9410\65039")
+  ,("mag","\128269")
+  ,("mag_right","\128270")
+  ,("mahjong","\126980")
+  ,("mailbox","\128235")
+  ,("mailbox_closed","\128234")
+  ,("mailbox_with_mail","\128236")
+  ,("mailbox_with_no_mail","\128237")
+  ,("man","\128104")
+  ,("man_with_gua_pi_mao","\128114")
+  ,("man_with_turban","\128115")
+  ,("mans_shoe","\128094")
+  ,("maple_leaf","\127809")
+  ,("mask","\128567")
+  ,("massage","\128134")
+  ,("meat_on_bone","\127830")
+  ,("mega","\128227")
+  ,("melon","\127816")
+  ,("memo","\128221")
+  ,("mens","\128697")
+  ,("metro","\128647")
+  ,("microphone","\127908")
+  ,("microscope","\128300")
+  ,("milky_way","\127756")
+  ,("minibus","\128656")
+  ,("minidisc","\128189")
+  ,("mobile_phone_off","\128244")
+  ,("money_with_wings","\128184")
+  ,("moneybag","\128176")
+  ,("monkey","\128018")
+  ,("monkey_face","\128053")
+  ,("monorail","\128669")
+  ,("moon","\127764")
+  ,("mortar_board","\127891")
+  ,("mount_fuji","\128507")
+  ,("mountain_bicyclist","\128693")
+  ,("mountain_cableway","\128672")
+  ,("mountain_railway","\128670")
+  ,("mouse","\128045")
+  ,("mouse2","\128001")
+  ,("movie_camera","\127909")
+  ,("moyai","\128511")
+  ,("muscle","\128170")
+  ,("mushroom","\127812")
+  ,("musical_keyboard","\127929")
+  ,("musical_note","\127925")
+  ,("musical_score","\127932")
+  ,("mute","\128263")
+  ,("nail_care","\128133")
+  ,("name_badge","\128219")
+  ,("necktie","\128084")
+  ,("negative_squared_cross_mark","\10062")
+  ,("neutral_face","\128528")
+  ,("new","\127381")
+  ,("new_moon","\127761")
+  ,("new_moon_with_face","\127770")
+  ,("newspaper","\128240")
+  ,("ng","\127382")
+  ,("night_with_stars","\127747")
+  ,("nine","9\65039\8419")
+  ,("no_bell","\128277")
+  ,("no_bicycles","\128691")
+  ,("no_entry","\9940")
+  ,("no_entry_sign","\128683")
+  ,("no_good","\128581")
+  ,("no_mobile_phones","\128245")
+  ,("no_mouth","\128566")
+  ,("no_pedestrians","\128695")
+  ,("no_smoking","\128685")
+  ,("non-potable_water","\128689")
+  ,("nose","\128067")
+  ,("notebook","\128211")
+  ,("notebook_with_decorative_cover","\128212")
+  ,("notes","\127926")
+  ,("nut_and_bolt","\128297")
+  ,("o","\11093")
+  ,("o2","\127358\65039")
+  ,("ocean","\127754")
+  ,("octopus","\128025")
+  ,("oden","\127842")
+  ,("office","\127970")
+  ,("ok","\127383")
+  ,("ok_hand","\128076")
+  ,("ok_woman","\128582")
+  ,("older_man","\128116")
+  ,("older_woman","\128117")
+  ,("on","\128283")
+  ,("oncoming_automobile","\128664")
+  ,("oncoming_bus","\128653")
+  ,("oncoming_police_car","\128660")
+  ,("oncoming_taxi","\128662")
+  ,("one","1\65039\8419")
+  ,("open_book","\128214")
+  ,("open_file_folder","\128194")
+  ,("open_hands","\128080")
+  ,("open_mouth","\128558")
+  ,("ophiuchus","\9934")
+  ,("orange_book","\128217")
+  ,("outbox_tray","\128228")
+  ,("ox","\128002")
+  ,("package","\128230")
+  ,("page_facing_up","\128196")
+  ,("page_with_curl","\128195")
+  ,("pager","\128223")
+  ,("palm_tree","\127796")
+  ,("panda_face","\128060")
+  ,("paperclip","\128206")
+  ,("parking","\127359\65039")
+  ,("part_alternation_mark","\12349\65039")
+  ,("partly_sunny","\9925")
+  ,("passport_control","\128706")
+  ,("paw_prints","\128062")
+  ,("peach","\127825")
+  ,("pear","\127824")
+  ,("pencil","\128221")
+  ,("pencil2","\9999\65039")
+  ,("penguin","\128039")
+  ,("pensive","\128532")
+  ,("performing_arts","\127917")
+  ,("persevere","\128547")
+  ,("person_frowning","\128589")
+  ,("person_with_blond_hair","\128113")
+  ,("person_with_pouting_face","\128590")
+  ,("phone","\9742\65039")
+  ,("pig","\128055")
+  ,("pig2","\128022")
+  ,("pig_nose","\128061")
+  ,("pill","\128138")
+  ,("pineapple","\127821")
+  ,("pisces","\9811")
+  ,("pizza","\127829")
+  ,("point_down","\128071")
+  ,("point_left","\128072")
+  ,("point_right","\128073")
+  ,("point_up","\9757\65039")
+  ,("point_up_2","\128070")
+  ,("police_car","\128659")
+  ,("poodle","\128041")
+  ,("poop","\128169")
+  ,("post_office","\127971")
+  ,("postal_horn","\128239")
+  ,("postbox","\128238")
+  ,("potable_water","\128688")
+  ,("pouch","\128093")
+  ,("poultry_leg","\127831")
+  ,("pound","\128183")
+  ,("pouting_cat","\128574")
+  ,("pray","\128591")
+  ,("princess","\128120")
+  ,("punch","\128074")
+  ,("purple_heart","\128156")
+  ,("purse","\128091")
+  ,("pushpin","\128204")
+  ,("put_litter_in_its_place","\128686")
+  ,("question","\10067")
+  ,("rabbit","\128048")
+  ,("rabbit2","\128007")
+  ,("racehorse","\128014")
+  ,("radio","\128251")
+  ,("radio_button","\128280")
+  ,("rage","\128545")
+  ,("railway_car","\128643")
+  ,("rainbow","\127752")
+  ,("raised_hand","\9995")
+  ,("raised_hands","\128588")
+  ,("raising_hand","\128587")
+  ,("ram","\128015")
+  ,("ramen","\127836")
+  ,("rat","\128000")
+  ,("recycle","\9851\65039")
+  ,("red_car","\128663")
+  ,("red_circle","\128308")
+  ,("registered","\174\65039")
+  ,("relaxed","\9786\65039")
+  ,("relieved","\128524")
+  ,("repeat","\128257")
+  ,("repeat_one","\128258")
+  ,("restroom","\128699")
+  ,("revolving_hearts","\128158")
+  ,("rewind","\9194")
+  ,("ribbon","\127872")
+  ,("rice","\127834")
+  ,("rice_ball","\127833")
+  ,("rice_cracker","\127832")
+  ,("rice_scene","\127889")
+  ,("ring","\128141")
+  ,("rocket","\128640")
+  ,("roller_coaster","\127906")
+  ,("rooster","\128019")
+  ,("rose","\127801")
+  ,("rotating_light","\128680")
+  ,("round_pushpin","\128205")
+  ,("rowboat","\128675")
+  ,("ru","\127479\127482")
+  ,("rugby_football","\127945")
+  ,("runner","\127939")
+  ,("running","\127939")
+  ,("running_shirt_with_sash","\127933")
+  ,("sa","\127490\65039")
+  ,("sagittarius","\9808")
+  ,("sailboat","\9973")
+  ,("sake","\127862")
+  ,("sandal","\128097")
+  ,("santa","\127877")
+  ,("satellite","\128225")
+  ,("satisfied","\128518")
+  ,("saxophone","\127927")
+  ,("school","\127979")
+  ,("school_satchel","\127890")
+  ,("scissors","\9986\65039")
+  ,("scorpius","\9807")
+  ,("scream","\128561")
+  ,("scream_cat","\128576")
+  ,("scroll","\128220")
+  ,("seat","\128186")
+  ,("secret","\12953\65039")
+  ,("see_no_evil","\128584")
+  ,("seedling","\127793")
+  ,("seven","7\65039\8419")
+  ,("shaved_ice","\127847")
+  ,("sheep","\128017")
+  ,("shell","\128026")
+  ,("ship","\128674")
+  ,("shirt","\128085")
+  ,("shit","\128169")
+  ,("shoe","\128094")
+  ,("shower","\128703")
+  ,("signal_strength","\128246")
+  ,("six","6\65039\8419")
+  ,("six_pointed_star","\128303")
+  ,("ski","\127935")
+  ,("skull","\128128")
+  ,("sleeping","\128564")
+  ,("sleepy","\128554")
+  ,("slot_machine","\127920")
+  ,("small_blue_diamond","\128313")
+  ,("small_orange_diamond","\128312")
+  ,("small_red_triangle","\128314")
+  ,("small_red_triangle_down","\128315")
+  ,("smile","\128516")
+  ,("smile_cat","\128568")
+  ,("smiley","\128515")
+  ,("smiley_cat","\128570")
+  ,("smiling_imp","\128520")
+  ,("smirk","\128527")
+  ,("smirk_cat","\128572")
+  ,("smoking","\128684")
+  ,("snail","\128012")
+  ,("snake","\128013")
+  ,("snowboarder","\127938")
+  ,("snowflake","\10052\65039")
+  ,("snowman","\9924")
+  ,("sob","\128557")
+  ,("soccer","\9917")
+  ,("soon","\128284")
+  ,("sos","\127384")
+  ,("sound","\128265")
+  ,("space_invader","\128126")
+  ,("spades","\9824\65039")
+  ,("spaghetti","\127837")
+  ,("sparkle","\10055\65039")
+  ,("sparkler","\127879")
+  ,("sparkles","\10024")
+  ,("sparkling_heart","\128150")
+  ,("speak_no_evil","\128586")
+  ,("speaker","\128264")
+  ,("speech_balloon","\128172")
+  ,("speedboat","\128676")
+  ,("star","\11088")
+  ,("star2","\127775")
+  ,("stars","\127776")
+  ,("station","\128649")
+  ,("statue_of_liberty","\128509")
+  ,("steam_locomotive","\128642")
+  ,("stew","\127858")
+  ,("straight_ruler","\128207")
+  ,("strawberry","\127827")
+  ,("stuck_out_tongue","\128539")
+  ,("stuck_out_tongue_closed_eyes","\128541")
+  ,("stuck_out_tongue_winking_eye","\128540")
+  ,("sun_with_face","\127774")
+  ,("sunflower","\127803")
+  ,("sunglasses","\128526")
+  ,("sunny","\9728\65039")
+  ,("sunrise","\127749")
+  ,("sunrise_over_mountains","\127748")
+  ,("surfer","\127940")
+  ,("sushi","\127843")
+  ,("suspension_railway","\128671")
+  ,("sweat","\128531")
+  ,("sweat_drops","\128166")
+  ,("sweat_smile","\128517")
+  ,("sweet_potato","\127840")
+  ,("swimmer","\127946")
+  ,("symbols","\128291")
+  ,("syringe","\128137")
+  ,("tada","\127881")
+  ,("tanabata_tree","\127883")
+  ,("tangerine","\127818")
+  ,("taurus","\9801")
+  ,("taxi","\128661")
+  ,("tea","\127861")
+  ,("telephone","\9742\65039")
+  ,("telephone_receiver","\128222")
+  ,("telescope","\128301")
+  ,("tennis","\127934")
+  ,("tent","\9978")
+  ,("thought_balloon","\128173")
+  ,("three","3\65039\8419")
+  ,("thumbsdown","\128078")
+  ,("thumbsup","\128077")
+  ,("ticket","\127915")
+  ,("tiger","\128047")
+  ,("tiger2","\128005")
+  ,("tired_face","\128555")
+  ,("tm","\8482\65039")
+  ,("toilet","\128701")
+  ,("tokyo_tower","\128508")
+  ,("tomato","\127813")
+  ,("tongue","\128069")
+  ,("top","\128285")
+  ,("tophat","\127913")
+  ,("tractor","\128668")
+  ,("traffic_light","\128677")
+  ,("train","\128651")
+  ,("train2","\128646")
+  ,("tram","\128650")
+  ,("triangular_flag_on_post","\128681")
+  ,("triangular_ruler","\128208")
+  ,("trident","\128305")
+  ,("triumph","\128548")
+  ,("trolleybus","\128654")
+  ,("trophy","\127942")
+  ,("tropical_drink","\127865")
+  ,("tropical_fish","\128032")
+  ,("truck","\128666")
+  ,("trumpet","\127930")
+  ,("tshirt","\128085")
+  ,("tulip","\127799")
+  ,("turtle","\128034")
+  ,("tv","\128250")
+  ,("twisted_rightwards_arrows","\128256")
+  ,("two","2\65039\8419")
+  ,("two_hearts","\128149")
+  ,("two_men_holding_hands","\128108")
+  ,("two_women_holding_hands","\128109")
+  ,("u5272","\127545")
+  ,("u5408","\127540")
+  ,("u55b6","\127546")
+  ,("u6307","\127535")
+  ,("u6708","\127543\65039")
+  ,("u6709","\127542")
+  ,("u6e80","\127541")
+  ,("u7121","\127514")
+  ,("u7533","\127544")
+  ,("u7981","\127538")
+  ,("u7a7a","\127539")
+  ,("uk","\127468\127463")
+  ,("umbrella","\9748")
+  ,("unamused","\128530")
+  ,("underage","\128286")
+  ,("unlock","\128275")
+  ,("up","\127385")
+  ,("us","\127482\127480")
+  ,("v","\9996\65039")
+  ,("vertical_traffic_light","\128678")
+  ,("vhs","\128252")
+  ,("vibration_mode","\128243")
+  ,("video_camera","\128249")
+  ,("video_game","\127918")
+  ,("violin","\127931")
+  ,("virgo","\9805")
+  ,("volcano","\127755")
+  ,("vs","\127386")
+  ,("walking","\128694")
+  ,("waning_crescent_moon","\127768")
+  ,("waning_gibbous_moon","\127766")
+  ,("warning","\9888\65039")
+  ,("watch","\8986")
+  ,("water_buffalo","\128003")
+  ,("watermelon","\127817")
+  ,("wave","\128075")
+  ,("wavy_dash","\12336\65039")
+  ,("waxing_crescent_moon","\127762")
+  ,("waxing_gibbous_moon","\127764")
+  ,("wc","\128702")
+  ,("weary","\128553")
+  ,("wedding","\128146")
+  ,("whale","\128051")
+  ,("whale2","\128011")
+  ,("wheelchair","\9855")
+  ,("white_check_mark","\9989")
+  ,("white_circle","\9898")
+  ,("white_flower","\128174")
+  ,("white_large_square","\11036")
+  ,("white_medium_small_square","\9725")
+  ,("white_medium_square","\9723\65039")
+  ,("white_small_square","\9643\65039")
+  ,("white_square_button","\128307")
+  ,("wind_chime","\127888")
+  ,("wine_glass","\127863")
+  ,("wink","\128521")
+  ,("wolf","\128058")
+  ,("woman","\128105")
+  ,("womans_clothes","\128090")
+  ,("womans_hat","\128082")
+  ,("womens","\128698")
+  ,("worried","\128543")
+  ,("wrench","\128295")
+  ,("x","\10060")
+  ,("yellow_heart","\128155")
+  ,("yen","\128180")
+  ,("yum","\128523")
+  ,("zap","\9889")
+  ,("zero","0\65039\8419")
+  ,("zzz","\128164")
+  ]
+
diff --git a/src/Text/Pandoc/Error.hs b/src/Text/Pandoc/Error.hs
index 0a4e081..792098b 100644
--- a/src/Text/Pandoc/Error.hs
+++ b/src/Text/Pandoc/Error.hs
@@ -1,6 +1,6 @@
 {-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
 {-
-Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 -}
 {- |
    Module      : Text.Pandoc.Error
-   Copyright   : Copyright (C) 2006-2015 John MacFarlane
+   Copyright   : Copyright (C) 2006-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs
index d0b945d..1b9e92a 100644
--- a/src/Text/Pandoc/Highlighting.hs
+++ b/src/Text/Pandoc/Highlighting.hs
@@ -1,5 +1,5 @@
 {-
-Copyright (C) 2008-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2008-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.Highlighting
-   Copyright   : Copyright (C) 2008-2015 John MacFarlane
+   Copyright   : Copyright (C) 2008-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -65,14 +65,13 @@ highlight :: (FormatOptions -> [SourceLine] -> a) -- ^ Formatter
           -> String -- ^ Raw contents of the CodeBlock
           -> Maybe a -- ^ Maybe the formatted result
 highlight formatter (_, classes, keyvals) rawCode =
-  let firstNum = case safeRead (fromMaybe "1" $ lookup "startFrom" keyvals) of
-                      Just n  -> n
-                      Nothing -> 1
+  let firstNum = fromMaybe 1 (safeRead (fromMaybe "1" $ lookup "startFrom" keyvals))
       fmtOpts = defaultFormatOpts{
                   startNumber = firstNum,
                   numberLines = any (`elem`
                         ["number","numberLines", "number-lines"]) classes }
-      lcclasses = map (map toLower) classes
+      lcclasses = map (map toLower)
+                     (classes ++ concatMap languagesByExtension classes)
   in  case find (`elem` lcLanguages) lcclasses of
             Nothing
               | numberLines fmtOpts -> Just
@@ -126,6 +125,7 @@ langsList =    [("ada","Ada")
                ,("php","PHP")
                ,("xslt","XSLT")
                ,("html","HTML")
+               ,("gap","GAP")
                ]
 
 listingsLangs :: [String]
@@ -140,7 +140,7 @@ listingsLangs = ["Ada","Java","Prolog","Algol","JVMIS","Promela",
                  "Oberon-2","TeX","erlang","OCL","VBScript","Euphoria",
                  "Octave","Verilog","Fortran","Oz","VHDL","GCL",
                  "Pascal","VRML","Gnuplot","Perl","XML","Haskell",
-                 "PHP","XSLT","HTML","PL/I"]
+                 "PHP","XSLT","HTML","PL/I","GAP"]
 
 -- Determine listings language name from highlighting-kate language name.
 toListingsLanguage :: String -> Maybe String
diff --git a/src/Text/Pandoc/ImageSize.hs b/src/Text/Pandoc/ImageSize.hs
index a38a9dc..90dfbb5 100644
--- a/src/Text/Pandoc/ImageSize.hs
+++ b/src/Text/Pandoc/ImageSize.hs
@@ -1,7 +1,7 @@
 {-# LANGUAGE OverloadedStrings, ScopedTypeVariables, CPP #-}
 {-# OPTIONS_GHC -fno-warn-type-defaults #-}
 {-
-  Copyright (C) 2011-2015 John MacFarlane <jgm@berkeley.edu>
+  Copyright (C) 2011-2016 John MacFarlane <jgm@berkeley.edu>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 
 {- |
 Module      : Text.Pandoc.ImageSize
-Copyright   : Copyright (C) 2011-2015 John MacFarlane
+Copyright   : Copyright (C) 2011-2016 John MacFarlane
 License     : GNU GPL, version 2 or above
 
 Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -29,16 +29,35 @@ Portability : portable
 
 Functions for determining the size of a PNG, JPEG, or GIF image.
 -}
-module Text.Pandoc.ImageSize ( ImageType(..), imageType, imageSize,
-                    sizeInPixels, sizeInPoints ) where
+module Text.Pandoc.ImageSize ( ImageType(..)
+                             , imageType
+                             , imageSize
+                             , sizeInPixels
+                             , sizeInPoints
+                             , desiredSizeInPoints
+                             , Dimension(..)
+                             , Direction(..)
+                             , dimension
+                             , inInch
+                             , inPoints
+                             , numUnit
+                             , showInInch
+                             , showInPixel
+                             , showFl
+                             ) where
 import Data.ByteString (ByteString, unpack)
 import qualified Data.ByteString.Char8 as B
 import qualified Data.ByteString.Lazy as BL
+import Data.Char (isDigit)
 import Control.Monad
 import Data.Bits
 import Data.Binary
 import Data.Binary.Get
 import Text.Pandoc.Shared (safeRead, hush)
+import Data.Default (Default)
+import Numeric (showFFloat)
+import Text.Pandoc.Definition
+import Text.Pandoc.Options
 import qualified Data.Map as M
 import Text.Pandoc.Compat.Except
 import Control.Monad.Trans
@@ -48,6 +67,20 @@ import Data.Maybe (fromMaybe)
 -- algorithms borrowed from wwwis.pl
 
 data ImageType = Png | Gif | Jpeg | Pdf | Eps deriving Show
+data Direction = Width | Height
+instance Show Direction where
+  show Width  = "width"
+  show Height = "height"
+
+data Dimension = Pixel Integer
+               | Centimeter Double
+               | Inch Double
+               | Percent Double
+instance Show Dimension where
+  show (Pixel a)      = show   a ++ "px"
+  show (Centimeter a) = showFl a ++ "cm"
+  show (Inch a)       = showFl a ++ "in"
+  show (Percent a)    = show   a ++ "%"
 
 data ImageSize = ImageSize{
                      pxX   :: Integer
@@ -55,7 +88,11 @@ data ImageSize = ImageSize{
                    , dpiX  :: Integer
                    , dpiY  :: Integer
                    } deriving (Read, Show, Eq)
+instance Default ImageSize where
+  def = ImageSize 300 200 72 72
 
+showFl :: (RealFloat a) => a -> String
+showFl a = showFFloat (Just 5) a ""
 
 imageType :: ByteString -> Maybe ImageType
 imageType img = case B.take 4 img of
@@ -87,8 +124,93 @@ defaultSize = (72, 72)
 sizeInPixels :: ImageSize -> (Integer, Integer)
 sizeInPixels s = (pxX s, pxY s)
 
-sizeInPoints :: ImageSize -> (Integer, Integer)
-sizeInPoints s = (pxX s * 72 `div` dpiX s, pxY s * 72 `div` dpiY s)
+-- | Calculate (height, width) in points using the image file's dpi metadata,
+-- using 72 Points == 1 Inch.
+sizeInPoints :: ImageSize -> (Double, Double)
+sizeInPoints s = (pxXf * 72 / dpiXf, pxYf * 72 / dpiYf)
+  where
+    pxXf  = fromIntegral $ pxX s
+    pxYf  = fromIntegral $ pxY s
+    dpiXf = fromIntegral $ dpiX s
+    dpiYf = fromIntegral $ dpiY s
+
+-- | Calculate (height, width) in points, considering the desired dimensions in the
+-- attribute, while falling back on the image file's dpi metadata if no dimensions
+-- are specified in the attribute (or only dimensions in percentages).
+desiredSizeInPoints :: WriterOptions -> Attr -> ImageSize -> (Double, Double)
+desiredSizeInPoints opts attr s =
+  case (getDim Width, getDim Height) of
+    (Just w, Just h)   -> (w, h)
+    (Just w, Nothing)  -> (w, w / ratio)
+    (Nothing, Just h)  -> (h * ratio, h)
+    (Nothing, Nothing) -> sizeInPoints s
+  where
+    ratio = fromIntegral (pxX s) / fromIntegral (pxY s)
+    getDim dir = case (dimension dir attr) of
+                   Just (Percent _) -> Nothing
+                   Just dim         -> Just $ inPoints opts dim
+                   Nothing          -> Nothing
+
+inPoints :: WriterOptions -> Dimension -> Double
+inPoints opts dim = 72 * inInch opts dim
+
+inInch :: WriterOptions -> Dimension -> Double
+inInch opts dim =
+  case dim of
+    (Pixel a)      -> fromIntegral a / (fromIntegral $ writerDpi opts)
+    (Centimeter a) -> a * 0.3937007874
+    (Inch a)       -> a
+    (Percent _)    -> 0
+
+-- | Convert a Dimension to a String denoting its equivalent in inches, for example "2.00000".
+-- Note: Dimensions in percentages are converted to the empty string.
+showInInch :: WriterOptions -> Dimension -> String
+showInInch _ (Percent _) = ""
+showInInch opts dim = showFl $ inInch opts dim
+
+-- | Convert a Dimension to a String denoting its equivalent in pixels, for example "600".
+-- Note: Dimensions in percentages are converted to the empty string.
+showInPixel :: WriterOptions -> Dimension -> String
+showInPixel opts dim =
+  case dim of
+    (Pixel a)      -> show a
+    (Centimeter a) -> show (floor $ dpi * a * 0.3937007874 :: Int)
+    (Inch a)       -> show (floor $ dpi * a :: Int)
+    (Percent _)    -> ""
+  where
+    dpi = fromIntegral $ writerDpi opts
+
+-- | Maybe split a string into a leading number and trailing unit, e.g. "3cm" to Just (3.0, "cm")
+numUnit :: String -> Maybe (Double, String)
+numUnit s =
+  let (nums, unit) = span (\c -> isDigit c || ('.'==c)) s
+  in  case safeRead nums of
+        Just n  -> Just (n, unit)
+        Nothing -> Nothing
+
+-- | Read a Dimension from an Attr attribute.
+-- `dimension Width attr` might return `Just (Pixel 3)` or for example `Just (Centimeter 2.0)`, etc.
+dimension :: Direction -> Attr -> Maybe Dimension
+dimension dir (_, _, kvs) =
+  case dir of
+    Width  -> extractDim "width"
+    Height -> extractDim "height"
+  where
+    extractDim key =
+      case lookup key kvs of
+        Just str ->
+          case numUnit str of
+            Just (num, unit) -> toDim num unit
+            Nothing -> Nothing
+        Nothing  -> Nothing
+    toDim a "cm"   = Just $ Centimeter a
+    toDim a "mm"   = Just $ Centimeter (a / 10)
+    toDim a "in"   = Just $ Inch a
+    toDim a "inch" = Just $ Inch a
+    toDim a "%"    = Just $ Percent a
+    toDim a "px"   = Just $ Pixel (floor a::Integer)
+    toDim a ""     = Just $ Pixel (floor a::Integer)
+    toDim _ _      = Nothing
 
 epsSize :: ByteString -> Maybe ImageSize
 epsSize img = do
@@ -278,21 +400,21 @@ exifHeader hdr = do
        return (tag, payload)
   entries <- sequence $ replicate (fromIntegral numentries) ifdEntry
   subentries <- case lookup ExifOffset entries of
-                      Just (UnsignedLong offset) -> do
+                      Just (UnsignedLong offset') -> do
                         pos <- lift bytesRead
-                        lift $ skip (fromIntegral offset - (fromIntegral pos - 8))
+                        lift $ skip (fromIntegral offset' - (fromIntegral pos - 8))
                         numsubentries <- lift getWord16
                         sequence $
                            replicate (fromIntegral numsubentries) ifdEntry
                       _ -> return []
   let allentries = entries ++ subentries
-  (width, height) <- case (lookup ExifImageWidth allentries,
-                           lookup ExifImageHeight allentries) of
-                          (Just (UnsignedLong w), Just (UnsignedLong h)) ->
-                            return (fromIntegral w, fromIntegral h)
-                          _ -> return defaultSize
-                               -- we return a default width and height when
-                               -- the exif header doesn't contain these
+  (wdth, hght) <- case (lookup ExifImageWidth allentries,
+                        lookup ExifImageHeight allentries) of
+                       (Just (UnsignedLong w), Just (UnsignedLong h)) ->
+                         return (fromIntegral w, fromIntegral h)
+                       _ -> return defaultSize
+                            -- we return a default width and height when
+                            -- the exif header doesn't contain these
   let resfactor = case lookup ResolutionUnit allentries of
                         Just (UnsignedShort 1) -> (100 / 254)
                         _ -> 1
@@ -301,8 +423,8 @@ exifHeader hdr = do
   let yres = maybe 72 (\(UnsignedRational x) -> floor $ x * resfactor)
              $ lookup YResolution allentries
   return $ ImageSize{
-                    pxX  = width
-                  , pxY  = height
+                    pxX  = wdth
+                  , pxY  = hght
                   , dpiX = xres
                   , dpiY = yres }
 
diff --git a/src/Text/Pandoc/MIME.hs b/src/Text/Pandoc/MIME.hs
index 6fd9ac3..1164e04 100644
--- a/src/Text/Pandoc/MIME.hs
+++ b/src/Text/Pandoc/MIME.hs
@@ -1,5 +1,5 @@
 {-
-Copyright (C) 2011-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2011-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.MIME
-   Copyright   : Copyright (C) 2011-2015 John MacFarlane
+   Copyright   : Copyright (C) 2011-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 20c842e..1712109 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -1,6 +1,6 @@
-{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
 {-
-Copyright (C) 2012-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2012-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.Options
-   Copyright   : Copyright (C) 2012-2015 John MacFarlane
+   Copyright   : Copyright (C) 2012-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -42,6 +42,7 @@ module Text.Pandoc.Options ( Extension(..)
                            , ObfuscationMethod (..)
                            , HTMLSlideVariant (..)
                            , EPUBVersion (..)
+                           , WrapOption (..)
                            , WriterOptions (..)
                            , TrackChanges (..)
                            , def
@@ -54,6 +55,7 @@ import Text.Pandoc.Highlighting (Style, pygments)
 import Text.Pandoc.MediaBag (MediaBag)
 import Data.Data (Data)
 import Data.Typeable (Typeable)
+import GHC.Generics (Generic)
 
 -- | Individually selectable syntax extensions.
 data Extension =
@@ -85,7 +87,8 @@ data Extension =
     | Ext_markdown_attribute      -- ^ Interpret text inside HTML as markdown
                                   --   iff container has attribute 'markdown'
     | Ext_escaped_line_breaks     -- ^ Treat a backslash at EOL as linebreak
-    | Ext_link_attributes     -- ^ MMD style reference link attributes
+    | Ext_link_attributes         -- ^ link and image attributes
+    | Ext_mmd_link_attributes     -- ^ MMD style reference link attributes
     | Ext_autolink_bare_uris  -- ^ Make all absolute URIs into links
     | Ext_fancy_lists         -- ^ Enable fancy list numbers and delimiters
     | Ext_lists_without_preceding_blankline -- ^ Allow lists without preceding blank
@@ -103,8 +106,11 @@ data Extension =
     | Ext_subscript           -- ^ Subscript using ~this~ syntax
     | Ext_hard_line_breaks    -- ^ All newlines become hard line breaks
     | Ext_ignore_line_breaks  -- ^ Newlines in paragraphs are ignored
+    | Ext_east_asian_line_breaks  -- ^ Newlines in paragraphs are ignored between
+                              -- East Asian wide characters
     | Ext_literate_haskell    -- ^ Enable literate Haskell conventions
     | Ext_abbreviations       -- ^ PHP markdown extra abbreviation definitions
+    | Ext_emoji               -- ^ Support emoji like :smile:
     | Ext_auto_identifiers    -- ^ Automatic identifiers for headers
     | Ext_ascii_identifiers   -- ^ ascii-only identifiers for headers
     | Ext_header_attributes   -- ^ Explicit header attributes {#id .class k=v}
@@ -113,7 +119,7 @@ data Extension =
     | Ext_line_blocks         -- ^ RST style line blocks
     | Ext_epub_html_exts      -- ^ Recognise the EPUB extended version of HTML
     | Ext_shortcut_reference_links -- ^ Shortcut reference links
-    deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable)
+    deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable, Generic)
 
 pandocExtensions :: Set Extension
 pandocExtensions = Set.fromList
@@ -153,6 +159,7 @@ pandocExtensions = Set.fromList
   , Ext_subscript
   , Ext_auto_identifiers
   , Ext_header_attributes
+  , Ext_link_attributes
   , Ext_implicit_header_references
   , Ext_line_blocks
   , Ext_shortcut_reference_links
@@ -186,6 +193,7 @@ phpMarkdownExtraExtensions = Set.fromList
   , Ext_definition_lists
   , Ext_intraword_underscores
   , Ext_header_attributes
+  , Ext_link_attributes
   , Ext_abbreviations
   , Ext_shortcut_reference_links
   ]
@@ -194,7 +202,6 @@ githubMarkdownExtensions :: Set Extension
 githubMarkdownExtensions = Set.fromList
   [ Ext_pipe_tables
   , Ext_raw_html
-  , Ext_tex_math_single_backslash
   , Ext_fenced_code_blocks
   , Ext_auto_identifiers
   , Ext_ascii_identifiers
@@ -203,6 +210,7 @@ githubMarkdownExtensions = Set.fromList
   , Ext_intraword_underscores
   , Ext_strikeout
   , Ext_hard_line_breaks
+  , Ext_emoji
   , Ext_lists_without_preceding_blankline
   , Ext_shortcut_reference_links
   ]
@@ -212,7 +220,7 @@ multimarkdownExtensions = Set.fromList
   [ Ext_pipe_tables
   , Ext_raw_html
   , Ext_markdown_attribute
-  , Ext_link_attributes
+  , Ext_mmd_link_attributes
   , Ext_raw_tex
   , Ext_tex_math_double_backslash
   , Ext_intraword_underscores
@@ -256,7 +264,8 @@ data ReaderOptions = ReaderOptions{
        , readerDefaultImageExtension :: String -- ^ Default extension for images
        , readerTrace           :: Bool -- ^ Print debugging info
        , readerTrackChanges    :: TrackChanges
-} deriving (Show, Read, Data, Typeable)
+       , readerFileScope      :: Bool -- ^ Parse before combining
+} deriving (Show, Read, Data, Typeable, Generic)
 
 instance Default ReaderOptions
   where def = ReaderOptions{
@@ -272,13 +281,14 @@ instance Default ReaderOptions
                , readerDefaultImageExtension = ""
                , readerTrace                 = False
                , readerTrackChanges          = AcceptChanges
+               , readerFileScope             = False
                }
 
 --
 -- Writer options
 --
 
-data EPUBVersion = EPUB2 | EPUB3 deriving (Eq, Show, Read, Data, Typeable)
+data EPUBVersion = EPUB2 | EPUB3 deriving (Eq, Show, Read, Data, Typeable, Generic)
 
 data HTMLMathMethod = PlainMath
                     | LaTeXMathML (Maybe String)  -- url of LaTeXMathML.js
@@ -288,18 +298,18 @@ data HTMLMathMethod = PlainMath
                     | MathML (Maybe String)       -- url of MathMLinHTML.js
                     | MathJax String              -- url of MathJax.js
                     | KaTeX String String -- url of stylesheet and katex.js
-                    deriving (Show, Read, Eq, Data, Typeable)
+                    deriving (Show, Read, Eq, Data, Typeable, Generic)
 
 data CiteMethod = Citeproc                        -- use citeproc to render them
                   | Natbib                        -- output natbib cite commands
                   | Biblatex                      -- output biblatex cite commands
-                deriving (Show, Read, Eq, Data, Typeable)
+                deriving (Show, Read, Eq, Data, Typeable, Generic)
 
 -- | Methods for obfuscating email addresses in HTML.
 data ObfuscationMethod = NoObfuscation
                        | ReferenceObfuscation
                        | JavascriptObfuscation
-                       deriving (Show, Read, Eq, Data, Typeable)
+                       deriving (Show, Read, Eq, Data, Typeable, Generic)
 
 -- | Varieties of HTML slide shows.
 data HTMLSlideVariant = S5Slides
@@ -308,13 +318,19 @@ data HTMLSlideVariant = S5Slides
                       | DZSlides
                       | RevealJsSlides
                       | NoSlides
-                      deriving (Show, Read, Eq, Data, Typeable)
+                      deriving (Show, Read, Eq, Data, Typeable, Generic)
 
 -- | Options for accepting or rejecting MS Word track-changes.
 data TrackChanges = AcceptChanges
                   | RejectChanges
                   | AllChanges
-                  deriving (Show, Read, Eq, Data, Typeable)
+                  deriving (Show, Read, Eq, Data, Typeable, Generic)
+
+-- | Options for wrapping text in the output.
+data WrapOption = WrapAuto        -- ^ Automatically wrap to width
+                | WrapNone        -- ^ No non-semantic newlines
+                | WrapPreserve    -- ^ Preserve wrapping of input source
+                deriving (Show, Read, Eq, Data, Typeable, Generic)
 
 -- | Options for writers
 data WriterOptions = WriterOptions
@@ -332,7 +348,8 @@ data WriterOptions = WriterOptions
   , writerSectionDivs      :: Bool   -- ^ Put sections in div tags in HTML
   , writerExtensions       :: Set Extension -- ^ Markdown extensions that can be used
   , writerReferenceLinks   :: Bool   -- ^ Use reference links in writing markdown, rst
-  , writerWrapText         :: Bool   -- ^ Wrap text to line length
+  , writerDpi              :: Int    -- ^ Dpi for pixel to/from inch/cm conversions
+  , writerWrapText         :: WrapOption  -- ^ Option for wrapping text
   , writerColumns          :: Int    -- ^ Characters in a line (for text wrapping)
   , writerEmailObfuscation :: ObfuscationMethod -- ^ How to obfuscate emails
   , writerIdentifierPrefix :: String -- ^ Prefix for section & note ids in HTML
@@ -361,7 +378,7 @@ data WriterOptions = WriterOptions
   , writerMediaBag         :: MediaBag       -- ^ Media collected by docx or epub reader
   , writerVerbose          :: Bool           -- ^ Verbose debugging output
   , writerLaTeXArgs        :: [String]       -- ^ Flags to pass to latex-engine
-  } deriving (Show, Data, Typeable)
+  } deriving (Show, Data, Typeable, Generic)
 
 instance Default WriterOptions where
   def = WriterOptions { writerStandalone       = False
@@ -378,7 +395,8 @@ instance Default WriterOptions where
                       , writerSectionDivs      = False
                       , writerExtensions       = pandocExtensions
                       , writerReferenceLinks   = False
-                      , writerWrapText         = True
+                      , writerDpi              = 96
+                      , writerWrapText         = WrapAuto
                       , writerColumns          = 72
                       , writerEmailObfuscation = JavascriptObfuscation
                       , writerIdentifierPrefix = ""
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index f466fcb..4dbe1f0 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -1,6 +1,6 @@
 {-# LANGUAGE OverloadedStrings, CPP, ScopedTypeVariables #-}
 {-
-Copyright (C) 2012-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2012-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.PDF
-   Copyright   : Copyright (C) 2012-2015 John MacFarlane
+   Copyright   : Copyright (C) 2012-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -34,9 +34,11 @@ import Data.ByteString.Lazy (ByteString)
 import qualified Data.ByteString.Lazy as B
 import qualified Data.ByteString.Lazy.Char8 as BC
 import qualified Data.ByteString as BS
+import Text.Pandoc.Compat.Monoid ((<>))
 import System.Exit (ExitCode (..))
 import System.FilePath
 import System.IO (stderr, stdout)
+import System.IO.Temp (withTempFile)
 import System.Directory
 import Data.Digest.Pure.SHA (showDigest, sha1)
 import System.Environment
@@ -47,8 +49,10 @@ import Data.Maybe (fromMaybe)
 import qualified Text.Pandoc.UTF8 as UTF8
 import Text.Pandoc.Definition
 import Text.Pandoc.Walk (walkM)
-import Text.Pandoc.Shared (fetchItem', warn, withTempDir)
-import Text.Pandoc.Options (WriterOptions(..))
+import Text.Pandoc.Shared (fetchItem', warn, withTempDir, inDirectory,
+                           stringify)
+import Text.Pandoc.Writers.Shared (getField, metaToJSON)
+import Text.Pandoc.Options (WriterOptions(..), HTMLMathMethod(..))
 import Text.Pandoc.MIME (extensionFromMimeType, getMimeType)
 import Text.Pandoc.Process (pipeProcess)
 import qualified Data.ByteString.Lazy as BL
@@ -62,16 +66,44 @@ changePathSeparators :: FilePath -> FilePath
 changePathSeparators = intercalate "/" . splitDirectories
 #endif
 
-makePDF :: String              -- ^ pdf creator (pdflatex, lualatex, xelatex)
+makePDF :: String              -- ^ pdf creator (pdflatex, lualatex,
+                               -- xelatex, context, wkhtmltopdf)
         -> (WriterOptions -> Pandoc -> String)  -- ^ writer
         -> WriterOptions       -- ^ options
         -> Pandoc              -- ^ document
         -> IO (Either ByteString ByteString)
+makePDF "wkhtmltopdf" writer opts doc@(Pandoc meta _) = do
+  let mathArgs = case writerHTMLMathMethod opts of
+                 -- with MathJax, wait til all math is rendered:
+                      MathJax _ -> ["--run-script", "MathJax.Hub.Register.StartupHook('End Typeset', function() { window.status = 'mathjax_loaded' });",
+                                    "--window-status", "mathjax_loaded"]
+                      _ -> []
+  meta' <- metaToJSON opts (return . stringify) (return . stringify) meta
+  let toArgs (f, mbd) = maybe [] (\d -> ['-':'-':f, d]) mbd
+  let args   = mathArgs ++
+               concatMap toArgs
+                 [("page-size", getField "papersize" meta')
+                 ,("title", getField "title" meta')
+                 ,("margin-bottom", fromMaybe (Just "1.2in")
+                            (getField "margin-bottom" meta'))
+                 ,("margin-top", fromMaybe (Just "1.25in")
+                            (getField "margin-top" meta'))
+                 ,("margin-right", fromMaybe (Just "1.25in")
+                            (getField "margin-right" meta'))
+                 ,("margin-left", fromMaybe (Just "1.25in")
+                            (getField "margin-left" meta'))
+                 ]
+  let source = writer opts doc
+  html2pdf (writerVerbose opts) args source
 makePDF program writer opts doc = withTempDir "tex2pdf." $ \tmpdir -> do
   doc' <- handleImages opts tmpdir doc
   let source = writer opts doc'
       args   = writerLaTeXArgs opts
-  tex2pdf' (writerVerbose opts) args tmpdir program source
+  case takeBaseName program of
+     "context" -> context2pdf (writerVerbose opts) tmpdir source
+     prog | prog `elem` ["pdflatex", "lualatex", "xelatex"]
+         -> tex2pdf' (writerVerbose opts) args tmpdir program source
+     _ -> return $ Left $ UTF8.fromStringLazy $ "Unknown program " ++ program
 
 handleImages :: WriterOptions
              -> FilePath      -- ^ temp dir to store images
@@ -83,10 +115,10 @@ handleImage' :: WriterOptions
              -> FilePath
              -> Inline
              -> IO Inline
-handleImage' opts tmpdir (Image ils (src,tit)) = do
+handleImage' opts tmpdir (Image attr ils (src,tit)) = do
     exists <- doesFileExist src
     if exists
-       then return $ Image ils (src,tit)
+       then return $ Image attr ils (src,tit)
        else do
          res <- fetchItem' (writerMediaBag opts) (writerSourceURL opts) src
          case res of
@@ -96,20 +128,20 @@ handleImage' opts tmpdir (Image ils (src,tit)) = do
                 let basename = showDigest $ sha1 $ BL.fromChunks [contents]
                 let fname = tmpdir </> basename <.> ext
                 BS.writeFile fname contents
-                return $ Image ils (fname,tit)
+                return $ Image attr ils (fname,tit)
               _ -> do
                 warn $ "Could not find image `" ++ src ++ "', skipping..."
-                return $ Image ils (src,tit)
+                return $ Image attr ils (src,tit)
 handleImage' _ _ x = return x
 
 convertImages :: FilePath -> Inline -> IO Inline
-convertImages tmpdir (Image ils (src, tit)) = do
+convertImages tmpdir (Image attr ils (src, tit)) = do
   img <- convertImage tmpdir src
   newPath <-
     case img of
       Left e -> src <$ warn e
       Right fp -> return fp
-  return (Image ils (newPath, tit))
+  return (Image attr ils (newPath, tit))
 convertImages _ x = return x
 
 -- Convert formats which do not work well in pdf to png
@@ -127,7 +159,7 @@ convertImage tmpdir fname =
                  E.catch (Right fileOut <$ JP.savePngImage fileOut img) $
                      \(e :: E.SomeException) -> return (Left (show e))
   where
-    fileOut = replaceDirectory (replaceExtension fname (".png")) tmpdir
+    fileOut = replaceDirectory (replaceExtension fname ".png") tmpdir
     mime = getMimeType fname
     doNothing = return (Right fname)
 
@@ -147,8 +179,8 @@ tex2pdf' verbose args tmpDir program source = do
           let logmsg = extractMsg log'
           let extramsg =
                 case logmsg of
-                     x | ("! Package inputenc Error" `BC.isPrefixOf` x
-                           && program /= "xelatex")
+                     x | "! Package inputenc Error" `BC.isPrefixOf` x
+                           && program /= "xelatex"
                        -> "\nTry running pandoc with --latex-engine=xelatex."
                      _ -> ""
           return $ Left $ logmsg <> extramsg
@@ -166,6 +198,14 @@ extractMsg log' = do
      then log'
      else BC.unlines (msg'' ++ lineno)
 
+extractConTeXtMsg :: ByteString -> ByteString
+extractConTeXtMsg log' = do
+  let msg'  = take 1 $
+              dropWhile (not . ("tex error" `BC.isPrefixOf`)) $ BC.lines log'
+  if null msg'
+     then log'
+     else BC.unlines msg'
+
 -- running tex programs
 
 -- Run a TeX program on an input bytestring and return (exit code,
@@ -188,18 +228,18 @@ runTeXProgram verbose program args runNumber numRuns tmpDir source = do
     let programArgs = ["-halt-on-error", "-interaction", "nonstopmode",
          "-output-directory", tmpDir'] ++ args ++ [file']
     env' <- getEnvironment
-    let sep = searchPathSeparator:[]
+    let sep = [searchPathSeparator]
     let texinputs = maybe (tmpDir' ++ sep) ((tmpDir' ++ sep) ++)
           $ lookup "TEXINPUTS" env'
     let env'' = ("TEXINPUTS", texinputs) :
                   [(k,v) | (k,v) <- env', k /= "TEXINPUTS"]
     when (verbose && runNumber == 1) $ do
-      putStrLn $ "[makePDF] temp dir:"
+      putStrLn "[makePDF] temp dir:"
       putStrLn tmpDir'
-      putStrLn $ "[makePDF] Command line:"
+      putStrLn "[makePDF] Command line:"
       putStrLn $ program ++ " " ++ unwords (map show programArgs)
       putStr "\n"
-      putStrLn $ "[makePDF] Environment:"
+      putStrLn "[makePDF] Environment:"
       mapM_ print env''
       putStr "\n"
       putStrLn $ "[makePDF] Contents of " ++ file' ++ ":"
@@ -224,3 +264,99 @@ runTeXProgram verbose program args runNumber numRuns tmpDir source = do
                    else return Nothing
          return (exit, out <> err, pdf)
 
+html2pdf  :: Bool         -- ^ Verbose output
+          -> [String]     -- ^ Args to wkhtmltopdf
+          -> String       -- ^ HTML5 source
+          -> IO (Either ByteString ByteString)
+html2pdf verbose args source = do
+  file <- withTempFile "." "html2pdf.html" $ \fp _ -> return fp
+  pdfFile <- withTempFile "." "html2pdf.pdf" $ \fp _ -> return fp
+  UTF8.writeFile file source
+  let programArgs = args ++ [file, pdfFile]
+  env' <- getEnvironment
+  when verbose $ do
+    putStrLn "[makePDF] Command line:"
+    putStrLn $ "wkhtmltopdf" ++ " " ++ unwords (map show programArgs)
+    putStr "\n"
+    putStrLn "[makePDF] Environment:"
+    mapM_ print env'
+    putStr "\n"
+    putStrLn $ "[makePDF] Contents of " ++ file ++ ":"
+    B.readFile file >>= B.putStr
+    putStr "\n"
+  (exit, out, err) <- pipeProcess (Just env') "wkhtmltopdf"
+                              programArgs BL.empty
+  removeFile file
+  when verbose $ do
+    B.hPutStr stdout out
+    B.hPutStr stderr err
+    putStr "\n"
+  pdfExists <- doesFileExist pdfFile
+  mbPdf <- if pdfExists
+            -- We read PDF as a strict bytestring to make sure that the
+            -- temp directory is removed on Windows.
+            -- See https://github.com/jgm/pandoc/issues/1192.
+            then do
+              res <- (Just . B.fromChunks . (:[])) `fmap` BS.readFile pdfFile
+              removeFile pdfFile
+              return res
+            else return Nothing
+  let log' = out <> err
+  return $ case (exit, mbPdf) of
+             (ExitFailure _, _)      -> Left log'
+             (ExitSuccess, Nothing)  -> Left ""
+             (ExitSuccess, Just pdf) -> Right pdf
+
+context2pdf :: Bool         -- ^ Verbose output
+            -> FilePath     -- ^ temp directory for output
+            -> String       -- ^ ConTeXt source
+            -> IO (Either ByteString ByteString)
+context2pdf verbose tmpDir source = inDirectory tmpDir $ do
+  let file = "input.tex"
+  UTF8.writeFile file source
+#ifdef _WINDOWS
+  -- note:  we want / even on Windows, for TexLive
+  let tmpDir' = changePathSeparators tmpDir
+#else
+  let tmpDir' = tmpDir
+#endif
+  let programArgs = "--batchmode" : [file]
+  env' <- getEnvironment
+  let sep = [searchPathSeparator]
+  let texinputs = maybe (".." ++ sep) ((".." ++ sep) ++)
+        $ lookup "TEXINPUTS" env'
+  let env'' = ("TEXINPUTS", texinputs) :
+                [(k,v) | (k,v) <- env', k /= "TEXINPUTS"]
+  when verbose $ do
+    putStrLn "[makePDF] temp dir:"
+    putStrLn tmpDir'
+    putStrLn "[makePDF] Command line:"
+    putStrLn $ "context" ++ " " ++ unwords (map show programArgs)
+    putStr "\n"
+    putStrLn "[makePDF] Environment:"
+    mapM_ print env''
+    putStr "\n"
+    putStrLn $ "[makePDF] Contents of " ++ file ++ ":"
+    B.readFile file >>= B.putStr
+    putStr "\n"
+  (exit, out, err) <- pipeProcess (Just env'') "context" programArgs BL.empty
+  when verbose $ do
+    B.hPutStr stdout out
+    B.hPutStr stderr err
+    putStr "\n"
+  let pdfFile = replaceExtension file ".pdf"
+  pdfExists <- doesFileExist pdfFile
+  mbPdf <- if pdfExists
+            -- We read PDF as a strict bytestring to make sure that the
+            -- temp directory is removed on Windows.
+            -- See https://github.com/jgm/pandoc/issues/1192.
+            then (Just . B.fromChunks . (:[])) `fmap` BS.readFile pdfFile
+            else return Nothing
+  let log' = out <> err
+  case (exit, mbPdf) of
+       (ExitFailure _, _)      -> do
+          let logmsg = extractConTeXtMsg log'
+          return $ Left logmsg
+       (ExitSuccess, Nothing)  -> return $ Left ""
+       (ExitSuccess, Just pdf) -> return $ Right pdf
+
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index d2eaaf0..7bf8270 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -5,7 +5,7 @@
 , MultiParamTypeClasses
 , FlexibleInstances #-}
 {-
-Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.Parsing
-   Copyright   : Copyright (C) 2006-2015 John MacFarlane
+   Copyright   : Copyright (C) 2006-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -164,7 +164,8 @@ module Text.Pandoc.Parsing ( anyLine,
                              setSourceLine,
                              newPos,
                              addWarning,
-                             (<+?>)
+                             (<+?>),
+                             extractIdClass
                              )
 where
 
@@ -185,6 +186,7 @@ import Text.TeXMath.Readers.TeX.Macros (applyMacros, Macro,
                                         parseMacroDefinitions)
 import Text.Pandoc.Compat.TagSoupEntity ( lookupEntity )
 import Text.Pandoc.Asciify (toAsciiChar)
+import Text.Pandoc.Compat.Monoid ((<>))
 import Data.Default
 import qualified Data.Set as Set
 import Control.Monad.Reader
@@ -571,7 +573,11 @@ characterReference :: Stream s m Char => ParserT s st m Char
 characterReference = try $ do
   char '&'
   ent <- many1Till nonspaceChar (char ';')
-  case lookupEntity ent of
+  let ent' = case ent of
+                  '#':'X':xs -> '#':'x':xs  -- workaround tagsoup bug
+                  '#':_  -> ent
+                  _      -> ent ++ ";"
+  case lookupEntity ent' of
        Just c  -> return c
        Nothing -> fail "entity not found"
 
@@ -909,7 +915,7 @@ data ParserState = ParserState
       stateMeta'           :: F Meta,        -- ^ Document metadata
       stateHeaderTable     :: [HeaderType],  -- ^ Ordered list of header types used
       stateHeaders         :: M.Map Inlines String, -- ^ List of headers and ids (used for implicit ref links)
-      stateIdentifiers     :: [String],      -- ^ List of header identifiers used
+      stateIdentifiers     :: Set.Set String, -- ^ Header identifiers used
       stateNextExample     :: Int,           -- ^ Number of next example
       stateExamples        :: M.Map String Int, -- ^ Map from example labels to numbers
       stateHasChapters     :: Bool,          -- ^ True if \chapter encountered
@@ -967,8 +973,8 @@ instance HasHeaderMap ParserState where
   updateHeaderMap f st = st{ stateHeaders = f $ stateHeaders st }
 
 class HasIdentifierList st where
-  extractIdentifierList  :: st -> [String]
-  updateIdentifierList   :: ([String] -> [String]) -> st -> st
+  extractIdentifierList  :: st -> Set.Set String
+  updateIdentifierList   :: (Set.Set String -> Set.Set String) -> st -> st
 
 instance HasIdentifierList ParserState where
   extractIdentifierList     = stateIdentifiers
@@ -1007,7 +1013,7 @@ defaultParserState =
                   stateMeta'           = return nullMeta,
                   stateHeaderTable     = [],
                   stateHeaders         = M.empty,
-                  stateIdentifiers     = [],
+                  stateIdentifiers     = Set.empty,
                   stateNextExample     = 1,
                   stateExamples        = M.empty,
                   stateHasChapters     = False,
@@ -1065,7 +1071,7 @@ toKey = Key . map toLower . unwords . words . unbracket
   where unbracket ('[':xs) | "]" `isSuffixOf` xs = take (length xs - 1) xs
         unbracket xs       = xs
 
-type KeyTable = M.Map Key Target
+type KeyTable = M.Map Key (Target, Attr)
 
 type SubstTable = M.Map Key Inlines
 
@@ -1086,8 +1092,8 @@ registerHeader (ident,classes,kvs) header' = do
        let id'' = if Ext_ascii_identifiers `Set.member` exts
                      then catMaybes $ map toAsciiChar id'
                      else id'
-       updateState $ updateIdentifierList $
-         if id' == id'' then (id' :) else ([id', id''] ++)
+       updateState $ updateIdentifierList $ Set.insert id'
+       updateState $ updateIdentifierList $ Set.insert id''
        updateState $ updateHeaderMap $ insert' header' id'
        return (id'',classes,kvs)
      else do
@@ -1210,7 +1216,8 @@ citeKey = try $ do
   firstChar <- alphaNum <|> char '_' <|> char '*' -- @* for wildcard in nocite
   let regchar = satisfy (\c -> isAlphaNum c || c == '_')
   let internal p = try $ p <* lookAhead regchar
-  rest <- many $ regchar <|> internal (oneOf ":.#$%&-+?<>~/")
+  rest <- many $ regchar <|> internal (oneOf ":.#$%&-+?<>~/") <|>
+                 try (oneOf ":/" <* lookAhead (char '/'))
   let key = firstChar:rest
   return (suppress_author, key)
 
@@ -1262,3 +1269,14 @@ addWarning mbpos msg =
 infixr 5 <+?>
 (<+?>) :: (Monoid a, Monad m) => ParserT s st m a -> ParserT s st m a -> ParserT s st m a
 a <+?> b = a >>= flip fmap (try b <|> return mempty) . (<>)
+
+extractIdClass :: Attr -> Attr
+extractIdClass (ident, cls, kvs) = (ident', cls', kvs')
+  where
+    ident' = case (lookup "id" kvs) of
+               Just v  -> v
+               Nothing -> ident
+    cls'   = case (lookup "class" kvs) of
+               Just cl -> words cl
+               Nothing -> cls
+    kvs'  = filter (\(k,_) -> k /= "id" || k /= "class") kvs
diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs
index f100fb7..f3ef0ef 100644
--- a/src/Text/Pandoc/Pretty.hs
+++ b/src/Text/Pandoc/Pretty.hs
@@ -1,6 +1,6 @@
 {-# LANGUAGE GeneralizedNewtypeDeriving, CPP #-}
 {-
-Copyright (C) 2010-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2010-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111(-1)307  USA
 
 {- |
    Module      : Text.Pandoc.Pretty
-   Copyright   : Copyright (C) 2010-2015 John MacFarlane
+   Copyright   : Copyright (C) 2010-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -80,6 +80,7 @@ import Data.List (intercalate)
 import Data.String
 import Control.Monad.State
 import Data.Char (isSpace)
+import Text.Pandoc.Compat.Monoid ((<>))
 
 data RenderState a = RenderState{
          output       :: [a]        -- ^ In reverse order
@@ -170,7 +171,7 @@ infixr 5 $$
                    else x <> cr <> y
 
 infixr 5 $+$
--- | @a $$ b@ puts @a@ above @b@, with a blank line between.
+-- | @a $+$ b@ puts @a@ above @b@, with a blank line between.
 ($+$) :: Doc -> Doc -> Doc
 ($+$) x y = if isEmpty x
                then y
diff --git a/src/Text/Pandoc/Process.hs b/src/Text/Pandoc/Process.hs
index e524563..bc71f13 100644
--- a/src/Text/Pandoc/Process.hs
+++ b/src/Text/Pandoc/Process.hs
@@ -1,5 +1,5 @@
 {-
-Copyright (C) 2013-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2013-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.Process
-   Copyright   : Copyright (C) 2013-2015 John MacFarlane
+   Copyright   : Copyright (C) 2013-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
diff --git a/src/Text/Pandoc/Readers/CommonMark.hs b/src/Text/Pandoc/Readers/CommonMark.hs
index 51a35c8..d20d386 100644
--- a/src/Text/Pandoc/Readers/CommonMark.hs
+++ b/src/Text/Pandoc/Readers/CommonMark.hs
@@ -58,15 +58,19 @@ addBlocks = foldr addBlock []
 addBlock :: Node -> [Block] -> [Block]
 addBlock (Node _ PARAGRAPH nodes) =
   (Para (addInlines nodes) :)
-addBlock (Node _ HRULE _) =
+addBlock (Node _ THEMATIC_BREAK _) =
   (HorizontalRule :)
 addBlock (Node _ BLOCK_QUOTE nodes) =
   (BlockQuote (addBlocks nodes) :)
-addBlock (Node _ (HTML t) _) =
+addBlock (Node _ (HTML_BLOCK t) _) =
   (RawBlock (Format "html") (unpack t) :)
+-- Note:  the cmark parser will never generate CUSTOM_BLOCK,
+-- so we don't need to handle it:
+addBlock (Node _ (CUSTOM_BLOCK _onEnter _onExit) _nodes) =
+  id
 addBlock (Node _ (CODE_BLOCK info t) _) =
   (CodeBlock ("", take 1 (words (unpack info)), []) (unpack t) :)
-addBlock (Node _ (HEADER lev) nodes) =
+addBlock (Node _ (HEADING lev) nodes) =
   (Header lev ("",[],[]) (addInlines nodes) :)
 addBlock (Node _ (LIST listAttrs) nodes) =
   (constructor (map (setTightness . addBlocks . children) nodes) :)
@@ -103,9 +107,13 @@ addInline (Node _ (TEXT t) _) = (map toinl clumps ++)
         toinl (' ':_)    = Space
         toinl xs         = Str xs
 addInline (Node _ LINEBREAK _) = (LineBreak :)
-addInline (Node _ SOFTBREAK _) = (Space :)
-addInline (Node _ (INLINE_HTML t) _) =
+addInline (Node _ SOFTBREAK _) = (SoftBreak :)
+addInline (Node _ (HTML_INLINE t) _) =
   (RawInline (Format "html") (unpack t) :)
+-- Note:  the cmark parser will never generate CUSTOM_BLOCK,
+-- so we don't need to handle it:
+addInline (Node _ (CUSTOM_INLINE _onEnter _onExit) _nodes) =
+  id
 addInline (Node _ (CODE t) _) =
   (Code ("",[],[]) (unpack t) :)
 addInline (Node _ EMPH nodes) =
@@ -113,7 +121,7 @@ addInline (Node _ EMPH nodes) =
 addInline (Node _ STRONG nodes) =
   (Strong (addInlines nodes) :)
 addInline (Node _ (LINK url title) nodes) =
-  (Link (addInlines nodes) (unpack url, unpack title) :)
+  (Link nullAttr (addInlines nodes) (unpack url, unpack title) :)
 addInline (Node _ (IMAGE url title) nodes) =
-  (Image (addInlines nodes) (unpack url, unpack title) :)
+  (Image nullAttr (addInlines nodes) (unpack url, unpack title) :)
 addInline _ = id
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index f679ddb..e8fe92e 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -635,11 +635,20 @@ addToStart toadd bs =
 -- A DocBook mediaobject is a wrapper around a set of alternative presentations
 getMediaobject :: Element -> DB Inlines
 getMediaobject e = do
-  imageUrl <- case filterChild (named "imageobject") e of
-                Nothing  -> return mempty
-                Just z   -> case filterChild (named "imagedata") z of
-                              Nothing -> return mempty
-                              Just i -> return $ attrValue "fileref" i
+  (imageUrl, attr) <-
+    case filterChild (named "imageobject") e of
+      Nothing  -> return (mempty, nullAttr)
+      Just z   -> case filterChild (named "imagedata") z of
+                    Nothing -> return (mempty, nullAttr)
+                    Just i  -> let atVal a = attrValue a i
+                                   w = case atVal "width" of
+                                         "" -> []
+                                         d  -> [("width", d)]
+                                   h = case atVal "depth" of
+                                         "" -> []
+                                         d  -> [("height", d)]
+                                   atr = (atVal "id", words $ atVal "role", w ++ h)
+                               in  return (atVal "fileref", atr)
   let getCaption el = case filterChild (\x -> named "caption" x
                                             || named "textobject" x
                                             || named "alt" x) el of
@@ -649,7 +658,7 @@ getMediaobject e = do
   let (caption, title) = if isNull figTitle
                             then (getCaption e, "")
                             else (return figTitle, "fig:")
-  liftM (image imageUrl title) caption
+  liftM (imageWith attr imageUrl title) caption
 
 getBlocks :: Element -> DB Blocks
 getBlocks e =  mconcat <$> (mapM parseBlock $ elContent e)
@@ -968,7 +977,8 @@ parseInline (Elem e) =
                                Just h -> h
                                _      -> ('#' : attrValue "linkend" e)
              let ils' = if ils == mempty then str href else ils
-             return $ link href "" ils'
+             let attr = (attrValue "id" e, words $ attrValue "role" e, [])
+             return $ linkWith attr href "" ils'
         "foreignphrase" -> emph <$> innerInlines
         "emphasis" -> case attrValue "role" e of
                              "bold"   -> strong <$> innerInlines
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs
index ab49bf0..604bc20 100644
--- a/src/Text/Pandoc/Readers/Docx.hs
+++ b/src/Text/Pandoc/Readers/Docx.hs
@@ -50,8 +50,7 @@ implemented, [-] means partially implemented):
 * Inlines
 
   - [X] Str
-  - [X] Emph (From italics. `underline` currently read as span. In
-        future, it might optionally be emph as well)
+  - [X] Emph (italics and underline both read as Emph)
   - [X] Strong
   - [X] Strikeout
   - [X] Superscript
@@ -62,16 +61,16 @@ implemented, [-] means partially implemented):
   - [X] Code (styled with `VerbatimChar`)
   - [X] Space
   - [X] LineBreak (these are invisible in Word: entered with Shift-Return)
-  - [ ] Math
+  - [X] Math
   - [X] Link (links to an arbitrary bookmark create a span with the target as
         id and "anchor" class)
-  - [-] Image (Links to path in archive. Future option for
-        data-encoded URI likely.)
+  - [X] Image 
   - [X] Note (Footnotes and Endnotes are silently combined.)
 -}
 
 module Text.Pandoc.Readers.Docx
-       ( readDocx
+       ( readDocxWithWarnings
+       , readDocx
        ) where
 
 import Codec.Archive.Zip
@@ -81,7 +80,7 @@ import Text.Pandoc.Builder
 import Text.Pandoc.Walk
 import Text.Pandoc.Readers.Docx.Parse
 import Text.Pandoc.Readers.Docx.Lists
-import Text.Pandoc.Readers.Docx.Reducible
+import Text.Pandoc.Readers.Docx.Combine
 import Text.Pandoc.Shared
 import Text.Pandoc.MediaBag (insertMedia, MediaBag)
 import Data.List (delete, (\\), intersect)
@@ -89,6 +88,7 @@ import Text.TeXMath (writeTeX)
 import Data.Default (Default)
 import qualified Data.ByteString.Lazy as B
 import qualified Data.Map as M
+import qualified Data.Set as Set
 import Control.Monad.Reader
 import Control.Monad.State
 import Data.Sequence (ViewL(..), viewl)
@@ -97,14 +97,22 @@ import qualified Data.Sequence as Seq (null)
 import Text.Pandoc.Error
 import Text.Pandoc.Compat.Except
 
+readDocxWithWarnings :: ReaderOptions
+                     -> B.ByteString
+                     -> Either PandocError (Pandoc, MediaBag, [String])
+readDocxWithWarnings opts bytes =
+  case archiveToDocxWithWarnings (toArchive bytes) of
+    Right (docx, warnings) -> do
+      (meta, blks, mediaBag) <- docxToOutput opts docx
+      return (Pandoc meta blks, mediaBag, warnings)
+    Left _   -> Left (ParseFailure "couldn't parse docx file")
+
 readDocx :: ReaderOptions
          -> B.ByteString
          -> Either PandocError (Pandoc, MediaBag)
-readDocx opts bytes =
-  case archiveToDocx (toArchive bytes) of
-    Right docx -> (\(meta, blks, mediaBag) -> (Pandoc meta blks, mediaBag))
-                    <$> (docxToOutput opts docx)
-    Left _   -> Left (ParseFailure "couldn't parse docx file")
+readDocx opts bytes = do
+  (pandoc, mediaBag, _) <- readDocxWithWarnings opts bytes
+  return (pandoc, mediaBag)
 
 data DState = DState { docxAnchorMap :: M.Map String String
                      , docxMediaBag      :: MediaBag
@@ -166,7 +174,7 @@ bodyPartsToMeta' (bp : bps)
   | (Paragraph pPr parParts) <- bp
   , (c : _)<- intersect (pStyle pPr) (M.keys metaStyles)
   , (Just metaField) <- M.lookup c metaStyles = do
-    inlines <- concatReduce <$> mapM parPartToInlines parParts
+    inlines <- smushInlines <$> mapM parPartToInlines parParts
     remaining <- bodyPartsToMeta' bps
     let
       f (MetaInlines ils) (MetaInlines ils') = MetaBlocks [Para ils, Para ils']
@@ -290,37 +298,44 @@ runToInlines (Run rs runElems)
      Just SubScrpt -> subscript codeString
      _             -> codeString
   | otherwise = do
-    let ils = concatReduce (map runElemToInlines runElems)
+    let ils = smushInlines (map runElemToInlines runElems)
     return $ (runStyleToTransform $ resolveDependentRunStyle rs) ils
 runToInlines (Footnote bps) = do
-  blksList <- concatReduce <$> (mapM bodyPartToBlocks bps)
+  blksList <- smushBlocks <$> (mapM bodyPartToBlocks bps)
   return $ note blksList
 runToInlines (Endnote bps) = do
-  blksList <- concatReduce <$> (mapM bodyPartToBlocks bps)
+  blksList <- smushBlocks <$> (mapM bodyPartToBlocks bps)
   return $ note blksList
-runToInlines (InlineDrawing fp bs) = do
+runToInlines (InlineDrawing fp bs ext) = do
   mediaBag <- gets docxMediaBag
   modify $ \s -> s { docxMediaBag = insertMedia fp Nothing bs mediaBag }
-  return $ image fp "" ""
+  return $ imageWith (extentToAttr ext) fp "" ""
+
+extentToAttr :: Extent -> Attr
+extentToAttr (Just (w, h)) =
+  ("", [], [("width", showDim w), ("height", showDim h)] )
+  where
+    showDim d = show (d / 914400) ++ "in"
+extentToAttr _ = nullAttr
 
 parPartToInlines :: ParPart -> DocxContext Inlines
 parPartToInlines (PlainRun r) = runToInlines r
 parPartToInlines (Insertion _ author date runs) = do
   opts <- asks docxOptions
   case readerTrackChanges opts of
-    AcceptChanges -> concatReduce <$> mapM runToInlines runs
+    AcceptChanges -> smushInlines <$> mapM runToInlines runs
     RejectChanges -> return mempty
     AllChanges    -> do
-      ils <- concatReduce <$> mapM runToInlines runs
+      ils <- smushInlines <$> mapM runToInlines runs
       let attr = ("", ["insertion"], [("author", author), ("date", date)])
       return $ spanWith attr ils
 parPartToInlines (Deletion _ author date runs) = do
   opts <- asks docxOptions
   case readerTrackChanges opts of
     AcceptChanges -> return mempty
-    RejectChanges -> concatReduce <$> mapM runToInlines runs
+    RejectChanges -> smushInlines <$> mapM runToInlines runs
     AllChanges    -> do
-      ils <- concatReduce <$> mapM runToInlines runs
+      ils <- smushInlines <$> mapM runToInlines runs
       let attr = ("", ["deletion"], [("author", author), ("date", date)])
       return $ spanWith attr ils
 parPartToInlines (BookMark _ anchor) | anchor `elem` dummyAnchors =
@@ -343,20 +358,20 @@ parPartToInlines (BookMark _ anchor) =
     -- avoid an extra pass.
     let newAnchor =
           if not inHdrBool && anchor `elem` (M.elems anchorMap)
-          then uniqueIdent [Str anchor] (M.elems anchorMap)
+          then uniqueIdent [Str anchor] (Set.fromList $ M.elems anchorMap)
           else anchor
     unless inHdrBool
       (modify $ \s -> s { docxAnchorMap = M.insert anchor newAnchor anchorMap})
     return $ spanWith (newAnchor, ["anchor"], []) mempty
-parPartToInlines (Drawing fp bs) = do
+parPartToInlines (Drawing fp bs ext) = do
   mediaBag <- gets docxMediaBag
   modify $ \s -> s { docxMediaBag = insertMedia fp Nothing bs mediaBag }
-  return $ image fp "" ""
+  return $ imageWith (extentToAttr ext) fp "" ""
 parPartToInlines (InternalHyperLink anchor runs) = do
-  ils <- concatReduce <$> mapM runToInlines runs
+  ils <- smushInlines <$> mapM runToInlines runs
   return $ link ('#' : anchor) "" ils
 parPartToInlines (ExternalHyperLink target runs) = do
-  ils <- concatReduce <$> mapM runToInlines runs
+  ils <- smushInlines <$> mapM runToInlines runs
   return $ link target "" ils
 parPartToInlines (PlainOMath exps) = do
   return $ math $ writeTeX exps
@@ -386,7 +401,7 @@ makeHeaderAnchor' (Header n (_, classes, kvs) ils)
   | (c:cs) <- filter isAnchorSpan ils
   , (Span (ident, ["anchor"], _) _) <- c = do
     hdrIDMap <- gets docxAnchorMap
-    let newIdent = uniqueIdent ils (M.elems hdrIDMap)
+    let newIdent = uniqueIdent ils (Set.fromList $ M.elems hdrIDMap)
     modify $ \s -> s {docxAnchorMap = M.insert ident newIdent hdrIDMap}
     return $ Header n (newIdent, classes, kvs) (ils \\ (c:cs))
 -- Otherwise we just give it a name, and register that name (associate
@@ -394,7 +409,7 @@ makeHeaderAnchor' (Header n (_, classes, kvs) ils)
 makeHeaderAnchor' (Header n (_, classes, kvs) ils) =
   do
     hdrIDMap <- gets docxAnchorMap
-    let newIdent = uniqueIdent ils (M.elems hdrIDMap)
+    let newIdent = uniqueIdent ils (Set.fromList $ M.elems hdrIDMap)
     modify $ \s -> s {docxAnchorMap = M.insert newIdent newIdent hdrIDMap}
     return $ Header n (newIdent, classes, kvs) ils
 makeHeaderAnchor' blk = return blk
@@ -409,7 +424,7 @@ singleParaToPlain blks = blks
 
 cellToBlocks :: Cell -> DocxContext Blocks
 cellToBlocks (Cell bps) = do
-  blks <- concatReduce <$> mapM bodyPartToBlocks bps
+  blks <- smushBlocks <$> mapM bodyPartToBlocks bps
   return $ fromList $ blocksToDefinitions $ blocksToBullets $ toList blks
 
 rowToBlocksList :: Row -> DocxContext [Blocks]
@@ -471,11 +486,11 @@ bodyPartToBlocks (Paragraph pPr parparts)
     $ concatMap parPartToString parparts
   | Just (style, n) <- pHeading pPr = do
     ils <- local (\s-> s{docxInHeaderBlock=True}) $
-           (concatReduce <$> mapM parPartToInlines parparts)
+           (smushInlines <$> mapM parPartToInlines parparts)
     makeHeaderAnchor $
       headerWith ("", delete style (pStyle pPr), []) n ils
   | otherwise = do
-    ils <- concatReduce <$> mapM parPartToInlines parparts >>=
+    ils <- smushInlines <$> mapM parPartToInlines parparts >>=
            (return . fromList . trimLineBreaks . normalizeSpaces . toList)
     dropIls <- gets docxDropCap
     let ils' = dropIls <> ils
@@ -486,7 +501,7 @@ bodyPartToBlocks (Paragraph pPr parparts)
               return $ case isNull ils' of
                 True -> mempty
                 _ -> parStyleToTransform pPr $ para ils'
-bodyPartToBlocks (ListItem pPr numId lvl levelInfo parparts) = do
+bodyPartToBlocks (ListItem pPr numId lvl (Just levelInfo) parparts) = do
   let
     kvs = case levelInfo of
       (_, fmt, txt, Just start) -> [ ("level", lvl)
@@ -503,6 +518,10 @@ bodyPartToBlocks (ListItem pPr numId lvl levelInfo parparts) = do
                                    ]
   blks <- bodyPartToBlocks (Paragraph pPr parparts)
   return $ divWith ("", ["list-item"], kvs) blks
+bodyPartToBlocks (ListItem pPr _ _ _ parparts) = 
+  let pPr' = pPr {pStyle = "ListParagraph": (pStyle pPr)}
+  in
+    bodyPartToBlocks $ Paragraph pPr' parparts
 bodyPartToBlocks (Tbl _ _ _ []) =
   return $ para mempty
 bodyPartToBlocks (Tbl cap _ look (r:rs)) = do
@@ -535,10 +554,10 @@ bodyPartToBlocks (OMathPara e) = do
 
 -- replace targets with generated anchors.
 rewriteLink' :: Inline -> DocxContext Inline
-rewriteLink' l@(Link ils ('#':target, title)) = do
+rewriteLink' l@(Link attr ils ('#':target, title)) = do
   anchorMap <- gets docxAnchorMap
   return $ case M.lookup target anchorMap of
-    Just newTarget -> (Link ils ('#':newTarget, title))
+    Just newTarget -> (Link attr ils ('#':newTarget, title))
     Nothing        -> l
 rewriteLink' il = return il
 
@@ -549,7 +568,7 @@ bodyToOutput :: Body -> DocxContext (Meta, [Block], MediaBag)
 bodyToOutput (Body bps) = do
   let (metabps, blkbps) = sepBodyParts bps
   meta <- bodyPartsToMeta metabps
-  blks <- concatReduce <$> mapM bodyPartToBlocks blkbps
+  blks <- smushBlocks <$> mapM bodyPartToBlocks blkbps
   blks' <- rewriteLinks $ blocksToDefinitions $ blocksToBullets $ toList blks
   mediaBag <- gets docxMediaBag
   return $ (meta,
diff --git a/src/Text/Pandoc/Readers/Docx/Combine.hs b/src/Text/Pandoc/Readers/Docx/Combine.hs
new file mode 100644
index 0000000..39e0df8
--- /dev/null
+++ b/src/Text/Pandoc/Readers/Docx/Combine.hs
@@ -0,0 +1,154 @@
+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances,
+    PatternGuards #-}
+
+module Text.Pandoc.Readers.Docx.Combine ( smushInlines
+                                        , smushBlocks
+                                        )
+       where
+
+import Text.Pandoc.Builder
+import Data.List
+import Data.Sequence (ViewR(..), ViewL(..), viewl, viewr, (><), (|>))
+import qualified Data.Sequence as Seq (null)
+
+data Modifier a = Modifier (a -> a)
+                | AttrModifier (Attr -> a -> a) Attr
+                | NullModifier
+
+spaceOutInlinesL :: Inlines -> (Inlines, Inlines)
+spaceOutInlinesL ms = (l, stackInlines fs (m' <> r))
+  where (l, m, r) = spaceOutInlines ms
+        (fs, m')  = unstackInlines m
+
+spaceOutInlinesR :: Inlines -> (Inlines, Inlines)
+spaceOutInlinesR ms = (stackInlines fs (l <> m'), r)
+  where (l, m, r) = spaceOutInlines ms
+        (fs, m')  = unstackInlines m
+
+spaceOutInlines :: Inlines -> (Inlines, Inlines, Inlines)
+spaceOutInlines ils =
+  let (fs, ils') = unstackInlines ils
+      contents = unMany ils'
+      left  = case viewl contents of
+        (Space :< _) -> space
+        _            -> mempty
+      right = case viewr contents of
+        (_ :> Space) -> space
+        _            -> mempty in
+  (left, (stackInlines fs $ trimInlines . Many $ contents), right)
+
+stackInlines :: [Modifier Inlines] -> Inlines -> Inlines
+stackInlines [] ms = ms
+stackInlines (NullModifier : fs) ms = stackInlines fs ms
+stackInlines ((Modifier f) : fs) ms =
+  if isEmpty ms
+  then stackInlines fs ms
+  else f $ stackInlines fs ms
+stackInlines ((AttrModifier f attr) : fs) ms = f attr $ stackInlines fs ms
+
+unstackInlines :: Inlines -> ([Modifier Inlines], Inlines)
+unstackInlines ms = case ilModifier ms of
+  NullModifier -> ([], ms)
+  _            -> (f : fs, ms') where
+    f = ilModifier ms
+    (fs, ms') = unstackInlines $ ilInnards ms
+
+ilModifier :: Inlines -> Modifier Inlines
+ilModifier ils = case viewl (unMany ils) of
+  (x :< xs) | Seq.null xs -> case x of
+    (Emph _)        -> Modifier emph
+    (Strong _)      -> Modifier strong
+    (SmallCaps _)   -> Modifier smallcaps
+    (Strikeout _)   -> Modifier strikeout
+    (Superscript _) -> Modifier superscript
+    (Subscript _)   -> Modifier subscript
+    (Link attr _ tgt) -> Modifier $ linkWith attr (fst tgt) (snd tgt)
+    (Span attr _)   -> AttrModifier spanWith attr
+    _               -> NullModifier
+  _ -> NullModifier
+
+ilInnards :: Inlines -> Inlines
+ilInnards ils = case viewl (unMany ils) of
+  (x :< xs) | Seq.null xs -> case x of
+    (Emph lst)        -> fromList lst
+    (Strong lst)      -> fromList lst
+    (SmallCaps lst)   -> fromList lst
+    (Strikeout lst)   -> fromList lst
+    (Superscript lst) -> fromList lst
+    (Subscript lst)   -> fromList lst
+    (Link _ lst _)    -> fromList lst
+    (Span _ lst)      -> fromList lst
+    _        -> ils
+  _          -> ils
+
+inlinesL :: Inlines -> (Inlines, Inlines)
+inlinesL ils = case viewl $ unMany ils of
+  (s :< sq) -> (singleton s, Many sq)
+  _          -> (mempty, ils)
+
+inlinesR :: Inlines -> (Inlines, Inlines)
+inlinesR ils = case viewr $ unMany ils of
+  (sq :> s) -> (Many sq, singleton s)
+  _          -> (ils, mempty)
+
+combineInlines :: Inlines -> Inlines -> Inlines
+combineInlines x y =
+  let (xs', x') = inlinesR x
+      (y', ys') = inlinesL y
+  in
+   xs' <> (combineSingletonInlines x' y') <> ys'
+
+combineSingletonInlines :: Inlines -> Inlines -> Inlines
+combineSingletonInlines x y =
+  let (xfs, xs) = unstackInlines x
+      (yfs, ys) = unstackInlines y
+      shared = xfs `intersect` yfs
+      x_remaining = xfs \\ shared
+      y_remaining = yfs \\ shared
+      x_rem_attr = filter isAttrModifier x_remaining
+      y_rem_attr = filter isAttrModifier y_remaining
+  in
+   case null shared of
+     True | isEmpty xs && isEmpty ys ->
+            stackInlines (x_rem_attr ++ y_rem_attr) mempty
+          | isEmpty xs ->
+            let (sp, y') = spaceOutInlinesL y in
+            (stackInlines x_rem_attr mempty) <> sp <> y'
+          | isEmpty ys ->
+            let (x', sp) = spaceOutInlinesR x in
+            x' <> sp <> (stackInlines y_rem_attr mempty)
+          | otherwise ->
+              let (x', xsp) = spaceOutInlinesR x
+                  (ysp, y') = spaceOutInlinesL y
+              in
+               x' <> xsp <> ysp <> y'
+     False -> stackInlines shared $
+              combineInlines
+              (stackInlines x_remaining xs)
+              (stackInlines y_remaining ys)
+
+combineBlocks :: Blocks -> Blocks -> Blocks
+combineBlocks bs cs
+  | bs' :> (BlockQuote bs'') <- viewr (unMany bs)
+  , (BlockQuote cs'') :< cs' <- viewl (unMany cs) =
+      Many $ (bs' |> (BlockQuote (bs'' <> cs''))) >< cs'
+combineBlocks bs cs = bs <> cs
+
+instance (Monoid a, Eq a) => Eq (Modifier a) where
+  (Modifier f) == (Modifier g) = (f mempty == g mempty)
+  (AttrModifier f attr) == (AttrModifier g attr') = (f attr mempty == g attr' mempty)
+  (NullModifier) == (NullModifier) = True
+  _ == _ = False
+
+isEmpty :: (Monoid a, Eq a) => a -> Bool
+isEmpty x = x == mempty
+
+isAttrModifier :: Modifier a -> Bool
+isAttrModifier (AttrModifier _ _) = True
+isAttrModifier _                  = False
+
+smushInlines :: [Inlines] -> Inlines
+smushInlines xs = foldl combineInlines mempty xs
+
+smushBlocks :: [Blocks] -> Blocks
+smushBlocks xs = foldl combineBlocks mempty xs
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs
index 432965d..3644839 100644
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -35,6 +35,7 @@ module Text.Pandoc.Readers.Docx.Parse ( Docx(..)
                                       , Body(..)
                                       , BodyPart(..)
                                       , TblLook(..)
+                                      , Extent
                                       , ParPart(..)
                                       , Run(..)
                                       , RunElem(..)
@@ -49,6 +50,7 @@ module Text.Pandoc.Readers.Docx.Parse ( Docx(..)
                                       , Row(..)
                                       , Cell(..)
                                       , archiveToDocx
+                                      , archiveToDocxWithWarnings
                                       ) where
 import Codec.Archive.Zip
 import Text.XML.Light
@@ -59,9 +61,11 @@ import Data.Bits ((.|.))
 import qualified Data.ByteString.Lazy as B
 import qualified Text.Pandoc.UTF8 as UTF8
 import Control.Monad.Reader
+import Control.Monad.State
 import Control.Applicative ((<|>))
 import qualified Data.Map as M
 import Text.Pandoc.Compat.Except
+import Text.Pandoc.Shared (safeRead)
 import Text.TeXMath.Readers.OMML (readOMML)
 import Text.Pandoc.Readers.Docx.Fonts (getUnicode, Font(..))
 import Text.TeXMath (Exp)
@@ -75,19 +79,24 @@ data ReaderEnv = ReaderEnv { envNotes         :: Notes
                            , envFont          :: Maybe Font
                            , envCharStyles    :: CharStyleMap
                            , envParStyles     :: ParStyleMap
+                           , envLocation      :: DocumentLocation
                            }
                deriving Show
 
+data ReaderState = ReaderState { stateWarnings :: [String] }
+                 deriving Show
+                                                  
+
 data DocxError = DocxError | WrongElem
                deriving Show
 
 instance Error DocxError where
   noMsg = WrongElem
 
-type D = ExceptT DocxError (Reader ReaderEnv)
+type D = ExceptT DocxError (ReaderT ReaderEnv (State ReaderState))
 
-runD :: D a -> ReaderEnv -> Either DocxError a
-runD dx re = runReader (runExceptT dx ) re
+runD :: D a -> ReaderEnv -> ReaderState -> (Either DocxError a, ReaderState)
+runD dx re rs = runState (runReaderT (runExceptT dx) re) rs
 
 maybeToD :: Maybe a -> D a
 maybeToD (Just a) = return a
@@ -140,7 +149,10 @@ data AbstractNumb = AbstractNumb String [Level]
 -- (ilvl, format, string, start)
 type Level = (String, String, String, Maybe Integer)
 
-data Relationship = Relationship (RelId, Target)
+data DocumentLocation = InDocument | InFootnote | InEndnote
+                      deriving (Eq,Show)
+
+data Relationship = Relationship DocumentLocation RelId Target
                   deriving Show
 
 data Notes = Notes NameSpaces
@@ -173,7 +185,7 @@ defaultParagraphStyle = ParagraphStyle { pStyle = []
 
 
 data BodyPart = Paragraph ParagraphStyle [ParPart]
-              | ListItem ParagraphStyle String String Level [ParPart]
+              | ListItem ParagraphStyle String String (Maybe Level) [ParPart]
               | Tbl String TblGrid TblLook [Row]
               | OMathPara [Exp]
               deriving Show
@@ -192,20 +204,23 @@ data Row = Row [Cell]
 data Cell = Cell [BodyPart]
             deriving Show
 
+-- (width, height) in EMUs
+type Extent = Maybe (Double, Double)
+
 data ParPart = PlainRun Run
              | Insertion ChangeId Author ChangeDate [Run]
              | Deletion ChangeId Author ChangeDate [Run]
              | BookMark BookMarkId Anchor
              | InternalHyperLink Anchor [Run]
              | ExternalHyperLink URL [Run]
-             | Drawing FilePath B.ByteString
+             | Drawing FilePath B.ByteString Extent
              | PlainOMath [Exp]
              deriving Show
 
 data Run = Run RunStyle [RunElem]
          | Footnote [BodyPart]
          | Endnote [BodyPart]
-         | InlineDrawing FilePath B.ByteString
+         | InlineDrawing FilePath B.ByteString Extent
            deriving Show
 
 data RunElem = TextRun String | LnBrk | Tab | SoftHyphen | NoBreakHyphen
@@ -238,7 +253,6 @@ defaultRunStyle = RunStyle { isBold = Nothing
                            , rUnderline = Nothing
                            , rStyle = Nothing}
 
-
 type Target = String
 type Anchor = String
 type URL = String
@@ -249,15 +263,23 @@ type Author = String
 type ChangeDate = String
 
 archiveToDocx :: Archive -> Either DocxError Docx
-archiveToDocx archive = do
+archiveToDocx archive = fst <$> archiveToDocxWithWarnings archive
+
+archiveToDocxWithWarnings :: Archive -> Either DocxError (Docx, [String])
+archiveToDocxWithWarnings archive = do
   let notes     = archiveToNotes archive
       numbering = archiveToNumbering archive
       rels      = archiveToRelationships archive
       media     = archiveToMedia archive
       (styles, parstyles) = archiveToStyles archive
-      rEnv = ReaderEnv notes numbering rels media Nothing styles parstyles
-  doc <- runD (archiveToDocument archive) rEnv
-  return $ Docx doc
+      rEnv =
+        ReaderEnv notes numbering rels media Nothing styles parstyles InDocument
+      rState = ReaderState { stateWarnings = [] }
+      (eitherDoc, st) = runD (archiveToDocument archive) rEnv rState
+  case eitherDoc of
+    Right doc -> Right (Docx doc, stateWarnings st)
+    Left e    -> Left e
+
 
 
 archiveToDocument :: Archive -> D Document
@@ -362,29 +384,30 @@ archiveToNotes zf =
   in
    Notes ns fn en
 
-filePathIsRel :: FilePath -> Bool
-filePathIsRel fp =
-  let (dir, name) = splitFileName fp
-  in
-   (dir == "word/_rels/") && ((takeExtension name) == ".rels")
+filePathToRelType :: FilePath -> Maybe DocumentLocation
+filePathToRelType "word/_rels/document.xml.rels" = Just InDocument
+filePathToRelType "word/_rels/footnotes.xml.rels" = Just InFootnote
+filePathToRelType "word/_rels/endnotes.xml.rels" = Just InEndnote
+filePathToRelType _ = Nothing
 
-relElemToRelationship :: Element -> Maybe Relationship
-relElemToRelationship element | qName (elName element) == "Relationship" =
+relElemToRelationship :: DocumentLocation -> Element -> Maybe Relationship
+relElemToRelationship relType element | qName (elName element) == "Relationship" =
   do
     relId <- findAttr (QName "Id" Nothing Nothing) element
     target <- findAttr (QName "Target" Nothing Nothing) element
-    return $ Relationship (relId, target)
-relElemToRelationship _ = Nothing
-
-
+    return $ Relationship relType relId target
+relElemToRelationship _ _ = Nothing
+
+filePathToRelationships :: Archive -> FilePath -> [Relationship]
+filePathToRelationships ar fp | Just relType <- filePathToRelType fp
+                              , Just entry <- findEntryByPath fp ar
+                              , Just relElems <- (parseXMLDoc . UTF8.toStringLazy . fromEntry) entry =
+  mapMaybe (relElemToRelationship relType) $ elChildren relElems
+filePathToRelationships _ _ = []
+                               
 archiveToRelationships :: Archive -> [Relationship]
 archiveToRelationships archive =
-  let relPaths = filter filePathIsRel (filesInArchive archive)
-      entries  = mapMaybe (\f -> findEntryByPath f archive) relPaths
-      relElems = mapMaybe (parseXMLDoc . UTF8.toStringLazy . fromEntry) entries
-      rels =     mapMaybe relElemToRelationship $ concatMap elChildren relElems
-  in
-   rels
+  concatMap (filePathToRelationships archive) $ filesInArchive archive
 
 filePathIsMedia :: FilePath -> Bool
 filePathIsMedia fp =
@@ -409,6 +432,7 @@ lookupLevel numId ilvl (Numbering _ numbs absNumbs) = do
   lvl  <- lookup ilvl $ map (\l@(i, _, _, _) -> (i, l)) lvls
   return lvl
 
+
 numElemToNum :: NameSpaces -> Element -> Maybe Numb
 numElemToNum ns element |
   qName (elName element) == "num" &&
@@ -558,23 +582,21 @@ elemToBodyPart ns element
     let parstyle = elemToParagraphStyle ns element sty
     parparts <- mapD (elemToParPart ns) (elChildren element)
     num <- asks envNumbering
-    case lookupLevel numId lvl num of
-     Just levelInfo -> return $ ListItem parstyle numId lvl levelInfo parparts
-     Nothing        -> throwError WrongElem
+    let levelInfo = lookupLevel numId lvl num
+    return $ ListItem parstyle numId lvl levelInfo parparts
 elemToBodyPart ns element
   | isElem ns "w" "p" element = do
       sty <- asks envParStyles
       let parstyle = elemToParagraphStyle ns element sty
       parparts <- mapD (elemToParPart ns) (elChildren element)
-      case pNumInfo parstyle of
-       Just (numId, lvl) -> do
-         num <- asks envNumbering
-         case lookupLevel numId lvl num of
-          Just levelInfo ->
-            return $ ListItem parstyle numId lvl levelInfo parparts
-          Nothing         ->
-            throwError WrongElem
-       Nothing -> return $ Paragraph parstyle parparts
+      -- 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
+                    num <- asks envNumbering
+                    let levelInfo = lookupLevel numId lvl num
+                    return $ ListItem parstyle numId lvl levelInfo parparts
+        _ -> return $ Paragraph parstyle parparts
 elemToBodyPart ns element
   | isElem ns "w" "tbl" element = do
     let caption' = findChild (elemName ns "w" "tblPr") element
@@ -596,13 +618,16 @@ elemToBodyPart ns element
     return $ Tbl caption grid tblLook rows
 elemToBodyPart _ _ = throwError WrongElem
 
-lookupRelationship :: RelId -> [Relationship] -> Maybe Target
-lookupRelationship relid rels =
-  lookup relid (map (\(Relationship pair) -> pair) rels)
+lookupRelationship :: DocumentLocation -> RelId -> [Relationship] -> Maybe Target
+lookupRelationship docLocation relid rels =
+  lookup (docLocation, relid) pairs
+  where
+    pairs = map (\(Relationship loc relid' target) -> ((loc, relid'), target)) rels
 
 expandDrawingId :: String -> D (FilePath, B.ByteString)
 expandDrawingId s = do
-  target <- asks (lookupRelationship s . envRelationships)
+  location <- asks envLocation
+  target <- asks (lookupRelationship location s . envRelationships)
   case target of
     Just filepath -> do
       bytes <- asks (lookup ("word/" ++ filepath) . envMedia)
@@ -614,13 +639,13 @@ expandDrawingId s = do
 elemToParPart :: NameSpaces -> Element -> D ParPart
 elemToParPart ns element
   | isElem ns "w" "r" element
-  , Just _ <- findChild (elemName ns "w" "drawing") element =
+  , Just drawingElem <- findChild (elemName ns "w" "drawing") element =
     let a_ns = "http://schemas.openxmlformats.org/drawingml/2006/main"
         drawing = findElement (QName "blip" (Just a_ns) (Just "a")) element
                   >>= findAttr (QName "embed" (lookup "r" ns) (Just "r"))
     in
      case drawing of
-       Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp bs)
+       Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp bs $ elemToExtent drawingElem)
        Nothing -> throwError WrongElem
 -- The below is an attempt to deal with images in deprecated vml format.
 elemToParPart ns element
@@ -630,7 +655,7 @@ elemToParPart ns element
                   >>= findAttr (elemName ns "r" "id")
     in
      case drawing of
-       Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp bs)
+       Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp bs Nothing)
        Nothing -> throwError WrongElem
 elemToParPart ns element
   | isElem ns "w" "r" element =
@@ -657,9 +682,10 @@ elemToParPart ns element
 elemToParPart ns element
   | isElem ns "w" "hyperlink" element
   , Just relId <- findAttr (elemName ns "r" "id") element = do
+    location <- asks envLocation
     runs <- mapD (elemToRun ns) (elChildren element)
     rels <- asks envRelationships
-    case lookupRelationship relId rels of
+    case lookupRelationship location relId rels of
       Just target -> do
          case findAttr (elemName ns "w" "anchor") element of
              Just anchor -> return $ ExternalHyperLink (target ++ '#':anchor) runs
@@ -681,36 +707,68 @@ lookupFootnote s (Notes _ fns _) = fns >>= (M.lookup s)
 lookupEndnote :: String -> Notes -> Maybe Element
 lookupEndnote s (Notes _ _ ens) = ens >>= (M.lookup s)
 
-elemToRun :: NameSpaces -> Element -> D Run
-elemToRun ns element
-  | isElem ns "w" "r" element
-  , Just drawingElem <- findChild (elemName ns "w" "drawing") element =
+elemToExtent :: Element -> Extent
+elemToExtent drawingElem =
+  case (getDim "cx", getDim "cy") of
+    (Just w, Just h) -> Just (w, h)
+    _ -> Nothing
+    where
+      wp_ns  = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
+      getDim at = findElement (QName "extent" (Just wp_ns) (Just "wp")) drawingElem
+                    >>= findAttr (QName at Nothing Nothing) >>= safeRead
+
+
+childElemToRun :: NameSpaces -> Element -> D Run
+childElemToRun ns element
+  | isElem ns "w" "drawing" element =
     let a_ns = "http://schemas.openxmlformats.org/drawingml/2006/main"
-        drawing = findElement (QName "blip" (Just a_ns) (Just "a")) drawingElem
+        drawing = findElement (QName "blip" (Just a_ns) (Just "a")) element
                   >>= findAttr (QName "embed" (lookup "r" ns) (Just "r"))
     in
      case drawing of
        Just s -> expandDrawingId s >>=
-                 (\(fp, bs) -> return $ InlineDrawing fp bs)
+                 (\(fp, bs) -> return $ InlineDrawing fp bs $ elemToExtent element)
        Nothing -> throwError WrongElem
-elemToRun ns element
-  | isElem ns "w" "r" element
-  , Just ref <- findChild (elemName ns "w" "footnoteReference") element
-  , Just fnId <- findAttr (elemName ns "w" "id") ref = do
+childElemToRun ns element
+  | isElem ns "w" "footnoteReference" element
+  , Just fnId <- findAttr (elemName ns "w" "id") element = do
     notes <- asks envNotes
     case lookupFootnote fnId notes of
-      Just e -> do bps <- mapD (elemToBodyPart ns) (elChildren e)
+      Just e -> do bps <- local (\r -> r {envLocation=InFootnote}) $ mapD (elemToBodyPart ns) (elChildren e)
                    return $ Footnote bps
       Nothing  -> return $ Footnote []
-elemToRun ns element
-  | isElem ns "w" "r" element
-  , Just ref <- findChild (elemName ns "w" "endnoteReference") element
-  , Just enId <- findAttr (elemName ns "w" "id") ref = do
+childElemToRun ns element
+  | isElem ns "w" "endnoteReference" element
+  , Just enId <- findAttr (elemName ns "w" "id") element = do
     notes <- asks envNotes
     case lookupEndnote enId notes of
-      Just e -> do bps <- mapD (elemToBodyPart ns) (elChildren e)
+      Just e -> do bps <- local (\r -> r {envLocation=InEndnote}) $ mapD (elemToBodyPart ns) (elChildren e)
                    return $ Endnote bps
       Nothing  -> return $ Endnote []
+childElemToRun _ _ = throwError WrongElem
+
+elemToRun :: NameSpaces -> Element -> D Run
+elemToRun ns element
+  | isElem ns "w" "r" element
+  , Just altCont <- findChild (elemName ns "mc" "AlternateContent") element =
+    do let choices = findChildren (elemName ns "mc" "Choice") altCont
+           choiceChildren = map head $ filter (not . null) $ map elChildren choices
+       outputs <- mapD (childElemToRun ns) choiceChildren
+       case outputs of
+         r : _ -> return r
+         []    -> throwError WrongElem
+elemToRun ns element
+  | isElem ns "w" "r" element
+  , Just drawingElem <- findChild (elemName ns "w" "drawing") element =
+    childElemToRun ns drawingElem
+elemToRun ns element
+  | isElem ns "w" "r" element
+  , Just ref <- findChild (elemName ns "w" "footnoteReference") element =
+    childElemToRun ns ref
+elemToRun ns element
+  | isElem ns "w" "r" element
+  , Just ref <- findChild (elemName ns "w" "endnoteReference") element =
+    childElemToRun ns ref
 elemToRun ns element
   | isElem ns "w" "r" element = do
     runElems <- elemToRunElems ns element
@@ -919,3 +977,4 @@ elemToRunElems _ _ = throwError WrongElem
 
 setFont :: Maybe Font -> ReaderEnv -> ReaderEnv
 setFont f s = s{envFont = f}
+
diff --git a/src/Text/Pandoc/Readers/Docx/Reducible.hs b/src/Text/Pandoc/Readers/Docx/Reducible.hs
deleted file mode 100644
index c93b401..0000000
--- a/src/Text/Pandoc/Readers/Docx/Reducible.hs
+++ /dev/null
@@ -1,181 +0,0 @@
-{-# LANGUAGE TypeSynonymInstances, FlexibleInstances,
-    PatternGuards #-}
-
-module Text.Pandoc.Readers.Docx.Reducible ( concatReduce
-                                          , (<+>)
-                                          )
-       where
-
-
-import Text.Pandoc.Builder
-import Data.List
-import Data.Sequence (ViewR(..), ViewL(..), viewl, viewr)
-import qualified Data.Sequence as Seq (null)
-
-data Modifier a = Modifier (a -> a)
-                | AttrModifier (Attr -> a -> a) Attr
-                | NullModifier
-
-class (Eq a) => Modifiable a where
-  modifier :: a -> Modifier a
-  innards :: a -> a
-  getL    :: a -> (a, a)
-  getR    :: a -> (a, a)
-  spaceOut :: a -> (a, a, a)
-
-spaceOutL :: (Monoid a, Modifiable a) => a -> (a, a)
-spaceOutL ms = (l, stack fs (m' <> r))
-  where (l, m, r) = spaceOut ms
-        (fs, m')  = unstack m
-
-spaceOutR :: (Monoid a, Modifiable a) => a -> (a, a)
-spaceOutR ms = (stack fs (l <> m'), r)
-  where (l, m, r) = spaceOut ms
-        (fs, m')  = unstack m
-
-instance (Monoid a, Show a) => Show (Modifier a) where
-  show (Modifier f) = show $ f mempty
-  show (AttrModifier f attr) = show $ f attr mempty
-  show (NullModifier) = "NullModifier"
-
-instance (Monoid a, Eq a) => Eq (Modifier a) where
-  (Modifier f) == (Modifier g) = (f mempty == g mempty)
-  (AttrModifier f attr) == (AttrModifier g attr') = (f attr mempty == g attr' mempty)
-  (NullModifier) == (NullModifier) = True
-  _ == _ = False
-
-instance Modifiable Inlines where
-  modifier ils = case viewl (unMany ils) of
-    (x :< xs) | Seq.null xs -> case x of
-      (Emph _)        -> Modifier emph
-      (Strong _)      -> Modifier strong
-      (SmallCaps _)   -> Modifier smallcaps
-      (Strikeout _)   -> Modifier strikeout
-      (Superscript _) -> Modifier superscript
-      (Subscript _)   -> Modifier subscript
-      (Span attr _)   -> AttrModifier spanWith attr
-      _               -> NullModifier
-    _ -> NullModifier
-
-  innards ils = case viewl (unMany ils) of
-    (x :< xs) | Seq.null xs -> case x of
-      (Emph lst)        -> fromList lst
-      (Strong lst)      -> fromList lst
-      (SmallCaps lst)   -> fromList lst
-      (Strikeout lst)   -> fromList lst
-      (Superscript lst) -> fromList lst
-      (Subscript lst)   -> fromList lst
-      (Span _ lst)      -> fromList lst
-      _        -> ils
-    _          -> ils
-
-  getL ils = case viewl $ unMany ils of
-    (s :< sq) -> (singleton s, Many sq)
-    _          -> (mempty, ils)
-
-  getR ils = case viewr $ unMany ils of
-    (sq :> s) -> (Many sq, singleton s)
-    _          -> (ils, mempty)
-
-  spaceOut ils =
-    let (fs, ils') = unstack ils
-        contents = unMany ils'
-        left  = case viewl contents of
-          (Space :< _) -> space
-          _            -> mempty
-        right = case viewr contents of
-          (_ :> Space) -> space
-          _            -> mempty in
-    (left, (stack fs $ trimInlines .Many $ contents), right)
-
-instance Modifiable Blocks where
-  modifier blks = case viewl (unMany blks) of
-    (x :< xs) | Seq.null xs -> case x of
-      (BlockQuote _) -> Modifier blockQuote
-      -- (Div attr _)   -> AttrModifier divWith attr
-      _               -> NullModifier
-    _ -> NullModifier
-
-  innards blks = case viewl (unMany blks) of
-    (x :< xs) | Seq.null xs -> case x of
-      (BlockQuote lst) -> fromList lst
-      -- (Div attr lst)   -> fromList lst
-      _        -> blks
-    _          -> blks
-
-  spaceOut blks = (mempty, blks, mempty)
-
-  getL ils = case viewl $ unMany ils of
-    (s :< sq) -> (singleton s, Many sq)
-    _          -> (mempty, ils)
-
-  getR ils = case viewr $ unMany ils of
-    (sq :> s) -> (Many sq, singleton s)
-    _          -> (ils, mempty)
-
-
-unstack :: (Modifiable a) => a -> ([Modifier a], a)
-unstack ms = case modifier ms of
-  NullModifier -> ([], ms)
-  _            -> (f : fs, ms') where
-    f = modifier ms
-    (fs, ms') = unstack $ innards ms
-
-stack :: (Monoid a, Modifiable a) => [Modifier a] -> a -> a
-stack [] ms = ms
-stack (NullModifier : fs) ms = stack fs ms
-stack ((Modifier f) : fs) ms =
-  if isEmpty ms
-  then stack fs ms
-  else f $ stack fs ms
-stack ((AttrModifier f attr) : fs) ms = f attr $ stack fs ms
-
-isEmpty :: (Monoid a, Eq a) => a -> Bool
-isEmpty x = x == mempty
-
-
-combine :: (Monoid a, Modifiable a, Eq a) => a -> a -> a
-combine x y =
-  let (xs', x') = getR x
-      (y', ys') = getL y
-  in
-   xs' <> (combineSingleton x' y') <> ys'
-
-isAttrModifier :: Modifier a -> Bool
-isAttrModifier (AttrModifier _ _) = True
-isAttrModifier _                  = False
-
-combineSingleton :: (Monoid a, Modifiable a, Eq a) => a -> a -> a
-combineSingleton x y =
-  let (xfs, xs) = unstack x
-      (yfs, ys) = unstack y
-      shared = xfs `intersect` yfs
-      x_remaining = xfs \\ shared
-      y_remaining = yfs \\ shared
-      x_rem_attr = filter isAttrModifier x_remaining
-      y_rem_attr = filter isAttrModifier y_remaining
-  in
-   case null shared of
-     True | isEmpty xs && isEmpty ys ->
-            stack (x_rem_attr ++ y_rem_attr) mempty
-          | isEmpty xs ->
-            let (sp, y') = spaceOutL y in
-            (stack x_rem_attr mempty) <> sp <> y'
-          | isEmpty ys ->
-            let (x', sp) = spaceOutR x in
-            x' <> sp <> (stack y_rem_attr mempty)
-          | otherwise ->
-              let (x', xsp) = spaceOutR x
-                  (ysp, y') = spaceOutL y
-              in
-               x' <> xsp <> ysp <> y'
-     False -> stack shared $
-              combine
-              (stack x_remaining xs)
-              (stack y_remaining ys)
-
-(<+>) :: (Monoid a, Modifiable a, Eq a) => a -> a -> a
-x <+> y = combine x y
-
-concatReduce :: (Monoid a, Modifiable a) => [a] -> a
-concatReduce xs = foldl combine mempty xs
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs
index 2da5e9e..07d2827 100644
--- a/src/Text/Pandoc/Readers/EPUB.hs
+++ b/src/Text/Pandoc/Readers/EPUB.hs
@@ -16,6 +16,7 @@ import Text.Pandoc.Options ( ReaderOptions(..), readerTrace)
 import Text.Pandoc.Shared (escapeURI, collapseFilePath, addMetaField)
 import Text.Pandoc.MediaBag (MediaBag, insertMedia)
 import Text.Pandoc.Compat.Except (MonadError, throwError, runExcept, Except)
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Pandoc.MIME (MimeType)
 import qualified Text.Pandoc.Builder as B
 import Codec.Archive.Zip ( Archive (..), toArchive, fromEntry
@@ -29,7 +30,7 @@ import Control.Monad (guard, liftM, when)
 import Data.List (isPrefixOf, isInfixOf)
 import Data.Maybe (mapMaybe, fromMaybe)
 import qualified Data.Map as M (Map, lookup, fromList, elems)
-import Control.DeepSeq.Generics (deepseq, NFData)
+import Control.DeepSeq (deepseq, NFData)
 
 import Debug.Trace (trace)
 
@@ -99,12 +100,12 @@ fetchImages mimes root arc (query iq -> links) =
           <$> findEntryByPath abslink arc
 
 iq :: Inline -> [FilePath]
-iq (Image _ (url, _)) = [url]
+iq (Image _ _ (url, _)) = [url]
 iq _ = []
 
 -- Remove relative paths
 renameImages :: FilePath -> Inline -> Inline
-renameImages root (Image a (url, b)) = Image a (collapseFilePath (root </> url), b)
+renameImages root (Image attr a (url, b)) = Image attr a (collapseFilePath (root </> url), b)
 renameImages _ x = x
 
 imageToPandoc :: FilePath -> Pandoc
@@ -189,14 +190,14 @@ fixInlineIRs s (Span as v) =
   Span (fixAttrs s as) v
 fixInlineIRs s (Code as code) =
   Code (fixAttrs s as) code
-fixInlineIRs s (Link t ('#':url, tit)) =
-  Link t (addHash s url, tit)
+fixInlineIRs s (Link attr t ('#':url, tit)) =
+  Link attr t (addHash s url, tit)
 fixInlineIRs _ v = v
 
 prependHash :: [String] -> Inline -> Inline
-prependHash ps l@(Link is (url, tit))
+prependHash ps l@(Link attr is (url, tit))
   | or [s `isPrefixOf` url | s <- ps] =
-    Link is ('#':url, tit)
+    Link attr is ('#':url, tit)
   | otherwise = l
 prependHash _ i = i
 
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 8b66d2d..fb936cf 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -43,7 +43,7 @@ import Text.HTML.TagSoup.Match
 import Text.Pandoc.Definition
 import qualified Text.Pandoc.Builder as B
 import Text.Pandoc.Builder (Blocks, Inlines, trimInlines, HasMeta(..))
-import Text.Pandoc.Shared ( extractSpaces, renderTags'
+import Text.Pandoc.Shared ( extractSpaces, renderTags', addMetaField
                           , escapeURI, safeRead, mapLeft )
 import Text.Pandoc.Options (ReaderOptions(readerParseRaw, readerTrace)
                            , Extension (Ext_epub_html_exts,
@@ -52,9 +52,9 @@ import Text.Pandoc.Parsing hiding ((<|>))
 import Text.Pandoc.Walk
 import qualified Data.Map as M
 import Data.Maybe ( fromMaybe, isJust)
-import Data.List ( intercalate, isInfixOf, isPrefixOf, isSuffixOf )
+import Data.List ( intercalate, isInfixOf, isPrefixOf )
 import Data.Char ( isDigit )
-import Control.Monad ( liftM, guard, when, mzero, void, unless )
+import Control.Monad ( guard, when, mzero, void, unless )
 import Control.Arrow ((***))
 import Control.Applicative ( (<|>) )
 import Data.Monoid (First (..))
@@ -63,12 +63,12 @@ import Debug.Trace (trace)
 import Text.TeXMath (readMathML, writeTeX)
 import Data.Default (Default (..), def)
 import Control.Monad.Reader (Reader,ask, asks, local, runReader)
-import Network.URI (isURI)
+import Network.URI (URI, parseURIReference, nonStrictRelativeTo)
 import Text.Pandoc.Error
 import Text.Pandoc.CSS (foldOrElse, pickStyleAttrProps)
-
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Parsec.Error
-
+import qualified Data.Set as Set
 
 -- | Convert HTML-formatted string to 'Pandoc' document.
 readHtml :: ReaderOptions -- ^ Reader options
@@ -77,7 +77,7 @@ readHtml :: ReaderOptions -- ^ Reader options
 readHtml opts inp =
     mapLeft (ParseFailure . getError) . flip runReader def $
       runParserT parseDoc
-        (HTMLState def{ stateOptions = opts } [] Nothing [] M.empty)
+        (HTMLState def{ stateOptions = opts } [] Nothing Set.empty M.empty)
         "source" tags
     where tags = stripPrefixes . canonicalizeTags $
                    parseTagsOptions parseOptions{ optTagPosition = True } inp
@@ -103,8 +103,8 @@ data HTMLState =
   HTMLState
   {  parserState :: ParserState,
      noteTable   :: [(String, Blocks)],
-     baseHref    :: Maybe String,
-     identifiers :: [String],
+     baseHref    :: Maybe URI,
+     identifiers :: Set.Set String,
      headerMap   :: M.Map Inlines String
   }
 
@@ -137,19 +137,17 @@ pHead = pInTags "head" $ pTitle <|> pMetaTag <|> pBaseTag <|> (mempty <$ pAnyTag
              then return mempty
              else do
                let content = fromAttrib "content" mt
-               updateState $ B.setMeta name (B.text content)
+               updateState $ \s ->
+                 let ps = parserState s in
+                 s{ parserState = ps{
+                      stateMeta = addMetaField name (B.text content)
+                                   (stateMeta ps) } }
                return mempty
         pBaseTag = do
           bt <- pSatisfy (~== TagOpen "base" [])
-          let baseH = fromAttrib "href" bt
-          if null baseH
-             then return mempty
-             else do
-               let baseH' = case reverse baseH of
-                                  '/':_ -> baseH
-                                  _     -> baseH ++ "/"
-               updateState $ \st -> st{ baseHref = Just baseH' }
-               return mempty
+          updateState $ \st -> st{ baseHref =
+               parseURIReference $ fromAttrib "href" bt }
+          return mempty
 
 block :: TagParser Blocks
 block = do
@@ -441,6 +439,7 @@ pTable = try $ do
   -- fail on empty table
   guard $ not $ null head' && null rows
   let isSinglePlain x = case B.toList x of
+                             []        -> True
                              [Plain _] -> True
                              _         -> False
   let isSimple = all isSinglePlain $ concat (head':rows)
@@ -601,40 +600,36 @@ pLineBreak = do
   return B.linebreak
 
 pLink :: TagParser Inlines
-pLink = pRelLink <|> pAnchor
-
-pAnchor :: TagParser Inlines
-pAnchor = try $ do
-  tag <- pSatisfy (tagOpenLit "a" (isJust . lookup "id"))
-  return $ B.spanWith (fromAttrib "id" tag , [], []) mempty
-
-pRelLink :: TagParser Inlines
-pRelLink = try $ do
-  tag <- pSatisfy (tagOpenLit "a" (isJust . lookup "href"))
+pLink = try $ do
+  tag <- pSatisfy $ tagOpenLit "a" (const True)
   mbBaseHref <- baseHref <$> getState
   let url' = fromAttrib "href" tag
-  let url = case (isURI url', mbBaseHref) of
-                 (False, Just h) -> h ++ url'
-                 _               -> url'
+  let url = case (parseURIReference url', mbBaseHref) of
+                 (Just rel, Just bs) -> show (rel `nonStrictRelativeTo` bs)
+                 _                   -> url'
   let title = fromAttrib "title" tag
   let uid = fromAttrib "id" tag
-  let spanC = case uid of
-              [] -> id
-              s  -> B.spanWith (s, [], [])
+  let cls = words $ fromAttrib "class" tag
   lab <- trimInlines . mconcat <$> manyTill inline (pCloses "a")
-  return $ spanC $ B.link (escapeURI url) title lab
+  return $ B.linkWith (uid, cls, []) (escapeURI url) title lab
 
 pImage :: TagParser Inlines
 pImage = do
   tag <- pSelfClosing (=="img") (isJust . lookup "src")
   mbBaseHref <- baseHref <$> getState
   let url' = fromAttrib "src" tag
-  let url = case (isURI url', mbBaseHref) of
-                 (False, Just h) -> h ++ url'
-                 _               -> url'
+  let url = case (parseURIReference url', mbBaseHref) of
+                 (Just rel, Just bs) -> show (rel `nonStrictRelativeTo` bs)
+                 _                   -> url'
   let title = fromAttrib "title" tag
   let alt = fromAttrib "alt" tag
-  return $ B.image (escapeURI url) title (B.text alt)
+  let uid = fromAttrib "id" tag
+  let cls = words $ fromAttrib "class" tag
+  let getAtt k = case fromAttrib k tag of
+                   "" -> []
+                   v  -> [(k, v)]
+  let kvs = concat $ map getAtt ["width", "height", "sizes", "srcset"]
+  return $ B.imageWith (uid, cls, kvs) (escapeURI url) title (B.text alt)
 
 pCode :: TagParser Inlines
 pCode = try $ do
@@ -803,7 +798,10 @@ pBad = do
   return $ B.str [c']
 
 pSpace :: InlinesParser Inlines
-pSpace = many1 (satisfy isSpace) >> return B.space
+pSpace = many1 (satisfy isSpace) >>= \xs ->
+            if '\n' `elem` xs
+               then return B.softbreak
+               else return B.space
 
 --
 -- Constants
@@ -926,14 +924,45 @@ htmlInBalanced :: (Monad m)
                => (Tag String -> Bool)
                -> ParserT String st m String
 htmlInBalanced f = try $ do
-  (TagOpen t _, tag) <- htmlTag f
-  guard $ not $ "/>" `isSuffixOf` tag -- not a self-closing tag
-  let stopper = htmlTag (~== TagClose t)
-  let anytag = snd <$> htmlTag (const True)
-  contents <- many $ notFollowedBy' stopper >>
-                     (htmlInBalanced f <|> anytag <|> count 1 anyChar)
-  endtag <- liftM snd stopper
-  return $ tag ++ concat contents ++ endtag
+  lookAhead (char '<')
+  inp <- getInput
+  let ts = canonicalizeTags $
+        parseTagsOptions parseOptions{ optTagWarning = True,
+                                       optTagPosition = True } inp
+  case ts of
+    (TagPosition sr sc : t@(TagOpen tn _) : rest) -> do
+       guard $ f t
+       guard $ not $ hasTagWarning (t : take 1 rest)
+       case htmlInBalanced' tn (t:rest) of
+            []  -> mzero
+            xs  -> case reverse xs of
+                        (TagClose _ : TagPosition er ec : _) -> do
+                          let ls = er - sr
+                          let cs = ec - sc
+                          lscontents <- unlines <$> count ls anyLine
+                          cscontents <- count cs anyChar
+                          (_,closetag) <- htmlTag (~== TagClose tn)
+                          return (lscontents ++ cscontents ++ closetag)
+                        _ -> mzero
+    _ -> mzero
+
+htmlInBalanced' :: String
+                -> [Tag String]
+                -> [Tag String]
+htmlInBalanced' tagname ts = fromMaybe [] $ go 0 ts
+  where go :: Int -> [Tag String] -> Maybe [Tag String]
+        go n (t@(TagOpen tn' _):rest) | tn' == tagname =
+              (t :) <$> go (n + 1) rest
+        go 1 (t@(TagClose tn'):_) | tn' == tagname =
+              return [t]
+        go n (t@(TagClose tn'):rest)  | tn' == tagname =
+              (t :) <$> go (n - 1) rest
+        go n (t:ts') = (t :) <$> go n ts'
+        go _ [] = mzero
+
+hasTagWarning :: [Tag String] -> Bool
+hasTagWarning (TagWarning _:_) = True
+hasTagWarning _ = False
 
 -- | Matches a tag meeting a certain condition.
 htmlTag :: Monad m
@@ -942,12 +971,11 @@ htmlTag :: Monad m
 htmlTag f = try $ do
   lookAhead (char '<')
   inp <- getInput
-  let hasTagWarning (TagWarning _:_) = True
-      hasTagWarning _ = False
   let (next : rest) = canonicalizeTags $ parseTagsOptions
                        parseOptions{ optTagWarning = True } inp
   guard $ f next
   case next of
+       TagWarning _ -> fail "encountered TagWarning"
        TagComment s
          | "<!--" `isPrefixOf` inp -> do
           count (length s + 4) anyChar
diff --git a/src/Text/Pandoc/Readers/Haddock.hs b/src/Text/Pandoc/Readers/Haddock.hs
index 2b74f5f..16f3d7e 100644
--- a/src/Text/Pandoc/Readers/Haddock.hs
+++ b/src/Text/Pandoc/Readers/Haddock.hs
@@ -16,6 +16,7 @@ module Text.Pandoc.Readers.Haddock
 
 import Text.Pandoc.Builder (Blocks, Inlines)
 import qualified Text.Pandoc.Builder as B
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Pandoc.Shared (trim, splitBy)
 import Data.List (intersperse, stripPrefix)
 import Data.Maybe (fromMaybe)
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 359661c..2be55c9 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -54,6 +54,7 @@ import Data.List (intercalate)
 import qualified Data.Map as M
 import qualified Control.Exception as E
 import Text.Pandoc.Highlighting (fromListingsLanguage)
+import Text.Pandoc.ImageSize (numUnit, showFl)
 import Text.Pandoc.Error
 
 -- | Parse LaTeX from string and return 'Pandoc' document.
@@ -99,8 +100,13 @@ dimenarg = try $ do
   return $ ch ++ num ++ dim
 
 sp :: LP ()
-sp = skipMany1 $ satisfy (\c -> c == ' ' || c == '\t')
-        <|> try (newline <* lookAhead anyChar <* notFollowedBy blankline)
+sp = whitespace <|> endline
+
+whitespace :: LP ()
+whitespace = skipMany1 $ satisfy (\c -> c == ' ' || c == '\t')
+
+endline :: LP ()
+endline = try (newline >> lookAhead anyChar >> notFollowedBy blankline)
 
 isLowerHex :: Char -> Bool
 isLowerHex x = x >= '0' && x <= '9' || x >= 'a' && x <= 'f'
@@ -126,7 +132,9 @@ comment = do
   return ()
 
 bgroup :: LP ()
-bgroup = () <$ char '{'
+bgroup = try $ do
+  skipMany (spaceChar <|> try (newline <* notFollowedBy blankline))
+  () <$ char '{'
      <|> () <$ controlSeq "bgroup"
      <|> () <$ controlSeq "begingroup"
 
@@ -158,32 +166,54 @@ mathInline :: LP String -> LP Inlines
 mathInline p = math <$> (try p >>= applyMacros')
 
 mathChars :: LP String
-mathChars = (concat <$>) $
-  many $
-          many1 (satisfy (\c -> c /= '$' && c /='\\'))
-      <|> (\c -> ['\\',c]) <$> try (char '\\' *> anyChar)
+mathChars =
+  concat <$> many (escapedChar
+               <|> (snd <$> withRaw braced)
+               <|> many1 (satisfy isOrdChar))
+   where escapedChar = try $ do char '\\'
+                                c <- anyChar
+                                return ['\\',c]
+         isOrdChar '$' = False
+         isOrdChar '{' = False
+         isOrdChar '}' = False
+         isOrdChar '\\' = False
+         isOrdChar _ = True
 
 quoted' :: (Inlines -> Inlines) -> LP String -> LP () -> LP Inlines
 quoted' f starter ender = do
   startchs <- starter
-  try ((f . mconcat) <$> manyTill inline ender) <|> lit startchs
+  smart <- getOption readerSmart
+  if smart
+     then do
+       ils <- many (notFollowedBy ender >> inline)
+       (ender >> return (f (mconcat ils))) <|>
+            (<> mconcat ils) <$>
+                    lit (case startchs of
+                              "``"  -> "“"
+                              "`"   -> "‘"
+                              _     -> startchs)
+     else lit startchs
 
 doubleQuote :: LP Inlines
-doubleQuote =
-      quoted' doubleQuoted (try $ string "``") (void $ try $ string "''")
-  <|> quoted' doubleQuoted (string "“")        (void $ char '”')
-  -- the following is used by babel for localized quotes:
-  <|> quoted' doubleQuoted (try $ string "\"`") (void $ try $ string "\"'")
-  <|> quoted' doubleQuoted (string "\"")       (void $ char '"')
+doubleQuote = do
+  quoted' doubleQuoted (try $ string "``") (void $ try $ string "''")
+   <|> quoted' doubleQuoted (string "“")        (void $ char '”')
+   -- the following is used by babel for localized quotes:
+   <|> quoted' doubleQuoted (try $ string "\"`") (void $ try $ string "\"'")
+   <|> quoted' doubleQuoted (string "\"")       (void $ char '"')
 
 singleQuote :: LP Inlines
-singleQuote =
-      quoted' singleQuoted (string "`") (try $ char '\'' >> notFollowedBy letter)
-  <|> quoted' singleQuoted (string "‘") (try $ char '’' >> notFollowedBy letter)
+singleQuote = do
+  smart <- getOption readerSmart
+  if smart
+     then quoted' singleQuoted (string "`") (try $ char '\'' >> notFollowedBy letter)
+      <|> quoted' singleQuoted (string "‘") (try $ char '’' >> notFollowedBy letter)
+     else str <$> many1 (oneOf "`\'‘’")
 
 inline :: LP Inlines
 inline = (mempty <$ comment)
-     <|> (space  <$ sp)
+     <|> (space  <$ whitespace)
+     <|> (softbreak <$ endline)
      <|> inlineText
      <|> inlineCommand
      <|> inlineEnvironment
@@ -392,14 +422,16 @@ inlineCommand = try $ do
   star <- option "" (string "*")
   let name' = name ++ star
   let raw = do
-        rawcommand <- getRawCommand name'
+        rawargs <- withRaw (skipopts *> option "" dimenarg *> many braced)
+        let rawcommand = '\\' : name ++ star ++ snd rawargs
         transformed <- applyMacros' rawcommand
         if transformed /= rawcommand
            then parseFromString inlines transformed
            else if parseRaw
                    then return $ rawInline "latex" rawcommand
                    else return mempty
-  lookupListDefault mzero [name',name] inlineCommands
+  (lookupListDefault mzero [name',name] inlineCommands <*
+      optional (try (string "{}")))
     <|> raw
 
 unlessParseRaw :: LP ()
@@ -412,6 +444,7 @@ isBlockCommand s = s `M.member` blockCommands
 inlineEnvironments :: M.Map String (LP Inlines)
 inlineEnvironments = M.fromList
   [ ("displaymath", mathEnv id Nothing "displaymath")
+  , ("math", math <$> verbEnv "math")
   , ("equation", mathEnv id Nothing "equation")
   , ("equation*", mathEnv id Nothing "equation*")
   , ("gather", mathEnv id (Just "gathered") "gather")
@@ -522,7 +555,9 @@ inlineCommands = M.fromList $
   , ("href", (unescapeURL <$> braced <* optional sp) >>= \url ->
        tok >>= \lab ->
          pure (link url "" lab))
-  , ("includegraphics", skipopts *> (unescapeURL <$> braced) >>= mkImage)
+  , ("includegraphics", do options <- option [] keyvals
+                           src <- unescapeURL <$> braced
+                           mkImage options src)
   , ("enquote", enquote)
   , ("cite", citation "cite" AuthorInText False)
   , ("Cite", citation "cite" AuthorInText False)
@@ -584,14 +619,19 @@ inlineCommands = M.fromList $
   -- in which case they will appear as raw latex blocks:
   [ "index" ]
 
-mkImage :: String -> LP Inlines
-mkImage src = do
+mkImage :: [(String, String)] -> String -> LP Inlines
+mkImage options src = do
+   let replaceTextwidth (k,v) = case numUnit v of
+                                  Just (num, "\\textwidth") -> (k, showFl (num * 100) ++ "%")
+                                  _ -> (k, v)
+   let kvs = map replaceTextwidth $ filter (\(k,_) -> k `elem` ["width", "height"]) options
+   let attr = ("",[], kvs)
    let alt = str "image"
    case takeExtension src of
         "" -> do
               defaultExt <- getOption readerDefaultImageExtension
-              return $ image (addExtension src defaultExt) "" alt
-        _  -> return $ image src "" alt
+              return $ imageWith attr (addExtension src defaultExt) "" alt
+        _  -> return $ imageWith attr src "" alt
 
 inNote :: Inlines -> Inlines
 inNote ils =
@@ -886,7 +926,7 @@ verbatimEnv' = fmap snd <$>
              string "\\begin"
              name <- braced'
              guard $ name `elem` ["verbatim", "Verbatim", "lstlisting",
-                                  "minted", "alltt"]
+                                  "minted", "alltt", "comment"]
              manyTill anyChar (try $ string $ "\\end{" ++ name ++ "}")
 
 blob' :: IncludeParser
@@ -972,7 +1012,7 @@ readFileFromDirs (d:ds) f =
 keyval :: LP (String, String)
 keyval = try $ do
   key <- many1 alphaNum
-  val <- option "" $ char '=' >> many1 alphaNum
+  val <- option "" $ char '=' >> many1 (alphaNum <|> char '.' <|> char '\\')
   skipMany spaceChar
   optional (char ',')
   skipMany spaceChar
@@ -999,11 +1039,11 @@ rawLaTeXInline = do
 
 addImageCaption :: Blocks -> LP Blocks
 addImageCaption = walkM go
-  where go (Image alt (src,tit)) = do
+  where go (Image attr alt (src,tit)) = do
           mbcapt <- stateCaption <$> getState
           return $ case mbcapt of
-               Just ils -> Image (toList ils) (src, "fig:")
-               Nothing  -> Image alt (src,tit)
+               Just ils -> Image attr (toList ils) (src, "fig:")
+               Nothing  -> Image attr alt (src,tit)
         go x = return x
 
 addTableCaption :: Blocks -> LP Blocks
@@ -1039,6 +1079,7 @@ environments = M.fromList
   , ("code", guardEnabled Ext_literate_haskell *>
       (codeBlockWith ("",["sourceCode","literate","haskell"],[]) <$>
         verbEnv "code"))
+  , ("comment", mempty <$ verbEnv "comment")
   , ("verbatim", codeBlock <$> verbEnv "verbatim")
   , ("Verbatim",   do options <- option [] keyvals
                       let kvs = [ (if k == "firstnumber"
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index f2b0872..b5d1754 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -36,9 +36,11 @@ import Data.List ( transpose, sortBy, findIndex, intersperse, intercalate )
 import qualified Data.Map as M
 import Data.Scientific (coefficient, base10Exponent)
 import Data.Ord ( comparing )
-import Data.Char ( isSpace, isAlphaNum, toLower )
+import Data.Char ( isSpace, isAlphaNum, toLower, isPunctuation )
 import Data.Maybe
 import Text.Pandoc.Definition
+import Text.Pandoc.Emoji (emojis)
+import Text.Pandoc.Generic (bottomUp)
 import qualified Data.Text as T
 import Data.Text (Text)
 import qualified Data.Yaml as Yaml
@@ -50,6 +52,7 @@ import qualified Data.Vector as V
 import Text.Pandoc.Builder (Inlines, Blocks, trimInlines)
 import Text.Pandoc.Options
 import Text.Pandoc.Shared
+import Text.Pandoc.Pretty (charWidth)
 import Text.Pandoc.XML (fromEntities)
 import Text.Pandoc.Parsing hiding (tableWith)
 import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
@@ -58,10 +61,10 @@ import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockT
 import Control.Monad
 import System.FilePath (takeExtension, addExtension)
 import Text.HTML.TagSoup
-import Text.HTML.TagSoup.Match (tagOpen)
 import qualified Data.Set as Set
 import Text.Printf (printf)
 import Debug.Trace (trace)
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Pandoc.Error
 
 type MarkdownParser = Parser [Char] ParserState
@@ -326,23 +329,22 @@ stopLine = try $ (string "---" <|> string "...") >> blankline >> return ()
 mmdTitleBlock :: MarkdownParser ()
 mmdTitleBlock = try $ do
   guardEnabled Ext_mmd_title_block
-  kvPairs <- many1 kvPair
+  firstPair <- kvPair False
+  restPairs <- many (kvPair True)
+  let kvPairs = firstPair : restPairs
   blanklines
   updateState $ \st -> st{ stateMeta' = stateMeta' st <>
                              return (Meta $ M.fromList kvPairs) }
 
-kvPair :: MarkdownParser (String, MetaValue)
-kvPair = try $ do
+kvPair :: Bool -> MarkdownParser (String, MetaValue)
+kvPair allowEmpty = try $ do
   key <- many1Till (alphaNum <|> oneOf "_- ") (char ':')
-  skipMany1 spaceNoNewline
-  val <- manyTill anyChar
+  val <- trim <$> manyTill anyChar
           (try $ newline >> lookAhead (blankline <|> nonspaceChar))
-  guard $ not . null . trim $ val
+  guard $ allowEmpty || not (null val)
   let key' = concat $ words $ map toLower key
-  let val' = MetaBlocks $ B.toList $ B.plain $ B.text $ trim val
+  let val' = MetaBlocks $ B.toList $ B.plain $ B.text $ val
   return (key',val')
-  where
-    spaceNoNewline = satisfy (\x -> isSpace x && (x/='\n') && (x/='\r'))
 
 parseMarkdown :: MarkdownParser Pandoc
 parseMarkdown = do
@@ -355,7 +357,19 @@ parseMarkdown = do
   st <- getState
   let meta = runF (stateMeta' st) st
   let Pandoc _ bs = B.doc $ runF blocks st
-  return $ Pandoc meta bs
+  eastAsianLineBreaks <- option False $
+                    True <$ guardEnabled Ext_east_asian_line_breaks
+  return $ (if eastAsianLineBreaks
+               then bottomUp softBreakFilter
+               else id) $ Pandoc meta bs
+
+softBreakFilter :: [Inline] -> [Inline]
+softBreakFilter (x:SoftBreak:y:zs) =
+  case (stringify x, stringify y) of
+        (xs@(_:_), (c:_))
+          | charWidth (last xs) == 2 && charWidth c == 2 -> x:y:zs
+        _ -> x:SoftBreak:y:zs
+softBreakFilter xs = xs
 
 referenceKey :: MarkdownParser (F Blocks)
 referenceKey = try $ do
@@ -367,23 +381,26 @@ referenceKey = try $ do
   let sourceURL = liftM unwords $ many $ try $ do
                     skipMany spaceChar
                     notFollowedBy' referenceTitle
+                    notFollowedBy' $ guardEnabled Ext_link_attributes >> attributes
                     notFollowedBy' (() <$ reference)
                     many1 $ notFollowedBy space >> litChar
   let betweenAngles = try $ char '<' >> manyTill litChar (char '>')
   src <- try betweenAngles <|> sourceURL
   tit <- option "" referenceTitle
-  -- currently we just ignore MMD-style link/image attributes
-  _kvs <- option [] $ guardEnabled Ext_link_attributes
-                      >> many (try $ spnl >> keyValAttr)
+  attr   <- option nullAttr $ try $
+              guardEnabled Ext_link_attributes >> skipSpaces >> attributes
+  addKvs <- option [] $ guardEnabled Ext_mmd_link_attributes
+                          >> many (try $ spnl >> keyValAttr)
   blanklines
-  let target = (escapeURI $ trimr src,  tit)
+  let attr'  = extractIdClass $ foldl (\x f -> f x) attr addKvs
+      target = (escapeURI $ trimr src, tit)
   st <- getState
   let oldkeys = stateKeys st
   let key = toKey raw
   case M.lookup key oldkeys of
     Just _  -> addWarning (Just pos) $ "Duplicate link reference `" ++ raw ++ "'"
     Nothing -> return ()
-  updateState $ \s -> s { stateKeys = M.insert key target oldkeys }
+  updateState $ \s -> s { stateKeys = M.insert key (target, attr') oldkeys }
   return $ return mempty
 
 referenceTitle :: MarkdownParser String
@@ -466,7 +483,6 @@ block = do
   res <- choice [ mempty <$ blanklines
                , codeBlockFenced
                , yamlMetaBlock
-               , guardEnabled Ext_latex_macros *> (macro >>= return . return)
                -- note: bulletList needs to be before header because of
                -- the possibility of empty list items: -
                , bulletList
@@ -476,6 +492,7 @@ block = do
                , htmlBlock
                , table
                , codeBlockIndented
+               , guardEnabled Ext_latex_macros *> (macro >>= return . return)
                , rawTeXBlock
                , lineBlock
                , blockQuote
@@ -516,9 +533,9 @@ atxHeader = try $ do
   (text, raw) <- withRaw $
           trimInlinesF . mconcat <$> many (notFollowedBy atxClosing >> inline)
   attr <- atxClosing
-  attr'@(ident,_,_) <- registerHeader attr (runF text defaultParserState)
+  attr' <- registerHeader attr (runF text defaultParserState)
   guardDisabled Ext_implicit_header_references
-    <|> registerImplicitHeader raw ident
+    <|> registerImplicitHeader raw attr'
   return $ B.headerWith attr' level <$> text
 
 atxClosing :: MarkdownParser Attr
@@ -559,16 +576,16 @@ setextHeader = try $ do
   many (char underlineChar)
   blanklines
   let level = (fromMaybe 0 $ findIndex (== underlineChar) setextHChars) + 1
-  attr'@(ident,_,_) <- registerHeader attr (runF text defaultParserState)
+  attr' <- registerHeader attr (runF text defaultParserState)
   guardDisabled Ext_implicit_header_references
-    <|> registerImplicitHeader raw ident
+    <|> registerImplicitHeader raw attr'
   return $ B.headerWith attr' level <$> text
 
-registerImplicitHeader :: String -> String -> MarkdownParser ()
-registerImplicitHeader raw ident = do
+registerImplicitHeader :: String -> Attr -> MarkdownParser ()
+registerImplicitHeader raw attr@(ident, _, _) = do
   let key = toKey $ "[" ++ raw ++ "]"
   updateState (\s -> s { stateHeaderKeys =
-                         M.insert key ('#':ident,"") (stateHeaderKeys s) })
+                         M.insert key (('#':ident,""), attr) (stateHeaderKeys s) })
 
 --
 -- hrule block
@@ -979,11 +996,11 @@ para = try $ do
             return $ do
               result' <- result
               case B.toList result' of
-                   [Image alt (src,tit)]
+                   [Image attr alt (src,tit)]
                      | Ext_implicit_figures `Set.member` exts ->
                         -- the fig: at beginning of title indicates a figure
                         return $ B.para $ B.singleton
-                               $ Image alt (src,'f':'i':'g':':':tit)
+                               $ Image attr alt (src,'f':'i':'g':':':tit)
                    _ -> return $ B.para result'
 
 plain :: MarkdownParser (F Blocks)
@@ -1034,12 +1051,11 @@ strictHtmlBlock :: MarkdownParser String
 strictHtmlBlock = htmlInBalanced (not . isInlineTag)
 
 rawVerbatimBlock :: MarkdownParser String
-rawVerbatimBlock = try $ do
-  (TagOpen tag _, open) <- htmlTag (tagOpen (flip elem
-                                                  ["pre", "style", "script"])
-                              (const True))
-  contents <- manyTill anyChar (htmlTag (~== TagClose tag))
-  return $ open ++ contents ++ renderTags' [TagClose tag]
+rawVerbatimBlock = htmlInBalanced isVerbTag
+  where isVerbTag (TagOpen "pre" _)    = True
+        isVerbTag (TagOpen "style" _)  = True
+        isVerbTag (TagOpen "script" _) = True
+        isVerbTag _                    = False
 
 rawTeXBlock :: MarkdownParser (F Blocks)
 rawTeXBlock = do
@@ -1321,7 +1337,7 @@ removeOneLeadingSpace xs =
 gridTableFooter :: MarkdownParser [Char]
 gridTableFooter = blanklines
 
-pipeBreak :: MarkdownParser [Alignment]
+pipeBreak :: MarkdownParser ([Alignment], [Int])
 pipeBreak = try $ do
   nonindentSpaces
   openPipe <- (True <$ char '|') <|> return False
@@ -1331,16 +1347,25 @@ pipeBreak = try $ do
   guard $ not (null rest && not openPipe)
   optional (char '|')
   blankline
-  return (first:rest)
+  return $ unzip (first:rest)
 
 pipeTable :: MarkdownParser ([Alignment], [Double], F [Blocks], F [[Blocks]])
 pipeTable = try $ do
   nonindentSpaces
   lookAhead nonspaceChar
-  (heads,aligns) <- (,) <$> pipeTableRow <*> pipeBreak
-  lines' <-  sequence <$> many pipeTableRow
-  let widths = replicate (length aligns) 0.0
-  return $ (aligns, widths, heads, lines')
+  (heads,(aligns, seplengths)) <- (,) <$> pipeTableRow <*> pipeBreak
+  let heads' = take (length aligns) <$> heads
+  lines' <- many pipeTableRow
+  let lines'' = map (take (length aligns) <$>) lines'
+  let maxlength = maximum $
+       map (\x -> length . stringify $ runF x def) (heads' : lines'')
+  numColumns <- getOption readerColumns
+  let widths = if maxlength > numColumns
+                  then map (\len ->
+                           fromIntegral (len + 1) / fromIntegral numColumns)
+                             seplengths
+                  else replicate (length aligns) 0.0
+  return $ (aligns, widths, heads', sequence lines'')
 
 sepPipe :: MarkdownParser ()
 sepPipe = try $ do
@@ -1349,39 +1374,42 @@ sepPipe = try $ do
 
 -- parse a row, also returning probable alignments for org-table cells
 pipeTableRow :: MarkdownParser (F [Blocks])
-pipeTableRow = do
+pipeTableRow = try $ do
+  scanForPipe
   skipMany spaceChar
   openPipe <- (True <$ char '|') <|> return False
-  let cell = mconcat <$>
-                 many (notFollowedBy (blankline <|> char '|') >> inline)
-  first <- cell
-  rest <- many $ sepPipe *> cell
+  -- split into cells
+  let chunk = void (code <|> rawHtmlInline <|> escapedChar <|> rawLaTeXInline')
+       <|> void (noneOf "|\n\r")
+  let cellContents = ((trim . snd) <$> withRaw (many chunk)) >>=
+        parseFromString pipeTableCell
+  cells <- cellContents `sepEndBy1` (char '|')
   -- surrounding pipes needed for a one-column table:
-  guard $ not (null rest && not openPipe)
-  optional (char '|')
+  guard $ not (length cells == 1 && not openPipe)
   blankline
-  let cells  = sequence (first:rest)
-  return $ do
-    cells' <- cells
-    return $ map
-        (\ils ->
-           case trimInlines ils of
-                 ils' | B.isNull ils' -> mempty
-                      | otherwise   -> B.plain $ ils') cells'
-
-pipeTableHeaderPart :: Parser [Char] st Alignment
+  return $ sequence cells
+
+pipeTableCell :: MarkdownParser (F Blocks)
+pipeTableCell = do
+  result <- many inline
+  if null result
+     then return mempty
+     else return $ B.plain . mconcat <$> sequence result
+
+pipeTableHeaderPart :: Parser [Char] st (Alignment, Int)
 pipeTableHeaderPart = try $ do
   skipMany spaceChar
   left <- optionMaybe (char ':')
-  many1 (char '-')
+  pipe <- many1 (char '-')
   right <- optionMaybe (char ':')
   skipMany spaceChar
+  let len = length pipe + maybe 0 (const 1) left + maybe 0 (const 1) right
   return $
-    case (left,right) of
-      (Nothing,Nothing) -> AlignDefault
-      (Just _,Nothing)  -> AlignLeft
-      (Nothing,Just _)  -> AlignRight
-      (Just _,Just _)   -> AlignCenter
+    ((case (left,right) of
+       (Nothing,Nothing) -> AlignDefault
+       (Just _,Nothing)  -> AlignLeft
+       (Nothing,Just _)  -> AlignRight
+       (Just _,Just _)   -> AlignCenter), len)
 
 -- Succeed only if current line contains a pipe.
 scanForPipe :: Parser [Char] st ()
@@ -1426,11 +1454,16 @@ table = try $ do
   caption <- case frontCaption of
                   Nothing  -> option (return mempty) tableCaption
                   Just c   -> return c
+  -- renormalize widths if greater than 100%:
+  let totalWidth = sum widths
+  let widths' = if totalWidth < 1
+                   then widths
+                   else map (/ totalWidth) widths
   return $ do
     caption' <- caption
     heads' <- heads
     lns' <- lns
-    return $ B.table caption' (zip aligns widths) heads' lns'
+    return $ B.table caption' (zip aligns widths') heads' lns'
 
 --
 -- inline
@@ -1460,6 +1493,7 @@ inline = choice [ whitespace
                 , exampleRef
                 , smart
                 , return . B.singleton <$> charRef
+                , emoji
                 , symbol
                 , ltSign
                 ] <?> "inline"
@@ -1522,7 +1556,7 @@ math :: MarkdownParser (F Inlines)
 math =  (return . B.displayMath <$> (mathDisplay >>= applyMacros'))
      <|> (return . B.math <$> (mathInline >>= applyMacros')) <+?>
                ((getOption readerSmart >>= guard) *> (return <$> apostrophe)
-                <* notFollowedBy space)
+                <* notFollowedBy (space <|> satisfy isPunctuation))
 
 -- Parses material enclosed in *s, **s, _s, or __s.
 -- Designed to avoid backtracking.
@@ -1666,7 +1700,7 @@ endline = try $ do
   (eof >> return mempty)
     <|> (guardEnabled Ext_hard_line_breaks >> return (return B.linebreak))
     <|> (guardEnabled Ext_ignore_line_breaks >> return mempty)
-    <|> (return $ return B.space)
+    <|> (skipMany spaceChar >> return (return B.softbreak))
 
 --
 -- links
@@ -1710,16 +1744,18 @@ link = try $ do
   setState $ st{ stateAllowLinks = False }
   (lab,raw) <- reference
   setState $ st{ stateAllowLinks = True }
-  regLink B.link lab <|> referenceLink B.link (lab,raw)
+  regLink B.linkWith lab <|> referenceLink B.linkWith (lab,raw)
 
-regLink :: (String -> String -> Inlines -> Inlines)
+regLink :: (Attr -> String -> String -> Inlines -> Inlines)
         -> F Inlines -> MarkdownParser (F Inlines)
 regLink constructor lab = try $ do
   (src, tit) <- source
-  return $ constructor src tit <$> lab
+  attr <- option nullAttr $
+          guardEnabled Ext_link_attributes >> attributes
+  return $ constructor attr src tit <$> lab
 
 -- a link like [this][ref] or [this][] or [this]
-referenceLink :: (String -> String -> Inlines -> Inlines)
+referenceLink :: (Attr -> String -> String -> Inlines -> Inlines)
               -> (F Inlines, String) -> MarkdownParser (F Inlines)
 referenceLink constructor (lab, raw) = do
   sp <- (True <$ lookAhead (char ' ')) <|> return False
@@ -1731,7 +1767,7 @@ referenceLink constructor (lab, raw) = do
   let labIsRef = raw' == "" || raw' == "[]"
   let key = toKey $ if labIsRef then raw else raw'
   parsedRaw <- parseFromString (mconcat <$> many inline) raw'
-  fallback <- parseFromString (mconcat <$> many inline) $ dropBrackets raw
+  fallback  <- parseFromString (mconcat <$> many inline) $ dropBrackets raw
   implicitHeaderRefs <- option False $
                          True <$ guardEnabled Ext_implicit_header_references
   let makeFallback = do
@@ -1748,10 +1784,10 @@ referenceLink constructor (lab, raw) = do
             then do
               headerKeys <- asksF stateHeaderKeys
               case M.lookup key headerKeys of
-                   Just (src, tit) -> constructor src tit <$> lab
-                   Nothing         -> makeFallback
+                   Just ((src, tit), _) -> constructor nullAttr src tit <$> lab
+                   Nothing              -> makeFallback
             else makeFallback
-       Just (src,tit) -> constructor src tit <$> lab
+       Just ((src,tit), attr) -> constructor attr src tit <$> lab
 
 dropBrackets :: String -> String
 dropBrackets = reverse . dropRB . reverse . dropLB
@@ -1785,9 +1821,9 @@ image = try $ do
   char '!'
   (lab,raw) <- reference
   defaultExt <- getOption readerDefaultImageExtension
-  let constructor src = case takeExtension src of
-                              "" -> B.image (addExtension src defaultExt)
-                              _  -> B.image src
+  let constructor attr' src = case takeExtension src of
+                          "" -> B.imageWith attr' (addExtension src defaultExt)
+                          _  -> B.imageWith attr' src
   regLink constructor lab <|> referenceLink constructor (lab,raw)
 
 note :: MarkdownParser (F Inlines)
@@ -1891,6 +1927,21 @@ rawHtmlInline = do
                              else not . isTextTag
   return $ return $ B.rawInline "html" result
 
+-- Emoji
+
+emojiChars :: [Char]
+emojiChars = ['a'..'z'] ++ ['0'..'9'] ++ ['_','+','-']
+
+emoji :: MarkdownParser (F Inlines)
+emoji = try $ do
+  guardEnabled Ext_emoji
+  char ':'
+  emojikey <- many1 (oneOf emojiChars)
+  char ':'
+  case M.lookup emojikey emojis of
+       Just s  -> return (return (B.str s))
+       Nothing -> mzero
+
 -- Citations
 
 cite :: MarkdownParser (F Inlines)
@@ -1923,7 +1974,7 @@ textualCite = try $ do
               spc | null spaces' = mempty
                   | otherwise    = B.space
           lab <- parseFromString (mconcat <$> many inline) $ dropBrackets raw'
-          fallback <- referenceLink B.link (lab,raw')
+          fallback <- referenceLink B.linkWith (lab,raw')
           return $ do
             fallback' <- fallback
             cs' <- cs
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index 4f5f9c2..9504979 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -39,6 +39,7 @@ module Text.Pandoc.Readers.MediaWiki ( readMediaWiki ) where
 import Text.Pandoc.Definition
 import qualified Text.Pandoc.Builder as B
 import Text.Pandoc.Builder (Inlines, Blocks, trimInlines)
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Pandoc.Options
 import Text.Pandoc.Readers.HTML ( htmlTag, isBlockTag, isCommentTag )
 import Text.Pandoc.XML ( fromEntities )
@@ -51,6 +52,7 @@ import Text.HTML.TagSoup
 import Data.Sequence (viewl, ViewL(..), (<|))
 import qualified Data.Foldable as F
 import qualified Data.Map as M
+import qualified Data.Set as Set
 import Data.Char (isDigit, isSpace)
 import Data.Maybe (fromMaybe)
 import Text.Printf (printf)
@@ -68,7 +70,7 @@ readMediaWiki opts s =
                                        , mwNextLinkNumber  = 1
                                        , mwCategoryLinks = []
                                        , mwHeaderMap = M.empty
-                                       , mwIdentifierList = []
+                                       , mwIdentifierList = Set.empty
                                        }
            (s ++ "\n")
 
@@ -77,7 +79,7 @@ data MWState = MWState { mwOptions         :: ReaderOptions
                        , mwNextLinkNumber  :: Int
                        , mwCategoryLinks   :: [Inlines]
                        , mwHeaderMap       :: M.Map Inlines String
-                       , mwIdentifierList  :: [String]
+                       , mwIdentifierList  :: Set.Set String
                        }
 
 type MWParser = Parser [Char] MWState
@@ -369,8 +371,6 @@ preformatted = try $ do
                    manyTill anyChar (htmlTag (~== TagClose "nowiki")))
   let inline' = whitespace' <|> endline' <|> nowiki'
                   <|> (try $ notFollowedBy newline *> inline)
-  let strToCode (Str s) = Code ("",[],[]) s
-      strToCode  x      = x
   contents <- mconcat <$> many1 inline'
   let spacesStr (Str xs) = all isSpace xs
       spacesStr _        = False
@@ -378,6 +378,10 @@ preformatted = try $ do
      then return mempty
      else return $ B.para $ walk strToCode contents
 
+strToCode :: Inline -> Inline
+strToCode (Str s) = Code ("",[],[]) s
+strToCode  x      = x
+
 header :: MWParser Blocks
 header = try $ do
   guardColumnOne
@@ -541,8 +545,8 @@ inlineTag = do
        TagOpen "del" _ -> B.strikeout <$> inlinesInTags "del"
        TagOpen "sub" _ -> B.subscript <$> inlinesInTags "sub"
        TagOpen "sup" _ -> B.superscript <$> inlinesInTags "sup"
-       TagOpen "code" _ -> B.code <$> charsInTags "code"
-       TagOpen "tt" _ -> B.code <$> charsInTags "tt"
+       TagOpen "code" _ -> walk strToCode <$> inlinesInTags "code"
+       TagOpen "tt" _ -> walk strToCode <$> inlinesInTags "tt"
        TagOpen "hask" _ -> B.codeWith ("",["haskell"],[]) <$> charsInTags "hask"
        _ -> B.rawInline "html" . snd <$> htmlTag (~== tag)
 
@@ -554,7 +558,8 @@ inlineHtml :: MWParser Inlines
 inlineHtml = B.rawInline "html" . snd <$> htmlTag isInlineTag'
 
 whitespace :: MWParser Inlines
-whitespace = B.space <$ (skipMany1 spaceChar <|> endline <|> htmlComment)
+whitespace = B.space <$ (skipMany1 spaceChar <|> htmlComment)
+         <|> B.softbreak <$ endline
 
 endline :: MWParser ()
 endline = () <$ try (newline <*
@@ -575,21 +580,29 @@ image = try $ do
   sym "[["
   choice imageIdentifiers
   fname <- many1 (noneOf "|]")
-  _ <- many (try $ char '|' *> imageOption)
+  _ <- many imageOption
+  dims <- try (char '|' *> (sepBy (many digit) (char 'x')) <* string "px")
+          <|> return []
+  _ <- many imageOption
+  let kvs = case dims of
+              w:[]     -> [("width", w)]
+              w:(h:[]) -> [("width", w), ("height", h)]
+              _        -> []
+  let attr = ("", [], kvs)
   caption <-   (B.str fname <$ sym "]]")
            <|> try (char '|' *> (mconcat <$> manyTill inline (sym "]]")))
-  return $ B.image fname ("fig:" ++ stringify caption) caption
+  return $ B.imageWith attr fname ("fig:" ++ stringify caption) caption
 
 imageOption :: MWParser String
-imageOption =
-      try (oneOfStrings [ "border", "thumbnail", "frameless"
-                        , "thumb", "upright", "left", "right"
-                        , "center", "none", "baseline", "sub"
-                        , "super", "top", "text-top", "middle"
-                        , "bottom", "text-bottom" ])
-  <|> try (string "frame")
-  <|> try (many1 (oneOf "x0123456789") <* string "px")
-  <|> try (oneOfStrings ["link=","alt=","page=","class="] <* many (noneOf "|]"))
+imageOption = try $ char '|' *> opt
+  where
+    opt = try (oneOfStrings [ "border", "thumbnail", "frameless"
+                            , "thumb", "upright", "left", "right"
+                            , "center", "none", "baseline", "sub"
+                            , "super", "top", "text-top", "middle"
+                            , "bottom", "text-bottom" ])
+      <|> try (string "frame")
+      <|> try (oneOfStrings ["link=","alt=","page=","class="] <* many (noneOf "|]"))
 
 collapseUnderscores :: String -> String
 collapseUnderscores [] = []
diff --git a/src/Text/Pandoc/Readers/Odt/Arrows/State.hs b/src/Text/Pandoc/Readers/Odt/Arrows/State.hs
index 2cc8318..30f96c5 100644
--- a/src/Text/Pandoc/Readers/Odt/Arrows/State.hs
+++ b/src/Text/Pandoc/Readers/Odt/Arrows/State.hs
@@ -46,6 +46,7 @@ import           Control.Monad
 
 import           Data.Foldable
 
+import           Text.Pandoc.Compat.Monoid
 import           Text.Pandoc.Readers.Odt.Arrows.Utils
 import           Text.Pandoc.Readers.Odt.Generic.Fallible
 
diff --git a/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs b/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs
index d4dcf5b..8c9ee05 100644
--- a/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs
+++ b/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs
@@ -46,7 +46,7 @@ import qualified Data.Foldable                    as F
 
 import           Text.Pandoc.Readers.Odt.Generic.Fallible
 import           Text.Pandoc.Readers.Odt.Generic.Utils
-
+import           Text.Pandoc.Compat.Monoid
 
 and2 :: (Arrow a) => a b c -> a b c' -> a b (c,c')
 and2 = (&&&)
@@ -129,24 +129,23 @@ joinOn :: (Arrow a) => (x -> y -> z) -> a (x,y) z
 joinOn = arr.uncurry
 
 -- | Applies a function to the uncurried result-pair of an arrow-application.
--- (The §-symbol was chosen to evoke an association with pairs through the
--- shared first character)
-(>>§) :: (Arrow a) => a x (b,c) -> (b -> c -> d) -> a x d
-a >>§ f = a >>^ uncurry f
+-- (The %-symbol was chosen to evoke an association with pairs.)
+(>>%) :: (Arrow a) => a x (b,c) -> (b -> c -> d) -> a x d
+a >>% f = a >>^ uncurry f
 
--- | '(>>§)' with its arguments flipped
-(§<<) :: (Arrow a) => (b -> c -> d) -> a x (b,c) -> a x d
-(§<<) = flip (>>§)
+-- | '(>>%)' with its arguments flipped
+(%<<) :: (Arrow a) => (b -> c -> d) -> a x (b,c) -> a x d
+(%<<) = flip (>>%)
 
 -- | Precomposition with an uncurried function
-(§>>) :: (Arrow a) => (b -> c -> d) -> a d r -> a (b,c) r
-f §>> a = uncurry f ^>> a
+(%>>) :: (Arrow a) => (b -> c -> d) -> a d r -> a (b,c) r
+f %>> a = uncurry f ^>> a
 
 -- | Precomposition with an uncurried function (right to left variant)
-(<<§) :: (Arrow a) => a d r -> (b -> c -> d) -> a (b,c) r
-(<<§) = flip (§>>)
+(<<%) :: (Arrow a) => a d r -> (b -> c -> d) -> a (b,c) r
+(<<%) = flip (%>>)
 
-infixr 2 >>§, §<<, §>>, <<§
+infixr 2 >>%, %<<, %>>, <<%
 
 
 -- | Duplicate a value and apply an arrow to the second instance.
@@ -271,7 +270,7 @@ newtype ParallelArrow a b c = CoEval { evalParallelArrow :: a b c }
 
 instance (Arrow a, Monoid m) => Monoid (ParallelArrow a b m) where
   mempty = CoEval $ returnV mempty
-  (CoEval a) `mappend` (CoEval ~b) = CoEval $ a &&& b >>§ mappend
+  (CoEval a) `mappend` (CoEval ~b) = CoEval $ a &&& b >>% mappend
 
 -- | Evaluates a collection of arrows in a parallel fashion.
 --
@@ -433,29 +432,29 @@ a ^>>?^? f = a ^>> Left ^|||^ f
 a >>?! f = a >>> right f
 
 ---
-(>>?§) :: (ArrowChoice a, Monoid f)
+(>>?%) :: (ArrowChoice a, Monoid f)
           => FallibleArrow a x f (b,b')
           -> (b -> b' -> c)
           -> FallibleArrow a x f c
-a >>?§ f = a >>?^ (uncurry f)
+a >>?% f = a >>?^ (uncurry f)
 
 ---
-(^>>?§) :: (ArrowChoice a, Monoid f)
+(^>>?%) :: (ArrowChoice a, Monoid f)
           => (x -> Either f (b,b'))
           -> (b -> b' -> c)
           -> FallibleArrow a x f c
-a ^>>?§ f = arr a >>?^ (uncurry f)
+a ^>>?% f = arr a >>?^ (uncurry f)
 
 ---
-(>>?§?) :: (ArrowChoice a, Monoid f)
+(>>?%?) :: (ArrowChoice a, Monoid f)
            => FallibleArrow a x f (b,b')
            -> (b -> b' -> (Either f c))
            -> FallibleArrow a x f c
-a >>?§? f = a >>?^? (uncurry f)
+a >>?%? f = a >>?^? (uncurry f)
 
 infixr 1  >>?,  >>?^,  >>?^?
 infixr 1 ^>>?, ^>>?^, ^>>?^?, >>?!
-infixr 1 >>?§, ^>>?§, >>?§?
+infixr 1 >>?%, ^>>?%, >>?%?
 
 -- | Keep values that are Right, replace Left values by a constant.
 ifFailedUse :: (ArrowChoice a) => v -> a (Either f v) v
diff --git a/src/Text/Pandoc/Readers/Odt/ContentReader.hs b/src/Text/Pandoc/Readers/Odt/ContentReader.hs
index 9ff3532..8c475ee 100644
--- a/src/Text/Pandoc/Readers/Odt/ContentReader.hs
+++ b/src/Text/Pandoc/Readers/Odt/ContentReader.hs
@@ -61,6 +61,7 @@ import           Text.Pandoc.Readers.Odt.Generic.XMLConverter
 import           Text.Pandoc.Readers.Odt.Generic.Fallible
 import           Text.Pandoc.Readers.Odt.Generic.Utils
 
+import qualified Data.Set as Set
 
 --------------------------------------------------------------------------------
 -- State
@@ -145,7 +146,7 @@ type OdtReaderSafe  a b = XMLReaderSafe ReaderState a b
 fromStyles :: (a -> Styles -> b) -> OdtReaderSafe a b
 fromStyles f =     keepingTheValue
                      (getExtraState >>^ styleSet)
-               >>§ f
+               >>% f
 
 --
 getStyleByName :: OdtReader StyleName Style
@@ -162,7 +163,7 @@ lookupListStyle = fromStyles lookupListStyleByName >>^ maybeToChoice
 --
 switchCurrentListStyle :: OdtReaderSafe (Maybe ListStyle) (Maybe ListStyle)
 switchCurrentListStyle =     keepingTheValue getExtraState
-                         >>§ swapCurrentListStyle
+                         >>% swapCurrentListStyle
                          >>> first setExtraState
                          >>^ snd
 
@@ -170,7 +171,7 @@ switchCurrentListStyle =     keepingTheValue getExtraState
 pushStyle :: OdtReaderSafe Style Style
 pushStyle =     keepingTheValue (
                   (     keepingTheValue getExtraState
-                    >>§ pushStyle'
+                    >>% pushStyle'
                   )
                   >>> setExtraState
                 )
@@ -221,7 +222,7 @@ getPrettyAnchor = proc (baseIdent, uglyAnchor) -> do
 getHeaderAnchor :: OdtReaderSafe Inlines Anchor
 getHeaderAnchor = proc title -> do
   state <- getExtraState -< ()
-  let anchor = uniqueIdent (toList title) (usedAnchors state)
+  let anchor = uniqueIdent (toList title) (Set.fromList $ usedAnchors state)
   modifyExtraState (putPrettyAnchor anchor anchor) -<< anchor
 
 
@@ -470,7 +471,7 @@ matchingElement :: (Monoid e)
 matchingElement ns name reader = (ns, name, asResultAccumulator reader)
   where
    asResultAccumulator :: (ArrowChoice a, Monoid m) => a m m -> a m (Fallible m)
-   asResultAccumulator a = liftAsSuccess $ keepingTheValue a >>§ (<>)
+   asResultAccumulator a = liftAsSuccess $ keepingTheValue a >>% (<>)
 
 --
 matchChildContent'   :: (Monoid result)
@@ -497,14 +498,14 @@ matchChildContent ls fallback = returnV mempty >>> matchContent ls fallback
 --
 -- | Open Document allows several consecutive spaces if they are marked up
 read_plain_text :: OdtReaderSafe (Inlines, XML.Content) Inlines
-read_plain_text =  fst ^&&& read_plain_text' >>§ recover
+read_plain_text =  fst ^&&& read_plain_text' >>% recover
   where
     -- fallible version
     read_plain_text' :: OdtReader (Inlines, XML.Content) Inlines
     read_plain_text' =      (     second ( arr extractText )
                               >>^ spreadChoice >>?! second text
                             )
-                       >>?§ (<>)
+                       >>?% (<>)
     --
     extractText     :: XML.Content -> Fallible String
     extractText (XML.Text cData) = succeedWith (XML.cdData cData)
diff --git a/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs b/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs
index 343ec14..d0fdc22 100644
--- a/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs
+++ b/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs
@@ -41,7 +41,7 @@ module Text.Pandoc.Readers.Odt.Generic.Fallible where
 
 import           Control.Applicative
 import           Control.Monad
-
+import           Text.Pandoc.Compat.Monoid ((<>))
 import qualified Data.Foldable       as F
 
 -- | Default for now. Will probably become a class at some point.
diff --git a/src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs b/src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs
index 7c17648..8c03d1a 100644
--- a/src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs
+++ b/src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs
@@ -331,7 +331,7 @@ convertingExtraState v a = withSubStateF setVAsExtraState modifyWithA
   where
     setVAsExtraState     = liftAsSuccess $ extractFromState id >>^ replaceExtraState v
     modifyWithA          = keepingTheValue (moreState ^>> a)
-                           >>^ spreadChoice >>?§ flip replaceExtraState
+                           >>^ spreadChoice >>?% flip replaceExtraState
 
 -- | First sets the extra state to the new value. Then produces a new
 -- extra state with a converter that uses the new state. Finally, the
@@ -413,14 +413,14 @@ elemName                 :: (NameSpaceID nsID)
                          -> XMLConverter nsID extraState x XML.QName
 elemName nsID name       =         lookupNSiri nsID
                                &&& lookupNSprefix nsID
-                           >>§ XML.QName name
+                           >>% XML.QName name
 
 -- | Checks if a given element matches both a specified namespace id
 -- and a specified element name
 elemNameIs               :: (NameSpaceID nsID)
                          => nsID -> ElementName
                          -> XMLConverter nsID extraState XML.Element Bool
-elemNameIs nsID name     = keepingTheValue (lookupNSiri nsID) >>§ hasThatName
+elemNameIs nsID name     = keepingTheValue (lookupNSiri nsID) >>% hasThatName
   where hasThatName e iri = let elName = XML.elName e
                             in     XML.qName elName == name
                                 && XML.qURI  elName == iri
@@ -461,8 +461,8 @@ currentElemIs'' nsID name = ( (getCurrentElement >>^ XML.elName >>>
                                 (XML.qName >>^ (&&).(== name) )
                                   ^&&&^
                                 (XML.qIRI  >>^ (==) )
-                              ) >>§ (.)
-                            ) &&& lookupNSiri nsID >>§ ($)
+                              ) >>% (.)
+                            ) &&& lookupNSiri nsID >>% ($)
 -}
 
 --
@@ -487,7 +487,7 @@ findChildren             :: (NameSpaceID nsID)
                          -> XMLConverter nsID extraState x [XML.Element]
 findChildren nsID name   =         elemName nsID name
                                &&& getCurrentElement
-                           >>§ XML.findChildren
+                           >>% XML.findChildren
 
 --
 filterChildren           :: (XML.Element -> Bool)
@@ -508,7 +508,7 @@ findChild'              :: (NameSpaceID nsID)
                         -> XMLConverter nsID extraState x (Maybe XML.Element)
 findChild' nsID name    =         elemName nsID name
                               &&& getCurrentElement
-                          >>§ XML.findChild
+                          >>% XML.findChild
 
 --
 findChild              :: (NameSpaceID nsID)
@@ -596,7 +596,7 @@ isThatTheAttrValue       :: (NameSpaceID nsID)
 isThatTheAttrValue nsID attrName
                          =     keepingTheValue
                                  (findAttr nsID attrName)
-                           >>§ right.(==)
+                           >>% right.(==)
 
 -- | Lookup value in a dictionary, fail if no attribute found or value
 -- not in dictionary
@@ -669,7 +669,7 @@ findAttr'               :: (NameSpaceID nsID)
                         -> XMLConverter nsID extraState x (Maybe AttributeValue)
 findAttr' nsID attrName =         elemName nsID attrName
                               &&& getCurrentElement
-                          >>§ XML.findAttr
+                          >>% XML.findAttr
 
 -- | Return value as string or fail
 findAttr               :: (NameSpaceID nsID)
@@ -787,7 +787,7 @@ prepareIteration       :: (NameSpaceID nsID)
                        -> XMLConverter nsID extraState b [(b, XML.Element)]
 prepareIteration nsID name =     keepingTheValue
                                    (findChildren nsID name)
-                             >>§ distributeValue
+                             >>% distributeValue
 
 -- | Applies a converter to every child element of a specific type.
 -- Collects results in a 'Monoid'.
@@ -877,9 +877,9 @@ makeMatcherE nsID name c = (     second (
                                               elemNameIs nsID name
                                           >>^ bool Nothing (Just tryC)
                                         )
-                             >>§ (<|>)
+                             >>% (<|>)
                            ) &&&^ snd
-  where tryC = (fst ^&&& executeThere c >>§ recover) &&&^ snd
+  where tryC = (fst ^&&& executeThere c >>% recover) &&&^ snd
 
 -- Helper function: The @c@ is actually a converter that is to be selected by
 -- matching XML content to the first two parameters.
@@ -899,14 +899,14 @@ makeMatcherC nsID name c = (    second (    contentToElem
                                               >>^ bool Nothing (Just cWithJump)
                                              )
                                         )
-                             >>§ (<|>)
+                             >>% (<|>)
                            ) &&&^ snd
   where cWithJump =      ( fst
                            ^&&& (      second contentToElem
                                   >>>  spreadChoice
                                   ^>>? executeThere c
                                 )
-                            >>§ recover)
+                            >>% recover)
                     &&&^ snd
         contentToElem :: FallibleXMLConverter nsID extraState XML.Content XML.Element
         contentToElem = arr $ \e -> case e of
diff --git a/src/Text/Pandoc/Readers/Odt/Namespaces.hs b/src/Text/Pandoc/Readers/Odt/Namespaces.hs
index e280568..deb0099 100644
--- a/src/Text/Pandoc/Readers/Odt/Namespaces.hs
+++ b/src/Text/Pandoc/Readers/Odt/Namespaces.hs
@@ -107,4 +107,4 @@ nsIDs = [
   ("http://www.w3.org/1999/xhtml"                           , NsXHtml        ),
   ("http://www.w3.org/2002/xforms"                          , NsXForms       ),
   ("http://www.w3.org/1999/xlink"                           , NsXLink        )
-  ]
\ No newline at end of file
+  ]
diff --git a/src/Text/Pandoc/Readers/Odt/StyleReader.hs b/src/Text/Pandoc/Readers/Odt/StyleReader.hs
index e403424..96cfed0 100644
--- a/src/Text/Pandoc/Readers/Odt/StyleReader.hs
+++ b/src/Text/Pandoc/Readers/Odt/StyleReader.hs
@@ -174,7 +174,7 @@ findPitch :: XMLReaderSafe FontPitches _x (Maybe FontPitch)
 findPitch =     ( lookupAttr NsStyle "font-pitch"
                   `ifFailedDo`     findAttr NsStyle "font-name"
                                >>? (     keepingTheValue getExtraState
-                                     >>§ M.lookup
+                                     >>% M.lookup
                                      >>^ maybeToChoice
                                    )
                 )
@@ -447,7 +447,7 @@ readAllStyles :: StyleReader _x Styles
 readAllStyles = (      readFontPitches
                   >>?! (     readAutomaticStyles
                          &&& readStyles ))
-                  >>?§? chooseMax
+                  >>?%? chooseMax
  -- all top elements are always on the same hierarchy level
 
 --
diff --git a/src/Text/Pandoc/Readers/Org.hs b/src/Text/Pandoc/Readers/Org.hs
index 27a8fe9..7dd611b 100644
--- a/src/Text/Pandoc/Readers/Org.hs
+++ b/src/Text/Pandoc/Readers/Org.hs
@@ -2,7 +2,7 @@
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances #-}
 {-
-Copyright (C) 2014-2015 Albert Krewinkel <tarleb@moltkeplatz.de>
+Copyright (C) 2014-2016 Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -21,10 +21,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.Readers.Org
-   Copyright   : Copyright (C) 2014 Albert Krewinkel
+   Copyright   : Copyright (C) 2014-2016 Albert Krewinkel
    License     : GNU GPL, version 2 or above
 
-   Maintainer  : Albert Krewinkel <tarleb@moltkeplatz.de>
+   Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
 
 Conversion of org-mode formatted plain text to 'Pandoc' document.
 -}
@@ -34,6 +34,7 @@ import qualified Text.Pandoc.Builder as B
 import           Text.Pandoc.Builder ( Inlines, Blocks, HasMeta(..),
                                        trimInlines )
 import           Text.Pandoc.Definition
+import           Text.Pandoc.Compat.Monoid ((<>))
 import           Text.Pandoc.Options
 import qualified Text.Pandoc.Parsing as P
 import           Text.Pandoc.Parsing hiding ( F, unF, askF, asksF, runF
@@ -52,6 +53,7 @@ import           Data.Char (isAlphaNum, toLower)
 import           Data.Default
 import           Data.List (intersperse, isPrefixOf, isSuffixOf)
 import qualified Data.Map as M
+import qualified Data.Set as Set
 import           Data.Maybe (fromMaybe, isJust)
 import           Network.HTTP (urlEncode)
 
@@ -86,8 +88,10 @@ parseOrg = do
 -- | Drop COMMENT headers and the document tree below those headers.
 dropCommentTrees :: [Block] -> [Block]
 dropCommentTrees [] = []
-dropCommentTrees blks@(b:bs) =
-  maybe blks (flip dropUntilHeaderAboveLevel bs) $ commentHeaderLevel b
+dropCommentTrees (b:bs) =
+  maybe (b:dropCommentTrees bs)
+        (dropCommentTrees . flip dropUntilHeaderAboveLevel bs)
+        (commentHeaderLevel b)
 
 -- | Return the level of a header starting a comment or :noexport: tree and
 --  Nothing otherwise.
@@ -140,7 +144,8 @@ data OrgParserState = OrgParserState
                       , orgStateMeta                 :: Meta
                       , orgStateMeta'                :: F Meta
                       , orgStateNotes'               :: OrgNoteTable
-                      , orgStateIdentifiers          :: [String]
+                      , orgStateParserContext        :: ParserContext
+                      , orgStateIdentifiers          :: Set.Set String
                       , orgStateHeaderMap            :: M.Map Inlines String
                       }
 
@@ -181,7 +186,8 @@ defaultOrgParserState = OrgParserState
                         , orgStateMeta = nullMeta
                         , orgStateMeta' = return nullMeta
                         , orgStateNotes' = []
-                        , orgStateIdentifiers = []
+                        , orgStateParserContext = NullState
+                        , orgStateIdentifiers = Set.empty
                         , orgStateHeaderMap = M.empty
                         }
 
@@ -291,6 +297,23 @@ blanklines =
        <* updateLastPreCharPos
        <* updateLastForbiddenCharPos
 
+-- | Succeeds when we're in list context.
+inList :: OrgParser ()
+inList = do
+  ctx <- orgStateParserContext <$> getState
+  guard (ctx == ListItemState)
+
+-- | Parse in different context
+withContext :: ParserContext -- ^ New parser context
+            -> OrgParser a   -- ^ Parser to run in that context
+            -> OrgParser a
+withContext context parser = do
+  oldContext <- orgStateParserContext <$> getState
+  updateState $ \s -> s{ orgStateParserContext = context }
+  result <- parser
+  updateState $ \s -> s{ orgStateParserContext = oldContext }
+  return result
+
 --
 -- parsing blocks
 --
@@ -513,10 +536,16 @@ rundocBlockClass :: String
 rundocBlockClass = rundocPrefix ++ "block"
 
 blockOption :: OrgParser (String, String)
-blockOption = try $ (,) <$> orgArgKey <*> orgParamValue
+blockOption = try $ do
+  argKey <- orgArgKey
+  paramValue <- option "yes" orgParamValue
+  return (argKey, paramValue)
 
 inlineBlockOption :: OrgParser (String, String)
-inlineBlockOption = try $ (,) <$> orgArgKey <*> orgInlineParamValue
+inlineBlockOption = try $ do
+  argKey <- orgArgKey
+  paramValue <- option "yes" orgInlineParamValue
+  return (argKey, paramValue)
 
 orgArgKey :: OrgParser String
 orgArgKey = try $
@@ -525,11 +554,17 @@ orgArgKey = try $
 
 orgParamValue :: OrgParser String
 orgParamValue = try $
-  skipSpaces *> many1 (noneOf "\t\n\r ") <* skipSpaces
+  skipSpaces
+    *> notFollowedBy (char ':' )
+    *> many1 (noneOf "\t\n\r ")
+    <* skipSpaces
 
 orgInlineParamValue :: OrgParser String
 orgInlineParamValue = try $
-  skipSpaces *> many1 (noneOf "\t\n\r ]") <* skipSpaces
+  skipSpaces
+    *> notFollowedBy (char ':')
+    *> many1 (noneOf "\t\n\r ]")
+    <* skipSpaces
 
 orgArgWordChar :: OrgParser Char
 orgArgWordChar = alphaNum <|> oneOf "-_"
@@ -594,7 +629,7 @@ figure = try $ do
          maybeNam <- lookupBlockAttribute "name"
          guard $ isJust maybeCap || isJust maybeNam
          return ( fromMaybe mempty maybeCap
-                , maybe mempty withFigPrefix maybeNam )
+                , withFigPrefix $ fromMaybe mempty maybeNam )
    withFigPrefix cs =
        if "fig:" `isPrefixOf` cs
        then cs
@@ -699,7 +734,7 @@ headerTags = try $
 
 headerStart :: OrgParser Int
 headerStart = try $
-  (length <$> many1 (char '*')) <* many1 (char ' ')
+  (length <$> many1 (char '*')) <* many1 (char ' ') <* updateLastPreCharPos
 
 
 -- Don't use (or need) the reader wrapper here, we want hline to be
@@ -891,9 +926,13 @@ noteBlock = try $ do
 paraOrPlain :: OrgParser (F Blocks)
 paraOrPlain = try $ do
   ils <- parseInlines
-  nl <- option False (newline >> return True)
-  try (guard nl >> notFollowedBy (orderedListStart <|> bulletListStart) >>
-           return (B.para <$> ils))
+  nl <- option False (newline *> return True)
+  -- Read block as paragraph, except if we are in a list context and the block
+  -- is directly followed by a list item, in which case the block is read as
+  -- plain text.
+  try (guard nl
+       *> notFollowedBy (inList *> (orderedListStart <|> bulletListStart))
+       *> return (B.para <$> ils))
     <|>  (return (B.plain <$> ils))
 
 inlinesTillNewline :: OrgParser (F Inlines)
@@ -958,19 +997,22 @@ definitionListItem :: OrgParser Int
                    -> OrgParser (F (Inlines, [Blocks]))
 definitionListItem parseMarkerGetLength = try $ do
   markerLength <- parseMarkerGetLength
-  term <- manyTill (noneOf "\n\r") (try $ string "::")
+  term <- manyTill (noneOf "\n\r") (try definitionMarker)
   line1 <- anyLineNewline
   blank <- option "" ("\n" <$ blankline)
   cont <- concat <$> many (listContinuation markerLength)
   term' <- parseFromString parseInlines term
   contents' <- parseFromString parseBlocks $ line1 ++ blank ++ cont
   return $ (,) <$> term' <*> fmap (:[]) contents'
+ where
+   definitionMarker =
+     spaceChar *> string "::" <* (spaceChar <|> lookAhead P.newline)
 
 
 -- parse raw text for one list item, excluding start marker and continuations
 listItem :: OrgParser Int
          -> OrgParser (F Blocks)
-listItem start = try $ do
+listItem start = try . withContext ListItemState $ do
   markerLength <- try start
   firstLine <- anyLineNewline
   blank <- option "" ("\n" <$ blankline)
@@ -1064,7 +1106,7 @@ endline = try $ do
   decEmphasisNewlinesCount
   guard =<< newlinesCountWithinLimits
   updateLastPreCharPos
-  return . return $ B.space
+  return . return $ B.softbreak
 
 cite :: OrgParser (F Inlines)
 cite = try $ do
@@ -1197,37 +1239,37 @@ applyCustomLinkFormat link = do
     formatter <- M.lookup linkType <$> asksF orgStateLinkFormatters
     return $ maybe link ($ drop 1 rest) formatter
 
--- TODO: might be a lot smarter/cleaner to use parsec and ADTs for this kind
--- of parsing.
+-- | Take a link and return a function which produces new inlines when given
+-- description inlines.
 linkToInlinesF :: String -> Inlines -> F Inlines
-linkToInlinesF s =
+linkToInlinesF linkStr =
+  case linkStr of
+    ""      -> pure . B.link mempty ""       -- wiki link (empty by convention)
+    ('#':_) -> pure . B.link linkStr ""      -- document-local fraction
+    _       -> case cleanLinkString linkStr of
+                 (Just cleanedLink) -> if isImageFilename cleanedLink
+                                       then const . pure $ B.image cleanedLink "" ""
+                                       else pure . B.link cleanedLink ""
+                 Nothing -> internalLink linkStr  -- other internal link
+
+-- | Cleanup and canonicalize a string describing a link.  Return @Nothing@ if
+-- the string does not appear to be a link.
+cleanLinkString :: String -> Maybe String
+cleanLinkString s =
   case s of
-    ""      -> pure . B.link "" ""
-    ('#':_) -> pure . B.link s ""
-    _ | isImageFilename s     -> const . pure $ B.image s "" ""
-    _ | isFileLink s          -> pure . B.link (dropLinkType s) ""
-    _ | isUri s               -> pure . B.link s ""
-    _ | isAbsoluteFilePath s  -> pure . B.link ("file://" ++ s) ""
-    _ | isRelativeFilePath s  -> pure . B.link s ""
-    _                         -> internalLink s
-
-isFileLink :: String -> Bool
-isFileLink s = ("file:" `isPrefixOf` s) && not ("file://" `isPrefixOf` s)
-
-dropLinkType :: String -> String
-dropLinkType = tail . snd . break (== ':')
-
-isRelativeFilePath :: String -> Bool
-isRelativeFilePath s = (("./" `isPrefixOf` s) || ("../" `isPrefixOf` s)) &&
-                       (':' `notElem` s)
-
-isUri :: String -> Bool
-isUri s = let (scheme, path) = break (== ':') s
-          in all (\c -> isAlphaNum c || c `elem` (".-" :: String)) scheme
-             && not (null path)
-
-isAbsoluteFilePath :: String -> Bool
-isAbsoluteFilePath = ('/' ==) . head
+    '/':_                  -> Just $ "file://" ++ s  -- absolute path
+    '.':'/':_              -> Just s                 -- relative path
+    '.':'.':'/':_          -> Just s                 -- relative path
+    -- Relative path or URL (file schema)
+    'f':'i':'l':'e':':':s' -> Just $ if ("//" `isPrefixOf` s') then s else s'
+    _ | isUrl s            -> Just s                 -- URL
+    _                      -> Nothing
+ where
+   isUrl :: String -> Bool
+   isUrl cs =
+     let (scheme, path) = break (== ':') cs
+     in all (\c -> isAlphaNum c || c `elem` (".-"::String)) scheme
+          && not (null path)
 
 isImageFilename :: String -> Bool
 isImageFilename filename =
@@ -1549,8 +1591,11 @@ smart :: OrgParser (F Inlines)
 smart = do
   getOption readerSmart >>= guard
   doubleQuoted <|> singleQuoted <|>
-    choice (map (return <$>) [orgApostrophe, dash, ellipses])
-  where orgApostrophe =
+    choice (map (return <$>) [orgApostrophe, orgDash, orgEllipses])
+  where
+    orgDash = dash <* updatePositions '-'
+    orgEllipses = ellipses <* updatePositions '.'
+    orgApostrophe =
           (char '\'' <|> char '\8217') <* updateLastPreCharPos
                                        <* updateLastForbiddenCharPos
                                        *> return (B.str "\x2019")
@@ -1558,9 +1603,10 @@ smart = do
 singleQuoted :: OrgParser (F Inlines)
 singleQuoted = try $ do
   singleQuoteStart
+  updatePositions '\''
   withQuoteContext InSingleQuote $
     fmap B.singleQuoted . trimInlinesF . mconcat <$>
-      many1Till inline singleQuoteEnd
+      many1Till inline (singleQuoteEnd <* updatePositions '\'')
 
 -- doubleQuoted will handle regular double-quoted sections, as well
 -- as dialogues with an open double-quote without a close double-quote
@@ -1568,6 +1614,7 @@ singleQuoted = try $ do
 doubleQuoted :: OrgParser (F Inlines)
 doubleQuoted = try $ do
   doubleQuoteStart
+  updatePositions '"'
   contents <- mconcat <$> many (try $ notFollowedBy doubleQuoteEnd >> inline)
   (withQuoteContext InDoubleQuote $ (doubleQuoteEnd <* updateLastForbiddenCharPos) >> return
        (fmap B.doubleQuoted . trimInlinesF $ contents))
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 4fb30e6..7be0cd3 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -48,7 +48,7 @@ import Text.Pandoc.Builder (Inlines, Blocks, trimInlines)
 import qualified Text.Pandoc.Builder as B
 import Data.Sequence (viewr, ViewR(..))
 import Data.Char (toLower, isHexDigit, isSpace)
-
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Pandoc.Error
 
 -- | Parse reStructuredText string and return Pandoc document.
@@ -541,6 +541,12 @@ directive' = do
   body <- option "" $ try $ blanklines >> indentedBlock
   optional blanklines
   let body' = body ++ "\n\n"
+      imgAttr cl = ("", classes, getAtt "width" ++ getAtt "height")
+        where
+          classes = words $ maybe "" trim $ lookup cl fields
+          getAtt k = case lookup k fields of
+                       Just v  -> [(k, filter (not . isSpace) v)]
+                       Nothing -> []
   case label of
         "raw" -> return $ B.rawBlock (trim top) (stripTrailingNewlines body)
         "role" -> addNewRole top $ map (\(k,v) -> (k, trim v)) fields
@@ -590,15 +596,16 @@ directive' = do
         "figure" -> do
            (caption, legend) <- parseFromString extractCaption body'
            let src = escapeURI $ trim top
-           return $ B.para (B.image src "fig:" caption) <> legend
+           return $ B.para (B.imageWith (imgAttr "figclass") src "fig:" caption) <> legend
         "image" -> do
            let src = escapeURI $ trim top
            let alt = B.str $ maybe "image" trim $ lookup "alt" fields
+           let attr = imgAttr "class"
            return $ B.para
                   $ case lookup "target" fields of
                           Just t  -> B.link (escapeURI $ trim t) ""
-                                     $ B.image src "" alt
-                          Nothing -> B.image src "" alt
+                                     $ B.imageWith attr src "" alt
+                          Nothing -> B.imageWith attr src "" alt
         "class" -> do
             let attrs = ("", (splitBy isSpace $ trim top), map (\(k,v) -> (k, trimr v)) fields)
             --  directive content or the first immediately following element
@@ -812,10 +819,10 @@ substKey = try $ do
   res <- B.toList <$> directive'
   il <- case res of
              -- use alt unless :alt: attribute on image:
-             [Para [Image [Str "image"] (src,tit)]] ->
-                return $ B.image src tit alt
-             [Para [Link [Image [Str "image"] (src,tit)] (src',tit')]] ->
-                return $ B.link src' tit' (B.image src tit alt)
+             [Para [Image attr [Str "image"] (src,tit)]] ->
+                return $ B.imageWith attr src tit alt
+             [Para [Link _ [Image attr [Str "image"] (src,tit)] (src',tit')]] ->
+                return $ B.link src' tit' (B.imageWith attr src tit alt)
              [Para ils] -> return $ B.fromList ils
              _          -> mzero
   let key = toKey $ stripFirstAndLast ref
@@ -827,7 +834,8 @@ anonymousKey = try $ do
   src <- targetURI
   pos <- getPosition
   let key = toKey $ "_" ++ printf "%09d" (sourceLine pos)
-  updateState $ \s -> s { stateKeys = M.insert key (src,"") $ stateKeys s }
+  --TODO: parse width, height, class and name attributes
+  updateState $ \s -> s { stateKeys = M.insert key ((src,""), nullAttr) $ stateKeys s }
 
 stripTicks :: String -> String
 stripTicks = reverse . stripTick . reverse . stripTick
@@ -841,7 +849,8 @@ regularKey = try $ do
   char ':'
   src <- targetURI
   let key = toKey $ stripTicks ref
-  updateState $ \s -> s { stateKeys = M.insert key (src,"") $ stateKeys s }
+  --TODO: parse width, height, class and name attributes
+  updateState $ \s -> s { stateKeys = M.insert key ((src,""), nullAttr) $ stateKeys s }
 
 --
 -- tables
@@ -1096,7 +1105,7 @@ endline = try $ do
      then notFollowedBy (anyOrderedListMarker >> spaceChar) >>
           notFollowedBy' bulletListStart
      else return ()
-  return B.space
+  return B.softbreak
 
 --
 -- links
@@ -1131,12 +1140,12 @@ referenceLink = try $ do
                    if null anonKeys
                       then mzero
                       else return (head anonKeys)
-  (src,tit) <- case M.lookup key keyTable of
-                    Nothing     -> fail "no corresponding key"
-                    Just target -> return target
+  ((src,tit), attr) <- case M.lookup key keyTable of
+                         Nothing  -> fail "no corresponding key"
+                         Just val -> return val
   -- if anonymous link, remove key so it won't be used again
   when (isAnonKey key) $ updateState $ \s -> s{ stateKeys = M.delete key keyTable }
-  return $ B.link src tit label'
+  return $ B.linkWith attr src tit label'
 
 autoURI :: RSTParser Inlines
 autoURI = do
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
index 83280aa..6f64540 100644
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -51,12 +51,13 @@ TODO : refactor common patterns across readers :
 
 
 module Text.Pandoc.Readers.Textile ( readTextile) where
+import Text.Pandoc.CSS
 import Text.Pandoc.Definition
 import Text.Pandoc.Builder (Inlines, Blocks, trimInlines)
 import qualified Text.Pandoc.Builder as B
 import Text.Pandoc.Options
 import Text.Pandoc.Parsing
-import Text.Pandoc.Readers.HTML ( htmlTag, isBlockTag )
+import Text.Pandoc.Readers.HTML ( htmlTag, isBlockTag, isInlineTag )
 import Text.Pandoc.Shared (trim)
 import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
 import Text.HTML.TagSoup (parseTags, innerText, fromAttrib, Tag(..))
@@ -64,6 +65,7 @@ import Text.HTML.TagSoup.Match
 import Data.List ( intercalate )
 import Data.Char ( digitToInt, isUpper)
 import Control.Monad ( guard, liftM, when )
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Printf
 import Debug.Trace (trace)
 import Text.Pandoc.Error
@@ -79,11 +81,12 @@ readTextile opts s =
 -- | Generate a Pandoc ADT from a textile document
 parseTextile :: Parser [Char] ParserState Pandoc
 parseTextile = do
-  -- textile allows raw HTML and does smart punctuation by default
+  -- textile allows raw HTML and does smart punctuation by default,
+  -- but we do not enable smart punctuation unless it is explicitly
+  -- asked for, for better conversion to other light markup formats
   oldOpts <- stateOptions `fmap` getState
   updateState $ \state -> state{ stateOptions =
-                                   oldOpts{ readerSmart = True
-                                          , readerParseRaw = True
+                                   oldOpts{ readerParseRaw = True
                                           , readerOldDashes = True
                                           } }
   many blankline
@@ -501,7 +504,7 @@ endline = try $ do
   return B.linebreak
 
 rawHtmlInline :: Parser [Char] ParserState Inlines
-rawHtmlInline = B.rawInline "html" . snd <$> htmlTag (const True)
+rawHtmlInline = B.rawInline "html" . snd <$> htmlTag isInlineTag
 
 -- | Raw LaTeX Inline
 rawLaTeXInline' :: Parser [Char] ParserState Inlines
@@ -533,10 +536,14 @@ link = try $ do
 image :: Parser [Char] ParserState Inlines
 image = try $ do
   char '!' >> notFollowedBy space
+  (ident, cls, kvs) <- attributes
+  let attr = case lookup "style" kvs of
+               Just stls -> (ident, cls, pickStylesToKVs ["width", "height"] stls)
+               Nothing   -> (ident, cls, kvs)
   src <- manyTill anyChar' (lookAhead $ oneOf "!(")
   alt <- option "" (try $ (char '(' >> manyTill anyChar' (char ')')))
   char '!'
-  return $ B.image src alt (B.str alt)
+  return $ B.imageWith attr src alt (B.str alt)
 
 escapedInline :: Parser [Char] ParserState Inlines
 escapedInline = escapedEqs <|> escapedTag
@@ -576,7 +583,18 @@ code2 = do
 
 -- | Html / CSS attributes
 attributes :: Parser [Char] ParserState Attr
-attributes = (foldl (flip ($)) ("",[],[])) `fmap` many attribute
+attributes = (foldl (flip ($)) ("",[],[])) <$>
+  try (do special <- option id specialAttribute
+          attrs <- many attribute
+          return (special : attrs))
+
+specialAttribute :: Parser [Char] ParserState (Attr -> Attr)
+specialAttribute = do
+  alignStr <- ("center" <$ char '=') <|>
+    ("justify" <$ try (string "<>")) <|>
+    ("right" <$ char '>') <|>
+    ("left" <$ char '<')
+  return $ addStyle ("text-align:" ++ alignStr)
 
 attribute :: Parser [Char] ParserState (Attr -> Attr)
 attribute = classIdAttr <|> styleAttr <|> langAttr
@@ -595,7 +613,13 @@ classIdAttr = try $ do -- (class class #id)
 styleAttr :: Parser [Char] ParserState (Attr -> Attr)
 styleAttr = do
   style <- try $ enclosed (char '{') (char '}') anyChar'
-  return $ \(id',classes,keyvals) -> (id',classes,("style",style):keyvals)
+  return $ addStyle style
+
+addStyle :: String -> Attr -> Attr
+addStyle style (id',classes,keyvals) =
+  (id',classes,keyvals')
+  where keyvals' = ("style", style') : [(k,v) | (k,v) <- keyvals, k /= "style"]
+        style' = style ++ ";" ++ concat [v | ("style",v) <- keyvals]
 
 langAttr :: Parser [Char] ParserState (Attr -> Attr)
 langAttr = do
diff --git a/src/Text/Pandoc/Readers/Txt2Tags.hs b/src/Text/Pandoc/Readers/Txt2Tags.hs
index 1c868f5..c28ce16 100644
--- a/src/Text/Pandoc/Readers/Txt2Tags.hs
+++ b/src/Text/Pandoc/Readers/Txt2Tags.hs
@@ -34,6 +34,7 @@ module Text.Pandoc.Readers.Txt2Tags ( readTxt2Tags
 
 import qualified Text.Pandoc.Builder as B
 import Text.Pandoc.Builder ( Inlines, Blocks, trimInlines )
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Pandoc.Definition
 import Text.Pandoc.Options
 import Text.Pandoc.Shared (escapeURI,compactify', compactify'DL)
@@ -549,7 +550,7 @@ endline = try $ do
   notFollowedBy quote
   notFollowedBy list
   notFollowedBy table
-  return $ B.space
+  return $ B.softbreak
 
 str :: T2T Inlines
 str = try $ do
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
index 4f4b605..d08d636 100644
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -1,6 +1,6 @@
 {-# LANGUAGE OverloadedStrings #-}
 {-
-Copyright (C) 2011-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2011-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.SelfContained
-   Copyright   : Copyright (C) 2011-2015 John MacFarlane
+   Copyright   : Copyright (C) 2011-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -135,7 +135,7 @@ pCSSUrl media sourceURL d = P.try $ do
       'd':'a':'t':'a':':':_ -> return fallback
       u ->  do let url' = if isURI u then u else d </> u
                enc <- lift $ getDataURI media sourceURL "" url'
-               return (B.pack enc)
+               return (B.pack $ "url(" ++ enc ++ ")")
 
 
 getDataURI :: MediaBag -> Maybe String -> MimeType -> String
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 58e0658..d6b0883 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -2,7 +2,7 @@
     FlexibleContexts, ScopedTypeVariables, PatternGuards,
     ViewPatterns #-}
 {-
-Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.Shared
-   Copyright   : Copyright (C) 2006-2015 John MacFarlane
+   Copyright   : Copyright (C) 2006-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -110,8 +110,9 @@ import Data.Char ( toLower, isLower, isUpper, isAlpha,
 import Data.List ( find, stripPrefix, intercalate )
 import Data.Version ( showVersion )
 import qualified Data.Map as M
-import Network.URI ( escapeURIString, isURI, nonStrictRelativeTo,
-                     unEscapeString, parseURIReference, isAllowedInURI )
+import Network.URI ( escapeURIString, nonStrictRelativeTo,
+                     unEscapeString, parseURIReference, isAllowedInURI,
+                     parseURI, URI(..) )
 import qualified Data.Set as Set
 import System.Directory
 import System.FilePath (splitDirectories, isPathSeparator)
@@ -129,6 +130,7 @@ import System.IO (stderr)
 import System.IO.Temp
 import Text.HTML.TagSoup (renderTagsOptions, RenderOptions(..), Tag(..),
          renderOptions)
+import Text.Pandoc.Compat.Monoid ((<>))
 import qualified Data.ByteString as BS
 import qualified Data.ByteString.Char8 as B8
 import Data.ByteString.Base64 (decodeLenient)
@@ -373,17 +375,19 @@ isSpaceOrEmpty (Str "") = True
 isSpaceOrEmpty _ = False
 
 -- | Extract the leading and trailing spaces from inside an inline element
--- and place them outside the element.
-
+-- and place them outside the element.  SoftBreaks count as Spaces for
+-- these purposes.
 extractSpaces :: (Inlines -> Inlines) -> Inlines -> Inlines
 extractSpaces f is =
   let contents = B.unMany is
       left  = case viewl contents of
-                    (Space :< _) -> B.space
-                    _            -> mempty
+                    (Space :< _)     -> B.space
+                    (SoftBreak :< _) -> B.softbreak
+                    _                -> mempty
       right = case viewr contents of
-                    (_ :> Space) -> B.space
-                    _            -> mempty in
+                    (_ :> Space)     -> B.space
+                    (_ :> SoftBreak) -> B.softbreak
+                    _                -> mempty in
   (left <> f (B.trimInlines . B.Many $ contents) <> right)
 
 -- | Normalize @Pandoc@ document, consolidating doubled 'Space's,
@@ -450,6 +454,8 @@ normalizeInlines (Str x : ys) =
      isStr _       = False
      fromStr (Str z) = z
      fromStr _       = error "normalizeInlines - fromStr - not a Str"
+normalizeInlines (Space : SoftBreak : ys) =
+  SoftBreak : normalizeInlines ys
 normalizeInlines (Space : ys) =
   if null rest
      then []
@@ -522,10 +528,10 @@ normalizeInlines (Note bs : ys) = Note (normalizeBlocks bs) :
   normalizeInlines ys
 normalizeInlines (Quoted qt ils : ys) =
   Quoted qt (normalizeInlines ils) : normalizeInlines ys
-normalizeInlines (Link ils t : ys) =
-  Link (normalizeInlines ils) t : normalizeInlines ys
-normalizeInlines (Image ils t : ys) =
-  Image (normalizeInlines ils) t : normalizeInlines ys
+normalizeInlines (Link attr ils t : ys) =
+  Link attr (normalizeInlines ils) t : normalizeInlines ys
+normalizeInlines (Image attr ils t : ys) =
+  Image attr (normalizeInlines ils) t : normalizeInlines ys
 normalizeInlines (Cite cs ils : ys) =
   Cite cs (normalizeInlines ils) : normalizeInlines ys
 normalizeInlines (x : xs) = x : normalizeInlines xs
@@ -537,6 +543,7 @@ removeFormatting = query go . walk deNote
   where go :: Inline -> [Inline]
         go (Str xs)     = [Str xs]
         go Space        = [Space]
+        go SoftBreak    = [SoftBreak]
         go (Code _ x)   = [Str x]
         go (Math _ x)   = [Str x]
         go LineBreak    = [Space]
@@ -551,6 +558,7 @@ stringify :: Walkable Inline a => a -> String
 stringify = query go . walk deNote
   where go :: Inline -> [Char]
         go Space = " "
+        go SoftBreak = " "
         go (Str x) = x
         go (Code _ x) = x
         go (Math _ x) = x
@@ -698,14 +706,14 @@ headerLtEq _ _ = False
 
 -- | Generate a unique identifier from a list of inlines.
 -- Second argument is a list of already used identifiers.
-uniqueIdent :: [Inline] -> [String] -> String
+uniqueIdent :: [Inline] -> Set.Set String -> String
 uniqueIdent title' usedIdents
   =  let baseIdent = case inlineListToIdentifier title' of
                         ""   -> "section"
                         x    -> x
          numIdent n = baseIdent ++ "-" ++ show n
-     in  if baseIdent `elem` usedIdents
-           then case find (\x -> numIdent x `notElem` usedIdents) ([1..60000] :: [Int]) of
+     in  if baseIdent `Set.member` usedIdents
+           then case find (\x -> not $ numIdent x `Set.member` usedIdents) ([1..60000] :: [Int]) of
                   Just x  -> numIdent x
                   Nothing -> baseIdent   -- if we have more than 60,000, allow repeats
            else baseIdent
@@ -854,7 +862,6 @@ readDefaultDataFile fname =
 #else
   getDataFileName fname' >>= checkExistence >>= BS.readFile
     where fname' = if fname == "README" then fname else "data" </> fname
-#endif
 
 checkExistence :: FilePath -> IO FilePath
 checkExistence fn = do
@@ -862,6 +869,7 @@ checkExistence fn = do
   if exists
      then return fn
      else err 97 ("Could not find data file " ++ fn)
+#endif
 
 -- | Read file from specified user data directory or, if not found there, from
 -- Cabal data directory.
@@ -878,20 +886,36 @@ readDataFileUTF8 :: Maybe FilePath -> FilePath -> IO String
 readDataFileUTF8 userDir fname =
   UTF8.toString `fmap` readDataFile userDir fname
 
+-- | Specialized version of parseURIReference that disallows
+-- single-letter schemes.  Reason:  these are usually windows absolute
+-- paths.
+parseURIReference' :: String -> Maybe URI
+parseURIReference' s =
+  case parseURIReference s of
+       Just u
+         | length (uriScheme u) > 2  -> Just u
+         | null (uriScheme u)        -> Just u  -- protocol-relative
+       _                             -> Nothing
+
 -- | Fetch an image or other item from the local filesystem or the net.
 -- Returns raw content and maybe mime type.
 fetchItem :: Maybe String -> String
           -> IO (Either E.SomeException (BS.ByteString, Maybe MimeType))
 fetchItem sourceURL s =
-  case (sourceURL >>= parseURIReference . ensureEscaped, ensureEscaped s) of
-       (_, s') | isURI s'  -> openURL s'
+  case (sourceURL >>= parseURIReference' . ensureEscaped, ensureEscaped s) of
        (Just u, s') -> -- try fetching from relative path at source
-          case parseURIReference s' of
+          case parseURIReference' s' of
                Just u' -> openURL $ show $ u' `nonStrictRelativeTo` u
                Nothing -> openURL s' -- will throw error
-       (Nothing, _) -> E.try readLocalFile -- get from local file system
-  where readLocalFile = do
-          cont <- BS.readFile fp
+       (Nothing, s') ->
+          case parseURI s' of  -- requires absolute URI
+               -- We don't want to treat C:/ as a scheme:
+               Just u' | length (uriScheme u') > 2 -> openURL (show u')
+               Just u' | uriScheme u' == "file:" ->
+                    E.try $ readLocalFile $ dropWhile (=='/') (uriPath u')
+               _ -> E.try $ readLocalFile fp -- get from local file system
+  where readLocalFile f = do
+          cont <- BS.readFile f
           return (cont, mime)
         dropFragmentAndQuery = takeWhile (\c -> c /= '?' && c /= '#')
         fp = unEscapeString $ dropFragmentAndQuery s
@@ -899,8 +923,9 @@ fetchItem sourceURL s =
                     ".gz" -> getMimeType $ dropExtension fp
                     ".svgz" -> getMimeType $ dropExtension fp ++ ".svg"
                     x     -> getMimeType x
-        ensureEscaped x@(_:':':'\\':_) = x -- likely windows path
-        ensureEscaped x = escapeURIString isAllowedInURI x
+        ensureEscaped = escapeURIString isAllowedInURI . map convertSlash
+        convertSlash '\\' = '/'
+        convertSlash x    = x
 
 -- | Like 'fetchItem', but also looks for items in a 'MediaBag'.
 fetchItem' :: MediaBag -> Maybe String -> String
@@ -913,9 +938,9 @@ fetchItem' media sourceURL s = do
 -- | Read from a URL and return raw data and maybe mime type.
 openURL :: String -> IO (Either E.SomeException (BS.ByteString, Maybe MimeType))
 openURL u
-  | Just u' <- stripPrefix "data:" u =
-    let mime     = takeWhile (/=',') u'
-        contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u'
+  | Just u'' <- stripPrefix "data:" u =
+    let mime     = takeWhile (/=',') u''
+        contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u''
     in  return $ Right (decodeLenient contents, Just mime)
 #ifdef HTTP_CLIENT
   | otherwise = withSocketsDo $ E.try $ do
diff --git a/src/Text/Pandoc/Slides.hs b/src/Text/Pandoc/Slides.hs
index 878c900..e19dba3 100644
--- a/src/Text/Pandoc/Slides.hs
+++ b/src/Text/Pandoc/Slides.hs
@@ -1,5 +1,5 @@
 {-
-Copyright (C) 2012-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2012-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.Slides
-   Copyright   : Copyright (C) 2012-2015 John MacFarlane
+   Copyright   : Copyright (C) 2012-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -40,7 +40,7 @@ getSlideLevel = go 6
                  | otherwise               = go least (x:xs)
         go least (_ : xs) = go least xs
         go least [] = least
-        nonHOrHR (Header _ _ _) = False
+        nonHOrHR (Header{}) = False
         nonHOrHR (HorizontalRule) = False
         nonHOrHR _ = True
 
diff --git a/src/Text/Pandoc/Templates.hs b/src/Text/Pandoc/Templates.hs
index f366299..9259258 100644
--- a/src/Text/Pandoc/Templates.hs
+++ b/src/Text/Pandoc/Templates.hs
@@ -1,7 +1,7 @@
 {-# LANGUAGE TypeSynonymInstances, FlexibleInstances, CPP,
     OverloadedStrings, GeneralizedNewtypeDeriving #-}
 {-
-Copyright (C) 2009-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2009-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.Templates
-   Copyright   : Copyright (C) 2009-2015 John MacFarlane
+   Copyright   : Copyright (C) 2009-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -98,6 +98,7 @@ import Control.Monad (guard, when)
 import Data.Aeson (ToJSON(..), Value(..))
 import qualified Text.Parsec as P
 import Text.Parsec.Text (Parser)
+import Text.Pandoc.Compat.Monoid ((<>))
 import qualified Data.Text as T
 import Data.Text (Text)
 import Data.Text.Encoding (encodeUtf8)
diff --git a/src/Text/Pandoc/UTF8.hs b/src/Text/Pandoc/UTF8.hs
index de3314a..87ed531 100644
--- a/src/Text/Pandoc/UTF8.hs
+++ b/src/Text/Pandoc/UTF8.hs
@@ -1,6 +1,6 @@
 {-# LANGUAGE CPP #-}
 {-
-Copyright (C) 2010-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2010-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.UTF8
-   Copyright   : Copyright (C) 2010-2015 John MacFarlane
+   Copyright   : Copyright (C) 2010-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
diff --git a/src/Text/Pandoc/UUID.hs b/src/Text/Pandoc/UUID.hs
index 463be04..5d05fa3 100644
--- a/src/Text/Pandoc/UUID.hs
+++ b/src/Text/Pandoc/UUID.hs
@@ -1,5 +1,5 @@
 {-
-Copyright (C) 2010-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2010-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.UUID
-   Copyright   : Copyright (C) 2010-2015 John MacFarlane
+   Copyright   : Copyright (C) 2010-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs
index c3406f3..4ac6aa0 100644
--- a/src/Text/Pandoc/Writers/AsciiDoc.hs
+++ b/src/Text/Pandoc/Writers/AsciiDoc.hs
@@ -46,6 +46,7 @@ import Text.Pandoc.Parsing hiding (blankline, space)
 import Data.Maybe (fromMaybe)
 import Data.List ( stripPrefix, intersperse, intercalate )
 import Text.Pandoc.Pretty
+import Text.Pandoc.ImageSize
 import Control.Monad.State
 import qualified Data.Map as M
 import Data.Aeson (Value(String), fromJSON, toJSON, Result(..))
@@ -72,7 +73,7 @@ pandocToAsciiDoc :: WriterOptions -> Pandoc -> State WriterState String
 pandocToAsciiDoc opts (Pandoc meta blocks) = do
   let titleblock = not $ null (docTitle meta) && null (docAuthors meta) &&
                          null (docDate meta)
-  let colwidth = if writerWrapText opts
+  let colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
   metadata <- metaToJSON opts
@@ -126,8 +127,8 @@ blockToAsciiDoc _ Null = return empty
 blockToAsciiDoc opts (Plain inlines) = do
   contents <- inlineListToAsciiDoc opts inlines
   return $ contents <> blankline
-blockToAsciiDoc opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do
-  blockToAsciiDoc opts (Para [Image alt (src,tit)])
+blockToAsciiDoc opts (Para [Image attr alt (src,'f':'i':'g':':':tit)]) = do
+  blockToAsciiDoc opts (Para [Image attr alt (src,tit)])
 blockToAsciiDoc opts (Para inlines) = do
   contents <- inlineListToAsciiDoc opts inlines
   -- escape if para starts with ordered list marker
@@ -159,13 +160,12 @@ blockToAsciiDoc opts (Header level (ident,_,_) inlines) = do
                _  -> empty) <> blankline
             else
               identifier $$ text (replicate level '=') <> space <> contents <> blankline)
-blockToAsciiDoc _ (CodeBlock (_,classes,_) str) = return $
-  flush (attrs <> dashes <> space <> attrs <> cr <> text str <>
-           cr <> dashes) <> blankline
-     where dashes  = text $ replicate (maximum $ map length $ lines str) '-'
-           attrs = if null classes
-                      then empty
-                      else text $ intercalate "," $ "code" : classes
+blockToAsciiDoc _ (CodeBlock (_,classes,_) str) = return $ (flush $
+  if null classes
+     then "...." $$ text str $$ "...."
+     else attrs $$ "----" $$ text str $$ "----")
+  <> blankline
+    where attrs = "[" <> text (intercalate "," ("source" : classes)) <> "]"
 blockToAsciiDoc opts (BlockQuote blocks) = do
   contents <- blockListToAsciiDoc opts blocks
   let isBlock (BlockQuote _) = True
@@ -227,7 +227,7 @@ blockToAsciiDoc opts (Table caption aligns widths headers rows) =  do
   rows' <- mapM makeRow rows
   head' <- makeRow headers
   let head'' = if all null headers then empty else head'
-  let colwidth = if writerWrapText opts
+  let colwidth = if writerWrapText opts == WrapAuto
                     then writerColumns opts
                     else 100000
   let maxwidth = maximum $ map offset (head':rows')
@@ -253,7 +253,10 @@ blockToAsciiDoc opts (OrderedList (_start, sty, _delim) items) = do
 blockToAsciiDoc opts (DefinitionList items) = do
   contents <- mapM (definitionListItemToAsciiDoc opts) items
   return $ cat contents <> blankline
-blockToAsciiDoc opts (Div _ bs) = blockListToAsciiDoc opts bs
+blockToAsciiDoc opts (Div (ident,_,_) bs) = do
+  let identifier = if (null ident) then empty else ("[[" <> text ident <> "]]")
+  contents <- blockListToAsciiDoc opts bs
+  return $ identifier $$ contents
 
 -- | Convert bullet list item (list of blocks) to asciidoc.
 bulletListItemToAsciiDoc :: WriterOptions -> [Block] -> State WriterState Doc
@@ -335,7 +338,7 @@ inlineListToAsciiDoc opts lst = do
            x' <- withIntraword $ inlineToAsciiDoc opts x
            xs' <- go xs
            return (y' <> x' <> xs')
-         | x /= Space && x /= LineBreak = do
+         | not (isSpacy x) = do
            y' <- withIntraword $ inlineToAsciiDoc opts y
            xs' <- go (x:xs)
            return (y' <> xs')
@@ -345,6 +348,7 @@ inlineListToAsciiDoc opts lst = do
            return (x' <> xs')
        isSpacy Space = True
        isSpacy LineBreak = True
+       isSpacy SoftBreak = True
        isSpacy _ = False
 
 setIntraword :: Bool -> State WriterState ()
@@ -391,8 +395,13 @@ inlineToAsciiDoc _ (RawInline f s)
   | otherwise       = return empty
 inlineToAsciiDoc _ (LineBreak) = return $ " +" <> cr
 inlineToAsciiDoc _ Space = return space
+inlineToAsciiDoc opts SoftBreak =
+  case writerWrapText opts of
+       WrapAuto -> return space
+       WrapPreserve -> return cr
+       WrapNone -> return space
 inlineToAsciiDoc opts (Cite _ lst) = inlineListToAsciiDoc opts lst
-inlineToAsciiDoc opts (Link txt (src, _tit)) = do
+inlineToAsciiDoc opts (Link _ txt (src, _tit)) = do
 -- relative:  link:downloads/foo.zip[download foo.zip]
 -- abs:  http://google.cod[Google]
 -- or my@email.com[email john]
@@ -408,7 +417,7 @@ inlineToAsciiDoc opts (Link txt (src, _tit)) = do
   return $ if useAuto
               then text srcSuffix
               else prefix <> text src <> "[" <> linktext <> "]"
-inlineToAsciiDoc opts (Image alternate (src, tit)) = do
+inlineToAsciiDoc opts (Image attr alternate (src, tit)) = do
 -- image:images/logo.png[Company logo, title="blah"]
   let txt = if (null alternate) || (alternate == [Str ""])
                then [Str "image"]
@@ -416,8 +425,19 @@ inlineToAsciiDoc opts (Image alternate (src, tit)) = do
   linktext <- inlineListToAsciiDoc opts txt
   let linktitle = if null tit
                      then empty
-                     else text $ ",title=\"" ++ tit ++ "\""
-  return $ "image:" <> text src <> "[" <> linktext <> linktitle <> "]"
+                     else ",title=\"" <> text tit <> "\""
+      showDim dir = case (dimension dir attr) of
+                      Just (Percent a) ->
+                        ["scaledwidth=" <> text (show (Percent a))]
+                      Just dim         ->
+                        [text (show dir) <> "=" <> text (showInPixel opts dim)]
+                      Nothing          ->
+                        []
+      dimList = showDim Width ++ showDim Height
+      dims = if null dimList
+                then empty
+                else "," <> cat (intersperse "," dimList)
+  return $ "image:" <> text src <> "[" <> linktext <> linktitle <> dims <> "]"
 inlineToAsciiDoc opts (Note [Para inlines]) =
   inlineToAsciiDoc opts (Note [Plain inlines])
 inlineToAsciiDoc opts (Note [Plain inlines]) = do
@@ -425,4 +445,8 @@ inlineToAsciiDoc opts (Note [Plain inlines]) = do
   return $ text "footnote:[" <> contents <> "]"
 -- asciidoc can't handle blank lines in notes
 inlineToAsciiDoc _ (Note _) = return "[multiblock footnote omitted]"
-inlineToAsciiDoc opts (Span _ ils) = inlineListToAsciiDoc opts ils
+inlineToAsciiDoc opts (Span (ident,_,_) ils) = do
+  let identifier = if (null ident) then empty else ("[[" <> text ident <> "]]")
+  contents <- inlineListToAsciiDoc opts ils
+  return $ identifier <> contents
+
diff --git a/src/Text/Pandoc/Writers/CommonMark.hs b/src/Text/Pandoc/Writers/CommonMark.hs
index fee36d4..262f491 100644
--- a/src/Text/Pandoc/Writers/CommonMark.hs
+++ b/src/Text/Pandoc/Writers/CommonMark.hs
@@ -75,7 +75,7 @@ blocksToCommonMark opts bs = return $
   T.unpack $ nodeToCommonmark cmarkOpts colwidth
            $ node DOCUMENT (blocksToNodes bs)
    where cmarkOpts = [optHardBreaks | isEnabled Ext_hard_line_breaks opts]
-         colwidth = if writerWrapText opts
+         colwidth = if writerWrapText opts == WrapAuto
                        then Just $ writerColumns opts
                        else Nothing
 
@@ -84,7 +84,7 @@ inlinesToCommonMark opts ils = return $
   T.unpack $ nodeToCommonmark cmarkOpts colwidth
            $ node PARAGRAPH (inlinesToNodes ils)
    where cmarkOpts = [optHardBreaks | isEnabled Ext_hard_line_breaks opts]
-         colwidth = if writerWrapText opts
+         colwidth = if writerWrapText opts == WrapAuto
                        then Just $ writerColumns opts
                        else Nothing
 
@@ -97,8 +97,8 @@ blockToNodes (Para xs) = (node PARAGRAPH (inlinesToNodes xs) :)
 blockToNodes (CodeBlock (_,classes,_) xs) =
   (node (CODE_BLOCK (T.pack (unwords classes)) (T.pack xs)) [] :)
 blockToNodes (RawBlock fmt xs)
-  | fmt == Format "html" = (node (HTML (T.pack xs)) [] :)
-  | otherwise = id
+  | fmt == Format "html" = (node (HTML_BLOCK (T.pack xs)) [] :)
+  | otherwise = (node (CUSTOM_BLOCK (T.pack xs) (T.empty)) [] :)
 blockToNodes (BlockQuote bs) =
   (node BLOCK_QUOTE (blocksToNodes bs) :)
 blockToNodes (BulletList items) =
@@ -116,8 +116,8 @@ blockToNodes (OrderedList (start, _sty, delim) items) =
                                 _         -> PERIOD_DELIM,
                listTight = isTightList items,
                listStart = start }) (map (node ITEM . blocksToNodes) items) :)
-blockToNodes HorizontalRule = (node HRULE [] :)
-blockToNodes (Header lev _ ils) = (node (HEADER lev) (inlinesToNodes ils) :)
+blockToNodes HorizontalRule = (node THEMATIC_BREAK [] :)
+blockToNodes (Header lev _ ils) = (node (HEADING lev) (inlinesToNodes ils) :)
 blockToNodes (Div _ bs) = (blocksToNodes bs ++)
 blockToNodes (DefinitionList items) = blockToNodes (BulletList items')
   where items' = map dlToBullet items
@@ -128,7 +128,7 @@ blockToNodes (DefinitionList items) = blockToNodes (BulletList items')
         dlToBullet (term, xs) =
           Para term : concat xs
 blockToNodes t@(Table _ _ _ _ _) =
-  (node (HTML (T.pack $! writeHtmlString def $! Pandoc nullMeta [t])) [] :)
+  (node (HTML_BLOCK (T.pack $! writeHtmlString def $! Pandoc nullMeta [t])) [] :)
 blockToNodes Null = id
 
 inlinesToNodes :: [Inline] -> [Node]
@@ -138,28 +138,29 @@ inlineToNodes :: Inline -> [Node] -> [Node]
 inlineToNodes (Str s) = (node (TEXT (T.pack s)) [] :)
 inlineToNodes Space   = (node (TEXT (T.pack " ")) [] :)
 inlineToNodes LineBreak = (node LINEBREAK [] :)
+inlineToNodes SoftBreak = (node SOFTBREAK [] :)
 inlineToNodes (Emph xs) = (node EMPH (inlinesToNodes xs) :)
 inlineToNodes (Strong xs) = (node STRONG (inlinesToNodes xs) :)
 inlineToNodes (Strikeout xs) =
-  ((node (INLINE_HTML (T.pack "<s>")) [] : inlinesToNodes xs ++
-   [node (INLINE_HTML (T.pack "</s>")) []]) ++ )
+  ((node (HTML_INLINE (T.pack "<s>")) [] : inlinesToNodes xs ++
+   [node (HTML_INLINE (T.pack "</s>")) []]) ++ )
 inlineToNodes (Superscript xs) =
-  ((node (INLINE_HTML (T.pack "<sup>")) [] : inlinesToNodes xs ++
-   [node (INLINE_HTML (T.pack "</sup>")) []]) ++ )
+  ((node (HTML_INLINE (T.pack "<sup>")) [] : inlinesToNodes xs ++
+   [node (HTML_INLINE (T.pack "</sup>")) []]) ++ )
 inlineToNodes (Subscript xs) =
-  ((node (INLINE_HTML (T.pack "<sub>")) [] : inlinesToNodes xs ++
-   [node (INLINE_HTML (T.pack "</sub>")) []]) ++ )
+  ((node (HTML_INLINE (T.pack "<sub>")) [] : inlinesToNodes xs ++
+   [node (HTML_INLINE (T.pack "</sub>")) []]) ++ )
 inlineToNodes (SmallCaps xs) =
-  ((node (INLINE_HTML (T.pack "<span style=\"font-variant:small-caps;\">")) []
+  ((node (HTML_INLINE (T.pack "<span style=\"font-variant:small-caps;\">")) []
     : inlinesToNodes xs ++
-    [node (INLINE_HTML (T.pack "</span>")) []]) ++ )
-inlineToNodes (Link ils (url,tit)) =
+    [node (HTML_INLINE (T.pack "</span>")) []]) ++ )
+inlineToNodes (Link _ ils (url,tit)) =
   (node (LINK (T.pack url) (T.pack tit)) (inlinesToNodes ils) :)
-inlineToNodes (Image ils (url,tit)) =
+inlineToNodes (Image _ ils (url,tit)) =
   (node (IMAGE (T.pack url) (T.pack tit)) (inlinesToNodes ils) :)
 inlineToNodes (RawInline fmt xs)
-  | fmt == Format "html" = (node (INLINE_HTML (T.pack xs)) [] :)
-  | otherwise = id
+  | fmt == Format "html" = (node (HTML_INLINE (T.pack xs)) [] :)
+  | otherwise = (node (CUSTOM_INLINE (T.pack xs) (T.empty)) [] :)
 inlineToNodes (Quoted qt ils) =
   ((node (TEXT start) [] : inlinesToNodes ils ++ [node (TEXT end) []]) ++)
   where (start, end) = case qt of
@@ -169,9 +170,9 @@ inlineToNodes (Code _ str) = (node (CODE (T.pack str)) [] :)
 inlineToNodes (Math mt str) =
   case mt of
     InlineMath  ->
-      (node (INLINE_HTML (T.pack ("\\(" ++ str ++ "\\)"))) [] :)
+      (node (HTML_INLINE (T.pack ("\\(" ++ str ++ "\\)"))) [] :)
     DisplayMath ->
-      (node (INLINE_HTML (T.pack ("\\[" ++ str ++ "\\]"))) [] :)
+      (node (HTML_INLINE (T.pack ("\\[" ++ str ++ "\\]"))) [] :)
 inlineToNodes (Span _ ils) = (inlinesToNodes ils ++)
 inlineToNodes (Cite _ ils) = (inlinesToNodes ils ++)
 inlineToNodes (Note _) = id -- should not occur
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 7d3830a..8d54d62 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -35,10 +35,12 @@ import Text.Pandoc.Writers.Shared
 import Text.Pandoc.Options
 import Text.Pandoc.Walk (query)
 import Text.Printf ( printf )
-import Data.List ( intercalate )
+import Data.List ( intercalate, intersperse )
 import Data.Char ( ord )
+import Data.Maybe ( catMaybes )
 import Control.Monad.State
 import Text.Pandoc.Pretty
+import Text.Pandoc.ImageSize
 import Text.Pandoc.Templates ( renderTemplate' )
 import Network.URI ( isURI, unEscapeString )
 
@@ -62,7 +64,7 @@ writeConTeXt options document =
 
 pandocToConTeXt :: WriterOptions -> Pandoc -> State WriterState String
 pandocToConTeXt options (Pandoc meta blocks) = do
-  let colwidth = if writerWrapText options
+  let colwidth = if writerWrapText options == WrapAuto
                     then Just $ writerColumns options
                     else Nothing
   metadata <- metaToJSON options
@@ -71,6 +73,14 @@ pandocToConTeXt options (Pandoc meta blocks) = do
               meta
   body <- mapM (elementToConTeXt options) $ hierarchicalize blocks
   let main = (render colwidth . vcat) body
+  let layoutFromMargins = intercalate [','] $ catMaybes $
+                              map (\(x,y) ->
+                                ((x ++ "=") ++) <$> getField y metadata)
+                              [("leftmargin","margin-left")
+                              ,("rightmargin","margin-right")
+                              ,("top","margin-top")
+                              ,("bottom","margin-bottom")
+                              ]
   let context =   defField "toc" (writerTableOfContents options)
                 $ defField "placelist" (intercalate ("," :: String) $
                      take (writerTOCDepth options + if writerChapters options
@@ -79,6 +89,7 @@ pandocToConTeXt options (Pandoc meta blocks) = do
                        ["chapter","section","subsection","subsubsection",
                         "subsubsubsection","subsubsubsubsection"])
                 $ defField "body" main
+                $ defField "layout" layoutFromMargins
                 $ defField "number-sections" (writerNumberSections options)
                 $ metadata
   let context' =  defField "context-lang" (maybe "" (fromBcp47 . splitBy (=='-')) $
@@ -141,10 +152,14 @@ blockToConTeXt :: Block
 blockToConTeXt Null = return empty
 blockToConTeXt (Plain lst) = inlineListToConTeXt lst
 -- title beginning with fig: indicates that the image is a figure
-blockToConTeXt (Para [Image txt (src,'f':'i':'g':':':_)]) = do
+blockToConTeXt (Para [Image attr txt (src,'f':'i':'g':':':_)]) = do
   capt <- inlineListToConTeXt txt
-  return $ blankline $$ "\\placefigure" <> braces capt <>
-           braces ("\\externalfigure" <> brackets (text src)) <> blankline
+  img  <- inlineToConTeXt (Image attr txt (src, ""))
+  let (ident, _, _) = attr
+      label = if null ident
+                 then empty
+                 else "[]" <> brackets (text $ toLabel ident)
+  return $ blankline $$ "\\placefigure" <> label <> braces capt <> img <> blankline
 blockToConTeXt (Para lst) = do
   contents <- inlineListToConTeXt lst
   return $ contents <> blankline
@@ -157,17 +172,21 @@ blockToConTeXt (CodeBlock _ str) =
 blockToConTeXt (RawBlock "context" str) = return $ text str <> blankline
 blockToConTeXt (RawBlock _ _ ) = return empty
 blockToConTeXt (Div (ident,_,kvs) bs) = do
-  contents <- blockListToConTeXt bs
-  let contents' = if null ident
-                     then contents
-                     else ("\\reference" <> brackets (text $ toLabel ident) <>
-                            braces empty <> "%") $$ contents
-  let align dir = blankline <> "\\startalignment[" <> dir <> "]"
-                    $$ contents' $$ "\\stopalignment" <> blankline
-  return $ case lookup "dir" kvs of
-             Just "rtl" -> align "righttoleft"
-             Just "ltr" -> align "lefttoright"
-             _          -> contents'
+  let align dir txt = "\\startalignment[" <> dir <> "]" $$ txt $$ "\\stopalignment"
+  let wrapRef txt = if null ident
+                       then txt
+                       else ("\\reference" <> brackets (text $ toLabel ident) <>
+                              braces empty <> "%") $$ txt
+      wrapDir = case lookup "dir" kvs of
+                  Just "rtl" -> align "righttoleft"
+                  Just "ltr" -> align "lefttoright"
+                  _          -> id
+      wrapLang txt = case lookup "lang" kvs of
+                       Just lng -> "\\start\\language["
+                                     <> text (fromBcp47' lng) <> "]" $$ txt $$ "\\stop"
+                       Nothing  -> txt
+      wrapBlank txt = blankline <> txt <> blankline
+  fmap (wrapBlank . wrapLang . wrapDir . wrapRef) $ blockListToConTeXt bs
 blockToConTeXt (BulletList lst) = do
   contents <- mapM listItemToConTeXt lst
   return $ ("\\startitemize" <> if isTightList lst
@@ -260,7 +279,17 @@ blockListToConTeXt lst = liftM vcat $ mapM blockToConTeXt lst
 -- | Convert list of inline elements to ConTeXt.
 inlineListToConTeXt :: [Inline]  -- ^ Inlines to convert
                     -> State WriterState Doc
-inlineListToConTeXt lst = liftM hcat $ mapM inlineToConTeXt lst
+inlineListToConTeXt lst = liftM hcat $ mapM inlineToConTeXt $ addStruts lst
+  -- We add a \strut after a line break that precedes a space,
+  -- or the space gets swallowed
+  where addStruts (LineBreak : s : xs) | isSpacey s =
+           LineBreak : RawInline (Format "context") "\\strut " : s :
+             addStruts xs
+        addStruts (x:xs) = x : addStruts xs
+        addStruts [] = []
+        isSpacey Space = True
+        isSpacey (Str ('\160':_)) = True
+        isSpacey _ = False
 
 -- | Convert inline element to ConTeXt
 inlineToConTeXt :: Inline    -- ^ Inline to convert
@@ -306,9 +335,15 @@ inlineToConTeXt (RawInline "context" str) = return $ text str
 inlineToConTeXt (RawInline "tex" str) = return $ text str
 inlineToConTeXt (RawInline _ _) = return empty
 inlineToConTeXt (LineBreak) = return $ text "\\crlf" <> cr
+inlineToConTeXt SoftBreak = do
+  wrapText <- gets (writerWrapText . stOptions)
+  return $ case wrapText of
+               WrapAuto     -> space
+               WrapNone     -> space
+               WrapPreserve -> cr
 inlineToConTeXt Space = return space
 -- Handle HTML-like internal document references to sections
-inlineToConTeXt (Link txt          (('#' : ref), _)) = do
+inlineToConTeXt (Link _ txt (('#' : ref), _)) = do
   opts <- gets stOptions
   contents <-  inlineListToConTeXt txt
   let ref' = toLabel $ stringToConTeXt opts ref
@@ -316,7 +351,7 @@ inlineToConTeXt (Link txt          (('#' : ref), _)) = do
            <> braces contents
            <> brackets (text ref')
 
-inlineToConTeXt (Link txt          (src, _))      = do
+inlineToConTeXt (Link _ txt (src, _)) = do
   let isAutolink = txt == [Str (unEscapeString src)]
   st <- get
   let next = stNextRef st
@@ -331,11 +366,29 @@ inlineToConTeXt (Link txt          (src, _))      = do
                   else brackets empty <> brackets contents)
            <> "\\from"
            <> brackets (text ref)
-inlineToConTeXt (Image _ (src, _)) = do
-  let src' = if isURI src
+inlineToConTeXt (Image attr@(_,cls,_) _ (src, _)) = do
+  opts <- gets stOptions
+  let showDim dir = let d = text (show dir) <> "="
+                    in case (dimension dir attr) of
+                         Just (Pixel a)   ->
+                           [d <> text (showInInch opts (Pixel a)) <> "in"]
+                         Just (Percent a) ->
+                           [d <> text (showFl (a / 100)) <> "\\textwidth"]
+                         Just dim         ->
+                           [d <> text (show dim)]
+                         Nothing          ->
+                           []
+      dimList = showDim Width ++ showDim Height
+      dims = if null dimList
+                then empty
+                else brackets $ cat (intersperse "," dimList)
+      clas = if null cls
+                then empty
+                else brackets $ text $ toLabel $ head cls
+      src' = if isURI src
                 then src
                 else unEscapeString src
-  return $ braces $ "\\externalfigure" <> brackets (text src')
+  return $ braces $ "\\externalfigure" <> brackets (text src') <> dims <> clas
 inlineToConTeXt (Note contents) = do
   contents' <- blockListToConTeXt contents
   let codeBlock x@(CodeBlock _ _) = [x]
@@ -346,11 +399,15 @@ inlineToConTeXt (Note contents) = do
               else text "\\startbuffer " <> nest 2 contents' <>
                    text "\\stopbuffer\\footnote{\\getbuffer}"
 inlineToConTeXt (Span (_,_,kvs) ils) = do
-  contents <- inlineListToConTeXt ils
-  return $ case lookup "dir" kvs of
-             Just "rtl" -> braces $ "\\righttoleft " <> contents
-             Just "ltr" -> braces $ "\\lefttoright " <> contents
-             _          -> contents
+  let wrapDir txt = case lookup "dir" kvs of
+                      Just "rtl" -> braces $ "\\righttoleft " <> txt
+                      Just "ltr" -> braces $ "\\lefttoright " <> txt
+                      _          -> txt
+      wrapLang txt = case lookup "lang" kvs of
+                       Just lng -> "\\start\\language[" <> text (fromBcp47' lng)
+                                      <> "]" <> txt <> "\\stop "
+                       Nothing -> txt
+  fmap (wrapLang . wrapDir) $ inlineListToConTeXt ils
 
 -- | Craft the section header, inserting the secton reference, if supplied.
 sectionHeader :: Attr
@@ -377,6 +434,9 @@ sectionHeader (ident,classes,_) hdrLevel lst = do
                        then char '\\' <> chapter <> braces contents
                        else contents <> blankline
 
+fromBcp47' :: String -> String
+fromBcp47' = fromBcp47 . splitBy (=='-')
+
 -- Takes a list of the constituents of a BCP 47 language code
 -- and irons out ConTeXt's exceptions
 -- https://tools.ietf.org/html/bcp47#section-2.1
@@ -399,7 +459,6 @@ fromBcp47 ("en":"GB":_)   = "en-gb"
 fromBcp47 ("grc":_)       = "agr"
 fromBcp47 x               = fromIso $ head x
   where
-    fromIso "cz" = "cs"
     fromIso "el" = "gr"
     fromIso "eu" = "ba"
     fromIso "he" = "il"
diff --git a/src/Text/Pandoc/Writers/Custom.hs b/src/Text/Pandoc/Writers/Custom.hs
index 8b7dde3..d69eaaa 100644
--- a/src/Text/Pandoc/Writers/Custom.hs
+++ b/src/Text/Pandoc/Writers/Custom.hs
@@ -222,8 +222,8 @@ blockToCustom _ Null = return ""
 
 blockToCustom lua (Plain inlines) = callfunc lua "Plain" inlines
 
-blockToCustom lua (Para [Image txt (src,tit)]) =
-  callfunc lua "CaptionedImage" src tit txt
+blockToCustom lua (Para [Image attr txt (src,tit)]) =
+  callfunc lua "CaptionedImage" src tit txt (attrToMap attr)
 
 blockToCustom lua (Para inlines) = callfunc lua "Para" inlines
 
@@ -276,6 +276,8 @@ inlineToCustom lua (Str str) = callfunc lua "Str" str
 
 inlineToCustom lua Space = callfunc lua "Space"
 
+inlineToCustom lua SoftBreak = callfunc lua "SoftBreak"
+
 inlineToCustom lua (Emph lst) = callfunc lua "Emph" lst
 
 inlineToCustom lua (Strong lst) = callfunc lua "Strong" lst
@@ -308,11 +310,11 @@ inlineToCustom lua (RawInline format str) =
 
 inlineToCustom lua (LineBreak) = callfunc lua "LineBreak"
 
-inlineToCustom lua (Link txt (src,tit)) =
-  callfunc lua "Link" txt src tit
+inlineToCustom lua (Link attr txt (src,tit)) =
+  callfunc lua "Link" txt src tit (attrToMap attr)
 
-inlineToCustom lua (Image alt (src,tit)) =
-  callfunc lua "Image" alt src tit
+inlineToCustom lua (Image attr alt (src,tit)) =
+  callfunc lua "Image" alt src tit (attrToMap attr)
 
 inlineToCustom lua (Note contents) = callfunc lua "Note" contents
 
diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs
index 8f9eece..2aaebf9 100644
--- a/src/Text/Pandoc/Writers/Docbook.hs
+++ b/src/Text/Pandoc/Writers/Docbook.hs
@@ -42,6 +42,7 @@ import Data.Char ( toLower )
 import Data.Monoid ( Any(..) )
 import Text.Pandoc.Highlighting ( languages, languagesByExtension )
 import Text.Pandoc.Pretty
+import Text.Pandoc.ImageSize
 import qualified Text.Pandoc.Builder as B
 import Text.TeXMath
 import qualified Text.XML.Light as Xml
@@ -51,7 +52,7 @@ import Data.Generics (everywhere, mkT)
 authorToDocbook :: WriterOptions -> [Inline] -> B.Inlines
 authorToDocbook opts name' =
   let name = render Nothing $ inlinesToDocbook opts name'
-      colwidth = if writerWrapText opts
+      colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
   in  B.rawInline "docbook" $ render colwidth $
@@ -75,7 +76,7 @@ authorToDocbook opts name' =
 writeDocbook :: WriterOptions -> Pandoc -> String
 writeDocbook opts (Pandoc meta blocks) =
   let elements = hierarchicalize blocks
-      colwidth = if writerWrapText opts
+      colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
       render' = render colwidth
@@ -150,6 +151,15 @@ listItemToDocbook :: WriterOptions -> [Block] -> Doc
 listItemToDocbook opts item =
   inTagsIndented "listitem" $ blocksToDocbook opts $ map plainToPara item
 
+imageToDocbook :: WriterOptions -> Attr -> String -> Doc
+imageToDocbook _ attr src = selfClosingTag "imagedata" $
+  ("fileref", src) : idAndRole attr ++ dims
+  where
+    dims = go Width "width" ++ go Height "depth"
+    go dir dstr = case (dimension dir attr) of
+                    Just a  -> [(dstr, show a)]
+                    Nothing -> []
+
 -- | Convert a Pandoc block element to Docbook.
 blockToDocbook :: WriterOptions -> Block -> Doc
 blockToDocbook _ Null = empty
@@ -165,7 +175,7 @@ blockToDocbook opts (Div _ bs) = blocksToDocbook opts $ map plainToPara bs
 blockToDocbook _ (Header _ _ _) = empty -- should not occur after hierarchicalize
 blockToDocbook opts (Plain lst) = inlinesToDocbook opts lst
 -- title beginning with fig: indicates that the image is a figure
-blockToDocbook opts (Para [Image txt (src,'f':'i':'g':':':_)]) =
+blockToDocbook opts (Para [Image attr txt (src,'f':'i':'g':':':_)]) =
   let alt  = inlinesToDocbook opts txt
       capt = if null txt
                 then empty
@@ -174,7 +184,7 @@ blockToDocbook opts (Para [Image txt (src,'f':'i':'g':':':_)]) =
         capt $$
         (inTagsIndented "mediaobject" $
            (inTagsIndented "imageobject"
-             (selfClosingTag "imagedata" [("fileref",src)])) $$
+             (imageToDocbook opts attr src)) $$
            inTagsSimple "textobject" (inTagsSimple "phrase" alt))
 blockToDocbook opts (Para lst)
   | hasLineBreaks lst = flush $ nowrap $ inTagsSimple "literallayout" $ inlinesToDocbook opts lst
@@ -321,7 +331,9 @@ inlineToDocbook _ (RawInline f x) | f == "html" || f == "docbook" = text x
                                   | otherwise                     = empty
 inlineToDocbook _ LineBreak = text "\n"
 inlineToDocbook _ Space = space
-inlineToDocbook opts (Link txt (src, _))
+-- because we use \n for LineBreak, we can't do soft breaks:
+inlineToDocbook _ SoftBreak = space
+inlineToDocbook opts (Link attr txt (src, _))
   | Just email <- stripPrefix "mailto:" src =
       let emailLink = inTagsSimple "email" $ text $
                       escapeStringForXML $ email
@@ -331,19 +343,30 @@ inlineToDocbook opts (Link txt (src, _))
                               char '(' <> emailLink <> char ')'
   | otherwise =
       (if isPrefixOf "#" src
-            then inTags False "link" [("linkend", drop 1 src)]
-            else inTags False "ulink" [("url", src)]) $
+            then inTags False "link" $ ("linkend", drop 1 src) : idAndRole attr
+            else inTags False "ulink" $ ("url", src) : idAndRole attr ) $
         inlinesToDocbook opts txt
-inlineToDocbook _ (Image _ (src, tit)) =
+inlineToDocbook opts (Image attr _ (src, tit)) =
   let titleDoc = if null tit
                    then empty
                    else inTagsIndented "objectinfo" $
                         inTagsIndented "title" (text $ escapeStringForXML tit)
   in  inTagsIndented "inlinemediaobject" $ inTagsIndented "imageobject" $
-      titleDoc $$ selfClosingTag "imagedata" [("fileref", src)]
+      titleDoc $$ imageToDocbook opts attr src
 inlineToDocbook opts (Note contents) =
   inTagsIndented "footnote" $ blocksToDocbook opts contents
 
 isMathML :: HTMLMathMethod -> Bool
 isMathML (MathML _) = True
 isMathML _          = False
+
+idAndRole :: Attr -> [(String, String)]
+idAndRole (id',cls,_) = ident ++ role
+  where
+    ident = if null id'
+               then []
+               else [("id", id')]
+    role  = if null cls
+               then []
+               else [("role", unwords cls)]
+
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 639818f..a841e1b 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -34,6 +34,7 @@ import qualified Data.ByteString as B
 import qualified Data.ByteString.Lazy as BL
 import qualified Data.ByteString.Lazy.Char8 as BL8
 import qualified Data.Map as M
+import qualified Data.Set as Set
 import qualified Text.Pandoc.UTF8 as UTF8
 import Codec.Archive.Zip
 import Data.Time.Clock.POSIX
@@ -60,6 +61,7 @@ import Data.Unique (hashUnique, newUnique)
 import System.Random (randomRIO)
 import Text.Printf (printf)
 import qualified Control.Exception as E
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Pandoc.MIME (MimeType, getMimeType, getMimeTypeDef,
                          extensionFromMimeType)
 import Control.Applicative ((<|>))
@@ -94,7 +96,7 @@ data WriterState = WriterState{
          stTextProperties :: [Element]
        , stParaProperties :: [Element]
        , stFootnotes      :: [Element]
-       , stSectionIds     :: [String]
+       , stSectionIds     :: Set.Set String
        , stExternalLinks  :: M.Map String String
        , stImages         :: M.Map FilePath (String, String, Maybe MimeType, Element, B.ByteString)
        , stListLevel      :: Int
@@ -116,7 +118,7 @@ defaultWriterState = WriterState{
         stTextProperties = []
       , stParaProperties = []
       , stFootnotes      = defaultFootnotes
-      , stSectionIds     = []
+      , stSectionIds     = Set.empty
       , stExternalLinks  = M.empty
       , stImages         = M.empty
       , stListLevel      = -1
@@ -244,7 +246,7 @@ writeDocx opts doc@(Pandoc meta _) = do
   let tocTitle = fromMaybe (stTocTitle defaultWriterState) $
                     metaValueToInlines <$> lookupMeta "toc-title" meta
 
-  ((contents, footnotes), st) <- runStateT (writeOpenXML opts{writerWrapText = False} doc')
+  ((contents, footnotes), st) <- runStateT (writeOpenXML opts{writerWrapText = WrapNone} doc')
                        defaultWriterState{ stChangesAuthor = fromMaybe "unknown" username
                                          , stChangesDate   = formatTime defaultTimeLocale "%FT%XZ" utctime
                                          , stPrintWidth = (maybe 420 (\x -> quot x 20) pgContentWidth)
@@ -535,7 +537,6 @@ styleToOpenXml sm style =
                              , mknode "w:link" [("w:val","VerbatimChar")] ()
                              , mknode "w:pPr" []
                                $ mknode "w:wordWrap" [("w:val","off")] ()
-                               : mknode "w:noProof" [] ()
                                : ( maybe [] (\col -> [mknode "w:shd" [("w:val","clear"),("w:fill",drop 1 $ fromColor col)] ()])
                                  $ backgroundColor style )
                              ]
@@ -742,7 +743,7 @@ blockToOpenXML opts (Header lev (ident,_,_) lst) = do
   let bookmarkName = if null ident
                         then uniqueIdent lst usedIdents
                         else ident
-  modify $ \s -> s{ stSectionIds = bookmarkName : stSectionIds s }
+  modify $ \s -> s{ stSectionIds = Set.insert bookmarkName $ stSectionIds s }
   id' <- getUniqueId
   let bookmarkStart = mknode "w:bookmarkStart" [("w:id", id')
                                                ,("w:name",bookmarkName)] ()
@@ -751,7 +752,7 @@ blockToOpenXML opts (Header lev (ident,_,_) lst) = do
 blockToOpenXML opts (Plain lst) = withParaProp (pCustomStyle "Compact")
   $ blockToOpenXML opts (Para lst)
 -- title beginning with fig: indicates that the image is a figure
-blockToOpenXML opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do
+blockToOpenXML opts (Para [Image attr alt (src,'f':'i':'g':':':tit)]) = do
   setFirstPara
   pushParaProp $ pCustomStyle $
     if null alt
@@ -759,7 +760,7 @@ blockToOpenXML opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do
       else "FigureWithCaption"
   paraProps <- getParaProps False
   popParaProp
-  contents <- inlinesToOpenXML opts [Image alt (src,tit)]
+  contents <- inlinesToOpenXML opts [Image attr alt (src,tit)]
   captionNode <- withParaProp (pCustomStyle "ImageCaption")
                  $ blockToOpenXML opts (Para alt)
   return $ mknode "w:p" [] (paraProps ++ contents) : captionNode
@@ -981,6 +982,7 @@ setFirstPara =  modify $ \s -> s { stFirstPara = True }
 inlineToOpenXML :: WriterOptions -> Inline -> WS [Element]
 inlineToOpenXML _ (Str str) = formattedString str
 inlineToOpenXML opts Space = inlineToOpenXML opts (Str " ")
+inlineToOpenXML opts SoftBreak = inlineToOpenXML opts (Str " ")
 inlineToOpenXML opts (Span (_,classes,kvs) ils)
   | "insertion" `elem` classes = do
     defaultAuthor <- gets stChangesAuthor
@@ -1069,8 +1071,8 @@ inlineToOpenXML opts (Note bs) = do
                    [ mknode "w:rPr" [] footnoteStyle
                    , mknode "w:footnoteRef" [] () ]
   let notemarkerXml = RawInline (Format "openxml") $ ppElement notemarker
-  let insertNoteRef (Plain ils : xs) = Plain (notemarkerXml : ils) : xs
-      insertNoteRef (Para ils  : xs) = Para  (notemarkerXml : ils) : xs
+  let insertNoteRef (Plain ils : xs) = Plain (notemarkerXml : Space : ils) : xs
+      insertNoteRef (Para ils  : xs) = Para  (notemarkerXml : Space : ils) : xs
       insertNoteRef xs               = Para [notemarkerXml] : xs
   oldListLevel <- gets stListLevel
   oldParaProperties <- gets stParaProperties
@@ -1086,11 +1088,11 @@ inlineToOpenXML opts (Note bs) = do
            [ mknode "w:rPr" [] footnoteStyle
            , mknode "w:footnoteReference" [("w:id", notenum)] () ] ]
 -- internal link:
-inlineToOpenXML opts (Link txt ('#':xs,_)) = do
+inlineToOpenXML opts (Link _ txt ('#':xs,_)) = do
   contents <- withTextPropM (rStyleM "Hyperlink") $ inlinesToOpenXML opts txt
   return [ mknode "w:hyperlink" [("w:anchor",xs)] contents ]
 -- external link:
-inlineToOpenXML opts (Link txt (src,_)) = do
+inlineToOpenXML opts (Link _ txt (src,_)) = do
   contents <- withTextPropM (rStyleM "Hyperlink") $ inlinesToOpenXML opts txt
   extlinks <- gets stExternalLinks
   id' <- case M.lookup src extlinks of
@@ -1101,7 +1103,7 @@ inlineToOpenXML opts (Link txt (src,_)) = do
                         M.insert src i extlinks }
               return i
   return [ mknode "w:hyperlink" [("r:id",id')] contents ]
-inlineToOpenXML opts (Image alt (src, tit)) = do
+inlineToOpenXML opts (Image attr alt (src, _)) = do
   -- first, check to see if we've already done this image
   pageWidth <- gets stPrintWidth
   imgs <- gets stImages
@@ -1117,13 +1119,8 @@ inlineToOpenXML opts (Image alt (src, tit)) = do
           inlinesToOpenXML opts alt
         Right (img, mt) -> do
           ident <- ("rId"++) `fmap` getUniqueId
-          (xpt,ypt) <- case imageSize img of
-                             Right size  -> return $ sizeInPoints size
-                             Left msg    -> do
-                               liftIO $ warn $
-                                 "Could not determine image size in `" ++
-                                 src ++ "': " ++ msg
-                               return (120,120)
+          let (xpt,ypt) = desiredSizeInPoints opts attr
+                 (either (const def) id (imageSize img))
           -- 12700 emu = 1 pt
           let (xemu,yemu) = fitToPage (xpt * 12700, ypt * 12700) (pageWidth * 12700)
           let cNvPicPr = mknode "pic:cNvPicPr" [] $
@@ -1157,7 +1154,7 @@ inlineToOpenXML opts (Image alt (src, tit)) = do
                  mknode "wp:inline" []
                   [ mknode "wp:extent" [("cx",show xemu),("cy",show yemu)] ()
                   , mknode "wp:effectExtent" [("b","0"),("l","0"),("r","0"),("t","0")] ()
-                  , mknode "wp:docPr" [("descr",tit),("id","1"),("name","Picture")] ()
+                  , mknode "wp:docPr" [("descr",stringify alt),("id","1"),("name","Picture")] ()
                   , graphic ]
           let imgext = case mt >>= extensionFromMimeType of
                             Just x    -> '.':x
@@ -1210,11 +1207,9 @@ parseXml refArchive distArchive relpath =
 
 -- | Scales the image to fit the page
 -- sizes are passed in emu
-fitToPage :: (Integer, Integer) -> Integer -> (Integer, Integer)
+fitToPage :: (Double, Double) -> Integer -> (Integer, Integer)
 fitToPage (x, y) pageWidth
   -- Fixes width to the page width and scales the height
-  | x > pageWidth =
-    (pageWidth, round $
-      ((fromIntegral pageWidth) / ((fromIntegral :: Integer -> Double) x)) * (fromIntegral y))
-  | otherwise = (x, y)
-
+  | x > fromIntegral pageWidth =
+    (pageWidth, floor $ ((fromIntegral pageWidth) / x) * y)
+  | otherwise = (floor x, floor y)
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs
index b68c46c..56e2b90 100644
--- a/src/Text/Pandoc/Writers/DokuWiki.hs
+++ b/src/Text/Pandoc/Writers/DokuWiki.hs
@@ -43,10 +43,12 @@ import Text.Pandoc.Definition
 import Text.Pandoc.Options ( WriterOptions(
                                 writerTableOfContents
                               , writerStandalone
-                              , writerTemplate) )
+                              , writerTemplate
+                              , writerWrapText), WrapOption(..) )
 import Text.Pandoc.Shared ( escapeURI, removeFormatting, camelCaseToHyphenated
                           , trimr, normalize, substitute  )
 import Text.Pandoc.Writers.Shared ( defField, metaToJSON )
+import Text.Pandoc.ImageSize
 import Text.Pandoc.Templates ( renderTemplate' )
 import Data.List ( intersect, intercalate, isPrefixOf, transpose )
 import Data.Default (Default(..))
@@ -126,7 +128,7 @@ blockToDokuWiki opts (Plain inlines) =
 
 -- 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 txt (src,'f':'i':'g':':':tit)]) = do
+blockToDokuWiki opts (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
   capt <- if null txt
              then return ""
              else (" " ++) `fmap` inlineListToDokuWiki opts txt
@@ -135,7 +137,7 @@ blockToDokuWiki opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
                else "|" ++ if null tit then capt else tit ++ capt
       -- Relative links fail isURI and receive a colon
       prefix = if isURI src then "" else ":"
-  return $ "{{" ++ prefix ++ src ++ opt ++ "}}\n"
+  return $ "{{" ++ prefix ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
 
 blockToDokuWiki opts (Para inlines) = do
   indent <- stIndent <$> ask
@@ -450,8 +452,11 @@ inlineToDokuWiki _ (Code _ str) =
 
 inlineToDokuWiki _ (Str str) = return $ escapeString str
 
-inlineToDokuWiki _ (Math _ str) = return $ "$" ++ str ++ "$"
+inlineToDokuWiki _ (Math mathType str) = return $ delim ++ str ++ delim
                                  -- note:  str should NOT be escaped
+  where delim = case mathType of
+                     DisplayMath -> "$$"
+                     InlineMath  -> "$"
 
 inlineToDokuWiki _ (RawInline f str)
   | f == Format "dokuwiki" = return str
@@ -460,20 +465,26 @@ inlineToDokuWiki _ (RawInline f str)
 
 inlineToDokuWiki _ (LineBreak) = return "\\\\\n"
 
+inlineToDokuWiki opts SoftBreak =
+  case writerWrapText opts of
+       WrapNone     -> return " "
+       WrapAuto     -> return " "
+       WrapPreserve -> return "\n"
+
 inlineToDokuWiki _ Space = return " "
 
-inlineToDokuWiki opts (Link txt (src, _)) = do
+inlineToDokuWiki opts (Link _ txt (src, _)) = do
   label <- inlineListToDokuWiki opts txt
   case txt of
      [Str s] | "mailto:" `isPrefixOf` src -> return $ "<" ++ s ++ ">"
              | escapeURI s == src -> return src
      _  -> if isURI src
-              then return $ "[[" ++ src ++ "|" ++ label ++ "]]"
+              then return $ "[[" ++ src  ++ "|" ++ label ++ "]]"
               else return $ "[[" ++ src' ++ "|" ++ label ++ "]]"
                      where src' = case src of
                                      '/':xs -> xs  -- with leading / it's a
                                      _      -> src -- link to a help page
-inlineToDokuWiki opts (Image alt (source, tit)) = do
+inlineToDokuWiki opts (Image attr alt (source, tit)) = do
   alt' <- inlineListToDokuWiki opts alt
   let txt = case (tit, alt) of
               ("", []) -> ""
@@ -481,10 +492,21 @@ inlineToDokuWiki opts (Image alt (source, tit)) = do
               (_ , _ ) -> "|" ++ tit
       -- Relative links fail isURI and receive a colon
       prefix = if isURI source then "" else ":"
-  return $ "{{" ++ prefix ++ source ++ txt ++ "}}"
+  return $ "{{" ++ prefix ++ source ++ imageDims opts attr ++ txt ++ "}}"
 
 inlineToDokuWiki opts (Note contents) = do
   contents' <- blockListToDokuWiki opts contents
   modify (\s -> s { stNotes = True })
   return $ "((" ++ contents' ++ "))"
   -- note - may not work for notes with multiple blocks
+
+imageDims :: WriterOptions -> Attr -> String
+imageDims opts attr = go (toPx $ dimension Width attr) (toPx $ dimension Height attr)
+  where
+    toPx = fmap (showInPixel opts) . checkPct
+    checkPct (Just (Percent _)) = Nothing
+    checkPct maybeDim = maybeDim
+    go (Just w) Nothing  = "?" ++ w
+    go (Just w) (Just h) = "?" ++ w ++ "x" ++ h
+    go Nothing  (Just h) = "?0x" ++ h
+    go Nothing  Nothing  = ""
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 2843f8c..804dbb9 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -31,6 +31,7 @@ Conversion of 'Pandoc' documents to EPUB.
 module Text.Pandoc.Writers.EPUB ( writeEPUB ) where
 import Data.IORef ( IORef, newIORef, readIORef, modifyIORef )
 import qualified Data.Map as M
+import qualified Data.Set as Set
 import Data.Maybe ( fromMaybe, catMaybes )
 import Data.List ( isPrefixOf, isInfixOf, intercalate )
 import System.Environment ( getEnv )
@@ -50,6 +51,7 @@ import Text.Pandoc.Shared ( renderTags', safeRead, uniqueIdent, trim
 import qualified Text.Pandoc.Shared as S (Element(..))
 import Text.Pandoc.Builder (fromList, setMeta)
 import Text.Pandoc.Options ( WriterOptions(..)
+                           , WrapOption(..)
                            , HTMLMathMethod(..)
                            , EPUBVersion(..)
                            , ObfuscationMethod(NoObfuscation) )
@@ -350,7 +352,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
                        if epub3
                           then MathML Nothing
                           else writerHTMLMathMethod opts
-                  , writerWrapText = True }
+                  , writerWrapText = WrapAuto }
   metadata <- getEPUBMetadata opts' meta
 
   -- cover page
@@ -455,10 +457,10 @@ writeEPUB opts doc@(Pandoc meta _) = do
                           chapters' [1..]
 
   let fixInternalReferences :: Inline -> Inline
-      fixInternalReferences (Link lab ('#':xs, tit)) =
+      fixInternalReferences (Link attr lab ('#':xs, tit)) =
         case lookup xs reftable of
-             Just ys ->  Link lab (ys, tit)
-             Nothing -> Link lab ('#':xs, tit)
+             Just ys -> Link attr lab (ys, tit)
+             Nothing -> Link attr lab ('#':xs, tit)
       fixInternalReferences x = x
 
   -- internal reference IDs change when we chunk the file,
@@ -816,7 +818,8 @@ transformTag :: WriterOptions
              -> Tag String
              -> IO (Tag String)
 transformTag opts mediaRef tag@(TagOpen name attr)
-  | name `elem` ["video", "source", "img", "audio"] = do
+  | name `elem` ["video", "source", "img", "audio"] &&
+    lookup "data-external" attr == Nothing = do
   let src = fromAttrib "src" tag
   let poster = fromAttrib "poster" tag
   newsrc <- modifyMediaRef opts mediaRef src
@@ -869,14 +872,14 @@ transformInline  :: WriterOptions
                  -> IORef [(FilePath, (FilePath, Maybe Entry))] -- ^ (oldpath, newpath) media
                  -> Inline
                  -> IO Inline
-transformInline opts mediaRef (Image lab (src,tit)) = do
+transformInline opts mediaRef (Image attr lab (src,tit)) = do
     newsrc <- modifyMediaRef opts mediaRef src
-    return $ Image lab (newsrc, tit)
+    return $ Image attr lab (newsrc, tit)
 transformInline opts mediaRef (x@(Math t m))
   | WebTeX url <- writerHTMLMathMethod opts = do
     newsrc <- modifyMediaRef opts mediaRef (url ++ urlEncode m)
     let mathclass = if t == DisplayMath then "display" else "inline"
-    return $ Span ("",["math",mathclass],[]) [Image [x] (newsrc, "")]
+    return $ Span ("",["math",mathclass],[]) [Image nullAttr [x] (newsrc, "")]
 transformInline opts mediaRef  (RawInline fmt raw)
   | fmt == Format "html" = do
   let tags = parseTags raw
@@ -914,13 +917,13 @@ showChapter = printf "ch%03d.xhtml"
 
 -- Add identifiers to any headers without them.
 addIdentifiers :: [Block] -> [Block]
-addIdentifiers bs = evalState (mapM go bs) []
+addIdentifiers bs = evalState (mapM go bs) Set.empty
  where go (Header n (ident,classes,kvs) ils) = do
          ids <- get
          let ident' = if null ident
                          then uniqueIdent ils ids
                          else ident
-         put $ ident' : ids
+         modify $ Set.insert ident'
          return $ Header n (ident',classes,kvs) ils
        go x = return x
 
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs
index 31fa4be..80296e1 100644
--- a/src/Text/Pandoc/Writers/FB2.hs
+++ b/src/Text/Pandoc/Writers/FB2.hs
@@ -314,8 +314,8 @@ blockToXml :: Block -> FBM [Content]
 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 alt (src,'f':'i':'g':':':tit)]) =
-  insertImage NormalImage (Image alt (src,tit))
+blockToXml (Para [Image atr alt (src,'f':'i':'g':':':tit)]) =
+  insertImage NormalImage (Image atr alt (src,tit))
 blockToXml (Para ss) = liftM (list . el "p") $ cMapM toXml ss
 blockToXml (CodeBlock _ s) = return . spaceBeforeAfter .
                              map (el "p" . el "code") . lines $ s
@@ -439,10 +439,11 @@ toXml (Quoted DoubleQuote ss) = do
 toXml (Cite _ ss) = cMapM toXml ss  -- FIXME: support citation styles
 toXml (Code _ s) = return [el "code" s]
 toXml Space = return [txt " "]
+toXml SoftBreak = return [txt " "]
 toXml LineBreak = return [el "empty-line" ()]
 toXml (Math _ formula) = insertMath InlineImage formula
 toXml (RawInline _ _) = return []  -- raw TeX and raw HTML are suppressed
-toXml (Link text (url,ttl)) = do
+toXml (Link _ text (url,ttl)) = do
   fns <- footnotes `liftM` get
   let n = 1 + length fns
   let ln_id = linkID n
@@ -459,7 +460,7 @@ toXml (Link text (url,ttl)) = do
                   ( [ attr ("l","href") ('#':ln_id)
                     , uattr "type" "note" ]
                   , ln_ref) ]
-toXml img@(Image _ _) = insertImage InlineImage img
+toXml img@(Image _ _ _) = insertImage InlineImage img
 toXml (Note bs) = do
   fns <- footnotes `liftM` get
   let n = 1 + length fns
@@ -478,12 +479,12 @@ insertMath immode formula = do
     WebTeX url -> do
        let alt = [Code nullAttr formula]
        let imgurl = url ++ urlEncode formula
-       let img = Image alt (imgurl, "")
+       let img = Image nullAttr alt (imgurl, "")
        insertImage immode img
     _ -> return [el "code" formula]
 
 insertImage :: ImageMode -> Inline -> FBM [Content]
-insertImage immode (Image alt (url,ttl)) = do
+insertImage immode (Image _ alt (url,ttl)) = do
   images <- imagesToFetch `liftM` get
   let n = 1 + length images
   let fname = "image" ++ show n
@@ -569,11 +570,12 @@ plain (Quoted _ ss) = concat (map plain ss)
 plain (Cite _ ss) = concat (map plain ss)  -- FIXME
 plain (Code _ s) = s
 plain Space = " "
+plain SoftBreak = " "
 plain LineBreak = "\n"
 plain (Math _ s) = s
 plain (RawInline _ s) = s
-plain (Link text (url,_)) = concat (map plain text ++ [" <", url, ">"])
-plain (Image alt _) = concat (map plain alt)
+plain (Link _ text (url,_)) = concat (map plain text ++ [" <", url, ">"])
+plain (Image _ alt _) = concat (map plain alt)
 plain (Note _) = ""  -- FIXME
 
 -- | Create an XML element.
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index d06bec8..c5b6a6d 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -31,9 +31,11 @@ Conversion of 'Pandoc' documents to HTML.
 -}
 module Text.Pandoc.Writers.HTML ( writeHtml , writeHtmlString ) where
 import Text.Pandoc.Definition
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Pandoc.Shared
 import Text.Pandoc.Writers.Shared
 import Text.Pandoc.Options
+import Text.Pandoc.ImageSize
 import Text.Pandoc.Templates
 import Text.Pandoc.Readers.TeXMath
 import Text.Pandoc.Slides
@@ -93,9 +95,9 @@ strToHtml [] = ""
 
 -- | Hard linebreak.
 nl :: WriterOptions -> Html
-nl opts = if writerWrapText opts
-             then preEscapedString "\n"
-             else mempty
+nl opts = if writerWrapText opts == WrapNone
+             then mempty
+             else preEscapedString "\n"
 
 -- | Convert Pandoc document to Html string.
 writeHtmlString :: WriterOptions -> Pandoc -> String
@@ -138,40 +140,38 @@ pandocToHtml opts (Pandoc meta blocks) = do
   st <- get
   let notes = reverse (stNotes st)
   let thebody = blocks' >> footnoteSection opts notes
-  let  math = if stMath st
-                then case writerHTMLMathMethod opts of
-                           LaTeXMathML (Just url) ->
-                              H.script ! A.src (toValue url)
-                                       ! A.type_ "text/javascript"
-                                       $ mempty
-                           MathML (Just url) ->
-                              H.script ! A.src (toValue url)
-                                       ! A.type_ "text/javascript"
-                                       $ mempty
-                           MathJax url ->
-                              H.script ! A.src (toValue url)
-                                       ! A.type_ "text/javascript"
-                                       $ case writerSlideVariant opts of
-                                              SlideousSlides ->
-                                                 preEscapedString
-                                                 "MathJax.Hub.Queue([\"Typeset\",MathJax.Hub]);"
-                                              _ -> mempty
-                           JsMath (Just url) ->
-                              H.script ! A.src (toValue url)
-                                       ! A.type_ "text/javascript"
-                                       $ mempty
-                           KaTeX js css ->
-                              (H.script ! A.src (toValue js) $ mempty) <>
-                              (H.link ! A.rel "stylesheet" ! A.href (toValue css)) <>
-                              (H.script ! A.type_ "text/javascript" $ toHtml renderKaTeX)
-                           _ -> case lookup "mathml-script" (writerVariables opts) of
-                                      Just s | not (writerHtml5 opts) ->
-                                        H.script ! A.type_ "text/javascript"
-                                           $ preEscapedString
-                                            ("/*<![CDATA[*/\n" ++ s ++ "/*]]>*/\n")
-                                             | otherwise -> mempty
-                                      Nothing -> mempty
-                else mempty
+  let  math = case writerHTMLMathMethod opts of
+                      LaTeXMathML (Just url) ->
+                         H.script ! A.src (toValue url)
+                                  ! A.type_ "text/javascript"
+                                  $ mempty
+                      MathML (Just url) ->
+                         H.script ! A.src (toValue url)
+                                  ! A.type_ "text/javascript"
+                                  $ mempty
+                      MathJax url ->
+                         H.script ! A.src (toValue url)
+                                  ! A.type_ "text/javascript"
+                                  $ case writerSlideVariant opts of
+                                         SlideousSlides ->
+                                            preEscapedString
+                                            "MathJax.Hub.Queue([\"Typeset\",MathJax.Hub]);"
+                                         _ -> mempty
+                      JsMath (Just url) ->
+                         H.script ! A.src (toValue url)
+                                  ! A.type_ "text/javascript"
+                                  $ mempty
+                      KaTeX js css ->
+                         (H.script ! A.src (toValue js) $ mempty) <>
+                         (H.link ! A.rel "stylesheet" ! A.href (toValue css)) <>
+                         (H.script ! A.type_ "text/javascript" $ toHtml renderKaTeX)
+                      _ -> case lookup "mathml-script" (writerVariables opts) of
+                                 Just s | not (writerHtml5 opts) ->
+                                   H.script ! A.type_ "text/javascript"
+                                      $ preEscapedString
+                                       ("/*<![CDATA[*/\n" ++ s ++ "/*]]>*/\n")
+                                        | otherwise -> mempty
+                                 Nothing -> mempty
   let context =   (if stHighlighting st
                       then defField "highlighting-css"
                              (styleToCss $ writerHighlightStyle opts)
@@ -192,9 +192,6 @@ pandocToHtml opts (Pandoc meta blocks) = do
                   defField "revealjs-url" ("reveal.js" :: String) $
                   defField "s5-url" ("s5/default" :: String) $
                   defField "html5" (writerHtml5 opts) $
-                  defField "center" (case lookupMeta "center" meta of
-                                          Just (MetaBool False) -> False
-                                          _                     -> True) $
                   metadata
   return (thebody, context)
 
@@ -307,11 +304,9 @@ elementToHtml slideLevel opts (Sec level num (id',classes,keyvals) title' elemen
                    $ if titleSlide
                         -- title slides have no content of their own
                         then filter isSec elements
-                        else if slide
-                                then case splitBy isPause elements of
-                                          []     -> []
-                                          (x:xs) -> x ++ concatMap inDiv xs
-                                else elements
+                        else case splitBy isPause elements of
+                                  []     -> []
+                                  (x:xs) -> x ++ concatMap inDiv xs
   let inNl x = mconcat $ nl opts : intersperse (nl opts) x ++ [nl opts]
   let classes' = ["titleslide" | titleSlide] ++ ["slide" | slide] ++
                   ["section" | (slide || writerSectionDivs opts) &&
@@ -360,10 +355,10 @@ parseMailto s = do
        _ -> fail "not a mailto: URL"
 
 -- | Obfuscate a "mailto:" link.
-obfuscateLink :: WriterOptions -> Html -> String -> Html
-obfuscateLink opts txt s | writerEmailObfuscation opts == NoObfuscation =
-  H.a ! A.href (toValue s) $ txt
-obfuscateLink opts (renderHtml -> txt) s =
+obfuscateLink :: WriterOptions -> Attr -> Html -> String -> Html
+obfuscateLink opts attr txt s | writerEmailObfuscation opts == NoObfuscation =
+  addAttrs opts attr $ H.a ! A.href (toValue s) $ txt
+obfuscateLink opts attr (renderHtml -> txt) s =
   let meth = writerEmailObfuscation opts
       s' = map toLower (take 7 s) ++ drop 7 s
   in  case parseMailto s' of
@@ -389,7 +384,7 @@ obfuscateLink opts (renderHtml -> txt) s =
                      linkText  ++ "+'<\\/'+'a'+'>');\n// -->\n")) >>
                      H.noscript (preEscapedString $ obfuscateString altText)
                 _ -> error $ "Unknown obfuscation method: " ++ show meth
-        _ -> H.a ! A.href (toValue s) $ toHtml txt  -- malformed email
+        _ -> addAttrs opts attr $ H.a ! A.href (toValue s) $ toHtml txt  -- malformed email
 
 -- | Obfuscate character as entity.
 obfuscateChar :: Char -> String
@@ -405,11 +400,33 @@ obfuscateString = concatMap obfuscateChar . fromEntities
 addAttrs :: WriterOptions -> Attr -> Html -> Html
 addAttrs opts attr h = foldl (!) h (attrsToHtml opts attr)
 
+toAttrs :: [(String, String)] -> [Attribute]
+toAttrs kvs = map (\(x,y) -> customAttribute (fromString x) (toValue y)) kvs
+
 attrsToHtml :: WriterOptions -> Attr -> [Attribute]
 attrsToHtml opts (id',classes',keyvals) =
   [prefixedId opts id' | not (null id')] ++
-  [A.class_ (toValue $ unwords classes') | not (null classes')] ++
-  map (\(x,y) -> customAttribute (fromString x) (toValue y)) keyvals
+  [A.class_ (toValue $ unwords classes') | not (null classes')] ++ toAttrs keyvals
+
+imgAttrsToHtml :: WriterOptions -> Attr -> [Attribute]
+imgAttrsToHtml opts attr =
+    attrsToHtml opts (ident,cls,kvs') ++
+    toAttrs (dimensionsToAttrList opts attr)
+  where
+    (ident,cls,kvs) = attr
+    kvs' = filter isNotDim kvs
+    isNotDim ("width", _)  = False
+    isNotDim ("height", _) = False
+    isNotDim _ = True
+
+dimensionsToAttrList :: WriterOptions -> Attr -> [(String, String)]
+dimensionsToAttrList opts attr = (go Width) ++ (go Height)
+  where
+    go dir = case (dimension dir attr) of
+               (Just (Percent a)) -> [("style", show dir ++ ":" ++ show (Percent a))]
+               (Just dim)         -> [(show dir, showInPixel opts dim)]
+               _ -> []
+
 
 imageExts :: [String]
 imageExts = [ "art", "bmp", "cdr", "cdt", "cpt", "cr2", "crw", "djvu", "erf",
@@ -430,8 +447,8 @@ blockToHtml :: WriterOptions -> Block -> State WriterState Html
 blockToHtml _ Null = return mempty
 blockToHtml opts (Plain lst) = inlineListToHtml opts lst
 -- title beginning with fig: indicates that the image is a figure
-blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
-  img <- inlineToHtml opts (Image txt (s,tit))
+blockToHtml opts (Para [Image attr txt (s,'f':'i':'g':':':tit)]) = do
+  img <- inlineToHtml opts (Image attr txt (s,tit))
   let tocapt = if writerHtml5 opts
                   then H5.figcaption
                   else H.p ! A.class_ "caption"
@@ -543,6 +560,9 @@ blockToHtml opts (OrderedList (startnum, numstyle, _) lst) = do
   let attribs = (if startnum /= 1
                    then [A.start $ toValue startnum]
                    else []) ++
+                (if numstyle == Example
+                    then [A.class_ "example"]
+                    else []) ++
                 (if numstyle /= DefaultStyle
                    then if writerHtml5 opts
                            then [A.type_ $
@@ -593,8 +613,15 @@ blockToHtml opts (Table capt aligns widths headers rows') = do
                 return $ H.thead (nl opts >> contents) >> nl opts
   body' <- liftM (\x -> H.tbody (nl opts >> mconcat x)) $
                zipWithM (tableRowToHtml opts aligns) [1..] rows'
-  return $ H.table $ nl opts >> captionDoc >> coltags >> head' >>
-                   body' >> nl opts
+  let tbl = H.table $
+              nl opts >> captionDoc >> coltags >> head' >> body' >> nl opts
+  let totalWidth = sum widths
+  -- When widths of columns are < 100%, we need to set width for the whole
+  -- table, or some browsers give us skinny columns with lots of space between:
+  return $ if totalWidth == 0 || totalWidth == 1
+              then tbl
+              else tbl ! A.style (toValue $ "width:" ++
+                              show (round (totalWidth * 100) :: Int) ++ "%;")
 
 tableRowToHtml :: WriterOptions
                -> [Alignment]
@@ -618,7 +645,7 @@ alignmentToString alignment = case alignment of
                                  AlignLeft    -> "left"
                                  AlignRight   -> "right"
                                  AlignCenter  -> "center"
-                                 AlignDefault -> "left"
+                                 AlignDefault -> ""
 
 tableItemToHtml :: WriterOptions
                 -> (Html -> Html)
@@ -631,7 +658,10 @@ tableItemToHtml opts tag' align' item = do
   let attribs = if writerHtml5 opts
                    then A.style (toValue $ "text-align: " ++ alignStr ++ ";")
                    else A.align (toValue alignStr)
-  return $ (tag' ! attribs $ contents) >> nl opts
+  let tag'' = if null alignStr
+                 then tag'
+                 else tag' ! attribs
+  return $ (tag'' $ contents) >> nl opts
 
 toListItems :: WriterOptions -> [Html] -> [Html]
 toListItems opts items = map (toListItem opts) items ++ [nl opts]
@@ -668,6 +698,10 @@ inlineToHtml opts inline =
   case inline of
     (Str str)        -> return $ strToHtml str
     (Space)          -> return $ strToHtml " "
+    (SoftBreak)      -> return $ case writerWrapText opts of
+                                       WrapNone     -> preEscapedString " "
+                                       WrapAuto     -> preEscapedString " "
+                                       WrapPreserve -> preEscapedString "\n"
     (LineBreak)      -> return $ (if writerHtml5 opts then H5.br else H.br)
                                  <> strToHtml "\n"
     (Span (id',classes,kvs) ils)
@@ -786,10 +820,10 @@ inlineToHtml opts inline =
                                _             -> return mempty
       | f == Format "html" -> return $ preEscapedString str
       | otherwise          -> return mempty
-    (Link txt (s,_)) | "mailto:" `isPrefixOf` s -> do
+    (Link attr txt (s,_)) | "mailto:" `isPrefixOf` s -> do
                         linkText <- inlineListToHtml opts txt
-                        return $ obfuscateLink opts linkText s
-    (Link txt (s,tit)) -> do
+                        return $ obfuscateLink opts attr linkText s
+    (Link attr txt (s,tit)) -> do
                         linkText <- inlineListToHtml opts txt
                         let s' = case s of
                                       '#':xs | writerSlideVariant opts ==
@@ -799,19 +833,23 @@ inlineToHtml opts inline =
                         let link' = if txt == [Str (unEscapeString s)]
                                        then link ! A.class_ "uri"
                                        else link
+                        let link'' = addAttrs opts attr link'
                         return $ if null tit
-                                    then link'
-                                    else link' ! A.title (toValue tit)
-    (Image txt (s,tit)) | treatAsImage s -> do
+                                    then link''
+                                    else link'' ! A.title (toValue tit)
+    (Image attr txt (s,tit)) | treatAsImage s -> do
+                        let alternate' = stringify txt
                         let attributes = [A.src $ toValue s] ++
-                                         [A.title $ toValue tit | not $ null tit] ++
-                                         [A.alt $ toValue $ stringify txt]
+                                         [A.title $ toValue tit | not (null tit)] ++
+                                         [A.alt $ toValue alternate' | not (null txt)] ++
+                                         imgAttrsToHtml opts attr
                         let tag = if writerHtml5 opts then H5.img else H.img
                         return $ foldl (!) tag attributes
                         -- note:  null title included, as in Markdown.pl
-    (Image _ (s,tit)) -> do
+    (Image attr _ (s,tit)) -> do
                         let attributes = [A.src $ toValue s] ++
-                                         [A.title $ toValue tit | not $ null tit]
+                                         [A.title $ toValue tit | not (null tit)] ++
+                                         imgAttrsToHtml opts attr
                         return $ foldl (!) H5.embed attributes
                         -- note:  null title included, as in Markdown.pl
     (Note contents)
@@ -849,7 +887,7 @@ blockListToNote :: WriterOptions -> String -> [Block] -> State WriterState Html
 blockListToNote opts ref blocks =
   -- If last block is Para or Plain, include the backlink at the end of
   -- that block. Otherwise, insert a new Plain block with the backlink.
-  let backlink = [Link [Str "↩"] ("#" ++ writerIdentifierPrefix opts ++ "fnref" ++ ref,[])]
+  let backlink = [Link nullAttr [Str "↩"] ("#" ++ writerIdentifierPrefix opts ++ "fnref" ++ ref,[])]
       blocks'  = if null blocks
                     then []
                     else let lastBlock   = last blocks
diff --git a/src/Text/Pandoc/Writers/Haddock.hs b/src/Text/Pandoc/Writers/Haddock.hs
index 14f398d..2e5f2dd 100644
--- a/src/Text/Pandoc/Writers/Haddock.hs
+++ b/src/Text/Pandoc/Writers/Haddock.hs
@@ -57,7 +57,7 @@ writeHaddock opts document =
 -- | Return haddock representation of document.
 pandocToHaddock :: WriterOptions -> Pandoc -> State WriterState String
 pandocToHaddock opts (Pandoc meta blocks) = do
-  let colwidth = if writerWrapText opts
+  let colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
   body <- blockListToHaddock opts blocks
@@ -103,8 +103,8 @@ blockToHaddock opts (Plain inlines) = do
   contents <- inlineListToHaddock opts inlines
   return $ contents <> cr
 -- title beginning with fig: indicates figure
-blockToHaddock opts (Para [Image alt (src,'f':'i':'g':':':tit)]) =
-  blockToHaddock opts (Para [Image alt (src,tit)])
+blockToHaddock opts (Para [Image attr alt (src,'f':'i':'g':':':tit)]) =
+  blockToHaddock opts (Para [Image attr alt (src,tit)])
 blockToHaddock opts (Para inlines) =
   -- TODO:  if it contains linebreaks, we need to use a @...@ block
   (<> blankline) `fmap` blockToHaddock opts (Plain inlines)
@@ -325,18 +325,23 @@ inlineToHaddock _ (RawInline f str)
   | otherwise = return empty
 -- no line break in haddock (see above on CodeBlock)
 inlineToHaddock _ (LineBreak) = return cr
+inlineToHaddock opts SoftBreak =
+  case writerWrapText opts of
+       WrapAuto     -> return space
+       WrapNone     -> return space
+       WrapPreserve -> return cr
 inlineToHaddock _ Space = return space
 inlineToHaddock opts (Cite _ lst) = inlineListToHaddock opts lst
-inlineToHaddock opts (Link txt (src, _)) = do
-  linktext <- inlineListToHaddock opts txt
+inlineToHaddock _ (Link _ txt (src, _)) = do
+  let linktext = text $ escapeString $ stringify txt
   let useAuto = isURI src &&
                 case txt of
                       [Str s] | escapeURI s == src -> True
                       _                            -> False
   return $ nowrap $ "<" <> text src <>
            (if useAuto then empty else space <> linktext) <> ">"
-inlineToHaddock opts (Image alternate (source, tit)) = do
-  linkhaddock <- inlineToHaddock opts (Link alternate (source, tit))
+inlineToHaddock opts (Image attr alternate (source, tit)) = do
+  linkhaddock <- inlineToHaddock opts (Link attr alternate (source, tit))
   return $ "<" <> linkhaddock <> ">"
 -- haddock doesn't have notes, but we can fake it:
 inlineToHaddock opts (Note contents) = do
diff --git a/src/Text/Pandoc/Writers/ICML.hs b/src/Text/Pandoc/Writers/ICML.hs
index ae068a9..57a6117 100644
--- a/src/Text/Pandoc/Writers/ICML.hs
+++ b/src/Text/Pandoc/Writers/ICML.hs
@@ -16,12 +16,14 @@ into InDesign with File -> Place.
 module Text.Pandoc.Writers.ICML (writeICML) where
 import Text.Pandoc.Definition
 import Text.Pandoc.XML
+import Text.Pandoc.Readers.TeXMath (texMathToInlines)
 import Text.Pandoc.Writers.Shared
-import Text.Pandoc.Shared (splitBy)
+import Text.Pandoc.Shared (splitBy, fetchItem, warn)
 import Text.Pandoc.Options
 import Text.Pandoc.Templates (renderTemplate')
 import Text.Pandoc.Pretty
-import Data.List (isPrefixOf, isInfixOf, stripPrefix)
+import Text.Pandoc.ImageSize
+import Data.List (isPrefixOf, isInfixOf, stripPrefix, intersperse)
 import Data.Text as Text (breakOnAll, pack)
 import Control.Monad.State
 import Network.URI (isURI)
@@ -38,7 +40,7 @@ data WriterState = WriterState{
   , maxListDepth :: Int
   }
 
-type WS a = State WriterState a
+type WS a = StateT WriterState IO a
 
 defaultWriterState :: WriterState
 defaultWriterState = WriterState{
@@ -69,6 +71,8 @@ linkName        = "Link"
 
 -- block element names (appear in InDesign's paragraph styles pane)
 paragraphName     :: String
+figureName        :: String
+imgCaptionName    :: String
 codeBlockName     :: String
 blockQuoteName    :: String
 orderedListName   :: String
@@ -90,7 +94,10 @@ lowerAlphaName    :: String
 upperAlphaName    :: String
 subListParName    :: String
 footnoteName      :: String
+citeName          :: String
 paragraphName     = "Paragraph"
+figureName        = "Figure"
+imgCaptionName    = "Caption"
 codeBlockName     = "CodeBlock"
 blockQuoteName    = "Blockquote"
 orderedListName   = "NumList"
@@ -112,30 +119,31 @@ lowerAlphaName    = "lowerAlpha"
 upperAlphaName    = "upperAlpha"
 subListParName    = "subParagraph"
 footnoteName      = "Footnote"
+citeName          = "Cite"
 
 
 -- | Convert Pandoc document to string in ICML format.
-writeICML :: WriterOptions -> Pandoc -> String
-writeICML opts (Pandoc meta blocks) =
-  let colwidth = if writerWrapText opts
+writeICML :: WriterOptions -> Pandoc -> IO String
+writeICML opts (Pandoc meta blocks) = do
+  let colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
       render' = render colwidth
-      renderMeta f s = Just $ render' $ fst $ runState (f opts [] s) defaultWriterState
-      Just metadata = metaToJSON opts
-                 (renderMeta blocksToICML)
-                 (renderMeta inlinesToICML)
-                 meta
-      (doc, st) = runState (blocksToICML opts [] blocks) defaultWriterState
-      main    = render' doc
+      renderMeta f s = liftM (render' . fst) $ runStateT (f opts [] s) defaultWriterState
+  metadata <- metaToJSON opts
+             (renderMeta blocksToICML)
+             (renderMeta inlinesToICML)
+             meta
+  (doc, st) <- runStateT (blocksToICML opts [] blocks) defaultWriterState
+  let main    = render' doc
       context = defField "body" main
               $ defField "charStyles" (render' $ charStylesToDoc st)
               $ defField "parStyles"  (render' $ parStylesToDoc st)
               $ defField "hyperlinks" (render' $ hyperlinksToDoc $ links st)
               $ metadata
-  in  if writerStandalone opts
-         then renderTemplate' (writerTemplate opts) context
-         else main
+  return $ if writerStandalone opts
+              then renderTemplate' (writerTemplate opts) context
+              else main
 
 -- | Auxilary functions for parStylesToDoc and charStylesToDoc.
 contains :: String -> (String, (String, String)) -> [(String, String)]
@@ -276,11 +284,18 @@ hyperlinksToDoc (x:xs) = hyp x $$ hyperlinksToDoc xs
 
 -- | Convert a list of Pandoc blocks to ICML.
 blocksToICML :: WriterOptions -> Style -> [Block] -> WS Doc
-blocksToICML opts style lst = vcat `fmap` mapM (blockToICML opts style) lst
+blocksToICML opts style lst = do
+  docs <- mapM (blockToICML opts style) lst
+  return $ intersperseBrs docs
 
 -- | Convert a Pandoc block element to ICML.
 blockToICML :: WriterOptions -> Style -> Block -> WS Doc
 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 (_,'f':'i':'g':':':_)]) = do
+  figure  <- parStyle opts (figureName:style) img
+  caption <- parStyle opts (imgCaptionName:style) txt
+  return $ intersperseBrs [figure, caption]
 blockToICML opts style (Para lst) = parStyle opts (paragraphName:style) lst
 blockToICML opts style (CodeBlock _ str) = parStyle opts (codeBlockName:style) $ [Str str]
 blockToICML _ _ (RawBlock f str)
@@ -289,7 +304,7 @@ blockToICML _ _ (RawBlock f str)
 blockToICML opts style (BlockQuote blocks) = blocksToICML opts (blockQuoteName:style) blocks
 blockToICML opts style (OrderedList attribs lst) = listItemsToICML opts orderedListName style (Just attribs) lst
 blockToICML opts style (BulletList lst) = listItemsToICML opts bulletListName style Nothing lst
-blockToICML opts style (DefinitionList lst) = vcat `fmap` mapM (definitionListItemToICML opts style) lst
+blockToICML opts style (DefinitionList lst) = intersperseBrs `fmap` mapM (definitionListItemToICML opts style) lst
 blockToICML opts style (Header lvl _ lst) =
   let stl = (headerName ++ show lvl):style
   in parStyle opts stl lst
@@ -354,7 +369,7 @@ listItemsToICML opts listType style attribs (first:rest) = do
   s    <- get
   let maxD = max (maxListDepth s) (listDepth s)
   put s{ listDepth = 1, maxListDepth = maxD }
-  return $ vcat docs
+  return $ intersperseBrs docs
 
 -- | Convert a list of blocks to ICML list items.
 listItemToICML :: WriterOptions -> Style -> Bool-> Maybe ListAttributes -> [Block] -> WS Doc
@@ -380,15 +395,15 @@ listItemToICML opts style isFirst attribs item =
            let insertTab (Para lst) = blockToICML opts (subListParName:style) $ Para $ (Str "\t"):lst
                insertTab block      = blockToICML opts style block
            f <- blockToICML opts stl' $ head item
-           r <- fmap vcat $ mapM insertTab $ tail item
-           return $ f $$ r
+           r <- mapM insertTab $ tail item
+           return $ intersperseBrs (f : r)
          else blocksToICML opts stl' item
 
 definitionListItemToICML :: WriterOptions -> Style -> ([Inline],[[Block]]) -> WS Doc
 definitionListItemToICML opts style (term,defs) = do
   term' <- parStyle opts (defListTermName:style) term
-  defs' <- vcat `fmap` mapM (blocksToICML opts (defListDefName:style)) defs
-  return $ term' $$ defs'
+  defs' <- mapM (blocksToICML opts (defListDefName:style)) defs
+  return $ intersperseBrs $ (term' : defs')
 
 
 -- | Convert a list of inline elements to ICML.
@@ -406,15 +421,21 @@ inlineToICML opts style (Subscript lst) = inlinesToICML opts (subscriptName:styl
 inlineToICML opts style (SmallCaps lst) = inlinesToICML opts (smallCapsName:style) lst
 inlineToICML opts style (Quoted SingleQuote lst) = inlinesToICML opts style $ [Str "‘"] ++ lst ++ [Str "’"]
 inlineToICML opts style (Quoted DoubleQuote lst) = inlinesToICML opts style $ [Str "“"] ++ lst ++ [Str "”"]
-inlineToICML opts style (Cite _ lst) = inlinesToICML opts style lst
+inlineToICML opts style (Cite _ lst) = inlinesToICML opts (citeName:style) lst
 inlineToICML _    style (Code _ str) = charStyle (codeName:style) $ text $ escapeStringForXML str
 inlineToICML _    style Space = charStyle style space
+inlineToICML opts style SoftBreak =
+  case writerWrapText opts of
+       WrapAuto     -> charStyle style space
+       WrapNone     -> charStyle style space
+       WrapPreserve -> charStyle style cr
 inlineToICML _ style LineBreak = charStyle style $ text lineSeparator
-inlineToICML _ style (Math _ str) = charStyle style $ text $ escapeStringForXML str --InDesign doesn't really do math
+inlineToICML opts style (Math mt str) =
+  cat <$> mapM (inlineToICML opts style) (texMathToInlines mt str)
 inlineToICML _ _ (RawInline f str)
   | f == Format "icml" = return $ text str
   | otherwise          = return empty
-inlineToICML opts style (Link lst (url, title)) = do
+inlineToICML opts style (Link _ lst (url, title)) = do
   content <- inlinesToICML opts (linkName:style) lst
   state $ \st ->
             let ident = if null $ links st
@@ -424,7 +445,7 @@ inlineToICML opts style (Link lst (url, title)) = do
                 cont  = inTags True "HyperlinkTextSource"
                          [("Self","htss-"++show ident), ("Name",title), ("Hidden","false")] content
             in  (cont, newst)
-inlineToICML opts style (Image alt target) = imageICML opts style alt target
+inlineToICML opts style (Image attr _ target) = imageICML opts style attr target
 inlineToICML opts style (Note lst) = footnoteToICML opts style lst
 inlineToICML opts style (Span _ lst) = inlinesToICML opts style lst
 
@@ -439,16 +460,26 @@ footnoteToICML opts style lst =
                    inTags True "CharacterStyleRange" [] $ inTagsSimple "Content" "<?ACE 4?>"
     return $ inTags True "CharacterStyleRange"
       [("AppliedCharacterStyle","$ID/NormalCharacterStyle"), ("Position","Superscript")]
-      $ inTags True "Footnote" [] $ number $$ vcat contents
+      $ inTags True "Footnote" [] $ number $$ intersperseBrs contents
 
 -- | Auxiliary function to merge Space elements into the adjacent Strs.
 mergeSpaces :: [Inline] -> [Inline]
-mergeSpaces ((Str s):(Space:((Str s'):xs))) = mergeSpaces $ Str(s++" "++s') : xs
-mergeSpaces (Space:((Str s):xs)) = mergeSpaces $ Str (" "++s) : xs
-mergeSpaces ((Str s):(Space:xs)) = mergeSpaces $ Str (s++" ") : xs
+mergeSpaces ((Str s):(x:((Str s'):xs))) | isSp x =
+  mergeSpaces $ Str(s++" "++s') : xs
+mergeSpaces (x:((Str s):xs)) | isSp x = mergeSpaces $ Str (" "++s) : xs
+mergeSpaces ((Str s):(x:xs)) | isSp x = mergeSpaces $ Str (s++" ") : xs
 mergeSpaces (x:xs) = x : (mergeSpaces xs)
 mergeSpaces []     = []
 
+isSp :: Inline -> Bool
+isSp Space = True
+isSp SoftBreak = True
+isSp _ = False
+
+-- | Intersperse line breaks
+intersperseBrs :: [Doc] -> Doc
+intersperseBrs = vcat . intersperse (selfClosingTag "Br" []) . filter (not . isEmpty)
+
 -- | Wrap a list of inline elements in an ICML Paragraph Style
 parStyle :: WriterOptions -> Style -> [Inline] -> WS Doc
 parStyle opts style lst =
@@ -470,8 +501,7 @@ parStyle opts style lst =
                    else [attrs]
   in  do
       content <- inlinesToICML opts [] lst
-      let cont = inTags True "ParagraphStyleRange" attrs'
-                   $ mappend content $ selfClosingTag "Br" []
+      let cont = inTags True "ParagraphStyleRange" attrs' content
       state $ \st -> (cont, st{ blockStyles = Set.insert stlStr $ blockStyles st })
 
 -- | Wrap a Doc in an ICML Character Style.
@@ -497,39 +527,48 @@ styleToStrAttr style =
   in  (stlStr, attrs)
 
 -- | Assemble an ICML Image.
-imageICML :: WriterOptions -> Style -> [Inline] -> Target -> WS Doc
-imageICML _ style _ (linkURI, _) =
-  let imgWidth  = 300::Int --TODO: set width, height dynamically as in Docx.hs
-      imgHeight = 200::Int
-      scaleFact = show (1::Double) --TODO: set scaling factor so image is scaled exactly to imgWidth x imgHeight
-      hw = show $ imgWidth  `div` 2
-      hh = show $ imgHeight `div` 2
-      qw = show $ imgWidth  `div` 4
-      qh = show $ imgHeight `div` 4
-      uriPrefix = if isURI linkURI then "" else "file:"
+imageICML :: WriterOptions -> Style -> Attr -> Target -> WS Doc
+imageICML opts style attr (src, _) = do
+  res  <- liftIO $ fetchItem (writerSourceURL opts) src
+  imgS <- case res of
+            Left (_) -> do
+              liftIO $ warn $ "Could not find image `" ++ src ++ "', skipping..."
+              return def
+            Right (img, _) -> do
+              case imageSize img of
+                Right size -> return size
+                Left msg   -> do
+                  return $ warn $ "Could not determine image size in `" ++
+                    src ++ "': " ++ msg
+                  return def
+  let (ow, oh) = sizeInPoints imgS
+      (imgWidth, imgHeight) = desiredSizeInPoints opts attr imgS
+      hw = showFl $ ow / 2
+      hh = showFl $ oh / 2
+      scale = showFl (imgWidth / ow) ++ " 0 0 " ++ showFl (imgHeight / oh)
+      src' = if isURI src then src else "file:" ++ src
       (stlStr, attrs) = styleToStrAttr style
       props  = inTags True "Properties" [] $ inTags True "PathGeometry" []
                  $ inTags True "GeometryPathType" [("PathOpen","false")]
                  $ inTags True "PathPointArray" []
                  $ vcat [
-                     selfClosingTag "PathPointType" [("Anchor", "-"++qw++" -"++qh),
-                       ("LeftDirection", "-"++qw++" -"++qh), ("RightDirection", "-"++qw++" -"++qh)]
-                   , selfClosingTag "PathPointType" [("Anchor", "-"++qw++" "++qh),
-                       ("LeftDirection", "-"++qw++" "++qh), ("RightDirection", "-"++qw++" "++qh)]
-                   , selfClosingTag "PathPointType" [("Anchor", qw++" "++qh),
-                       ("LeftDirection", qw++" "++qh), ("RightDirection", qw++" "++qh)]
-                   , selfClosingTag "PathPointType" [("Anchor", qw++" -"++qh),
-                       ("LeftDirection", qw++" -"++qh), ("RightDirection", qw++" -"++qh)]
+                     selfClosingTag "PathPointType" [("Anchor", "-"++hw++" -"++hh),
+                       ("LeftDirection", "-"++hw++" -"++hh), ("RightDirection", "-"++hw++" -"++hh)]
+                   , selfClosingTag "PathPointType" [("Anchor", "-"++hw++" "++hh),
+                       ("LeftDirection", "-"++hw++" "++hh), ("RightDirection", "-"++hw++" "++hh)]
+                   , selfClosingTag "PathPointType" [("Anchor", hw++" "++hh),
+                       ("LeftDirection", hw++" "++hh), ("RightDirection", hw++" "++hh)]
+                   , selfClosingTag "PathPointType" [("Anchor", hw++" -"++hh),
+                       ("LeftDirection", hw++" -"++hh), ("RightDirection", hw++" -"++hh)]
                    ]
       image  = inTags True "Image"
-                   [("Self","ue6"), ("ItemTransform", scaleFact++" 0 0 "++scaleFact++" -"++qw++" -"++qh)]
+                   [("Self","ue6"), ("ItemTransform", scale++" -"++hw++" -"++hh)]
                  $ vcat [
                      inTags True "Properties" [] $ inTags True "Profile" [("type","string")] $ text "$ID/Embedded"
-                       $$ selfClosingTag "GraphicBounds" [("Left","0"), ("Top","0"), ("Right", hw), ("Bottom", hh)]
-                   , selfClosingTag "Link" [("Self", "ueb"), ("LinkResourceURI", uriPrefix++linkURI)]
+                   , selfClosingTag "Link" [("Self", "ueb"), ("LinkResourceURI", src')]
                    ]
       doc    = inTags True "CharacterStyleRange" attrs
-                 $ inTags True "Rectangle" [("Self","uec"), ("ItemTransform", "1 0 0 1 "++qw++" -"++qh)]
+                 $ inTags True "Rectangle" [("Self","uec"), ("StrokeWeight", "0"),
+                     ("ItemTransform", scale++" "++hw++" -"++hh)]
                  $ (props $$ image)
-  in  do
-      state $ \st -> (doc, st{ inlineStyles = Set.insert stlStr $ inlineStyles st } )
+  state $ \st -> (doc, st{ inlineStyles = Set.insert stlStr $ inlineStyles st } )
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 770a674..0f47132 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -38,15 +38,16 @@ import Text.Pandoc.Options
 import Text.Pandoc.Templates
 import Text.Printf ( printf )
 import Network.URI ( isURI, unEscapeString )
-import Data.Aeson (object, (.=))
-import Data.List ( (\\), isInfixOf, stripPrefix, intercalate, intersperse )
+import Data.Aeson (object, (.=), FromJSON)
+import Data.List ( (\\), isInfixOf, stripPrefix, intercalate, intersperse, nub, nubBy )
 import Data.Char ( toLower, isPunctuation, isAscii, isLetter, isDigit, ord )
-import Data.Maybe ( fromMaybe )
+import Data.Maybe ( fromMaybe, isJust, catMaybes )
 import qualified Data.Text as T
 import Control.Applicative ((<|>))
 import Control.Monad.State
 import qualified Text.Parsec as P
 import Text.Pandoc.Pretty
+import Text.Pandoc.ImageSize
 import Text.Pandoc.Slides
 import Text.Pandoc.Highlighting (highlight, styleToLaTeX,
                                  formatLaTeXInline, formatLaTeXBlock,
@@ -99,12 +100,12 @@ pandocToLaTeX options (Pandoc meta blocks) = do
                              _ -> blocks
                    else blocks
   -- see if there are internal links
-  let isInternalLink (Link _ ('#':xs,_))  = [xs]
-      isInternalLink _                    = []
+  let isInternalLink (Link _ _ ('#':xs,_))  = [xs]
+      isInternalLink _                      = []
   modify $ \s -> s{ stInternalLinks = query isInternalLink blocks' }
   let template = writerTemplate options
   -- set stBook depending on documentclass
-  let colwidth = if writerWrapText options
+  let colwidth = if writerWrapText options == WrapAuto
                     then Just $ writerColumns options
                     else Nothing
   metadata <- metaToJSON options
@@ -112,12 +113,7 @@ pandocToLaTeX options (Pandoc meta blocks) = do
               (fmap (render colwidth) . inlineListToLaTeX)
               meta
   let bookClasses = ["memoir","book","report","scrreprt","scrbook"]
-  let documentClass = case P.parse (do P.skipMany (P.satisfy (/='\\'))
-                                       P.string "\\documentclass"
-                                       P.skipMany (P.satisfy (/='{'))
-                                       P.char '{'
-                                       P.manyTill P.letter (P.char '}')) "template"
-                              template of
+  let documentClass = case P.parse pDocumentClass "template" template of
                               Right r -> r
                               Left _  -> ""
   case lookup "documentclass" (writerVariables options) `mplus`
@@ -129,7 +125,12 @@ pandocToLaTeX options (Pandoc meta blocks) = do
                  | otherwise               -> return ()
   -- check for \usepackage...{csquotes}; if present, we'll use
   -- \enquote{...} for smart quotes:
-  when ("{csquotes}" `isInfixOf` template) $
+  let headerIncludesField :: FromJSON a => Maybe a
+      headerIncludesField = getField "header-includes" metadata
+  let headerIncludes = fromMaybe [] $ mplus
+                       (fmap return headerIncludesField)
+                       headerIncludesField
+  when (any (isInfixOf "{csquotes}") (template : headerIncludes)) $
     modify $ \s -> s{stCsquotes = True}
   let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then
                                  (blocks', [])
@@ -145,6 +146,16 @@ pandocToLaTeX options (Pandoc meta blocks) = do
   st <- get
   titleMeta <- stringToLaTeX TextString $ stringify $ docTitle meta
   authorsMeta <- mapM (stringToLaTeX TextString . stringify) $ docAuthors meta
+  let docLangs = nub $ query (extract "lang") blocks
+  let hasStringValue x = isJust (getField x metadata :: Maybe String)
+  let geometryFromMargins = intercalate [','] $ catMaybes $
+                              map (\(x,y) ->
+                                ((x ++ "=") ++) <$> getField y metadata)
+                              [("lmargin","margin-left")
+                              ,("rmargin","margin-right")
+                              ,("tmargin","margin-top")
+                              ,("bmargin","margin-bottom")
+                              ]
   let context  =  defField "toc" (writerTableOfContents options) $
                   defField "toc-depth" (show (writerTOCDepth options -
                                               if stBook st
@@ -179,18 +190,52 @@ pandocToLaTeX options (Pandoc meta blocks) = do
                          Biblatex -> defField "biblio-title" biblioTitle .
                                      defField "biblatex" True
                          _        -> id) $
+                  -- set lang to something so polyglossia/babel is included
+                  defField "lang" (if null docLangs then ""::String else "en") $
+                  defField "otherlangs" docLangs $
+                  defField "colorlinks" (any hasStringValue
+                           ["citecolor", "urlcolor", "linkcolor", "toccolor"]) $
+                  defField "dir" (if (null $ query (extract "dir") blocks)
+                                     then ""::String
+                                     else "ltr") $
+                  defField "section-titles" True $
+                  defField "geometry" geometryFromMargins $
                   metadata
   let toPolyObj lang = object [ "name"    .= T.pack name
                               , "options" .= T.pack opts ]
         where
           (name, opts) = toPolyglossia lang
   let lang = maybe [] (splitBy (=='-')) $ getField "lang" context
+      otherlangs = maybe [] (map $ splitBy (=='-')) $ getField "otherlangs" context
   let context' =
           defField "babel-lang" (toBabel lang)
+        $ defField "babel-otherlangs" (map toBabel otherlangs)
+        $ defField "babel-newcommands" (concatMap (\(poly, babel) ->
+            -- \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}}}\n"
+               else "\\newcommand{\\text" ++ poly ++ "}[2][]{\\foreignlanguage{"
+                      ++ babel ++ "}{#2}}\n" ++
+                    "\\newenvironment{" ++ poly ++ "}[1]{\\begin{otherlanguage}{"
+                      ++ babel ++ "}}{\\end{otherlanguage}}\n"
+            )
+            -- 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 ->
+              let lng = splitBy (=='-') l
+              in  (fst $ toPolyglossia lng, toBabel lng)
+              )
+            docLangs )
         $ defField "polyglossia-lang" (toPolyObj lang)
-        $ defField "polyglossia-otherlangs"
-            (maybe [] (map $ toPolyObj . splitBy (=='-')) $
-            getField "otherlangs" context)
+        $ defField "polyglossia-otherlangs" (map toPolyObj otherlangs)
         $ defField "latex-dir-rtl" (case (getField "dir" context)::Maybe String of
                                       Just "rtl" -> True
                                       _          -> False)
@@ -294,12 +339,8 @@ elementToBeamer slideLevel  (Sec lvl _num (ident,classes,kvs) tit elts)
           hasCodeBlock _               = []
       let hasCode (Code _ _) = [True]
           hasCode _          = []
-      opts <- gets stOptions
       let fragile = "fragile" `elem` classes ||
-                    not (null $ query hasCodeBlock elts ++
-                                     if writerListings opts
-                                        then query hasCode elts
-                                        else [])
+                    not (null $ query hasCodeBlock elts ++ query hasCode elts)
       let frameoptions = ["allowdisplaybreaks", "allowframebreaks",
                           "b", "c", "t", "environment",
                           "label", "plain", "shrink"]
@@ -326,6 +367,7 @@ isListBlock _                  = False
 
 isLineBreakOrSpace :: Inline -> Bool
 isLineBreakOrSpace LineBreak = True
+isLineBreakOrSpace SoftBreak = True
 isLineBreakOrSpace Space = True
 isLineBreakOrSpace _ = False
 
@@ -338,29 +380,49 @@ blockToLaTeX (Div (identifier,classes,kvs) bs) = do
   ref <- toLabel identifier
   let linkAnchor = if null identifier
                       then empty
-                      else "\\hyperdef{}" <> braces (text ref) <>
-                           braces ("\\label" <> braces (text ref))
-  contents' <- blockListToLaTeX bs
-  let align dir = inCmd "begin" dir $$ contents' $$ inCmd "end" dir
-  let contents = case lookup "dir" kvs of
-                   Just "rtl" -> align "RTL"
-                   Just "ltr" -> align "LTR"
-                   _          -> contents'
-  if beamer && "notes" `elem` classes  -- speaker notes
-     then return $ "\\note" <> braces contents
-     else return (linkAnchor $$ contents)
+                      else "\\hypertarget" <> braces (text ref) <>
+                             braces empty
+  let align dir txt = inCmd "begin" dir $$ txt $$ inCmd "end" dir
+  let wrapDir = case lookup "dir" kvs of
+                  Just "rtl" -> align "RTL"
+                  Just "ltr" -> align "LTR"
+                  _          -> id
+      wrapLang txt = case lookup "lang" kvs of
+                       Just lng -> let (l, o) = toPolyglossiaEnv lng
+                                       ops = if null o
+                                                then ""
+                                                else brackets $ text o
+                                   in  inCmd "begin" (text l) <> ops
+                                       $$ blankline <> txt <> blankline
+                                       $$ inCmd "end" (text l)
+                       Nothing  -> txt
+      wrapNotes txt = if beamer && "notes" `elem` classes
+                          then "\\note" <> braces txt -- speaker notes
+                          else linkAnchor $$ txt
+  fmap (wrapDir . wrapLang . wrapNotes) $ blockListToLaTeX bs
 blockToLaTeX (Plain lst) =
   inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
 -- title beginning with fig: indicates that the image is a figure
-blockToLaTeX (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
+blockToLaTeX (Para [Image attr@(ident, _, _) txt (src,'f':'i':'g':':':tit)]) = do
   inNote <- gets stInNote
+  modify $ \st -> st{ stInMinipage = True, stNotes = [] }
   capt <- inlineListToLaTeX txt
-  img <- inlineToLaTeX (Image txt (src,tit))
+  notes <- gets stNotes
+  modify $ \st -> st{ stInMinipage = False, stNotes = [] }
+  -- We can't have footnotes in the list of figures, so remove them:
+  captForLof <- if null notes
+                   then return empty
+                   else brackets <$> inlineListToLaTeX (walk deNote txt)
+  img <- inlineToLaTeX (Image attr txt (src,tit))
+  let footnotes = notesToLaTeX notes
+  figure <- refLabel ident $ cr <>
+            "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
+            ("\\caption" <> captForLof <> braces capt) $$
+            "\\end{figure}" <> cr
   return $ if inNote
               -- can't have figures in notes
               then "\\begin{center}" $$ img $+$ capt $$ "\\end{center}"
-              else "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
-                      ("\\caption" <> braces capt) $$ "\\end{figure}"
+              else figure $$ footnotes
 -- . . . indicates pause in beamer slides
 blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do
   beamer <- writerBeamer `fmap` gets stOptions
@@ -389,7 +451,7 @@ blockToLaTeX (CodeBlock (identifier,classes,keyvalAttr) str) = do
   ref <- toLabel identifier
   let linkAnchor = if null identifier
                       then empty
-                      else "\\hyperdef{}" <> braces (text ref) <>
+                      else "\\hypertarget" <> braces (text ref) <>
                                 braces ("\\label" <> braces (text ref))
   let lhsCodeBlock = do
         modify $ \s -> s{ stLHS = True }
@@ -510,26 +572,29 @@ blockToLaTeX (Header level (id',classes,_) lst) = do
 blockToLaTeX (Table caption aligns widths heads rows) = do
   headers <- if all null heads
                 then return empty
-                else ($$ "\\midrule\n") `fmap`
-                      (tableRowToLaTeX True aligns widths) heads
+                else do
+                    contents <- (tableRowToLaTeX True aligns widths) heads
+                    return ("\\toprule" $$ contents $$ "\\midrule")
   let endhead = if all null heads
                    then empty
                    else text "\\endhead"
+  let endfirsthead = if all null heads
+                       then empty
+                       else text "\\endfirsthead"
   captionText <- inlineListToLaTeX caption
   let capt = if isEmpty captionText
                 then empty
-                else text "\\caption" <> braces captionText
-                         <> "\\tabularnewline\n\\toprule\n"
-                         <> headers
-                         <> "\\endfirsthead"
+                else text "\\caption" <> braces captionText <> "\\tabularnewline"
+                         $$ headers
+                         $$ endfirsthead
   rows' <- mapM (tableRowToLaTeX False aligns widths) rows
   let colDescriptors = text $ concat $ map toColDescriptor aligns
   modify $ \s -> s{ stTable = True }
-  return $ "\\begin{longtable}[c]" <>
+  return $ "\\begin{longtable}[]" <>
               braces ("@{}" <> colDescriptors <> "@{}")
               -- the @{} removes extra space at beginning and end
          $$ capt
-         $$ "\\toprule"
+         $$ (if all null heads then "\\toprule" else empty)
          $$ headers
          $$ endhead
          $$ vcat rows'
@@ -602,19 +667,21 @@ tableCellToLaTeX header (width, align, blocks) = do
   return $ ("\\begin{minipage}" <> valign <>
             braces (text (printf "%.2f\\columnwidth" width)) <>
             (halign <> "\\strut" <> cr <> cellContents <> cr) <>
-            "\\strut\\end{minipage}")
-          $$ case notes of
-                  [] -> empty
-                  ns -> (case length ns of
+            "\\strut\\end{minipage}") $$
+            notesToLaTeX notes
+
+notesToLaTeX :: [Doc] -> Doc
+notesToLaTeX [] = empty
+notesToLaTeX ns = (case length ns of
                               n | n > 1 -> "\\addtocounter" <>
                                            braces "footnote" <>
                                            braces (text $ show $ 1 - n)
                                 | otherwise -> empty)
-                        $$
-                        vcat (intersperse
-                          ("\\addtocounter" <> braces "footnote" <> braces "1")
-                          $ map (\x -> "\\footnotetext" <> braces x)
-                          $ reverse ns)
+                   $$
+                   vcat (intersperse
+                     ("\\addtocounter" <> braces "footnote" <> braces "1")
+                     $ map (\x -> "\\footnotetext" <> braces x)
+                     $ reverse ns)
 
 listItemToLaTeX :: [Block] -> State WriterState Doc
 listItemToLaTeX lst
@@ -631,8 +698,8 @@ defListItemToLaTeX (term, defs) = do
     term' <- inlineListToLaTeX term
     -- put braces around term if it contains an internal link,
     -- since otherwise we get bad bracket interactions: \item[\hyperref[..]
-    let isInternalLink (Link _ ('#':_,_)) = True
-        isInternalLink _                  = False
+    let isInternalLink (Link _ _ ('#':_,_)) = True
+        isInternalLink _                    = False
     let term'' = if any isInternalLink term
                     then braces term'
                     else term'
@@ -649,9 +716,8 @@ sectionHeader :: Bool    -- True for unnumbered
               -> Int
               -> [Inline]
               -> State WriterState Doc
-sectionHeader unnumbered ref level lst = do
+sectionHeader unnumbered ident level lst = do
   txt <- inlineListToLaTeX lst
-  lab <- text `fmap` toLabel ref
   plain <- stringToLaTeX TextString $ foldl (++) "" $ map stringify lst
   let noNote (Note _) = Str ""
       noNote x        = x
@@ -674,17 +740,6 @@ sectionHeader unnumbered ref level lst = do
   book <- gets stBook
   opts <- gets stOptions
   let level' = if book || writerChapters opts then level - 1 else level
-  internalLinks <- gets stInternalLinks
-  let refLabel x = (if ref `elem` internalLinks
-                       then text "\\hyperdef"
-                                <> braces empty
-                                <> braces lab
-                                <> braces x
-                       else x)
-  let headerWith x y = refLabel $ text x <> y <>
-                             if null ref
-                                then empty
-                                else text "\\label" <> braces lab
   let sectionType = case level' of
                           0  | writerBeamer opts -> "part"
                              | otherwise -> "chapter"
@@ -700,16 +755,31 @@ sectionHeader unnumbered ref level lst = do
                   -- needed for \paragraph, \subparagraph in quote environment
                   -- see http://tex.stackexchange.com/questions/169830/
                   else empty
+  stuffing' <- refLabel ident $ text ('\\':sectionType) <> stuffing
   return $ if level' > 5
               then txt
-              else prefix $$
-                   headerWith ('\\':sectionType) stuffing
+              else prefix $$ stuffing'
                    $$ if unnumbered
                          then "\\addcontentsline{toc}" <>
                                 braces (text sectionType) <>
                                 braces txtNoNotes
                          else empty
 
+-- | Append label to x and wrap in hypertarget
+refLabel :: String -> Doc -> State WriterState Doc
+refLabel ident x = do
+  ref <- text `fmap` toLabel ident
+  internalLinks <- gets stInternalLinks
+  let hypertarget y = if ident `elem` internalLinks
+                         then text "\\hypertarget"
+                                <> braces ref
+                                <> braces y
+                         else y
+      label = if null ident
+                 then empty
+                 else text "\\label" <> braces ref
+  return $ hypertarget $ x <> label
+
 -- | Convert list of inline elements to LaTeX.
 inlineListToLaTeX :: [Inline]  -- ^ Inlines to convert
                   -> State WriterState Doc
@@ -743,25 +813,26 @@ isQuoted _ = False
 inlineToLaTeX :: Inline    -- ^ Inline to convert
               -> State WriterState Doc
 inlineToLaTeX (Span (id',classes,kvs) ils) = do
-  let noEmph = "csl-no-emph" `elem` classes
-  let noStrong = "csl-no-strong" `elem` classes
-  let noSmallCaps = "csl-no-smallcaps" `elem` classes
-  let rtl = ("dir","rtl") `elem` kvs
-  let ltr = ("dir","ltr") `elem` kvs
   ref <- toLabel id'
   let linkAnchor = if null id'
                       then empty
-                      else "\\protect\\hyperdef{}" <> braces (text ref) <>
-                             braces ("\\label" <> braces (text ref))
-  fmap (linkAnchor <>)
-    ((if noEmph then inCmd "textup" else id) .
-     (if noStrong then inCmd "textnormal" else id) .
-     (if noSmallCaps then inCmd "textnormal" else id) .
-     (if rtl then inCmd "RL" else id) .
-     (if ltr then inCmd "LR" else id) .
-     (if not (noEmph || noStrong || noSmallCaps || rtl || ltr)
-         then braces
-         else id)) `fmap` inlineListToLaTeX ils
+                      else "\\protect\\hypertarget" <> braces (text ref) <>
+                             braces empty
+  let cmds = ["textup" | "csl-no-emph" `elem` classes] ++
+             ["textnormal" | "csl-no-strong" `elem` classes ||
+                             "csl-no-smallcaps" `elem` classes] ++
+             ["RL" | ("dir", "rtl") `elem` kvs] ++
+             ["LR" | ("dir", "ltr") `elem` kvs] ++
+             (case lookup "lang" kvs of
+                Just lng -> let (l, o) = toPolyglossia $ splitBy (=='-') lng
+                                ops = if null o then "" else ("[" ++ o ++ "]")
+                            in  ["text" ++ l ++ ops]
+                Nothing  -> [])
+  contents <- inlineListToLaTeX ils
+  return $ linkAnchor <>
+           if null cmds
+              then braces contents
+              else foldr inCmd contents cmds
 inlineToLaTeX (Emph lst) =
   inlineListToLaTeX lst >>= return . inCmd "emph"
 inlineToLaTeX (Strong lst) =
@@ -842,12 +913,18 @@ inlineToLaTeX (RawInline f str)
                         = return $ text str
   | otherwise           = return empty
 inlineToLaTeX (LineBreak) = return $ "\\\\" <> cr
+inlineToLaTeX SoftBreak = do
+  wrapText <- gets (writerWrapText . stOptions)
+  case wrapText of
+       WrapAuto     -> return space
+       WrapNone     -> return space
+       WrapPreserve -> return cr
 inlineToLaTeX Space = return space
-inlineToLaTeX (Link txt ('#':ident, _)) = do
+inlineToLaTeX (Link _ txt ('#':ident, _)) = do
   contents <- inlineListToLaTeX txt
   lab <- toLabel ident
-  return $ text "\\hyperref" <> brackets (text lab) <> braces contents
-inlineToLaTeX (Link txt (src, _)) =
+  return $ text "\\protect\\hyperlink" <> braces (text lab) <> braces contents
+inlineToLaTeX (Link _ txt (src, _)) =
   case txt of
         [Str x] | escapeURI x == src ->  -- autolink
              do modify $ \s -> s{ stUrl = True }
@@ -864,16 +941,31 @@ inlineToLaTeX (Link txt (src, _)) =
                 src' <- stringToLaTeX URLString (escapeURI src)
                 return $ text ("\\href{" ++ src' ++ "}{") <>
                          contents <> char '}'
-inlineToLaTeX (Image _ (source, _)) = do
+inlineToLaTeX (Image attr _ (source, _)) = do
   modify $ \s -> s{ stGraphics = True }
-  let source' = if isURI source
+  opts <- gets stOptions
+  let showDim dir = let d = text (show dir) <> "="
+                    in case (dimension dir attr) of
+                         Just (Pixel a)   ->
+                           [d <> text (showInInch opts (Pixel a)) <> "in"]
+                         Just (Percent a) ->
+                           [d <> text (showFl (a / 100)) <> "\\textwidth"]
+                         Just dim         ->
+                           [d <> text (show dim)]
+                         Nothing          ->
+                           []
+      dimList = showDim Width ++ showDim Height
+      dims = if null dimList
+                then empty
+                else brackets $ cat (intersperse "," dimList)
+      source' = if isURI source
                    then source
                    else unEscapeString source
   source'' <- stringToLaTeX URLString (escapeURI source')
   inHeading <- gets stInHeading
   return $
-    (if inHeading then "\\protect\\includegraphics" else "\\includegraphics")
-    <> braces (text source'')
+    (if inHeading then "\\protect\\includegraphics" else "\\includegraphics") <>
+    dims <> braces (text source'')
 inlineToLaTeX (Note contents) = do
   inMinipage <- gets stInMinipage
   modify (\s -> s{stInNote = True})
@@ -1002,6 +1094,30 @@ getListingsLanguage :: [String] -> Maybe String
 getListingsLanguage [] = Nothing
 getListingsLanguage (x:xs) = toListingsLanguage x <|> getListingsLanguage xs
 
+-- Extract a key from divs and spans
+extract :: String -> Block -> [String]
+extract key (Div attr _)     = lookKey key attr
+extract key (Plain ils)      = concatMap (extractInline key) ils
+extract key (Para ils)       = concatMap (extractInline key) ils
+extract key (Header _ _ ils) = concatMap (extractInline key) ils
+extract _ _                  = []
+
+-- Extract a key from spans
+extractInline :: String -> Inline -> [String]
+extractInline key (Span attr _) = lookKey key attr
+extractInline _ _               = []
+
+-- Look up a key in an attribute and give a list of its values
+lookKey :: String -> Attr -> [String]
+lookKey key (_,_,kvs) =  maybe [] words $ lookup key kvs
+
+-- In environments \Arabic instead of \arabic is used
+toPolyglossiaEnv :: String -> (String, String)
+toPolyglossiaEnv l =
+  case toPolyglossia $ (splitBy (=='-')) l of
+    ("arabic", o) -> ("Arabic", o)
+    x             -> x
+
 -- Takes a list of the constituents of a BCP 47 language code and
 -- converts it to a Polyglossia (language, options) tuple
 -- http://mirrors.concertpass.com/tex-archive/macros/latex/contrib/polyglossia/polyglossia.pdf
@@ -1019,10 +1135,11 @@ toPolyglossia ("ar":"TN":_)        = ("arabic", "locale=tunisia")
 toPolyglossia ("de":"1901":_)      = ("german", "spelling=old")
 toPolyglossia ("de":"AT":"1901":_) = ("german", "variant=austrian, spelling=old")
 toPolyglossia ("de":"AT":_)        = ("german", "variant=austrian")
+toPolyglossia ("de":"CH":"1901":_) = ("german", "variant=swiss, spelling=old")
 toPolyglossia ("de":"CH":_)        = ("german", "variant=swiss")
 toPolyglossia ("de":_)             = ("german", "")
 toPolyglossia ("dsb":_)            = ("lsorbian", "")
-toPolyglossia ("el":"poly":_)      = ("greek",   "variant=poly")
+toPolyglossia ("el":"polyton":_)   = ("greek",   "variant=poly")
 toPolyglossia ("en":"AU":_)        = ("english", "variant=australian")
 toPolyglossia ("en":"CA":_)        = ("english", "variant=canadian")
 toPolyglossia ("en":"GB":_)        = ("english", "variant=british")
@@ -1044,7 +1161,7 @@ toBabel ("de":"AT":"1901":_) = "austrian"
 toBabel ("de":"AT":_)        = "naustrian"
 toBabel ("de":_)             = "ngerman"
 toBabel ("dsb":_)            = "lowersorbian"
-toBabel ("el":"poly":_)      = "polutonikogreek"
+toBabel ("el":"polyton":_)   = "polutonikogreek"
 toBabel ("en":"AU":_)        = "australian"
 toBabel ("en":"CA":_)        = "canadian"
 toBabel ("en":"GB":_)        = "british"
@@ -1076,7 +1193,7 @@ commonFromBcp47 x = fromIso $ head x
     fromIso "br"  = "breton"
     fromIso "ca"  = "catalan"
     fromIso "cy"  = "welsh"
-    fromIso "cz"  = "czech"
+    fromIso "cs"  = "czech"
     fromIso "cop" = "coptic"
     fromIso "da"  = "danish"
     fromIso "dv"  = "divehi"
@@ -1142,3 +1259,28 @@ commonFromBcp47 x = fromIso $ head x
     fromIso "ur"  = "urdu"
     fromIso "vi"  = "vietnamese"
     fromIso _     = ""
+
+deNote :: Inline -> Inline
+deNote (Note _) = RawInline (Format "latex") ""
+deNote x = x
+
+pDocumentOptions :: P.Parsec String () [String]
+pDocumentOptions = do
+  P.char '['
+  opts <- P.sepBy
+    (P.many $ P.spaces *> P.noneOf (" ,]" :: String) <* P.spaces)
+    (P.char ',')
+  P.char ']'
+  return opts
+
+pDocumentClass :: P.Parsec String () String
+pDocumentClass =
+  do P.skipMany (P.satisfy (/='\\'))
+     P.string "\\documentclass"
+     classOptions <- pDocumentOptions <|> return []
+     if ("article" :: String) `elem` classOptions
+       then return "article"
+       else do P.skipMany (P.satisfy (/='{'))
+               P.char '{'
+               P.manyTill P.letter (P.char '}')
+                                   
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
index 6b1e423..5c7d760 100644
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -54,7 +54,7 @@ writeMan opts document = evalState (pandocToMan opts document) (WriterState [] F
 -- | Return groff man representation of document.
 pandocToMan :: WriterOptions -> Pandoc -> State WriterState String
 pandocToMan opts (Pandoc meta blocks) = do
-  let colwidth = if writerWrapText opts
+  let colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
   let render' = render colwidth
@@ -146,6 +146,7 @@ breakSentence xs =
            []             -> (as, [])
            [c]            -> (as ++ [c], [])
            (c:Space:cs)   -> (as ++ [c], cs)
+           (c:SoftBreak:cs) -> (as ++ [c], cs)
            (Str ".":Str (')':ys):cs) -> (as ++ [Str ".", Str (')':ys)], cs)
            (x@(Str ('.':')':_)):cs) -> (as ++ [x], cs)
            (LineBreak:x@(Str ('.':_)):cs) -> (as ++[LineBreak], x:cs)
@@ -343,8 +344,9 @@ inlineToMan _ (RawInline f str)
   | otherwise         = return empty
 inlineToMan _ (LineBreak) = return $
   cr <> text ".PD 0" $$ text ".P" $$ text ".PD" <> cr
+inlineToMan _ SoftBreak = return space
 inlineToMan _ Space = return space
-inlineToMan opts (Link txt (src, _)) = do
+inlineToMan opts (Link _ txt (src, _)) = do
   linktext <- inlineListToMan opts txt
   let srcSuffix = fromMaybe src (stripPrefix "mailto:" src)
   return $ case txt of
@@ -352,12 +354,12 @@ inlineToMan opts (Link txt (src, _)) = do
              | escapeURI s == srcSuffix ->
                                  char '<' <> text srcSuffix <> char '>'
            _                  -> linktext <> text " (" <> text src <> char ')'
-inlineToMan opts (Image alternate (source, tit)) = do
+inlineToMan opts (Image attr alternate (source, tit)) = do
   let txt = if (null alternate) || (alternate == [Str ""]) ||
                (alternate == [Str source]) -- to prevent autolinks
                then [Str "image"]
                else alternate
-  linkPart <- inlineToMan opts (Link txt (source, tit))
+  linkPart <- inlineToMan opts (Link attr txt (source, tit))
   return $ char '[' <> text "IMAGE: " <> linkPart <> char ']'
 inlineToMan _ (Note contents) = do
   -- add to notes in state
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index cd9c262..ce99309 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -53,25 +53,28 @@ import Data.Yaml (Value(Object,String,Array,Bool,Number))
 import qualified Data.HashMap.Strict as H
 import qualified Data.Vector as V
 import qualified Data.Text as T
+import qualified Data.Set as Set
 
 type Notes = [[Block]]
-type Refs = [([Inline], Target)]
+type Ref   = ([Inline], Target, Attr)
+type Refs  = [Ref]
 data WriterState = WriterState { stNotes           :: Notes
                                , stRefs            :: Refs
                                , stRefShortcutable :: Bool
                                , stInList          :: Bool
-                               , stIds             :: [String]
+                               , stIds             :: Set.Set String
                                , stPlain           :: Bool }
 instance Default WriterState
   where def = WriterState{ stNotes = [], stRefs = [], stRefShortcutable = True,
-                           stInList = False, stIds = [], stPlain = False }
+                           stInList = False, stIds = Set.empty, stPlain = False }
 
 -- | Convert Pandoc to Markdown.
 writeMarkdown :: WriterOptions -> Pandoc -> String
 writeMarkdown opts document =
   evalState (pandocToMarkdown opts{
-                  writerWrapText = writerWrapText opts &&
-                  not (isEnabled Ext_hard_line_breaks opts) }
+                  writerWrapText = if isEnabled Ext_hard_line_breaks opts
+                                      then WrapNone
+                                      else writerWrapText opts }
              document) def
 
 -- | Convert Pandoc to plain text (like markdown, but without links,
@@ -114,7 +117,7 @@ plainTitleBlock tit auths dat =
   dat <> cr
 
 yamlMetadataBlock :: Value -> Doc
-yamlMetadataBlock v = "---" $$ (jsonToYaml v) $$ "..."
+yamlMetadataBlock v = "---" $$ (jsonToYaml v) $$ "---"
 
 jsonToYaml :: Value -> Doc
 jsonToYaml (Object hashmap) =
@@ -125,7 +128,8 @@ jsonToYaml (Object hashmap) =
                  | otherwise      -> (k' <> ":") $$ x
                (k', Object _, x)  -> (k' <> ":") $$ nest 2 x
                (_, String "", _)  -> empty
-               (k', _, x)         -> k' <> ":" <> space <> hang 2 "" x)
+               (k', _, x)  | k == "meta-json"  -> empty
+                           | otherwise -> k' <> ":" <> space <> hang 2 "" x)
        $ sortBy (comparing fst) $ H.toList hashmap
 jsonToYaml (Array vec) =
   vcat $ map (\v -> hang 2 "- " (jsonToYaml v)) $ V.toList vec
@@ -142,7 +146,7 @@ jsonToYaml _ = empty
 -- | Return markdown representation of document.
 pandocToMarkdown :: WriterOptions -> Pandoc -> State WriterState String
 pandocToMarkdown opts (Pandoc meta blocks) = do
-  let colwidth = if writerWrapText opts
+  let colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
   isPlain <- gets stPlain
@@ -200,15 +204,16 @@ refsToMarkdown opts refs = mapM (keyToMarkdown opts) refs >>= return . vcat
 
 -- | Return markdown representation of a reference key.
 keyToMarkdown :: WriterOptions
-              -> ([Inline], (String, String))
+              -> Ref
               -> State WriterState Doc
-keyToMarkdown opts (label, (src, tit)) = do
+keyToMarkdown opts (label, (src, tit), attr) = do
   label' <- inlineListToMarkdown opts label
   let tit' = if null tit
                 then empty
                 else space <> "\"" <> text tit <> "\""
   return $ nest 2 $ hang 2
             ("[" <> label' <> "]:" <> space) (text src <> tit')
+            <> linkAttributes opts attr
 
 -- | Return markdown representation of notes.
 notesToMarkdown :: WriterOptions -> [[Block]] -> State WriterState Doc
@@ -264,7 +269,7 @@ elementToListItem opts (Sec lev _nums (ident,_,_) headerText subsecs)
       not (null subsecs) && lev < writerTOCDepth opts ]
    where headerLink = if null ident
                          then headerText
-                         else [Link headerText ('#':ident, "")]
+                         else [Link nullAttr headerText ('#':ident, "")]
 elementToListItem _ (Blk _) = []
 
 attrsToMarkdown :: Attr -> Doc
@@ -283,6 +288,12 @@ attrsToMarkdown attribs = braces $ hsep [attribId, attribClasses, attribKeys]
                                             map (\(k,v) -> text k
                                               <> "=\"" <> text v <> "\"") ks
 
+linkAttributes :: WriterOptions -> Attr -> Doc
+linkAttributes opts attr =
+  if isEnabled Ext_link_attributes opts && attr /= nullAttr
+     then attrsToMarkdown attr
+     else empty
+
 -- | Ordered list start parser for use in Para below.
 olMarker :: Parser [Char] ParserState Char
 olMarker = do (start, style', delim) <- anyOrderedListMarker
@@ -315,7 +326,7 @@ blockToMarkdown opts (Plain inlines) = do
   contents <- inlineListToMarkdown opts inlines
   -- escape if para starts with ordered list marker
   st <- get
-  let colwidth = if writerWrapText opts
+  let colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
   let rendered = render colwidth contents
@@ -328,8 +339,8 @@ blockToMarkdown opts (Plain inlines) = do
                      else contents
   return $ contents' <> cr
 -- title beginning with fig: indicates figure
-blockToMarkdown opts (Para [Image alt (src,'f':'i':'g':':':tit)]) =
-  blockToMarkdown opts (Para [Image alt (src,tit)])
+blockToMarkdown opts (Para [Image attr alt (src,'f':'i':'g':':':tit)]) =
+  blockToMarkdown opts (Para [Image attr alt (src,tit)])
 blockToMarkdown opts (Para inlines) =
   (<> blankline) `fmap` blockToMarkdown opts (Plain inlines)
 blockToMarkdown opts (RawBlock f str)
@@ -354,7 +365,7 @@ blockToMarkdown opts (Header level attr inlines) = do
   -- so we know whether to print an explicit identifier
   ids <- gets stIds
   let autoId = uniqueIdent inlines ids
-  modify $ \st -> st{ stIds = autoId : ids }
+  modify $ \st -> st{ stIds = Set.insert autoId ids }
   let attr' = case attr of
                    ("",[],[]) -> empty
                    (id',[],[]) | isEnabled Ext_auto_identifiers opts
@@ -562,7 +573,7 @@ gridTable opts headless _aligns widths headers' rawRows =  do
                    else widths
   let widthsInChars = map (floor . (fromIntegral (writerColumns opts) *)) widths'
   let hpipeBlocks blocks = hcat [beg, middle, end]
-        where h       = maximum (map height blocks)
+        where h       = maximum (1 : map height blocks)
               sep'    = lblock 3 $ vcat (map text $ replicate h " | ")
               beg     = lblock 2 $ vcat (map text $ replicate h "| ")
               end     = lblock 2 $ vcat (map text $ replicate h " |")
@@ -668,21 +679,21 @@ blockListToMarkdown opts blocks =
 
 -- | Get reference for target; if none exists, create unique one and return.
 --   Prefer label if possible; otherwise, generate a unique key.
-getReference :: [Inline] -> Target -> State WriterState [Inline]
-getReference label (src, tit) = do
+getReference :: Attr -> [Inline] -> Target -> State WriterState [Inline]
+getReference attr label target = do
   st <- get
-  case find ((== (src, tit)) . snd) (stRefs st) of
-    Just (ref, _) -> return ref
+  case find (\(_,t,a) -> t == target && a == attr) (stRefs st) of
+    Just (ref, _, _) -> return ref
     Nothing       -> do
-      let label' = case find ((== label) . fst) (stRefs st) of
+      let label' = case find (\(l,_,_) -> l == label) (stRefs st) of
                       Just _ -> -- label is used; generate numerical label
                              case find (\n -> notElem [Str (show n)]
-                                                      (map fst (stRefs st)))
+                                                      (map (\(l,_,_) -> l) (stRefs st)))
                                        [1..(10000 :: Integer)] of
                                   Just x  -> [Str (show x)]
                                   Nothing -> error "no unique label"
                       Nothing -> label
-      modify (\s -> s{ stRefs = (label', (src,tit)) : stRefs st })
+      modify (\s -> s{ stRefs = (label', target, attr) : stRefs st })
       return label'
 
 -- | Convert list of Pandoc inline elements to markdown.
@@ -692,13 +703,17 @@ inlineListToMarkdown opts lst = do
   go (if inlist then avoidBadWrapsInList lst else lst)
   where go [] = return empty
         go (i:is) = case i of
-            (Link _ _) -> case is of
+            (Link _ _ _) -> case is of
                 -- If a link is followed by another link or '[' we don't shortcut
-                (Link _ _):_                  -> unshortcutable
-                Space:(Link _ _):_            -> unshortcutable
+                (Link _ _ _):_                -> unshortcutable
+                Space:(Link _ _ _):_          -> unshortcutable
                 Space:(Str('[':_)):_          -> unshortcutable
                 Space:(RawInline _ ('[':_)):_ -> unshortcutable
                 Space:(Cite _ _):_            -> unshortcutable
+                SoftBreak:(Link _ _ _):_      -> unshortcutable
+                SoftBreak:(Str('[':_)):_      -> unshortcutable
+                SoftBreak:(RawInline _ ('[':_)):_ -> unshortcutable
+                SoftBreak:(Cite _ _):_        -> unshortcutable
                 (Cite _ _):_                  -> unshortcutable
                 Str ('[':_):_                 -> unshortcutable
                 (RawInline _ ('[':_)):_       -> unshortcutable
@@ -712,18 +727,25 @@ inlineListToMarkdown opts lst = do
                     modify (\s -> s {stRefShortcutable = True })
                     fmap (iMark <>) (go is)
 
+isSp :: Inline -> Bool
+isSp Space = True
+isSp SoftBreak = True
+isSp _ = False
+
 avoidBadWrapsInList :: [Inline] -> [Inline]
 avoidBadWrapsInList [] = []
-avoidBadWrapsInList (Space:Str ('>':cs):xs) =
+avoidBadWrapsInList (s:Str ('>':cs):xs) | isSp s =
   Str (' ':'>':cs) : avoidBadWrapsInList xs
-avoidBadWrapsInList (Space:Str [c]:[])
-  | c `elem` ['-','*','+'] = Str [' ', c] : []
-avoidBadWrapsInList (Space:Str [c]:Space:xs)
-  | c `elem` ['-','*','+'] = Str [' ', c] : Space : avoidBadWrapsInList xs
-avoidBadWrapsInList (Space:Str cs:Space:xs)
-  | isOrderedListMarker cs = Str (' ':cs) : Space : avoidBadWrapsInList xs
-avoidBadWrapsInList (Space:Str cs:[])
-  | isOrderedListMarker cs = Str (' ':cs) : []
+avoidBadWrapsInList (s:Str [c]:[])
+  | isSp s && c `elem` ['-','*','+'] = Str [' ', c] : []
+avoidBadWrapsInList (s:Str [c]:Space:xs)
+  | isSp s && c `elem` ['-','*','+'] =
+    Str [' ', 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
 
 isOrderedListMarker :: String -> Bool
@@ -738,6 +760,7 @@ isRight (Left  _) = False
 escapeSpaces :: Inline -> Inline
 escapeSpaces (Str s) = Str $ substitute " " "\\ " s
 escapeSpaces Space = Str "\\ "
+escapeSpaces SoftBreak = Str "\\ "
 escapeSpaces x = x
 
 -- | Convert Pandoc inline element to markdown.
@@ -867,6 +890,11 @@ inlineToMarkdown opts (LineBreak) = do
              then "\\" <> cr
              else "  " <> cr
 inlineToMarkdown _ Space = return space
+inlineToMarkdown opts SoftBreak = return $
+  case writerWrapText opts of
+       WrapNone     -> space
+       WrapAuto     -> space
+       WrapPreserve -> cr
 inlineToMarkdown opts (Cite [] lst) = inlineListToMarkdown opts lst
 inlineToMarkdown opts (Cite (c:cs) lst)
   | not (isEnabled Ext_citations opts) = inlineListToMarkdown opts lst
@@ -897,7 +925,12 @@ inlineToMarkdown opts (Cite (c:cs) lst)
            return $ pdoc <+> r
         modekey SuppressAuthor = "-"
         modekey _              = ""
-inlineToMarkdown opts (Link txt (src, tit)) = do
+inlineToMarkdown opts lnk@(Link attr txt (src, tit))
+  | isEnabled Ext_raw_html opts &&
+    not (isEnabled Ext_link_attributes opts) &&
+    attr /= nullAttr = -- use raw HTML
+    return $ text $ trim $ writeHtmlString def $ Pandoc nullMeta [Plain [lnk]]
+  | otherwise = do
   plain <- gets stPlain
   linktext <- inlineListToMarkdown opts txt
   let linktitle = if null tit
@@ -912,7 +945,7 @@ inlineToMarkdown opts (Link txt (src, tit)) = do
   shortcutable <- gets stRefShortcutable
   let useShortcutRefLinks = shortcutable &&
                             isEnabled Ext_shortcut_reference_links opts
-  ref <- if useRefLinks then getReference txt (src, tit) else return []
+  ref <- if useRefLinks then getReference attr txt (src, tit) else return []
   reftext <- inlineListToMarkdown opts ref
   return $ if useAuto
               then if plain
@@ -929,14 +962,20 @@ inlineToMarkdown opts (Link txt (src, tit)) = do
                       else if plain
                               then linktext
                               else "[" <> linktext <> "](" <>
-                                   text src <> linktitle <> ")"
-inlineToMarkdown opts (Image alternate (source, tit)) = do
+                                   text src <> linktitle <> ")" <>
+                                   linkAttributes opts attr
+inlineToMarkdown opts img@(Image attr alternate (source, tit))
+  | isEnabled Ext_raw_html opts &&
+    not (isEnabled Ext_link_attributes opts) &&
+    attr /= nullAttr = -- use raw HTML
+    return $ text $ trim $ writeHtmlString def $ Pandoc nullMeta [Plain [img]]
+  | otherwise = do
   plain <- gets stPlain
   let txt = if null alternate || alternate == [Str source]
                                  -- to prevent autolinks
                then [Str ""]
                else alternate
-  linkPart <- inlineToMarkdown opts (Link txt (source, tit))
+  linkPart <- inlineToMarkdown opts (Link attr txt (source, tit))
   return $ if plain
               then "[" <> linkPart <> "]"
               else "!" <> linkPart
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs
index 2b7c47e..0da8bc9 100644
--- a/src/Text/Pandoc/Writers/MediaWiki.hs
+++ b/src/Text/Pandoc/Writers/MediaWiki.hs
@@ -35,6 +35,7 @@ import Text.Pandoc.Options
 import Text.Pandoc.Shared
 import Text.Pandoc.Writers.Shared
 import Text.Pandoc.Pretty (render)
+import Text.Pandoc.ImageSize
 import Text.Pandoc.Templates (renderTemplate')
 import Text.Pandoc.XML ( escapeStringForXML )
 import Data.List ( intersect, intercalate )
@@ -44,6 +45,7 @@ import Control.Monad.State
 
 data WriterState = WriterState {
     stNotes     :: Bool            -- True if there are notes
+  , stOptions   :: WriterOptions   -- writer options
   }
 
 data WriterReader = WriterReader {
@@ -57,7 +59,7 @@ type MediaWikiWriter = ReaderT WriterReader (State WriterState)
 -- | Convert Pandoc to MediaWiki.
 writeMediaWiki :: WriterOptions -> Pandoc -> String
 writeMediaWiki opts document =
-  let initialState = WriterState { stNotes = False }
+  let initialState = WriterState { stNotes = False, stOptions = opts }
       env = WriterReader { options = opts, listLevel = [], useTags = False }
   in  evalState (runReaderT (pandocToMediaWiki document) env) initialState
 
@@ -100,14 +102,15 @@ blockToMediaWiki (Plain inlines) =
   inlineListToMediaWiki inlines
 
 -- title beginning with fig: indicates that the image is a figure
-blockToMediaWiki (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
+blockToMediaWiki (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
   capt <- if null txt
              then return ""
              else ("|caption " ++) `fmap` inlineListToMediaWiki txt
+  img  <- imageToMediaWiki attr
   let opt = if null txt
                then ""
                else "|alt=" ++ if null tit then capt else tit ++ capt
-  return $ "[[File:" ++ src ++ "|frame|none" ++ opt ++ "]]\n"
+  return $ "[[File:" ++ src ++ "|frame|none" ++ img ++ opt ++ "]]\n"
 
 blockToMediaWiki (Para inlines) = do
   tags <- asks useTags
@@ -303,7 +306,11 @@ tableCellToMediaWiki headless rownum (alignment, width, bs) = do
   let attr = if null attrs
                 then ""
                 else unwords attrs ++ "|"
-  return $ marker ++ attr ++ trimr contents
+  let sep = case bs of
+                 [Plain _] -> " "
+                 [Para  _] -> " "
+                 _         -> "\n"
+  return $ marker ++ attr ++ sep ++ trimr contents
 
 alignmentToString :: Alignment -> String
 alignmentToString alignment = case alignment of
@@ -312,6 +319,23 @@ alignmentToString alignment = case alignment of
                                  AlignCenter  -> "center"
                                  AlignDefault -> "left"
 
+imageToMediaWiki :: Attr -> MediaWikiWriter String
+imageToMediaWiki attr = do
+  opts <- gets stOptions
+  let (_, cls, _) = attr
+      toPx = fmap (showInPixel opts) . checkPct
+      checkPct (Just (Percent _)) = Nothing
+      checkPct maybeDim = maybeDim
+      go (Just w) Nothing  = '|':w ++ "px"
+      go (Just w) (Just h) = '|':w ++ "x" ++ h ++ "px"
+      go Nothing  (Just h) = "|x" ++ h ++ "px"
+      go Nothing  Nothing  = ""
+      dims = go (toPx $ dimension Width attr) (toPx $ dimension Height attr)
+      classes = if null cls
+                   then ""
+                   else "|class=" ++ unwords cls
+  return $ dims ++ classes
+
 -- | Convert list of Pandoc block elements to MediaWiki.
 blockListToMediaWiki :: [Block]       -- ^ List of block elements
                      -> MediaWikiWriter String
@@ -377,9 +401,16 @@ inlineToMediaWiki (RawInline f str)
 
 inlineToMediaWiki (LineBreak) = return "<br />\n"
 
+inlineToMediaWiki SoftBreak = do
+  wrapText <- gets (writerWrapText . stOptions)
+  case wrapText of
+       WrapAuto     -> return " "
+       WrapNone     -> return " "
+       WrapPreserve -> return "\n"
+
 inlineToMediaWiki Space = return " "
 
-inlineToMediaWiki (Link txt (src, _)) = do
+inlineToMediaWiki (Link _ txt (src, _)) = do
   label <- inlineListToMediaWiki txt
   case txt of
      [Str s] | isURI src && escapeURI s == src -> return src
@@ -390,14 +421,15 @@ inlineToMediaWiki (Link txt (src, _)) = do
                                      '/':xs -> xs  -- with leading / it's a
                                      _      -> src -- link to a help page
 
-inlineToMediaWiki (Image alt (source, tit)) = do
+inlineToMediaWiki (Image attr alt (source, tit)) = do
+  img  <- imageToMediaWiki attr
   alt' <- inlineListToMediaWiki alt
   let txt = if null tit
                then if null alt
                        then ""
                        else '|' : alt'
                else '|' : tit
-  return $ "[[File:" ++ source ++ txt ++ "]]"
+  return $ "[[File:" ++ source ++ img ++ txt ++ "]]"
 
 inlineToMediaWiki (Note contents) = do
   contents' <- blockListToMediaWiki contents
diff --git a/src/Text/Pandoc/Writers/Native.hs b/src/Text/Pandoc/Writers/Native.hs
index 2343ff1..fc96e3e 100644
--- a/src/Text/Pandoc/Writers/Native.hs
+++ b/src/Text/Pandoc/Writers/Native.hs
@@ -34,7 +34,7 @@ metadata.
 -}
 module Text.Pandoc.Writers.Native ( writeNative )
 where
-import Text.Pandoc.Options ( WriterOptions(..) )
+import Text.Pandoc.Options ( WriterOptions(..), WrapOption(..) )
 import Data.List ( intersperse )
 import Text.Pandoc.Definition
 import Text.Pandoc.Pretty
@@ -70,7 +70,7 @@ prettyBlock block = text $ show block
 -- | Prettyprint Pandoc document.
 writeNative :: WriterOptions -> Pandoc -> String
 writeNative opts (Pandoc meta blocks) =
-  let colwidth = if writerWrapText opts
+  let colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
       withHead = if writerStandalone opts
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
index 922a3a7..ce4d456 100644
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -37,10 +37,10 @@ import Text.TeXMath
 import qualified Data.ByteString.Lazy as B
 import Text.Pandoc.UTF8 ( fromStringLazy )
 import Codec.Archive.Zip
-import Text.Pandoc.Options ( WriterOptions(..) )
+import Text.Pandoc.Options ( WriterOptions(..), WrapOption(..) )
 import Text.Pandoc.Shared ( stringify, fetchItem', warn,
                             getDefaultReferenceODT )
-import Text.Pandoc.ImageSize ( imageSize, sizeInPoints )
+import Text.Pandoc.ImageSize
 import Text.Pandoc.MIME ( getMimeType, extensionFromMimeType )
 import Text.Pandoc.Definition
 import Text.Pandoc.Walk
@@ -67,7 +67,7 @@ writeODT opts doc@(Pandoc meta _) = do
   -- handle formulas and pictures
   picEntriesRef <- newIORef ([] :: [Entry])
   doc' <- walkM (transformPicMath opts picEntriesRef) $ walk fixDisplayMath doc
-  let newContents = writeOpenDocument opts{writerWrapText = False} doc'
+  let newContents = writeOpenDocument opts{writerWrapText = WrapNone} doc'
   epochtime <- floor `fmap` getPOSIXTime
   let contentEntry = toEntry "content.xml" epochtime
                      $ fromStringLazy newContents
@@ -125,21 +125,36 @@ writeODT opts doc@(Pandoc meta _) = do
                   $ addEntryToArchive metaEntry archive'
   return $ fromArchive archive''
 
+-- | transform both Image and Math elements
 transformPicMath :: WriterOptions -> IORef [Entry] -> Inline -> IO Inline
-transformPicMath opts entriesRef (Image lab (src,t)) = do
+transformPicMath opts entriesRef (Image attr@(id', cls, _) lab (src,t)) = do
   res <- fetchItem' (writerMediaBag opts) (writerSourceURL opts) src
   case res of
      Left (_ :: E.SomeException) -> do
        warn $ "Could not find image `" ++ src ++ "', skipping..."
        return $ Emph lab
      Right (img, mbMimeType) -> do
-       (w,h) <- case imageSize img of
-                     Right size -> return $ sizeInPoints size
-                     Left msg   -> do
-                       warn $ "Could not determine image size in `" ++
-                         src ++ "': " ++ msg
-                       return (0,0)
-       let tit' = show w ++ "x" ++ show h
+       (ptX, ptY) <- case imageSize img of
+                       Right s  -> return $ sizeInPoints s
+                       Left msg -> do
+                         warn $ "Could not determine image size in `" ++
+                           src ++ "': " ++ msg
+                         return (100, 100)
+       let dims =
+             case (getDim Width, getDim Height) of
+               (Just w, Just h)              -> [("width", show w), ("height", show h)]
+               (Just w@(Percent _), Nothing) -> [("width", show w), ("style:rel-height", "scale")]
+               (Nothing, Just h@(Percent _)) -> [("style:rel-width", "scale"), ("height", show h)]
+               (Just w@(Inch i), Nothing)    -> [("width", show w), ("height", show (i / ratio) ++ "in")]
+               (Nothing, Just h@(Inch i))    -> [("width", show (i * ratio) ++ "in"), ("height", show h)]
+               _                             -> [("width", show ptX ++ "pt"), ("height", show ptY ++ "pt")]
+             where
+               ratio = ptX / ptY
+               getDim dir = case (dimension dir attr) of
+                              Just (Percent i) -> Just $ Percent i
+                              Just dim         -> Just $ Inch $ inInch opts dim
+                              Nothing          -> Nothing
+       let  newattr = (id', cls, dims)
        entries <- readIORef entriesRef
        let extension = fromMaybe (takeExtension $ takeWhile (/='?') src)
                            (mbMimeType >>= extensionFromMimeType)
@@ -148,9 +163,7 @@ transformPicMath opts entriesRef (Image lab (src,t)) = do
        epochtime <- floor `fmap` getPOSIXTime
        let entry = toEntry newsrc epochtime $ toLazy img
        modifyIORef entriesRef (entry:)
-       let fig | "fig:" `isPrefixOf` t = "fig:"
-               | otherwise             = ""
-       return $ Image lab (newsrc, fig++tit')
+       return $ Image newattr lab (newsrc, t)
 transformPicMath _ entriesRef (Math t math) = do
   entries <- readIORef entriesRef
   let dt = if t == InlineMath then DisplayInline else DisplayBlock
diff --git a/src/Text/Pandoc/Writers/OPML.hs b/src/Text/Pandoc/Writers/OPML.hs
index 5191368..5770c3c 100644
--- a/src/Text/Pandoc/Writers/OPML.hs
+++ b/src/Text/Pandoc/Writers/OPML.hs
@@ -45,7 +45,7 @@ import qualified Text.Pandoc.Builder as B
 writeOPML :: WriterOptions -> Pandoc -> String
 writeOPML opts (Pandoc meta blocks) =
   let elements = hierarchicalize blocks
-      colwidth = if writerWrapText opts
+      colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
       meta' = B.setMeta "date" (B.str $ convertDate $ docDate meta) meta
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
index ebe678d..e0434c6 100644
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -39,7 +39,7 @@ import Text.Pandoc.Pretty
 import Text.Printf ( printf )
 import Control.Arrow ( (***), (>>>) )
 import Control.Monad.State hiding ( when )
-import Data.Char (chr, isDigit)
+import Data.Char (chr)
 import qualified Data.Map as Map
 import Text.Pandoc.Writers.Shared
 
@@ -175,7 +175,7 @@ handleSpaces s
 -- | Convert Pandoc document to string in OpenDocument format.
 writeOpenDocument :: WriterOptions -> Pandoc -> String
 writeOpenDocument opts (Pandoc meta blocks) =
-  let colwidth = if writerWrapText opts
+  let colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
       render' = render colwidth
@@ -191,8 +191,7 @@ writeOpenDocument opts (Pandoc meta blocks) =
       listStyle (n,l) = inTags True "text:list-style"
                           [("style:name", "L" ++ show n)] (vcat l)
       listStyles  = map listStyle (stListStyles s)
-      automaticStyles = inTagsIndented "office:automatic-styles" $ vcat $
-                          reverse $ styles ++ listStyles
+      automaticStyles = vcat $ reverse $ styles ++ listStyles
       context = defField "body" body
               $ defField "automatic-styles" (render' automaticStyles)
               $ metadata
@@ -287,8 +286,8 @@ blockToOpenDocument o bs
     | Plain          b <- bs = if null b
                                   then return empty
                                   else inParagraphTags =<< inlinesToOpenDocument o b
-    | Para [Image c (s,'f':'i':'g':':':t)] <- bs
-                             = figure c s t
+    | Para [Image attr c (s,'f':'i':'g':':':t)] <- bs
+                             = figure attr c s t
     | Para           b <- bs = if null b
                                   then return empty
                                   else inParagraphTags =<< inlinesToOpenDocument o b
@@ -343,10 +342,10 @@ blockToOpenDocument o bs
         return $ inTags True "table:table" [ ("table:name"      , name)
                                            , ("table:style-name", name)
                                            ] (vcat columns $$ th $$ vcat tr) $$ captionDoc
-      figure caption source title | null caption =
-        withParagraphStyle o "Figure" [Para [Image caption (source,title)]]
+      figure attr caption source title | null caption =
+        withParagraphStyle o "Figure" [Para [Image attr caption (source,title)]]
                                   | otherwise    = do
-        imageDoc <- withParagraphStyle o "FigureWithCaption" [Para [Image caption (source,title)]]
+        imageDoc <- withParagraphStyle o "FigureWithCaption" [Para [Image attr caption (source,title)]]
         captionDoc <- withParagraphStyle o "FigureCaption" [Para caption]
         return $ imageDoc $$ captionDoc
 
@@ -375,38 +374,48 @@ inlinesToOpenDocument o l = hcat <$> mapM (inlineToOpenDocument o) l
 -- | Convert an inline element to OpenDocument.
 inlineToOpenDocument :: WriterOptions -> Inline -> State WriterState Doc
 inlineToOpenDocument o ils
-    | Space         <- ils = inTextStyle space
-    | Span _ xs     <- ils = inlinesToOpenDocument o xs
-    | LineBreak     <- ils = return $ selfClosingTag "text:line-break" []
-    | Str         s <- ils = inTextStyle $ handleSpaces $ escapeStringForXML s
-    | Emph        l <- ils = withTextStyle Italic $ inlinesToOpenDocument o l
-    | Strong      l <- ils = withTextStyle Bold   $ inlinesToOpenDocument o l
-    | Strikeout   l <- ils = withTextStyle Strike $ inlinesToOpenDocument o l
-    | Superscript l <- ils = withTextStyle Sup    $ inlinesToOpenDocument o l
-    | Subscript   l <- ils = withTextStyle Sub    $ inlinesToOpenDocument o l
-    | SmallCaps   l <- ils = withTextStyle SmallC $ inlinesToOpenDocument o l
-    | Quoted    t l <- ils = inQuotes t <$> inlinesToOpenDocument o l
-    | Code      _ s <- ils = withTextStyle Pre $ inTextStyle $ preformatted s
-    | Math      t s <- ils = inlinesToOpenDocument o (texMathToInlines t s)
-    | Cite      _ l <- ils = inlinesToOpenDocument o l
-    | RawInline f s <- ils = if f == Format "opendocument"
-                                then return $ text s
-                                else return empty
-    | Link  l (s,t) <- ils = mkLink s t <$> inlinesToOpenDocument o l
-    | Image _ (s,t) <- ils = mkImg  s t
-    | Note        l <- ils = mkNote l
-    | otherwise            = return empty
+  = case ils of
+    Space         -> inTextStyle space
+    SoftBreak
+     | writerWrapText o == WrapPreserve
+                  -> inTextStyle (preformatted "\n")
+     | otherwise  -> inTextStyle space
+    Span _ xs     -> inlinesToOpenDocument o xs
+    LineBreak     -> return $ selfClosingTag "text:line-break" []
+    Str         s -> inTextStyle $ handleSpaces $ escapeStringForXML s
+    Emph        l -> withTextStyle Italic $ inlinesToOpenDocument o l
+    Strong      l -> withTextStyle Bold   $ inlinesToOpenDocument o l
+    Strikeout   l -> withTextStyle Strike $ inlinesToOpenDocument o l
+    Superscript l -> withTextStyle Sup    $ inlinesToOpenDocument o l
+    Subscript   l -> withTextStyle Sub    $ inlinesToOpenDocument o l
+    SmallCaps   l -> withTextStyle SmallC $ inlinesToOpenDocument o l
+    Quoted    t l -> inQuotes t <$> inlinesToOpenDocument o l
+    Code      _ s -> withTextStyle Pre $ inTextStyle $ preformatted s
+    Math      t s -> inlinesToOpenDocument o (texMathToInlines t s)
+    Cite      _ l -> inlinesToOpenDocument o l
+    RawInline f s -> if f == Format "opendocument"
+                       then return $ text s
+                       else return empty
+    Link _ l (s,t) ->  mkLink s t <$> inlinesToOpenDocument o l
+    Image attr _ (s,t) -> mkImg attr s t
+    Note        l  -> mkNote l
     where
       preformatted s = handleSpaces $ escapeStringForXML s
       mkLink   s t = inTags False "text:a" [ ("xlink:type" , "simple")
                                            , ("xlink:href" , s       )
                                            , ("office:name", t       )
                                            ] . inSpanTags "Definition"
-      mkImg  s t   = do
+      mkImg (_, _, kvs) s _ = do
                id' <- gets stImageId
                modify (\st -> st{ stImageId = id' + 1 })
+               let getDims [] = []
+                   getDims (("width", w) :xs) = ("svg:width", w)  : getDims xs
+                   getDims (("height", h):xs) = ("svg:height", h) : getDims xs
+                   getDims (x@("style:rel-width", _) :xs) = x : getDims xs
+                   getDims (x@("style:rel-height", _):xs) = x : getDims xs
+                   getDims (_:xs) =                             getDims xs
                return $ inTags False "draw:frame"
-                        (("draw:name", "img" ++ show id'):attrsFromTitle t) $
+                        (("draw:name", "img" ++ show id') : getDims kvs) $
                      selfClosingTag "draw:image" [ ("xlink:href"   , s       )
                                                  , ("xlink:type"   , "simple")
                                                  , ("xlink:show"   , "embed" )
@@ -422,17 +431,6 @@ inlineToOpenDocument o ils
         addNote nn
         return nn
 
--- a title of the form "120x140" will be interpreted as image
--- size in points.
-attrsFromTitle :: String -> [(String,String)]
-attrsFromTitle s = if null xs || null ys
-                      then []
-                      else [("svg:width",xs ++ "pt"),("svg:height",ys ++ "pt")]
-  where (xs,rest) = span isDigit s
-        ys        = case rest of
-                         ('x':zs) | all isDigit zs -> zs
-                         _ -> ""
-
 bulletListStyle :: Int -> State WriterState (Int,(Int,[Doc]))
 bulletListStyle l =
     let doStyles  i = inTags True "text:list-level-style-bullet"
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
index 1b0ab38..20086ed 100644
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -61,7 +61,7 @@ writeOrg opts document =
 pandocToOrg :: Pandoc -> State WriterState String
 pandocToOrg (Pandoc meta blocks) = do
   opts <- liftM stOptions get
-  let colwidth = if writerWrapText opts
+  let colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
   metadata <- metaToJSON opts
@@ -102,6 +102,10 @@ escapeString = escapeStringUsing $
                , ('\x2026',"...")
                ] ++ backslashEscapes "^_"
 
+isRawFormat :: Format -> Bool
+isRawFormat f =
+  f == Format "latex" || f == Format "tex" || f == Format "org"
+
 -- | Convert Pandoc block element to Org.
 blockToOrg :: Block         -- ^ Block element
            -> State WriterState Doc
@@ -116,12 +120,12 @@ blockToOrg (Div attrs bs) = do
            nest 2 endTag $$ "#+END_HTML" $$ blankline
 blockToOrg (Plain inlines) = inlineListToOrg inlines
 -- title beginning with fig: indicates that the image is a figure
-blockToOrg (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
+blockToOrg (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
   capt <- if null txt
              then return empty
              else (\c -> "#+CAPTION: " <> c <> blankline) `fmap`
                     inlineListToOrg txt
-  img <- inlineToOrg (Image txt (src,tit))
+  img <- inlineToOrg (Image attr txt (src,tit))
   return $ capt <> img
 blockToOrg (Para inlines) = do
   contents <- inlineListToOrg inlines
@@ -129,7 +133,7 @@ blockToOrg (Para inlines) = do
 blockToOrg (RawBlock "html" str) =
   return $ blankline $$ "#+BEGIN_HTML" $$
            nest 2 (text str) $$ "#+END_HTML" $$ blankline
-blockToOrg (RawBlock f str) | f `elem` ["org", "latex", "tex"] =
+blockToOrg (RawBlock f str) | isRawFormat f =
   return $ text str
 blockToOrg (RawBlock _ _) = return empty
 blockToOrg HorizontalRule = return $ blankline $$ "--------------" $$ blankline
@@ -271,11 +275,18 @@ inlineToOrg (Math t str) = do
   return $ if t == InlineMath
               then "$" <> text str <> "$"
               else "$$" <> text str <> "$$"
-inlineToOrg (RawInline f str) | f == "tex" || f == "latex" = return $ text str
+inlineToOrg (RawInline f str) | isRawFormat f =
+  return $ text str
 inlineToOrg (RawInline _ _) = return empty
 inlineToOrg (LineBreak) = return (text "\\\\" <> cr)
 inlineToOrg Space = return space
-inlineToOrg (Link txt (src, _)) = do
+inlineToOrg SoftBreak = do
+  wrapText <- gets (writerWrapText . stOptions)
+  case wrapText of
+       WrapPreserve   -> return cr
+       WrapAuto       -> return space
+       WrapNone       -> return space
+inlineToOrg (Link _ txt (src, _)) = do
   case txt of
         [Str x] | escapeURI x == src ->  -- autolink
              do modify $ \s -> s{ stLinks = True }
@@ -283,7 +294,7 @@ inlineToOrg (Link txt (src, _)) = do
         _ -> do contents <- inlineListToOrg txt
                 modify $ \s -> s{ stLinks = True }
                 return $ "[[" <> text src <> "][" <> contents <> "]]"
-inlineToOrg (Image _ (source, _)) = do
+inlineToOrg (Image _ _ (source, _)) = do
   modify $ \s -> s{ stImages = True }
   return $ "[[" <> text source <> "]]"
 inlineToOrg (Note contents) = do
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 3346198..98c39bd 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -35,6 +35,7 @@ import Text.Pandoc.Definition
 import Text.Pandoc.Options
 import Text.Pandoc.Shared
 import Text.Pandoc.Writers.Shared
+import Text.Pandoc.ImageSize
 import Text.Pandoc.Templates (renderTemplate')
 import Text.Pandoc.Builder (deleteMeta)
 import Data.Maybe (fromMaybe)
@@ -49,7 +50,7 @@ type Refs = [([Inline], Target)]
 data WriterState =
   WriterState { stNotes       :: [[Block]]
               , stLinks       :: Refs
-              , stImages      :: [([Inline], (String, String, Maybe String))]
+              , stImages      :: [([Inline], (Attr, String, String, Maybe String))]
               , stHasMath     :: Bool
               , stHasRawTeX   :: Bool
               , stOptions     :: WriterOptions
@@ -69,7 +70,7 @@ writeRST opts document =
 pandocToRST :: Pandoc -> State WriterState String
 pandocToRST (Pandoc meta blocks) = do
   opts <- liftM stOptions get
-  let colwidth = if writerWrapText opts
+  let colwidth = if writerWrapText opts == WrapAuto
                     then Just $ writerColumns opts
                     else Nothing
   let subtit = case lookupMeta "subtitle" meta of
@@ -138,17 +139,22 @@ noteToRST num note = do
   return $ nowrap $ marker $$ nest 3 contents
 
 -- | Return RST representation of picture reference table.
-pictRefsToRST :: [([Inline], (String, String, Maybe String))]
+pictRefsToRST :: [([Inline], (Attr, String, String, Maybe String))]
               -> State WriterState Doc
 pictRefsToRST refs = mapM pictToRST refs >>= return . vcat
 
 -- | Return RST representation of a picture substitution reference.
-pictToRST :: ([Inline], (String, String,Maybe String))
+pictToRST :: ([Inline], (Attr, String, String, Maybe String))
           -> State WriterState Doc
-pictToRST (label, (src, _, mbtarget)) = do
+pictToRST (label, (attr, src, _, mbtarget)) = do
   label' <- inlineListToRST label
+  dims   <- imageDimsToRST attr
+  let (_, cls, _) = attr
+      classes = if null cls
+                   then empty
+                   else ":class: " <> text (unwords cls)
   return $ nowrap
-         $ ".. |" <> label' <> "| image:: " <> text src
+         $ ".. |" <> label' <> "| image:: " <> text src $$ hang 3 empty (classes $$ dims)
          $$ case mbtarget of
                  Nothing -> empty
                  Just t  -> "   :target: " <> text t
@@ -183,11 +189,16 @@ blockToRST (Div attr bs) = do
   return $ blankline <> startTag $+$ contents $+$ endTag $$ blankline
 blockToRST (Plain inlines) = inlineListToRST inlines
 -- title beginning with fig: indicates that the image is a figure
-blockToRST (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
+blockToRST (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
   capt <- inlineListToRST txt
+  dims <- imageDimsToRST attr
   let fig = "figure:: " <> text src
-  let alt = ":alt: " <> if null tit then capt else text tit
-  return $ hang 3 ".. " (fig $$ alt $+$ capt) $$ blankline
+      alt = ":alt: " <> if null tit then capt else text tit
+      (_,cls,_) = attr
+      classes = if null cls
+                   then empty
+                   else ":figclass: " <> text (unwords cls)
+  return $ hang 3 ".. " (fig $$ alt $$ classes $$ dims $+$ capt) $$ blankline
 blockToRST (Para inlines)
   | LineBreak `elem` inlines = do -- use line block if LineBreaks
       lns <- mapM inlineListToRST $ splitBy (==LineBreak) inlines
@@ -256,7 +267,7 @@ blockToRST (Table caption _ widths headers rows) =  do
           then map ((+2) . numChars) $ transpose (headers' : rawRows)
           else map (floor . (fromIntegral (writerColumns opts) *)) widths
   let hpipeBlocks blocks = hcat [beg, middle, end]
-        where h      = maximum (map height blocks)
+        where h      = maximum (1 : map height blocks)
               sep'   = lblock 3 $ vcat (map text $ replicate h " | ")
               beg    = lblock 2 $ vcat (map text $ replicate h "| ")
               end    = lblock 2 $ vcat (map text $ replicate h " |")
@@ -367,11 +378,13 @@ inlineListToRST lst =
         surroundComplex _ _ = False
         okAfterComplex :: Inline -> Bool
         okAfterComplex Space = True
+        okAfterComplex SoftBreak = True
         okAfterComplex LineBreak = True
         okAfterComplex (Str (c:_)) = isSpace c || c `elem` ("-.,:;!?\\/'\")]}>–—" :: String)
         okAfterComplex _ = False
         okBeforeComplex :: Inline -> Bool
         okBeforeComplex Space = True
+        okBeforeComplex SoftBreak = True
         okBeforeComplex LineBreak = True
         okBeforeComplex (Str (c:_)) = isSpace c || c `elem` ("-:/'\"<([{–—" :: String)
         okBeforeComplex _ = False
@@ -382,8 +395,8 @@ inlineListToRST lst =
         isComplex (Strikeout _) = True
         isComplex (Superscript _) = True
         isComplex (Subscript _) = True
-        isComplex (Link _ _) = True
-        isComplex (Image _ _) = True
+        isComplex (Link _ _ _) = True
+        isComplex (Image _ _ _) = True
         isComplex (Code _ _) = True
         isComplex (Math _ _) = True
         isComplex (Cite _ (x:_)) = isComplex x
@@ -435,18 +448,24 @@ inlineToRST (RawInline f x)
   | otherwise  = return empty
 inlineToRST (LineBreak) = return cr -- there's no line break in RST (see Para)
 inlineToRST Space = return space
+inlineToRST SoftBreak = do
+  wrapText <- gets (writerWrapText . stOptions)
+  case wrapText of
+        WrapPreserve  -> return cr
+        WrapAuto      -> return space
+        WrapNone      -> return space
 -- autolink
-inlineToRST (Link [Str str] (src, _))
+inlineToRST (Link _ [Str str] (src, _))
   | isURI src &&
     if "mailto:" `isPrefixOf` src
        then src == escapeURI ("mailto:" ++ str)
        else src == escapeURI str = do
   let srcSuffix = fromMaybe src (stripPrefix "mailto:" src)
   return $ text srcSuffix
-inlineToRST (Link [Image alt (imgsrc,imgtit)] (src, _tit)) = do
-  label <- registerImage alt (imgsrc,imgtit) (Just src)
+inlineToRST (Link _ [Image attr alt (imgsrc,imgtit)] (src, _tit)) = do
+  label <- registerImage attr alt (imgsrc,imgtit) (Just src)
   return $ "|" <> label <> "|"
-inlineToRST (Link txt (src, tit)) = do
+inlineToRST (Link _ txt (src, tit)) = do
   useReferenceLinks <- get >>= return . writerReferenceLinks . stOptions
   linktext <- inlineListToRST $ normalizeSpaces txt
   if useReferenceLinks
@@ -461,8 +480,8 @@ inlineToRST (Link txt (src, tit)) = do
                    modify $ \st -> st { stLinks = (txt,(src,tit)):refs }
                    return $ "`" <> linktext <> "`_"
     else return $ "`" <> linktext <> " <" <> text src <> ">`__"
-inlineToRST (Image alternate (source, tit)) = do
-  label <- registerImage alternate (source,tit) Nothing
+inlineToRST (Image attr alternate (source, tit)) = do
+  label <- registerImage attr alternate (source,tit) Nothing
   return $ "|" <> label <> "|"
 inlineToRST (Note contents) = do
   -- add to notes in state
@@ -471,16 +490,33 @@ inlineToRST (Note contents) = do
   let ref = show $ (length notes) + 1
   return $ " [" <> text ref <> "]_"
 
-registerImage :: [Inline] -> Target -> Maybe String -> State WriterState Doc
-registerImage alt (src,tit) mbtarget = do
+registerImage :: Attr -> [Inline] -> Target -> Maybe String -> State WriterState Doc
+registerImage attr alt (src,tit) mbtarget = do
   pics <- get >>= return . stImages
   txt <- case lookup alt pics of
-               Just (s,t,mbt) | (s,t,mbt) == (src,tit,mbtarget) -> return alt
+               Just (a,s,t,mbt) | (a,s,t,mbt) == (attr,src,tit,mbtarget)
+                 -> return alt
                _ -> do
                  let alt' = if null alt || alt == [Str ""]
                                then [Str $ "image" ++ show (length pics)]
                                else alt
                  modify $ \st -> st { stImages =
-                        (alt', (src,tit, mbtarget)):stImages st }
+                        (alt', (attr,src,tit, mbtarget)):stImages st }
                  return alt'
   inlineListToRST txt
+
+imageDimsToRST :: Attr -> State WriterState Doc
+imageDimsToRST attr = do
+  let (ident, _, _) = attr
+      name = if null ident
+                then empty
+                else ":name: " <> text ident
+      showDim dir = let cols d = ":" <> text (show dir) <> ": " <> text (show d)
+                    in  case (dimension dir attr) of
+                          Just (Percent a) ->
+                            case dir of
+                              Height -> empty
+                              Width  -> cols (Percent a)
+                          Just dim -> cols dim
+                          Nothing  -> empty
+  return $ cr <> name $$ showDim Width $$ showDim Height
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
index 9eb02ad..79a28c8 100644
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -46,7 +46,7 @@ import Text.Pandoc.ImageSize
 -- or a MediaBag, or the internet.
 -- If file not found or filetype not jpeg or png, leave the inline unchanged.
 rtfEmbedImage :: WriterOptions -> Inline -> IO Inline
-rtfEmbedImage opts x@(Image _ (src,_)) = do
+rtfEmbedImage opts x@(Image attr _ (src,_)) = do
   result <- fetchItem' (writerMediaBag opts) (writerSourceURL opts) src
   case result of
        Right (imgdata, Just mime)
@@ -63,12 +63,12 @@ rtfEmbedImage opts x@(Image _ (src,_)) = do
                                return ""
                              Right sz -> return $ "\\picw" ++ show xpx ++
                                         "\\pich" ++ show ypx ++
-                                        "\\picwgoal" ++ show (xpt * 20)
-                                        ++ "\\pichgoal" ++ show (ypt * 20)
+                                        "\\picwgoal" ++ show (floor (xpt * 20) :: Integer)
+                                        ++ "\\pichgoal" ++ show (floor (ypt * 20) :: Integer)
                                 -- twip = 1/1440in = 1/20pt
                                 where (xpx, ypx) = sizeInPixels sz
-                                      (xpt, ypt) = sizeInPoints sz
-         let raw = "{\\pict" ++ filetype ++ sizeSpec ++ " " ++
+                                      (xpt, ypt) = desiredSizeInPoints opts attr sz
+         let raw = "{\\pict" ++ filetype ++ sizeSpec ++ "\\bin " ++
                     concat bytes ++ "}"
          return $ if B.null imgdata
                      then x
@@ -349,11 +349,12 @@ inlineToRTF (RawInline f str)
   | f == Format "rtf" = str
   | otherwise         = ""
 inlineToRTF (LineBreak) = "\\line "
+inlineToRTF SoftBreak = " "
 inlineToRTF Space = " "
-inlineToRTF (Link text (src, _)) =
+inlineToRTF (Link _ text (src, _)) =
   "{\\field{\\*\\fldinst{HYPERLINK \"" ++ (codeStringToRTF src) ++
   "\"}}{\\fldrslt{\\ul\n" ++ (inlineListToRTF text) ++ "\n}}}\n"
-inlineToRTF (Image _ (source, _)) =
+inlineToRTF (Image _ _ (source, _)) =
   "{\\cf1 [image: " ++ source ++ "]\\cf0}"
 inlineToRTF (Note contents) =
   "{\\super\\chftn}{\\*\\footnote\\chftn\\~\\plain\\pard " ++
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index d94dbac..865d101 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -45,7 +45,8 @@ import Text.Pandoc.Options (WriterOptions(..))
 import qualified Data.HashMap.Strict as H
 import qualified Data.Map as M
 import qualified Data.Text as T
-import Data.Aeson (FromJSON(..), fromJSON, ToJSON (..), Value(Object), Result(..))
+import Data.Aeson (FromJSON(..), fromJSON, ToJSON (..), Value(Object), Result(..), encode)
+import Text.Pandoc.UTF8 (toStringLazy)
 import qualified Data.Traversable as Traversable
 import Data.List ( groupBy )
 
@@ -67,7 +68,8 @@ metaToJSON opts blockWriter inlineWriter (Meta metamap)
     renderedMap <- Traversable.mapM
                    (metaValueToJSON blockWriter inlineWriter)
                    metamap
-    return $ M.foldWithKey defField baseContext renderedMap
+    let metadata = M.foldWithKey defField baseContext renderedMap
+    return $ defField "meta-json" (toStringLazy $ encode metadata) metadata
   | otherwise = return (Object H.empty)
 
 metaValueToJSON :: Monad m
diff --git a/src/Text/Pandoc/Writers/TEI.hs b/src/Text/Pandoc/Writers/TEI.hs
new file mode 100644
index 0000000..b9e683a
--- /dev/null
+++ b/src/Text/Pandoc/Writers/TEI.hs
@@ -0,0 +1,320 @@
+{-# LANGUAGE OverloadedStrings, PatternGuards #-}
+{-
+Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+-}
+
+{- |
+   Module      : Text.Pandoc.Writers.Docbook
+   Copyright   : Copyright (C) 2006-2015 John MacFarlane
+   License     : GNU GPL, version 2 or above
+
+   Maintainer  : John MacFarlane <jgm@berkeley.edu>
+   Stability   : alpha
+   Portability : portable
+
+Conversion of 'Pandoc' documents to Docbook XML.
+-}
+module Text.Pandoc.Writers.TEI (writeTEI) where
+import Text.Pandoc.Definition
+import Text.Pandoc.XML
+import Text.Pandoc.Shared
+import Text.Pandoc.Writers.Shared
+import Text.Pandoc.Options
+import Text.Pandoc.Templates (renderTemplate')
+import Data.List ( stripPrefix, isPrefixOf, isSuffixOf )
+import Data.Char ( toLower )
+import Text.Pandoc.Highlighting ( languages, languagesByExtension )
+import Text.Pandoc.Pretty
+import Text.Pandoc.ImageSize
+import qualified Text.Pandoc.Builder as B
+
+-- | Convert list of authors to a docbook <author> section
+authorToTEI :: WriterOptions -> [Inline] -> B.Inlines
+authorToTEI opts name' =
+  let name = render Nothing $ inlinesToTEI opts name'
+      colwidth = if writerWrapText opts == WrapAuto
+                    then Just $ writerColumns opts
+                    else Nothing
+  in  B.rawInline "tei" $ render colwidth $
+      inTagsSimple "author" (text $ escapeStringForXML name)
+
+-- | Convert Pandoc document to string in Docbook format.
+writeTEI :: WriterOptions -> Pandoc -> String
+writeTEI opts (Pandoc meta blocks) =
+  let elements = hierarchicalize blocks
+      colwidth = if writerWrapText opts == WrapAuto
+                    then Just $ writerColumns opts
+                    else Nothing
+      render' = render colwidth
+      opts' = if "/book>" `isSuffixOf`
+                      (trimr $ writerTemplate opts)
+                 then opts{ writerChapters = True }
+                 else opts
+      startLvl = if writerChapters opts' then 0 else 1
+      auths'   = map (authorToTEI opts) $ docAuthors meta
+      meta'    = B.setMeta "author" auths' meta
+      Just metadata = metaToJSON opts
+                 (Just . render colwidth . (vcat .
+                          (map (elementToTEI opts' startLvl)) . hierarchicalize))
+                 (Just . render colwidth . inlinesToTEI opts')
+                 meta'
+      main    = render' $ vcat (map (elementToTEI opts' startLvl) elements)
+      context = defField "body" main
+              $ defField "mathml" (case writerHTMLMathMethod opts of
+                                        MathML _ -> True
+                                        _        -> False)
+              $ metadata
+  in  if writerStandalone opts
+         then renderTemplate' (writerTemplate opts) context
+         else main
+
+-- | Convert an Element to TEI.
+elementToTEI :: WriterOptions -> Int -> Element -> Doc
+elementToTEI opts _   (Blk block) = blockToTEI opts block
+elementToTEI opts lvl (Sec _ _num (id',_,_) title elements) =
+  -- TEI doesn't allow sections with no content, so insert some if needed
+  let elements' = if null elements
+                    then [Blk (Para [])]
+                    else elements
+      divType = case lvl of
+                 n | n == 0           -> "chapter"
+                   | n >= 1 && n <= 5 -> "level" ++ show n
+                   | otherwise        -> "section"
+  in inTags True "div" [("type", divType) | not (null id')] $
+--                        ("id", writerIdentifierPrefix opts ++ id') | not (null id')] $
+      inTagsSimple "head" (inlinesToTEI opts title) $$
+      vcat (map (elementToTEI opts (lvl + 1)) elements')
+
+-- | Convert a list of Pandoc blocks to TEI.
+blocksToTEI :: WriterOptions -> [Block] -> Doc
+blocksToTEI opts = vcat . map (blockToTEI opts)
+
+-- | Auxiliary function to convert Plain block to Para.
+plainToPara :: Block -> Block
+plainToPara (Plain x) = Para x
+plainToPara x         = x
+
+-- | Convert a list of pairs of terms and definitions into a TEI 
+-- list with labels and items.
+deflistItemsToTEI :: WriterOptions -> [([Inline],[[Block]])] -> Doc
+deflistItemsToTEI opts items =
+ vcat $ map (\(term, defs) -> deflistItemToTEI opts term defs) items
+
+-- | Convert a term and a list of blocks into a TEI varlistentry.
+deflistItemToTEI :: WriterOptions -> [Inline] -> [[Block]] -> Doc
+deflistItemToTEI opts term defs =
+  let def' = concatMap (map plainToPara) defs
+  in  inTagsIndented "label" (inlinesToTEI opts term) $$
+      inTagsIndented "item" (blocksToTEI opts def')
+
+-- | Convert a list of lists of blocks to a list of TEI list items.
+listItemsToTEI :: WriterOptions -> [[Block]] -> Doc
+listItemsToTEI opts items = vcat $ map (listItemToTEI opts) items
+
+-- | Convert a list of blocks into a TEI list item.
+listItemToTEI :: WriterOptions -> [Block] -> Doc
+listItemToTEI opts item =
+  inTagsIndented "item" $ blocksToTEI opts $ map plainToPara item
+
+imageToTEI :: WriterOptions -> Attr -> String -> Doc
+imageToTEI _ attr src = selfClosingTag "graphic" $
+  ("url", src) : idAndRole attr ++ dims
+  where
+    dims = go Width "width" ++ go Height "depth"
+    go dir dstr = case (dimension dir attr) of
+                    Just a  -> [(dstr, show a)]
+                    Nothing -> []
+
+-- | Convert a Pandoc block element to TEI.
+blockToTEI :: WriterOptions -> Block -> Doc
+blockToTEI _ Null = empty
+-- Add ids to paragraphs in divs with ids - this is needed for
+-- pandoc-citeproc to get link anchors in bibliographies:
+blockToTEI opts (Div (ident,_,_) [Para lst]) =
+  let attribs = [("id", ident) | not (null ident)] in
+      inTags False "p" attribs $ inlinesToTEI opts lst
+blockToTEI opts (Div _ bs) = blocksToTEI opts $ map plainToPara bs
+blockToTEI _ (Header _ _ _) = empty -- should not occur after hierarchicalize
+-- For TEI simple, text must be within containing block element, so
+-- we use plainToPara to ensure that Plain text ends up contained by
+-- something.
+blockToTEI opts (Plain lst) = blockToTEI opts $ Para lst
+-- title beginning with fig: indicates that the image is a figure
+--blockToTEI opts (Para [Image attr txt (src,'f':'i':'g':':':_)]) =
+--  let alt  = inlinesToTEI opts txt
+--      capt = if null txt
+--                then empty
+--                else inTagsSimple "title" alt
+--  in  inTagsIndented "figure" $
+--        capt $$
+--        (inTagsIndented "mediaobject" $
+--           (inTagsIndented "imageobject"
+--             (imageToTEI opts attr src)) $$
+--           inTagsSimple "textobject" (inTagsSimple "phrase" alt))
+blockToTEI opts (Para lst) =
+  inTags False "p" [] $ inlinesToTEI opts lst
+blockToTEI opts (BlockQuote blocks) =
+  inTagsIndented "quote" $ blocksToTEI opts blocks
+blockToTEI _ (CodeBlock (_,classes,_) str) =
+  text ("<ab type='codeblock " ++ lang ++ "'>") <> cr <>
+     flush (text (escapeStringForXML str) <> cr <> text "</ab>")
+    where lang  = if null langs
+                     then ""
+                     else escapeStringForXML (head langs) 
+          isLang l    = map toLower l `elem` map (map toLower) languages
+          langsFrom s = if isLang s
+                           then [s]
+                           else languagesByExtension . map toLower $ s
+          langs       = concatMap langsFrom classes
+blockToTEI opts (BulletList lst) =
+  let attribs = [("type", "unordered")]
+  in  inTags True "list" attribs $ listItemsToTEI opts lst
+blockToTEI _ (OrderedList _ []) = empty
+blockToTEI opts (OrderedList (start, numstyle, _) (first:rest)) =
+  let attribs = case numstyle of
+                       DefaultStyle -> []
+                       Decimal      -> [("type", "ordered:arabic")]
+                       Example      -> [("type", "ordered:arabic")]
+                       UpperAlpha   -> [("type", "ordered:upperalpha")]
+                       LowerAlpha   -> [("type", "ordered:loweralpha")]
+                       UpperRoman   -> [("type", "ordered:upperroman")]
+                       LowerRoman   -> [("type", "ordered:lowerroman")]
+      items      = if start == 1
+                      then listItemsToTEI opts (first:rest)
+                      else (inTags True "item" [("n",show start)]
+                           (blocksToTEI opts $ map plainToPara first)) $$
+                           listItemsToTEI opts rest
+  in  inTags True "list" attribs items
+blockToTEI opts (DefinitionList lst) =
+  let attribs = [("type", "definition")]
+  in  inTags True "list" attribs $ deflistItemsToTEI opts lst
+blockToTEI _ (RawBlock f str)
+  | f == "tei"     = text str -- raw TEI block (should such a thing exist).
+--  | f == "html"    = text str -- allow html for backwards compatibility
+  | otherwise      = empty
+blockToTEI _ HorizontalRule =
+  selfClosingTag "milestone" [("unit","undefined"), ("type","separator"),("rendition","line")]
+
+-- | TEI Tables
+-- TEI Simple's tables are composed of cells and rows; other 
+-- table info in the AST is here lossily discard.
+blockToTEI opts (Table _ _ _ headers rows) =
+  let
+    headers' = tableHeadersToTEI opts headers
+--    headers' = if all null headers
+--               then return empty
+--               else tableRowToTEI opts headers
+  in
+    inTags True "table" [] $ 
+    vcat $ [headers'] <> map (tableRowToTEI opts) rows 
+
+tableRowToTEI :: WriterOptions
+                  -> [[Block]]
+                  -> Doc
+tableRowToTEI opts cols =
+  inTagsIndented "row" $ vcat $ map (tableItemToTEI opts) cols
+
+tableHeadersToTEI :: WriterOptions
+                  -> [[Block]]
+                  -> Doc
+tableHeadersToTEI opts cols =
+  inTags True "row" [("role","label")] $ vcat $ map (tableItemToTEI opts) cols
+
+tableItemToTEI :: WriterOptions
+                  -> [Block]
+                  -> Doc
+tableItemToTEI opts item =
+  inTags False "cell" [] $ vcat $ map (blockToTEI opts) item
+
+-- | Convert a list of inline elements to TEI.
+inlinesToTEI :: WriterOptions -> [Inline] -> Doc
+inlinesToTEI opts lst = hcat $ map (inlineToTEI opts) lst
+
+-- | Convert an inline element to TEI.
+inlineToTEI :: WriterOptions -> Inline -> Doc
+inlineToTEI _ (Str str) = text $ escapeStringForXML str
+inlineToTEI opts (Emph lst) =
+  inTags False "hi" [("rendition","simple:italic")] $ inlinesToTEI opts lst
+inlineToTEI opts (Strong lst) =
+  inTags False "hi" [("rendition", "simple:bold")] $ inlinesToTEI opts lst
+inlineToTEI opts (Strikeout lst) =
+  inTags False "hi" [("rendition", "simple:strikethrough")] $
+  inlinesToTEI opts lst
+inlineToTEI opts (Superscript lst) =
+  inTags False "hi" [("rendition", "simple:superscript")] $ inlinesToTEI opts lst
+inlineToTEI opts (Subscript lst) =
+  inTags False "hi" [("rendition", "simple:subscript")] $ inlinesToTEI opts lst
+inlineToTEI opts (SmallCaps lst) =
+  inTags False "hi" [("rendition", "simple:smallcaps")] $
+  inlinesToTEI opts lst
+inlineToTEI opts (Quoted _ lst) =
+  inTagsSimple "quote" $ inlinesToTEI opts lst
+inlineToTEI opts (Cite _ lst) =
+  inlinesToTEI opts lst
+inlineToTEI opts (Span _ ils) =
+  inlinesToTEI opts ils
+inlineToTEI _ (Code _ str) =
+  inTags False "seg" [("type","code")] $ text (escapeStringForXML str)
+-- Distinguish display from inline math by wrapping the former in a "figure."
+inlineToTEI _ (Math t str) =
+  case t of
+    InlineMath  -> inTags False "formula" [("notation","TeX")] $
+                   text (str)
+    DisplayMath -> inTags True "figure" [("type","math")] $
+                   inTags False "formula" [("notation","TeX")] $ text (str)
+      
+inlineToTEI _ (RawInline f x) | f == "tei"     = text x
+                              | otherwise      = empty
+inlineToTEI _ LineBreak = selfClosingTag "lb" []
+inlineToTEI _ Space = space
+-- because we use \n for LineBreak, we can't do soft breaks:
+inlineToTEI _ SoftBreak = space
+inlineToTEI opts (Link attr txt (src, _))
+  | Just email <- stripPrefix "mailto:" src =
+      let emailLink = text $
+                      escapeStringForXML $ email
+      in  case txt of
+           [Str s] | escapeURI s == email -> emailLink
+           _             -> inlinesToTEI opts txt <+>
+                              char '(' <> emailLink <> char ')'
+  | otherwise =
+      (if isPrefixOf "#" src
+            then inTags False "ref" $ ("target", drop 1 src) : idAndRole attr
+            else inTags False "ref" $ ("target", src) : idAndRole attr ) $
+        inlinesToTEI opts txt
+inlineToTEI opts (Image attr description (src, tit)) =
+  let titleDoc = if null tit
+                   then empty
+                   else inTags False "figDesc" [] (text $ escapeStringForXML tit)
+      imageDesc = if null description
+                  then empty
+                  else inTags False "head" [] (inlinesToTEI opts description)
+  in  inTagsIndented "figure" $ imageDesc $$
+      imageToTEI opts attr src $$ titleDoc
+inlineToTEI opts (Note contents) =
+  inTagsIndented "note" $ blocksToTEI opts contents
+
+idAndRole :: Attr -> [(String, String)]
+idAndRole (id',cls,_) = ident ++ role
+  where
+    ident = if null id'
+               then []
+               else [("id", id')]
+    role  = if null cls
+               then []
+               else [("role", unwords cls)]
+
diff --git a/src/Text/Pandoc/Writers/Texinfo.hs b/src/Text/Pandoc/Writers/Texinfo.hs
index 2325d14..8420704 100644
--- a/src/Text/Pandoc/Writers/Texinfo.hs
+++ b/src/Text/Pandoc/Writers/Texinfo.hs
@@ -40,15 +40,18 @@ import Data.Ord ( comparing )
 import Data.Char ( chr, ord )
 import Control.Monad.State
 import Text.Pandoc.Pretty
+import Text.Pandoc.ImageSize
 import Network.URI ( isURI, unEscapeString )
 import System.FilePath
+import qualified Data.Set as Set
 
 data WriterState =
   WriterState { stStrikeout   :: Bool  -- document contains strikeout
               , stSuperscript :: Bool -- document contains superscript
               , stSubscript   :: Bool -- document contains subscript
               , stEscapeComma :: Bool -- in a context where we need @comma
-              , stIdentifiers :: [String] -- header ids used already
+              , stIdentifiers :: Set.Set String -- header ids used already
+              , stOptions     :: WriterOptions -- writer options
               }
 
 {- TODO:
@@ -61,7 +64,8 @@ writeTexinfo :: WriterOptions -> Pandoc -> String
 writeTexinfo options document =
   evalState (pandocToTexinfo options $ wrapTop document) $
   WriterState { stStrikeout = False, stSuperscript = False,
-                stEscapeComma = False, stSubscript = False, stIdentifiers = [] }
+                stEscapeComma = False, stSubscript = False,
+                stIdentifiers = Set.empty, stOptions = options}
 
 -- | Add a "Top" node around the document, needed by Texinfo.
 wrapTop :: Pandoc -> Pandoc
@@ -72,7 +76,7 @@ pandocToTexinfo :: WriterOptions -> Pandoc -> State WriterState String
 pandocToTexinfo options (Pandoc meta blocks) = do
   let titlePage = not $ all null
                       $ docTitle meta : docDate meta : docAuthors meta
-  let colwidth = if writerWrapText options
+  let colwidth = if writerWrapText options == WrapAuto
                     then Just $ writerColumns options
                     else Nothing
   metadata <- metaToJSON options
@@ -130,12 +134,12 @@ blockToTexinfo (Plain lst) =
   inlineListToTexinfo lst
 
 -- title beginning with fig: indicates that the image is a figure
-blockToTexinfo (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
+blockToTexinfo (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
   capt <- if null txt
              then return empty
              else (\c -> text "@caption" <> braces c) `fmap`
                     inlineListToTexinfo txt
-  img  <- inlineToTexinfo (Image txt (src,tit))
+  img  <- inlineToTexinfo (Image attr txt (src,tit))
   return $ text "@float" $$ img $$ capt $$ text "@end float"
 
 blockToTexinfo (Para lst) =
@@ -212,7 +216,7 @@ blockToTexinfo (Header level _ lst) = do
   txt <- inlineListToTexinfo lst
   idsUsed <- gets stIdentifiers
   let id' = uniqueIdent lst idsUsed
-  modify $ \st -> st{ stIdentifiers = id' : idsUsed }
+  modify $ \st -> st{ stIdentifiers = Set.insert id' idsUsed }
   return $ if (level > 0) && (level <= 4)
               then blankline <> text "@node " <> node $$
                    text (seccmd level) <> txt $$
@@ -422,13 +426,19 @@ inlineToTexinfo (RawInline f str)
   | f == "texinfo" =  return $ text str
   | otherwise      =  return empty
 inlineToTexinfo (LineBreak) = return $ text "@*" <> cr
+inlineToTexinfo SoftBreak = do
+  wrapText <- gets (writerWrapText . stOptions)
+  case wrapText of
+      WrapAuto     -> return space
+      WrapNone     -> return space
+      WrapPreserve -> return cr
 inlineToTexinfo Space = return space
 
-inlineToTexinfo (Link txt (src@('#':_), _)) = do
+inlineToTexinfo (Link _ txt (src@('#':_), _)) = do
   contents <- escapeCommas $ inlineListToTexinfo txt
   return $ text "@ref" <>
            braces (text (stringToTexinfo src) <> text "," <> contents)
-inlineToTexinfo (Link txt (src, _)) = do
+inlineToTexinfo (Link _ txt (src, _)) = do
   case txt of
         [Str x] | escapeURI x == src ->  -- autolink
              do return $ text $ "@url{" ++ x ++ "}"
@@ -437,10 +447,16 @@ inlineToTexinfo (Link txt (src, _)) = do
                 return $ text ("@uref{" ++ src1 ++ ",") <> contents <>
                          char '}'
 
-inlineToTexinfo (Image alternate (source, _)) = do
+inlineToTexinfo (Image attr alternate (source, _)) = do
   content <- escapeCommas $ inlineListToTexinfo alternate
-  return $ text ("@image{" ++ base ++ ",,,") <> content <> text "," <>
-           text (ext ++ "}")
+  opts <- gets stOptions
+  let showDim dim = case (dimension dim attr) of
+                      (Just (Pixel a))   -> showInInch opts (Pixel a) ++ "in"
+                      (Just (Percent _)) -> ""
+                      (Just d)           -> show d
+                      Nothing            -> ""
+  return $ text ("@image{" ++ base ++ ',':(showDim Width) ++ ',':(showDim Height) ++ ",")
+           <> content <> text "," <> text (ext ++ "}")
   where
     ext     = drop 1 $ takeExtension source'
     base    = dropExtension source'
diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs
index df632ad..98f9157 100644
--- a/src/Text/Pandoc/Writers/Textile.hs
+++ b/src/Text/Pandoc/Writers/Textile.hs
@@ -34,6 +34,7 @@ import Text.Pandoc.Definition
 import Text.Pandoc.Options
 import Text.Pandoc.Shared
 import Text.Pandoc.Pretty (render)
+import Text.Pandoc.ImageSize
 import Text.Pandoc.Writers.Shared
 import Text.Pandoc.Templates (renderTemplate')
 import Text.Pandoc.XML ( escapeStringForXML )
@@ -44,6 +45,7 @@ import Data.Char ( isSpace )
 data WriterState = WriterState {
     stNotes     :: [String]        -- Footnotes
   , stListLevel :: [Char]          -- String at beginning of list items, e.g. "**"
+  , stStartNum  :: Maybe Int       -- Start number if first list item
   , stUseTags   :: Bool            -- True if we should use HTML tags because we're in a complex list
   }
 
@@ -51,7 +53,8 @@ data WriterState = WriterState {
 writeTextile :: WriterOptions -> Pandoc -> String
 writeTextile opts document =
   evalState (pandocToTextile opts document)
-            WriterState { stNotes = [], stListLevel = [], stUseTags = False }
+            WriterState { stNotes = [], stListLevel = [], stStartNum = Nothing,
+                          stUseTags = False }
 
 -- | Return Textile representation of document.
 pandocToTextile :: WriterOptions -> Pandoc -> State WriterState String
@@ -114,9 +117,9 @@ blockToTextile opts (Plain inlines) =
   inlineListToTextile opts inlines
 
 -- title beginning with fig: indicates that the image is a figure
-blockToTextile opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
+blockToTextile opts (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
   capt <- blockToTextile opts (Para txt)
-  im <- inlineToTextile opts (Image txt (src,tit))
+  im <- inlineToTextile opts (Image attr txt (src,tit))
   return $ im ++ "\n" ++ capt
 
 blockToTextile opts (Para inlines) = do
@@ -218,7 +221,7 @@ blockToTextile opts x@(BulletList items) = do
         modify $ \s -> s { stListLevel = init (stListLevel s) }
         return $ vcat contents ++ (if level > 1 then "" else "\n")
 
-blockToTextile opts x@(OrderedList attribs items) = do
+blockToTextile opts x@(OrderedList attribs@(start, _, _) items) = do
   oldUseTags <- liftM stUseTags get
   let useTags = oldUseTags || not (isSimpleList x)
   if useTags
@@ -227,10 +230,14 @@ blockToTextile opts x@(OrderedList attribs items) = do
         return $ "<ol" ++ listAttribsToString attribs ++ ">\n" ++ vcat contents ++
                    "\n</ol>\n"
      else do
-        modify $ \s -> s { stListLevel = stListLevel s ++ "#" }
+        modify $ \s -> s { stListLevel = stListLevel s ++ "#"
+                         , stStartNum = if start > 1
+                                           then Just start
+                                           else Nothing }
         level <- get >>= return . length . stListLevel
         contents <- mapM (listItemToTextile opts) items
-        modify $ \s -> s { stListLevel = init (stListLevel s) }
+        modify $ \s -> s { stListLevel = init (stListLevel s),
+                           stStartNum = Nothing }
         return $ vcat contents ++ (if level > 1 then "" else "\n")
 
 blockToTextile opts (DefinitionList items) = do
@@ -258,8 +265,13 @@ listItemToTextile opts items = do
   if useTags
      then return $ "<li>" ++ contents ++ "</li>"
      else do
-       marker <- get >>= return . stListLevel
-       return $ marker ++ " " ++ contents
+       marker <- gets stListLevel
+       mbstart <- gets stStartNum
+       case mbstart of
+            Just n -> do
+              modify $ \s -> s{ stStartNum = Nothing }
+              return $ marker ++ show n ++ " " ++ contents
+            Nothing -> return $ marker ++ " " ++ contents
 
 -- | Convert definition list item (label, list of blocks) to Textile.
 definitionListItemToTextile :: WriterOptions
@@ -276,8 +288,8 @@ isSimpleList :: Block -> Bool
 isSimpleList x =
   case x of
        BulletList items                 -> all isSimpleListItem items
-       OrderedList (num, sty, _) items  -> all isSimpleListItem items &&
-                                            num == 1 && sty `elem` [DefaultStyle, Decimal]
+       OrderedList (_, sty, _) items    -> all isSimpleListItem items &&
+                                            sty `elem` [DefaultStyle, Decimal]
        _                                -> False
 
 -- | True if list item can be handled with the simple wiki syntax.  False if
@@ -422,25 +434,43 @@ inlineToTextile opts (RawInline f str)
 
 inlineToTextile _ (LineBreak) = return "\n"
 
+inlineToTextile _ SoftBreak = return " "
+
 inlineToTextile _ Space = return " "
 
-inlineToTextile opts (Link txt (src, _)) = do
+inlineToTextile opts (Link (_, cls, _) txt (src, _)) = do
+  let classes = if null cls
+                   then ""
+                   else "(" ++ unwords cls ++ ")"
   label <- case txt of
                 [Code _ s]
                  | s == src -> return "$"
                 [Str s]
                  | s == src -> return "$"
                 _           -> inlineListToTextile opts txt
-  return $ "\"" ++ label ++ "\":" ++ src
+  return $ "\"" ++ classes ++ label ++ "\":" ++ src
 
-inlineToTextile opts (Image alt (source, tit)) = do
+inlineToTextile opts (Image attr@(_, cls, _) alt (source, tit)) = do
   alt' <- inlineListToTextile opts alt
   let txt = if null tit
                then if null alt'
                        then ""
                        else "(" ++ alt' ++ ")"
                else "(" ++ tit ++ ")"
-  return $ "!" ++ source ++ txt ++ "!"
+      classes = if null cls
+                   then ""
+                   else "(" ++ unwords cls ++ ")"
+      showDim dir = let toCss str = Just $ show dir ++ ":" ++ str ++ ";"
+                    in case (dimension dir attr) of
+                         Just (Percent a) -> toCss $ show (Percent a)
+                         Just dim         -> toCss $ showInPixel opts dim ++ "px"
+                         Nothing          -> Nothing
+      styles = case (showDim Width, showDim Height) of
+                 (Just w, Just h)   -> "{" ++ w ++ h ++ "}"
+                 (Just w, Nothing)  -> "{" ++ w ++ "height:auto;}"
+                 (Nothing, Just h)  -> "{" ++ "width:auto;" ++ h ++ "}"
+                 (Nothing, Nothing) -> ""
+  return $ "!" ++ classes ++ styles ++ source ++ txt ++ "!"
 
 inlineToTextile opts (Note contents) = do
   curNotes <- liftM stNotes get
diff --git a/src/Text/Pandoc/XML.hs b/src/Text/Pandoc/XML.hs
index caa13f1..4cc2141 100644
--- a/src/Text/Pandoc/XML.hs
+++ b/src/Text/Pandoc/XML.hs
@@ -1,5 +1,5 @@
 {-
-Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu>
+Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 {- |
    Module      : Text.Pandoc.XML
-   Copyright   : Copyright (C) 2006-2015 John MacFarlane
+   Copyright   : Copyright (C) 2006-2016 John MacFarlane
    License     : GNU GPL, version 2 or above
 
    Maintainer  : John MacFarlane <jgm@berkeley.edu>
@@ -100,11 +100,16 @@ toEntities (c:cs)
 -- Unescapes XML entities
 fromEntities :: String -> String
 fromEntities ('&':xs) =
-  case lookupEntity ent of
+  case lookupEntity ent' of
         Just c  -> c : fromEntities rest
         Nothing -> '&' : fromEntities xs
     where (ent, rest) = case break (\c -> isSpace c || c == ';') xs of
                              (zs,';':ys) -> (zs,ys)
-                             _           -> ("",xs)
+                             (zs,    ys) -> (zs,ys)
+          ent' = case ent of
+                      '#':'X':ys -> '#':'x':ys  -- workaround tagsoup bug
+                      '#':_ -> ent
+                      _     -> ent ++ ";"
+
 fromEntities (x:xs) = x : fromEntities xs
 fromEntities [] = []
diff --git a/stack.full.yaml b/stack.full.yaml
new file mode 100644
index 0000000..7550ab0
--- /dev/null
+++ b/stack.full.yaml
@@ -0,0 +1,18 @@
+# This version builds both pandoc and pandoc-citeproc, assuming
+# pandoc-citeproc is in the pandoc-citeproc subdirectory.
+flags:
+  pandoc:
+    trypandoc: false
+    https: true
+    embed_data_files: false
+    old-locale: false
+    network-uri: true
+packages:
+- '.'
+- '../pandoc-citeproc'
+- '../pandoc-types'
+extra-deps:
+- 'aeson-0.11.1.1'
+- 'highlighting-kate-0.6.2'
+- 'texmath-0.8.5'
+resolver: lts-5.8
diff --git a/stack.hsb2hs.yaml b/stack.hsb2hs.yaml
new file mode 100644
index 0000000..7dd7899
--- /dev/null
+++ b/stack.hsb2hs.yaml
@@ -0,0 +1,4 @@
+packages:
+- 'https://hackage.haskell.org/package/preprocessor-tools-1.0.1/preprocessor-tools-1.0.1.tar.gz'
+- 'https://hackage.haskell.org/package/hsb2hs-0.3.1/hsb2hs-0.3.1.tar.gz'
+resolver: lts-4.0
diff --git a/stack.pkg.yaml b/stack.pkg.yaml
deleted file mode 100644
index 031524d..0000000
--- a/stack.pkg.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-flags:
-  pandoc:
-    trypandoc: false
-    https: true
-    embed_data_files: true
-    old-locale: false
-    network-uri: true
-  pandoc-citeproc:
-    bibutils: true
-    embed_data_files: true
-    unicode_collation: false
-    test_citeproc: false
-    debug: false
-ghc-options:
-  pandoc-citeproc:  '-pgmP cpphs -optP--cpp'
-  highlighting-kate: '-pgmP cpphs -optP--cpp'
-packages:
-- '.'
-- 'https://hackage.haskell.org/package/highlighting-kate-0.6/highlighting-kate-0.6.tar.gz'
-- 'https://hackage.haskell.org/package/texmath-0.8.4/texmath-0.8.4.tar.gz'
-- 'https://hackage.haskell.org/package/pandoc-citeproc-0.8.0.1/pandoc-citeproc-0.8.0.1.tar.gz'
-resolver: lts-3.9
diff --git a/stack.yaml b/stack.yaml
index ed35481..e25ad9b 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -8,4 +8,8 @@ flags:
 packages:
 - '.'
 extra-deps: []
-resolver: lts-3.9
+# to compile against aeson 0.11.0.0:
+# - 'aeson-0.11.0.0'
+# - 'fail-4.9.0.0'
+# - 'pandoc-types-1.16.1'
+resolver: lts-5.8
diff --git a/tests/Tests/Arbitrary.hs b/tests/Tests/Arbitrary.hs
index 3675d97..d792e13 100644
--- a/tests/Tests/Arbitrary.hs
+++ b/tests/Tests/Arbitrary.hs
@@ -56,14 +56,16 @@ arbInline n = frequency $ [ (60, liftM Str realString)
                    , (10,  do x1 <- arbitrary
                               x2 <- realString
                               return $ Math x1 x2)
-                   , (10,  do x1 <- arbInlines (n-1)
+                   , (10,  do x0 <- arbAttr
+                              x1 <- arbInlines (n-1)
                               x3 <- realString
                               x2 <- liftM escapeURI realString
-                              return $ Link x1 (x2,x3))
-                   , (10,  do x1 <- arbInlines (n-1)
+                              return $ Link x0 x1 (x2,x3))
+                   , (10,  do x0 <- arbAttr
+                              x1 <- arbInlines (n-1)
                               x3 <- realString
                               x2 <- liftM escapeURI realString
-                              return $ Image x1 (x2,x3))
+                              return $ Image x0 x1 (x2,x3))
                    , (2,  liftM2 Cite arbitrary (arbInlines 1))
                    , (2,  liftM Note $ resize 3 $ listOf1 $ arbBlock (n-1))
                    ]
diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs
index 5cfee9f..36bb339 100644
--- a/tests/Tests/Old.hs
+++ b/tests/Tests/Old.hs
@@ -162,9 +162,15 @@ tests = [ testGroup "markdown"
           [ test "reader" ["-r", "twiki", "-w", "native", "-s"]
               "twiki-reader.twiki" "twiki-reader.native" ]
         , testGroup "other writers" $ map (\f -> testGroup f $ writerTests f)
-          [ "opendocument" , "context" , "texinfo", "icml"
+          [ "opendocument" , "context" , "texinfo", "icml", "tei"
           , "man" , "plain" , "rtf", "org", "asciidoc"
           ]
+        , testGroup "writers-lang-and-dir"
+          [ test "latex" ["-f", "native", "-t", "latex", "-s"]
+            "writers-lang-and-dir.native" "writers-lang-and-dir.latex"
+          , test "context" ["-f", "native", "-t", "context", "-s"]
+            "writers-lang-and-dir.native" "writers-lang-and-dir.context"
+          ]
         ]
 
 -- makes sure file is fully closed after reading
@@ -178,7 +184,7 @@ lhsWriterTests format
     , t "lhs to lhs"    (format ++ "+lhs")
     ]
   where
-    t n f = test n ["--columns=78", "-r", "native", "-s", "-w", f]
+    t n f = test n ["--wrap=preserve", "-r", "native", "-s", "-w", f]
              "lhs-test.native" ("lhs-test" <.> f)
 
 lhsReaderTest :: String -> Test
@@ -196,7 +202,8 @@ writerTests format
     , test "tables" opts             "tables.native"    ("tables" <.> format)
     ]
   where
-    opts = ["-r", "native", "-w", format, "--columns=78"]
+    opts = ["-r", "native", "-w", format, "--columns=78",
+            "--variable", "pandoc-version="]
 
 s5WriterTest :: String -> [String] -> String -> Test
 s5WriterTest modifier opts format
diff --git a/tests/Tests/Readers/Docx.hs b/tests/Tests/Readers/Docx.hs
index 7e3f197..e09d565 100644
--- a/tests/Tests/Readers/Docx.hs
+++ b/tests/Tests/Readers/Docx.hs
@@ -111,6 +111,10 @@ tests = [ testGroup "inlines"
             "docx/links.docx"
             "docx/links.native"
           , testCompare
+            "normalizing adjacent hyperlinks"
+            "docx/adjacent_links.docx"
+            "docx/adjacent_links.native"
+          , testCompare
             "inline image"
             "docx/image.docx"
             "docx/image_no_embed.native"
@@ -165,10 +169,14 @@ tests = [ testGroup "inlines"
             "docx/already_auto_ident.docx"
             "docx/already_auto_ident.native"
           , testCompare
-            "numbered headers automatically made into list"
+            "single numbered item not made into list"
             "docx/numbered_header.docx"
             "docx/numbered_header.native"
           , testCompare
+            "enumerated headers not made into numbered list"
+            "docx/enumerated_headings.docx"
+            "docx/enumerated_headings.native"
+          , testCompare
             "i18n blocks (headers and blockquotes)"
             "docx/i18n_blocks.docx"
             "docx/i18n_blocks.native"
@@ -185,10 +193,22 @@ tests = [ testGroup "inlines"
             "docx/german_styled_lists.docx"
             "docx/german_styled_lists.native"
           , testCompare
+            "user deletes bullet after list item (=> part of item par)"
+            "docx/dummy_item_after_list_item.docx"
+            "docx/dummy_item_after_list_item.native"
+          , testCompare
+            "user deletes bullet after par (=> new par)"
+            "docx/dummy_item_after_paragraph.docx"
+            "docx/dummy_item_after_paragraph.native"
+          , testCompare
             "footnotes and endnotes"
             "docx/notes.docx"
             "docx/notes.native"
           , testCompare
+            "links in footnotes and endnotes"
+            "docx/link_in_notes.docx"
+            "docx/link_in_notes.native"
+          , testCompare
             "blockquotes (parsing indent as blockquote)"
             "docx/block_quotes.docx"
             "docx/block_quotes_parse_indent.native"
diff --git a/tests/Tests/Readers/HTML.hs b/tests/Tests/Readers/HTML.hs
index 2eb87a2..ff27b8a 100644
--- a/tests/Tests/Readers/HTML.hs
+++ b/tests/Tests/Readers/HTML.hs
@@ -15,11 +15,14 @@ html = handleError . readHtml def
 tests :: [Test]
 tests = [ testGroup "base tag"
           [ test html "simple" $
-            "<head><base href=\"http://www.w3schools.com/images\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?>
+            "<head><base href=\"http://www.w3schools.com/images/foo\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?>
             plain (image "http://www.w3schools.com/images/stickman.gif" "" (text "Stickman"))
           , test html "slash at end of base" $
             "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?>
             plain (image "http://www.w3schools.com/images/stickman.gif" "" (text "Stickman"))
+          , test html "slash at beginning of href" $
+            "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"/stickman.gif\" alt=\"Stickman\"></head>" =?>
+            plain (image "http://www.w3schools.com/stickman.gif" "" (text "Stickman"))
           , test html "absolute URL" $
             "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"http://example.com/stickman.gif\" alt=\"Stickman\"></head>" =?>
             plain (image "http://example.com/stickman.gif" "" (text "Stickman"))
diff --git a/tests/Tests/Readers/Markdown.hs b/tests/Tests/Readers/Markdown.hs
index c24d229..20602af 100644
--- a/tests/Tests/Readers/Markdown.hs
+++ b/tests/Tests/Readers/Markdown.hs
@@ -157,7 +157,7 @@ tests = [ testGroup "inline code"
           , "emph and strong emph alternating" =:
             "*xxx* ***xxx*** xxx\n*xxx* ***xxx*** xxx"
             =?> para (emph "xxx" <> space <> strong (emph "xxx") <>
-                      space <> "xxx" <> space <>
+                      space <> "xxx" <> softbreak <>
                       emph "xxx" <> space <> strong (emph "xxx") <>
                       space <> "xxx")
           , "emph with spaced strong" =:
@@ -181,6 +181,13 @@ tests = [ testGroup "inline code"
           , "technically invalid comment" =:
             "<!-- pandoc --help -->" =?>
             rawBlock "html" "<!-- pandoc --help -->"
+          , test markdownGH "issue 2469" $
+            "<\n\na>" =?>
+            para (text "<") <> para (text "a>")
+          ]
+        , testGroup "emoji"
+          [ test markdownGH "emoji symbols" $
+            ":smile: and :+1:" =?> para (text "😄 and 👍")
           ]
         , "unbalanced brackets" =:
             "[[[[[[[[[[[[[[[hi" =?> para (text "[[[[[[[[[[[[[[[hi")
@@ -318,7 +325,8 @@ tests = [ testGroup "inline code"
                            ]
           , "laziness" =:
             "foo1\n  :  bar\nbaz\n  : bar2\n" =?>
-            definitionList [ (text "foo1", [plain (text "bar baz"),
+            definitionList [ (text "foo1", [plain (text "bar" <>
+                                                 softbreak <> text "baz"),
                                             plain (text "bar2")])
                            ]
           , "no blank space before first of two paragraphs" =:
@@ -340,7 +348,8 @@ tests = [ testGroup "inline code"
         , testGroup "+compact_definition_lists"
           [ test markdownCDL "basic compact list" $
             "foo1\n:   bar\n    baz\nfoo2\n:   bar2\n" =?>
-            definitionList [ (text "foo1", [plain (text "bar baz")])
+            definitionList [ (text "foo1", [plain (text "bar" <> softbreak <>
+                                                     text "baz")])
                            , (text "foo2", [plain (text "bar2")])
                            ]
           ]
@@ -362,6 +371,15 @@ tests = [ testGroup "inline code"
                          , plain "b"
                          , plain "c" <> bulletList [plain "d"] ]
           ]
+        , testGroup "entities"
+          [ "character references" =:
+            "&lang; &ouml;" =?> para (text "\10216 ö")
+          , "numeric" =:
+            "&#44;&#x44;&#X44;" =?> para (text ",DD")
+          , "in link title" =:
+            "[link](/url \"title &lang; &ouml; &#44;\")" =?>
+               para (link "/url" "title \10216 ö ," (text "link"))
+          ]
         , testGroup "citations"
           [ "simple" =:
             "@item1" =?> para (cite [
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs
index b1aaaac..b095ac6 100644
--- a/tests/Tests/Readers/Org.hs
+++ b/tests/Tests/Readers/Org.hs
@@ -109,10 +109,9 @@ tests =
                   , "seven*eight* nine*"
                   , "+not+funny+"
                   ] =?>
-          para (spcSep [ "this+that+", "+so+on"
-                       , "seven*eight*", "nine*"
-                       , strikeout "not+funny"
-                       ])
+          para ("this+that+ +so+on" <> softbreak <>
+                "seven*eight* nine*" <> softbreak <>
+                strikeout "not+funny")
 
       , "No empty markup" =:
           "// ** __ ++ == ~~ $$" =?>
@@ -142,8 +141,9 @@ tests =
 
       , "Inline math must stay within three lines" =:
           unlines [ "$a", "b", "c$", "$d", "e", "f", "g$" ] =?>
-          para ((math "a\nb\nc") <> space <>
-                spcSep [ "$d", "e", "f", "g$" ])
+          para ((math "a\nb\nc") <> softbreak <>
+                "$d" <> softbreak <> "e" <> softbreak <>
+                "f" <> softbreak <> "g$")
 
       , "Single-character math" =:
           "$a$ $b$! $c$?" =?>
@@ -153,14 +153,13 @@ tests =
                        ])
 
       , "Markup may not span more than two lines" =:
-          unlines [ "/this *is +totally", "nice+ not*", "emph/" ] =?>
-          para (spcSep [ "/this"
-                       , (strong (spcSep
-                                  [ "is"
-                                  , (strikeout ("totally" <> space <> "nice"))
-                                  , "not"
-                                  ]))
-                       , "emph/" ])
+          "/this *is +totally\nnice+ not*\nemph/" =?>
+          para ("/this" <> space <>
+                  strong ("is" <> space <>
+                          strikeout ("totally" <>
+                            softbreak <> "nice") <>
+                          space <> "not") <>
+                  softbreak <> "emph/")
 
       , "Sub- and superscript expressions" =:
          unlines [ "a_(a(b)(c)d)"
@@ -174,7 +173,8 @@ tests =
                  , "3_{{}}"
                  , "4^(a(*b(c*)d))"
                  ] =?>
-         para (spcSep [ "a" <> subscript "(a(b)(c)d)"
+         para (mconcat $ intersperse softbreak
+                      [ "a" <> subscript "(a(b)(c)d)"
                       , "e" <> superscript "(f(g)h)"
                       , "i" <> (subscript "(jk)") <> "l)"
                       , "m" <> (superscript "()") <> "n"
@@ -190,6 +190,10 @@ tests =
           "[[./sunset.jpg]]" =?>
           (para $ image "./sunset.jpg" "" "")
 
+      , "Image with explicit file: prefix" =:
+          "[[file:sunrise.jpg]]" =?>
+          (para $ image "sunrise.jpg" "" "")
+
       , "Explicit link" =:
           "[[http://zeitlens.com/][pseudo-random /nonsense/]]" =?>
           (para $ link "http://zeitlens.com/" ""
@@ -264,6 +268,16 @@ tests =
                            )
                            "echo 'Hello, World'")
 
+      , "Inline code block with toggle" =:
+          "src_sh[:toggle]{echo $HOME}" =?>
+          (para $ codeWith ( ""
+                           , [ "bash", "rundoc-block" ]
+                           , [ ("rundoc-language", "sh")
+                             , ("rundoc-toggle", "yes")
+                             ]
+                           )
+                           "echo $HOME")
+
       , "Citation" =:
           "[@nonexistent]" =?>
           let citation = Citation
@@ -394,13 +408,13 @@ tests =
           unlines [ "  :LOGBOOK: foo"
                   , "  :END:"
                   ] =?>
-          para (spcSep [ ":LOGBOOK:", "foo", ":END:" ])
+          para (":LOGBOOK:" <> space <> "foo" <> softbreak <> ":END:")
 
       , "Drawers with unknown names are just text" =:
           unlines [ ":FOO:"
                   , ":END:"
                   ] =?>
-          para (":FOO:" <> space <> ":END:")
+          para (":FOO:" <> softbreak <> ":END:")
 
       , "Anchor reference" =:
           unlines [ "<<link-here>> Target."
@@ -529,6 +543,17 @@ tests =
           "* This: is not: tagged" =?>
           headerWith ("this-is-not-tagged", [], []) 1 "This: is not: tagged"
 
+      , "Header starting with strokeout text" =:
+          unlines [ "foo"
+                  , ""
+                  , "* +thing+ other thing"
+                  ] =?>
+          mconcat [ para "foo"
+                  , headerWith ("thing-other-thing", [], [])
+                               1
+                               ((strikeout "thing") <> " other thing")
+                  ]
+
       , "Comment Trees" =:
           unlines [ "* COMMENT A comment tree"
                   , "  Not much going on here"
@@ -548,6 +573,16 @@ tests =
                   ] =?>
           (mempty::Blocks)
 
+      , "Subtree with :noexport:" =:
+          unlines [ "* Exported"
+                  , "** This isn't exported :noexport:"
+                  , "*** This neither"
+                  , "** But this is"
+                  ] =?>
+          mconcat [ headerWith ("exported", [], []) 1 "Exported"
+                  , headerWith ("but-this-is", [], []) 2 "But this is"
+                  ]
+
       , "Paragraph starting with an asterisk" =:
           "*five" =?>
           para "*five"
@@ -556,7 +591,7 @@ tests =
           unlines [ "lucky"
                   , "*star"
                   ] =?>
-          para ("lucky" <> space <> "*star")
+          para ("lucky" <> softbreak <> "*star")
 
       , "Example block" =:
           unlines [ ": echo hello"
@@ -604,11 +639,11 @@ tests =
                   ] =?>
           para (image "edward.jpg" "fig:goodguy" "A very courageous man.")
 
-      , "Unnamed figure" =:
-          unlines [ "#+caption: A great whistleblower."
-                  , "[[snowden.png]]"
+      , "Figure with no name" =:
+          unlines [ "#+caption: I've been through the desert on this"
+                  , "[[horse.png]]"
                   ] =?>
-          para (image "snowden.png" "" "A great whistleblower.")
+          para (image "horse.png" "fig:" "I've been through the desert on this")
 
       , "Figure with `fig:` prefix in name" =:
           unlines [ "#+caption: Used as a metapher in evolutionary biology."
@@ -688,8 +723,8 @@ tests =
            "  Tony*\n" ++
            "- /Sideshow\n" ++
            " Bob/") =?>
-          bulletList [ plain $ strong ("Fat" <> space <> "Tony")
-                     , plain $ emph ("Sideshow" <> space <> "Bob")
+          bulletList [ plain $ strong ("Fat" <> softbreak <> "Tony")
+                     , plain $ emph ("Sideshow" <> softbreak <> "Bob")
                      ]
 
       , "Nested Bullet Lists" =:
@@ -820,7 +855,7 @@ tests =
           unlines [ "- PLL :: phase-locked loop"
                   , "- TTL ::"
                   , "  transistor-transistor logic"
-                  , "- PSK::phase-shift keying"
+                  , "- PSK :: phase-shift keying"
                   , ""
                   , "  a digital modulation scheme"
                   ] =?>
@@ -859,6 +894,10 @@ tests =
                   , headerWith ("header", [], []) 1 "header"
                   ]
 
+      , "Definition lists double-colon markers must be surrounded by whitespace" =:
+          "- std::cout" =?>
+          bulletList [ plain "std::cout" ]
+
       , "Loose bullet list" =:
           unlines [ "- apple"
                   , ""
@@ -870,6 +909,14 @@ tests =
                      , para "orange"
                      , para "peach"
                      ]
+
+      , "Recognize preceding paragraphs in non-list contexts" =:
+          unlines [ "CLOSED: [2015-10-19 Mon 15:03]"
+                  , "- Note taken on [2015-10-19 Mon 13:24]"
+                  ] =?>
+          mconcat [ para "CLOSED: [2015-10-19 Mon 15:03]"
+                  , bulletList [ plain "Note taken on [2015-10-19 Mon 13:24]" ]
+                  ]
       ]
 
   , testGroup "Tables"
@@ -1094,6 +1141,15 @@ tests =
                    , ": 65" ] =?>
            rawBlock "html" ""
 
+      , "Source block with toggling header arguments" =:
+        unlines [ "#+BEGIN_SRC sh :noeval"
+                , "echo $HOME"
+                , "#+END_SRC"
+                ] =?>
+        let classes = [ "bash", "rundoc-block" ]
+            params = [ ("rundoc-language", "sh"), ("rundoc-noeval", "yes") ]
+        in codeBlockWith ("", classes, params) "echo $HOME\n"
+
       , "Example block" =:
            unlines [ "#+begin_example"
                    , "A chosen representation of"
@@ -1208,6 +1264,7 @@ tests =
                         ]
           in codeBlockWith ( "", classes, params) "code body\n"
       ]
+
     , testGroup "Smart punctuation"
       [ test orgSmart "quote before ellipses"
         ("'...hi'"
@@ -1228,5 +1285,13 @@ tests =
       , test orgSmart "Dashes are allowed at the borders of emphasis'"
         ("/foo---/" =?>
          para (emph "foo—"))
+
+      , test orgSmart "Single quotes can be followed by emphasized text"
+        ("Singles on the '/meat market/'" =?>
+         para ("Singles on the " <> (singleQuoted $ emph "meat market")))
+
+      , test orgSmart "Double quotes can be followed by emphasized text"
+        ("Double income, no kids: \"/DINK/\"" =?>
+         para ("Double income, no kids: " <> (doubleQuoted $ emph "DINK")))
       ]
   ]
diff --git a/tests/Tests/Readers/RST.hs b/tests/Tests/Readers/RST.hs
index df6ba61..ea85a59 100644
--- a/tests/Tests/Readers/RST.hs
+++ b/tests/Tests/Readers/RST.hs
@@ -42,9 +42,9 @@ tests = [ "line block with blank line" =:
                                   , (text "IP address", [para "10.0.0.19"])
                                   , (str "Size", [para "3ru"])
                                   , (str "Version", [para "1"])
-                                  , (str "Indentation", [para "Since the field marker may be quite long, the second and subsequent lines of the field body do not have to line up with the first line, but they must be indented relative to the field name marker, and they must line up with each other."])
+                                  , (str "Indentation", [para "Since the field marker may be quite long, the second\nand subsequent lines of the field body do not have to line up\nwith the first line, but they must be indented relative to the\nfield name marker, and they must line up with each other."])
                                   , (text "Parameter i", [para "integer"])
-                                  , (str "Final", [para "item on two lines"])
+                                  , (str "Final", [para "item\non two lines"])
                                   ])
           , "metadata" =: unlines
              [ "====="
@@ -87,6 +87,7 @@ tests = [ "line block with blank line" =:
           para (link "http://google.com" "" "http://google.com" <> ", " <>
                 link "http://yahoo.com" "" "http://yahoo.com" <> "; " <>
                 link "http://foo.bar.baz" "" "http://foo.bar.baz" <> ". " <>
+                softbreak <>
                 link "http://foo.bar/baz_(bam)" "" "http://foo.bar/baz_(bam)"
                 <> " (" <> link "http://foo.bar" "" "http://foo.bar" <> ")")
         , "Reference names with special characters" =:
diff --git a/tests/Tests/Readers/Txt2Tags.hs b/tests/Tests/Readers/Txt2Tags.hs
index bfe217c..e0067c6 100644
--- a/tests/Tests/Readers/Txt2Tags.hs
+++ b/tests/Tests/Readers/Txt2Tags.hs
@@ -113,13 +113,13 @@ tests =
   , testGroup "Basic Blocks" $
       ["Paragraph, lines grouped together" =:
           "A paragraph\n A blank line ends the \n current paragraph\n"
-            =?> para "A paragraph A blank line ends the current paragraph"
+            =?> para "A paragraph\n A blank line ends the\n current paragraph"
       , "Paragraph, ignore leading and trailing spaces" =:
           "   Leading and trailing spaces are ignored.   \n" =?>
             para "Leading and trailing spaces are ignored."
       , "Comment line in paragraph" =:
           "A comment line can be placed inside a paragraph.\n% this comment will be ignored \nIt will not affect it.\n"
-          =?> para "A comment line can be placed inside a paragraph. It will not affect it."
+          =?> para "A comment line can be placed inside a paragraph.\nIt will not affect it."
       , "Paragraph" =:
           "Paragraph\n" =?>
           para "Paragraph"
@@ -167,7 +167,7 @@ tests =
           unlines [ "lucky"
                   , "*star"
                   ] =?>
-          para ("lucky" <> space <> "*star")
+          para ("lucky" <> softbreak <> "*star")
 
       , "Horizontal Rule" =:
           unlines [ "before"
diff --git a/tests/Tests/Writers/AsciiDoc.hs b/tests/Tests/Writers/AsciiDoc.hs
index 56a62c6..1b0a8de 100644
--- a/tests/Tests/Writers/AsciiDoc.hs
+++ b/tests/Tests/Writers/AsciiDoc.hs
@@ -7,7 +7,7 @@ import Tests.Helpers
 import Tests.Arbitrary()
 
 asciidoc :: (ToString a, ToPandoc a) => a -> String
-asciidoc = writeAsciiDoc def{ writerWrapText = False } . toPandoc
+asciidoc = writeAsciiDoc def{ writerWrapText = WrapNone } . toPandoc
 
 tests :: [Test]
 tests = [ testGroup "emphasis"
diff --git a/tests/Tests/Writers/ConTeXt.hs b/tests/Tests/Writers/ConTeXt.hs
index 8f0305a..d44b156 100644
--- a/tests/Tests/Writers/ConTeXt.hs
+++ b/tests/Tests/Writers/ConTeXt.hs
@@ -11,7 +11,7 @@ context :: (ToString a, ToPandoc a) => a -> String
 context = writeConTeXt def . toPandoc
 
 context' :: (ToString a, ToPandoc a) => a -> String
-context' = writeConTeXt def{ writerWrapText = False } . toPandoc
+context' = writeConTeXt def{ writerWrapText = WrapNone } . toPandoc
 
 {-
   "my test" =: X =?> Y
diff --git a/tests/Tests/Writers/Docbook.hs b/tests/Tests/Writers/Docbook.hs
index 97126b4..b1ac359 100644
--- a/tests/Tests/Writers/Docbook.hs
+++ b/tests/Tests/Writers/Docbook.hs
@@ -8,7 +8,7 @@ import Tests.Helpers
 import Tests.Arbitrary()
 
 docbook :: (ToString a, ToPandoc a) => a -> String
-docbook = writeDocbook def{ writerWrapText = False } . toPandoc
+docbook = writeDocbook def{ writerWrapText = WrapNone } . toPandoc
 
 {-
   "my test" =: X =?> Y
diff --git a/tests/Tests/Writers/HTML.hs b/tests/Tests/Writers/HTML.hs
index 84f4db1..53ed95f 100644
--- a/tests/Tests/Writers/HTML.hs
+++ b/tests/Tests/Writers/HTML.hs
@@ -8,7 +8,7 @@ import Tests.Helpers
 import Tests.Arbitrary()
 
 html :: (ToString a, ToPandoc a) => a -> String
-html = writeHtmlString def{ writerWrapText = False } . toPandoc
+html = writeHtmlString def{ writerWrapText = WrapNone } . toPandoc
 
 {-
   "my test" =: X =?> Y
diff --git a/tests/Tests/Writers/LaTeX.hs b/tests/Tests/Writers/LaTeX.hs
index d1cfd3d..05dfcbd 100644
--- a/tests/Tests/Writers/LaTeX.hs
+++ b/tests/Tests/Writers/LaTeX.hs
@@ -42,7 +42,7 @@ tests = [ testGroup "code blocks"
         , testGroup "definition lists"
           [ "with internal link" =: definitionList [(link "#go" "" (str "testing"),
              [plain (text "hi there")])] =?>
-            "\\begin{description}\n\\tightlist\n\\item[{\\hyperref[go]{testing}}]\nhi there\n\\end{description}"
+            "\\begin{description}\n\\tightlist\n\\item[{\\protect\\hyperlink{go}{testing}}]\nhi there\n\\end{description}"
           ]
         , testGroup "math"
           [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?>
diff --git a/tests/Tests/Writers/TEI.hs b/tests/Tests/Writers/TEI.hs
new file mode 100644
index 0000000..56764db
--- /dev/null
+++ b/tests/Tests/Writers/TEI.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Tests.Writers.TEI (tests) where
+
+import Test.Framework
+import Text.Pandoc.Builder
+import Text.Pandoc
+import Tests.Helpers
+import Tests.Arbitrary()
+
+{-
+  "my test" =: X =?> Y
+
+is shorthand for
+
+  test html "my test" $ X =?> Y
+
+which is in turn shorthand for
+
+  test html "my test" (X,Y)
+-}
+
+infix 4 =:
+(=:) :: (ToString a, ToPandoc a)
+     => String -> (a, String) -> Test
+(=:) = test (writeTEI def . toPandoc)
+
+tests :: [Test]
+tests = [ testGroup "block elements"
+          ["para"          =: para "Lorem ipsum cetera."
+                           =?> "<p>Lorem ipsum cetera.</p>"
+          ]
+        , testGroup "inlines"
+          [
+            "Emphasis"      =:  emph ("emphasized")
+                            =?> "<p><hi rendition=\"simple:italic\">emphasized</hi></p>"
+           ,"SingleQuoted"  =:  singleQuoted (text "quoted material")
+                            =?> "<p><quote>quoted material</quote></p>"
+           ,"DoubleQuoted"  =:  doubleQuoted (text "quoted material")
+                            =?> "<p><quote>quoted material</quote></p>"
+           ,"NestedQuoted"  =:  doubleQuoted (singleQuoted (text "quoted material"))
+                            =?> "<p><quote><quote>quoted material</quote></quote></p>"
+          ]
+         ]
diff --git a/tests/docbook-reader.native b/tests/docbook-reader.native
index b87e28d..3cce889 100644
--- a/tests/docbook-reader.native
+++ b/tests/docbook-reader.native
@@ -1,7 +1,7 @@
-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",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
+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 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"]
@@ -14,7 +14,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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",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 "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:"]
@@ -70,7 +70,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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",Space,Str "back."]]
+  ,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"]
@@ -137,9 +137,9 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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",Space,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",Space,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",Space,Str "return",Space,Str "the",Space,Str "empty",Space,Str "list.",Space,Str "This",Space,Str "is",Space,Str "reassuringly",Space,Str "familiar."]]]
+ [[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"],
@@ -177,28 +177,28 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
      [[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",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 "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",Space,Str "em."]]]
+,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 ",",Space,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",Space,Code ("",[],[]) "<html>",Str "."]
+,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 [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,",Space,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."]
+,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",Space,Str "name."]]
+,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",Space,Str "70\8217s?"]
+,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",Space,Math InlineMath "e = mc^{2}",Space,Math DisplayMath "e = mc^{2}"]
+,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
@@ -230,51 +230,51 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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 "."]
+,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 "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 "."]
+,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",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/",""),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 "."]
+,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:",Space,Link [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
+,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 [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","")]
+,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,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/>"]
+ [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.",Space,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.",Space,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","")]
+,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.",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",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",Space,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",Space,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,",Space,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",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
+,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)
diff --git a/tests/docbook-xref.native b/tests/docbook-xref.native
index ec87084..d454126 100644
--- a/tests/docbook-xref.native
+++ b/tests/docbook-xref.native
@@ -1,12 +1,12 @@
 Pandoc (Meta {unMeta = fromList []})
 [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",Space,Str "XRef."]
+,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",Space,Str "cross-reference",Space,Str "text:",Space,Link [Str "The Second Chapter"] ("#ch02",""),Str "."]]
- ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",Space,Str "element",Space,Str "with",Space,Str "an",Space,Str "XRefLabel:",Space,Link [Str "Chapter the Third"] ("#ch03",""),Str "."]]
- ,[Para [Str "A",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "EndTerm:",Space,Link [Str "Chapter 4"] ("#ch04",""),Str "."]]
- ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",Space,Str "cmdsynopsis",Space,Str "element:",Space,Link [Str "chgrp"] ("#cmd01",""),Str "."]]
- ,[Para [Str "A",Space,Str "link",Space,Str "to",Space,Str "an",Space,Str "funcsynopsis",Space,Str "element:",Space,Link [Str "max"] ("#func01",""),Str "."]]]
+ [[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 Second 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 the Third"] ("#ch03",""),Str "."]]
+ ,[Para [Str "A",Space,Str "link",Space,Str "with",Space,Str "an",SoftBreak,Str "EndTerm:",SoftBreak,Link ("",[],[]) [Str "Chapter 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"]
diff --git a/tests/docx/adjacent_links.docx b/tests/docx/adjacent_links.docx
new file mode 100644
index 0000000..86b1c2a
Binary files /dev/null and b/tests/docx/adjacent_links.docx differ
diff --git a/tests/docx/adjacent_links.native b/tests/docx/adjacent_links.native
new file mode 100644
index 0000000..cca8618
--- /dev/null
+++ b/tests/docx/adjacent_links.native
@@ -0,0 +1 @@
+[Para [Str "Le",Space,Str "plus",Space,Str "int\233ressant",Space,Str "\233tant",Space,Str "sans",Space,Str "doute",Space,Str "le",Space,Str "Marsan,",Space,Str "propos\233",Space,Str "par",Space,Str "Claude",Space,Str "Marsan",Space,Str "en",Space,Str "1976",Space,Str "qui",Space,Str "avait",Space,Str "m\234me",Space,Str "fait",Space,Str "l'objet",Space,Str "d'une",Space,Str "norme,",Space,Str "mais",Space,Str "qui",Space,Str "n'a",Space,Str "pas",Space,Str "du",Space,Str "tout",Space,Str "\233t\233",Space,Str "adopt\233",Space,Str "\224",Space,Str "cause",Space,Str "des",Space,Str "habitudes",Space,Str "trop",Space,Str "ancr\233es",Space,Str "et",Space,Str "qui",Space,Str "a",Space,Str "fini",Space,Str "par",Space,Str "tomber",Space,Str "dans",Space,Str "l'oubli,",Space,Str "gros",Space,Str "clin",Space,Str "d'\339il",Space,Str "\224",Space,Str "cela",Space,Str "d'ailleurs",Space,Str "dans",Space,Str "le",Space,Str "film",Space,Link ("",[],[]) [Emph [Str "\"Le",Space,Str "nom",Space,Str "des",Space,Str "gens\""]] ("http://www.allocine.fr/film/fichefilm_gen_cfilm=172167.html",""),Str ".",Space,Str "D\8217ailleurs",Space,Str "l\8217\233tat,",Space,Str "bien",Space,Str "conscient",Space,Str "que",Space,Str "tous",Space,Str "les",Space,Str "fran\231ais",Space,Str "\233crivent",Space,Str "sur",Space,Str "des",Space,Str "claviers",Space,Str "compl\232tement",Space,Str "inadapt\233s,",Space,Link ("",[],[]) [Emph [Str "tente",Space,Str "encore",Space,Str "une",Space,Str "fois",Space,Str "de",Space,Str "faire",Space,Str "une",Space,Str "norme",Space,Str "en",Space,Str "ce",Space,Str "moment",Space,Str "m\234me"]] ("http://www.appy-geek.com/Web/ArticleWeb.aspx?regionid=2&articleid=56103389&source=messenger",""),Str "."]]
diff --git a/tests/docx/already_auto_ident.native b/tests/docx/already_auto_ident.native
index 054bfe3..67c3729 100644
--- a/tests/docx/already_auto_ident.native
+++ b/tests/docx/already_auto_ident.native
@@ -1,2 +1,2 @@
 [Header 1 ("anchor-header",[],[]) [Str "Anchor",Space,Str "Header"]
-,Para [Str "A",Space,Link [Str "link"] ("#anchor-header","")]]
+,Para [Str "A",Space,Link ("",[],[]) [Str "link"] ("#anchor-header","")]]
diff --git a/tests/docx/dummy_item_after_list_item.docx b/tests/docx/dummy_item_after_list_item.docx
new file mode 100644
index 0000000..5e29b99
Binary files /dev/null and b/tests/docx/dummy_item_after_list_item.docx differ
diff --git a/tests/docx/dummy_item_after_list_item.native b/tests/docx/dummy_item_after_list_item.native
new file mode 100644
index 0000000..3f62319
--- /dev/null
+++ b/tests/docx/dummy_item_after_list_item.native
@@ -0,0 +1,3 @@
+[OrderedList (1,Decimal,Period)
+ [[Para [Str "One"]
+  ,Para [Str "Two",LineBreak,LineBreak,Str "Three"]]]]
diff --git a/tests/docx/dummy_item_after_paragraph.docx b/tests/docx/dummy_item_after_paragraph.docx
new file mode 100644
index 0000000..b0aee88
Binary files /dev/null and b/tests/docx/dummy_item_after_paragraph.docx differ
diff --git a/tests/docx/dummy_item_after_paragraph.native b/tests/docx/dummy_item_after_paragraph.native
new file mode 100644
index 0000000..2e9b831
--- /dev/null
+++ b/tests/docx/dummy_item_after_paragraph.native
@@ -0,0 +1,3 @@
+[Para [Str "First",Space,Str "bullet",Space,Str "point",Space,Str "created",Space,Str "and",Space,Str "then",Space,Str "deleted"]
+,Para [Str "A",Space,Str "normal",Space,Str "paragraph"]
+,Para [Str "First",Space,Str "bullet",Space,Str "point",Space,Str "created",Space,Str "and",Space,Str "then",Space,Str "deleted",Space,Str "after",Space,Str "the",Space,Str "normal",Space,Str "paragraph"]]
diff --git a/tests/docx/enumerated_headings.docx b/tests/docx/enumerated_headings.docx
new file mode 100644
index 0000000..afa8474
Binary files /dev/null and b/tests/docx/enumerated_headings.docx differ
diff --git a/tests/docx/enumerated_headings.native b/tests/docx/enumerated_headings.native
new file mode 100644
index 0000000..67c0df5
--- /dev/null
+++ b/tests/docx/enumerated_headings.native
@@ -0,0 +1,4 @@
+[Header 1 ("h1",[],[]) [Str "H1"]
+,Header 2 ("h2",[],[]) [Str "H2"]
+,Header 3 ("h3",[],[]) [Str "H3"]
+,Para [Str "And",Space,Str "some",Space,Str "text"]]
diff --git a/tests/docx/image_no_embed.native b/tests/docx/image_no_embed.native
index 95c7361..28eb918 100644
--- a/tests/docx/image_no_embed.native
+++ b/tests/docx/image_no_embed.native
@@ -1,2 +1,2 @@
 [Para [Str "An",Space,Str "image:"]
-,Para [Image [] ("media/image1.jpg","")]]
+,Para [Image ("",[],[("width","6.5in"),("height","5.508333333333334in")]) [] ("media/image1.jpg","")]]
diff --git a/tests/docx/image_no_embed_writer.native b/tests/docx/image_no_embed_writer.native
index 21802eb..6f19147 100644
--- a/tests/docx/image_no_embed_writer.native
+++ b/tests/docx/image_no_embed_writer.native
@@ -1,2 +1,2 @@
 [Para [Str "An",Space,Str "image:"]
-,Para [Image [] ("media/rId25.jpg","")]]
+,Para [Image ("",[],[("width","0.4166666666666667in"),("height","0.4166666666666667in")]) [] ("media/rId25.jpg","")]]
diff --git a/tests/docx/image_vml.native b/tests/docx/image_vml.native
index 8c5450a..e9fded6 100644
--- a/tests/docx/image_vml.native
+++ b/tests/docx/image_vml.native
@@ -1,4 +1,4 @@
 [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 [Image ("",[],[]) [] ("media/image4.jpeg","")]]]
diff --git a/tests/docx/inline_images.native b/tests/docx/inline_images.native
index f962f5c..a361dc6 100644
--- a/tests/docx/inline_images.native
+++ b/tests/docx/inline_images.native
@@ -1,2 +1,2 @@
-[Para [Str "This",Space,Str "picture",Space,Image [] ("media/image1.jpg",""),Space,Str "is",Space,Str "an",Space,Str "identicon."]
-,Para [Str "Here",Space,Str "is",Space,Link [Str "one",Space,Image [] ("media/image2.jpg",""),Space,Str "that"] ("http://www.google.com",""),Space,Str "links."]]
+[Para [Str "This",Space,Str "picture",Space,Image ("",[],[("width","0.8888888888888888in"),("height","0.8888888888888888in")]) [] ("media/image1.jpg",""),Space,Str "is",Space,Str "an",Space,Str "identicon."]
+,Para [Str "Here",Space,Str "is",Space,Link ("",[],[]) [Str "one",Space,Image ("",[],[("width","0.8888888888888888in"),("height","0.8888888888888888in")]) [] ("media/image2.jpg",""),Space,Str "that"] ("http://www.google.com",""),Space,Str "links."]]
diff --git a/tests/docx/inline_images_writer.native b/tests/docx/inline_images_writer.native
index da2a270..e5dfa5b 100644
--- a/tests/docx/inline_images_writer.native
+++ b/tests/docx/inline_images_writer.native
@@ -1,2 +1,2 @@
-[Para [Str "This",Space,Str "picture",Space,Image [] ("media/rId26.jpg",""),Space,Str "is",Space,Str "an",Space,Str "identicon."]
-,Para [Str "Here",Space,Str "is",Space,Link [Str "one",Space,Image [] ("media/rId27.jpg",""),Space,Str "that"] ("http://www.google.com",""),Space,Str "links."]]
+[Para [Str "This",Space,Str "picture",Space,Image ("",[],[("width","0.4166666666666667in"),("height","0.4166666666666667in")]) [] ("media/rId26.jpg",""),Space,Str "is",Space,Str "an",Space,Str "identicon."]
+,Para [Str "Here",Space,Str "is",Space,Link ("",[],[]) [Str "one",Space,Image ("",[],[("width","0.4166666666666667in"),("height","0.4166666666666667in")]) [] ("media/rId26.jpg",""),Space,Str "that"] ("http://www.google.com",""),Space,Str "links."]]
diff --git a/tests/docx/link_in_notes.docx b/tests/docx/link_in_notes.docx
new file mode 100644
index 0000000..f3398f4
Binary files /dev/null and b/tests/docx/link_in_notes.docx differ
diff --git a/tests/docx/link_in_notes.native b/tests/docx/link_in_notes.native
new file mode 100644
index 0000000..b203586
--- /dev/null
+++ b/tests/docx/link_in_notes.native
@@ -0,0 +1 @@
+[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "test",Note [Para [Link ("",[],[]) [Str "http://wikipedia.org/"] ("http://wikipedia.org/","")]],Str "."]]
diff --git a/tests/docx/links.native b/tests/docx/links.native
index a055781..2c46886 100644
--- a/tests/docx/links.native
+++ b/tests/docx/links.native
@@ -1,7 +1,7 @@
 [Header 2 ("an-internal-link-and-an-external-link",[],[]) [Str "An",Space,Str "internal",Space,Str "link",Space,Str "and",Space,Str "an",Space,Str "external",Space,Str "link"]
-,Para [Str "An",Space,Link [Str "external",Space,Str "link"] ("http://google.com",""),Space,Str "to",Space,Str "a",Space,Str "popular",Space,Str "website."]
-,Para [Str "An",Space,Link [Str "external",Space,Str "link"] ("http://pandoc.org/README.html#synopsis",""),Space,Str "to",Space,Str "a",Space,Str "website",Space,Str "with",Space,Str "an",Space,Str "anchor."]
-,Para [Str "An",Space,Link [Str "internal",Space,Str "link"] ("#a-section-for-testing-link-targets",""),Space,Str "to",Space,Str "a",Space,Str "section",Space,Str "header."]
-,Para [Str "An",Space,Link [Str "internal",Space,Str "link"] ("#my_bookmark",""),Space,Str "to",Space,Str "a",Space,Str "bookmark."]
+,Para [Str "An",Space,Link ("",[],[]) [Str "external",Space,Str "link"] ("http://google.com",""),Space,Str "to",Space,Str "a",Space,Str "popular",Space,Str "website."]
+,Para [Str "An",Space,Link ("",[],[]) [Str "external",Space,Str "link"] ("http://pandoc.org/README.html#synopsis",""),Space,Str "to",Space,Str "a",Space,Str "website",Space,Str "with",Space,Str "an",Space,Str "anchor."]
+,Para [Str "An",Space,Link ("",[],[]) [Str "internal",Space,Str "link"] ("#a-section-for-testing-link-targets",""),Space,Str "to",Space,Str "a",Space,Str "section",Space,Str "header."]
+,Para [Str "An",Space,Link ("",[],[]) [Str "internal",Space,Str "link"] ("#my_bookmark",""),Space,Str "to",Space,Str "a",Space,Str "bookmark."]
 ,Header 2 ("a-section-for-testing-link-targets",[],[]) [Str "A",Space,Str "section",Space,Str "for",Space,Str "testing",Space,Str "link",Space,Str "targets"]
 ,Para [Str "A",Space,Str "bookmark",Space,Str "right",Space,Span ("my_bookmark",["anchor"],[]) [],Str "here"]]
diff --git a/tests/docx/links_writer.native b/tests/docx/links_writer.native
index 25f4f90..48c1bcd 100644
--- a/tests/docx/links_writer.native
+++ b/tests/docx/links_writer.native
@@ -1,6 +1,6 @@
 [Header 2 ("an-internal-link-and-an-external-link",[],[]) [Str "An",Space,Str "internal",Space,Str "link",Space,Str "and",Space,Str "an",Space,Str "external",Space,Str "link"]
-,Para [Str "An",Space,Link [Str "external",Space,Str "link"] ("http://google.com",""),Space,Str "to",Space,Str "a",Space,Str "popular",Space,Str "website."]
-,Para [Str "An",Space,Link [Str "external",Space,Str "link"] ("http://pandoc.org/README.html#synopsis",""),Space,Str "to",Space,Str "a",Space,Str "website",Space,Str "with",Space,Str "an",Space,Str "anchor."]
-,Para [Str "An",Space,Link [Str "internal",Space,Str "link"] ("#a-section-for-testing-link-targets",""),Space,Str "to",Space,Str "a",Space,Str "section",Space,Str "header."]
-,Para [Str "An",Space,Link [Str "internal",Space,Str "link"] ("#my_bookmark",""),Space,Str "to",Space,Str "a",Space,Str "bookmark."]
+,Para [Str "An",Space,Link ("",[],[]) [Str "external",Space,Str "link"] ("http://google.com",""),Space,Str "to",Space,Str "a",Space,Str "popular",Space,Str "website."]
+,Para [Str "An",Space,Link ("",[],[]) [Str "external",Space,Str "link"] ("http://pandoc.org/README.html#synopsis",""),Space,Str "to",Space,Str "a",Space,Str "website",Space,Str "with",Space,Str "an",Space,Str "anchor."]
+,Para [Str "An",Space,Link ("",[],[]) [Str "internal",Space,Str "link"] ("#a-section-for-testing-link-targets",""),Space,Str "to",Space,Str "a",Space,Str "section",Space,Str "header."]
+,Para [Str "An",Space,Link ("",[],[]) [Str "internal",Space,Str "link"] ("#my_bookmark",""),Space,Str "to",Space,Str "a",Space,Str "bookmark."]
 ,Header 2 ("a-section-for-testing-link-targets",[],[]) [Str "A",Space,Str "section",Space,Str "for",Space,Str "testing",Space,Str "link",Space,Str "targets"]]
diff --git a/tests/dokuwiki_external_images.native b/tests/dokuwiki_external_images.native
index c2b8876..0f10346 100644
--- a/tests/dokuwiki_external_images.native
+++ b/tests/dokuwiki_external_images.native
@@ -1 +1 @@
-[Para [Image [Str "HTTPS",Space,Str "image"] ("https://cooluri.com/image.png",""),Space,Image [Str "HTTP",Space,Str "image"] ("http://cooluri.com/image.png",""),Space,Image [Str "FTP",Space,Str "image"] ("ftp://ftp.cooluri.com/image.png",""),Space,Image [Str "Filesystem",Space,Str "image"] ("file:///tmp/coolimage.png",""),Space,Image [Str "Relative",Space,Str "image",Space,Str "1"] ("/image.jpg",""),Space,Image [Str "Relative",Space,Str "image",Space,Str "2"] ("image.jpg","")]]
+[Para [Image ("",[],[]) [Str "HTTPS",Space,Str "image"] ("https://cooluri.com/image.png",""),Space,Image ("",[],[]) [Str "HTTP",Space,Str "image"] ("http://cooluri.com/image.png",""),Space,Image ("",[],[]) [Str "FTP",Space,Str "image"] ("ftp://ftp.cooluri.com/image.png",""),Space,Image ("",[],[]) [Str "Filesystem",Space,Str "image"] ("file:///tmp/coolimage.png",""),Space,Image ("",[],[]) [Str "Relative",Space,Str "image",Space,Str "1"] ("/image.jpg",""),Space,Image ("",[],[]) [Str "Relative",Space,Str "image",Space,Str "2"] ("image.jpg","")]]
diff --git a/tests/dokuwiki_multiblock_table.native b/tests/dokuwiki_multiblock_table.native
index ea6b833..3482429 100644
--- a/tests/dokuwiki_multiblock_table.native
+++ b/tests/dokuwiki_multiblock_table.native
@@ -10,4 +10,4 @@
   ,[Para [Str "$2.10"]]
   ,[BulletList
     [[Plain [Str "cures",Space,Str "scurvy"]]
-    ,[Plain [Str "tasty"]]]]]]]
\ No newline at end of file
+    ,[Plain [Str "tasty"]]]]]]]
diff --git a/tests/epub/features.native b/tests/epub/features.native
index 7bdefda..6ceac18 100644
--- a/tests/epub/features.native
+++ b/tests/epub/features.native
@@ -4,76 +4,76 @@
  ,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",Space,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",Space,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",Space,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",Space,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:"]
+  ,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",Space,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",Space,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",Space,Str "the",Space,Link [Str "test",Space,Str "suite",Space,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",Space,Str "information."]]
+  ,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",Space,Str "preceded",Space,Str "by",Space,Str "the",Space,Str "label:",Space,Span ("",["nature"],[("style","display: inline; font-size: 100%")]) [Str "[REQUIRED]"]]]
+       [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",Space,Str "preceded",Space,Str "by",Space,Str "the",Space,Str "label:",Space,Span ("",["nature"],[("style","display: inline; font-size: 100%")]) [Str "[OPTIONAL]"]]]]])
+       [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,",Space,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:",Space,Str "\"If",Space,Str "[some",Space,Str "condition],",Space,Str "the",Space,Str "test",Space,Str "passes\"."]]])
+     [[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]"],Space,Span ("",["test-id"],[]) [Str "mathml-010"],Space,Str "Rendering"]
+  [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}",Space,Math DisplayMath "\\sum\\limits_{n = 1}^{\\infty}\\frac{1}{n^{2}} = \\frac{\\pi^{2}}{6}",Space,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),",Space,Str "the",Space,Str "test",Space,Str "passes."]]
+  ,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]"],Space,Span ("",["test-id"],[]) [Str "mathml-020"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "math",Space,Str "element"]
+  [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",Space,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 "."]]
+  ,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]"],Space,Span ("",["test-id"],[]) [Str "mathml-021"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "mo",Space,Str "element"]
+  [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",Space,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 "."]]
+  ,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]"],Space,Span ("",["test-id"],[]) [Str "mathml-022"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "mi",Space,Str "element"]
+  [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",Space,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 "."]]
+  ,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]"],Space,Span ("",["test-id"],[]) [Str "mathml-023"],Space,Str "CSS",Space,Str "Styling",Space,Str "of",Space,Str "the",Space,Code ("",[],[]) "mn",Space,Str "element"]
+  [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",Space,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 "."]]
+  ,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]"],Space,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"]
+  [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]"],Space,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"]
+  [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 "(colum",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{array}{llllllllll}\n & {\\operatorname{cov}\\left( \\mathcal{L} \\right)} & \\longrightarrow & {\\operatorname{non}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{cof}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{cof}\\left( \\mathcal{L} \\right)} & \\longrightarrow & 2^{\\aleph_{0}} \\\\\n & \\uparrow & & \\uparrow & & \\uparrow & & \\uparrow & & \\\\\n & {\\mathfrak{b}} & \\longrightarrow & {\\mathfrak{d}} & & & & & & \\\\\n & \\uparrow & & \\uparrow & & & & & & \\\\\n\\aleph_{1} & \\longrightarrow & {\\operatorname{add}\\left( \\mathcal{L} \\right)} & \\longrightarrow & {\\operatorname{add}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{cov}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{non}\\left( \\mathcal{L} \\right)} & \\\\\n\\end{array}"]
-  ,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 "."]]
+  ,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]"],Space,Span ("",["test-id"],[]) [Str "mathml-026"],Str "BiDi,",Space,Str "RTL",Space,Str "and",Space,Str "Arabic",Space,Str "alphabets"]
+  [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 "{d\\left( s \\right)} = \\begin{cases}\n{\\sum\\limits_{{\\lbrack?\\rbrack} = 1}^{S}s^{\\lbrack?\\rbrack}} & {\\text{\1573\1584\1575\1603\1575\1606}s > 0} \\\\\n{\\int_{1}^{S}{s^{\\lbrack?\\rbrack}s}} & {\\text{\1573\1584\1575\1603\1575\1606}s \\in m} \\\\\n{T\\pi} & {\\text{\1594\1610\1585\1584\1604\1603}\\left( \\text{\1605\1593}\\pi \\simeq 3,141 \\right)} \\\\\n\\end{cases}"]
   ,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]"],Space,Span ("",["test-id"],[]) [Str "mathml-027"],Str "Elementary",Space,Str "math:",Space,Str "long",Space,Str "division",Space,Str "notation"]
+  [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."]
   ,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",[],[]) []]
@@ -83,9 +83,9 @@
   [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",Space,Str "\"PASS\"",Space,Str "nor",Space,Str "\"FAIL\"",Space,Str "is",Space,Str "rendered,",Space,Str "the",Space,Str "test",Space,Str "fails."]]
+  ,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]"],Space,Span ("",["test-id"],[]) [Str "switch-020"],Space,Str "MathML",Space,Str "Embedding"]
+  [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."]
diff --git a/tests/epub/formatting.native b/tests/epub/formatting.native
index 87cf63f..e1507ff 100644
--- a/tests/epub/formatting.native
+++ b/tests/epub/formatting.native
@@ -4,25 +4,25 @@
  ,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",Space,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",Space,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",Space,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",Space,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:"]
+  ,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",Space,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",Space,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",Space,Str "the",Space,Link [Str "test",Space,Str "suite",Space,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",Space,Str "information."]]
+  ,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",Space,Str "preceded",Space,Str "by",Space,Str "the",Space,Str "label:",Space,Span ("",["nature"],[("style","display: inline; font-size: 100%")]) [Str "[REQUIRED]"]]]
+       [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",Space,Str "preceded",Space,Str "by",Space,Str "the",Space,Str "label:",Space,Span ("",["nature"],[("style","display: inline; font-size: 100%")]) [Str "[OPTIONAL]"]]]]])
+       [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,",Space,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:",Space,Str "\"If",Space,Str "[some",Space,Str "condition],",Space,Str "the",Space,Str "test",Space,Str "passes\"."]]])
+     [[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",[],[]) []]
@@ -389,12 +389,12 @@
   [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."]]
+  ,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."]]
+  ,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."]
diff --git a/tests/epub/wasteland.native b/tests/epub/wasteland.native
index 3490786..335c63b 100644
--- a/tests/epub/wasteland.native
+++ b/tests/epub/wasteland.native
@@ -1,4 +1,4 @@
-[Para [Image [] ("wasteland-cover.jpg","")]
+[Para [Image ("",[],[]) [] ("wasteland-cover.jpg","")]
 ,Para [Span ("wasteland-content.xhtml",[],[]) []]
 ,Div ("wasteland-content.xhtml#frontmatter",["section"],[("type","frontmatter")])
  []
@@ -29,7 +29,7 @@
    ,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",Space,Str "deutsch."]]
+    [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 ("",[],[])
@@ -46,13 +46,13 @@
    [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."]]]
+    [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."]]]
     ,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."]]]
+     [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 ("",[],[])
@@ -70,7 +70,7 @@
      ,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."]]]
+        [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 ("",[],[])
@@ -83,7 +83,7 @@
        ,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",Space,Str "garden,"]]
+        [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 ("",[],[])
@@ -93,7 +93,7 @@
        ,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."]]]
+        [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,"]]
@@ -102,7 +102,7 @@
          ,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",Space,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.",Space,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",Space,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,",Space,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",Space,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",Space,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",Space,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",Space,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",Space,Str "himself."]]]
+          [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 ("",[],[])
@@ -131,15 +131,15 @@
            [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",Space,Str "plein",Space,Str "jour",Space,Str "raccroche",Space,Str "le",Space,Str "passant.\""]]]]
+           [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.\""]]]]
            ,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",Space,Str "morte",Space,Str "tanta",Space,Str "n'avesse",Space,Str "disfatta.\""]]]]
+            [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",Space,Str "sospiri,",LineBreak,Str "\"che",Space,Str "l'aura",Space,Str "eterna",Space,Str "facevan",Space,Str "tremare.\""]]]]
+             [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 ("",[],[])
@@ -147,9 +147,9 @@
              ,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."]]]
+              [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",Space,Str "\"Stetson!"]]
+               [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 ("",[],[])
@@ -160,16 +160,16 @@
                [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 "."]]]
+               [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 "-",Space,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."]]]
+                [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."]]]
+                   [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 ("",[],[])
@@ -199,7 +199,7 @@
                    ,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",Space,Str "flammis",LineBreak,Str "funalia",Space,Str "vincunt."]]]]
+                    [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 ("",[],[])
@@ -211,11 +211,11 @@
                     ,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."]]]
+                     [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."]]]
+                      [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."]]]
+                       [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."]]]
                        ,Div ("",[],[])
                         [Plain [Str "Filled",Space,Str "all",Space,Str "the",Space,Str "desert",Space,Str "with",Space,Str "inviolable",Space,Str "voice"]]
                        ,Div ("",[],[])
@@ -248,14 +248,14 @@
                          [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."]]]
+                         [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?\""]]]]
+                         [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"],[])
@@ -273,7 +273,7 @@
                          ,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."]]]
+                          [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 ("",[],[])
@@ -297,7 +297,7 @@
                           ,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."]]]
+                           [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 "-"]]
@@ -308,7 +308,7 @@
                             ,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",Space,Str "you"]]
+                             [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 ("",[],[])
@@ -320,11 +320,11 @@
                             ,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",Space,Str "said."]]
+                             [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",Space,Str "look."]]
+                             [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 ("",[],[])
@@ -332,7 +332,7 @@
                             ,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",Space,Str "telling."]]
+                             [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 ("",[],[])
@@ -344,19 +344,19 @@
                             ,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",Space,Str "same."]]
+                             [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",Space,Str "said,"]]
+                             [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",Space,Str "gammon,"]]
+                             [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",Space,Str "hot\8213"]]
+                             [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 ("",[],[])
@@ -366,7 +366,7 @@
                             ,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",Space,Str "night."]]]
+                             [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."]]]
                            ,RawBlock (Format "html") "</section>"
                            ,Div ("wasteland-content.xhtml#ch3",["section"],[])
                             [Header 2 ("",[],[]) [Str "III.",Space,Str "THE",Space,Str "FIRE",Space,Str "SERMON"]
@@ -376,15 +376,15 @@
                              ,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",Space,Str "departed."]]
+                              [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."]]]
+                              [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",Space,Str "departed."]]
+                               [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 ("",[],[])
@@ -398,7 +398,7 @@
                               ,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",Space,Str "ear."]]]
+                               [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"]]
@@ -411,7 +411,7 @@
                               ,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."]]]
+                               [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 ("",[],[])
@@ -419,19 +419,19 @@
                                ,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."]]]
+                                [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",Space,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",Space,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 ".\""]]]]]]
+                                 [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",Space,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."]]]
+                                  [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."]]]
+                                   [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"]]
@@ -449,7 +449,7 @@
                                     ,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",Space,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",Space,Str "payment",Space,Str "of",Space,Str "the",Space,Str "sight",Space,Str "draft."]]]
+                                     [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."]]]
                                      ,Div ("",[],[])
                                       [Plain [Str "C.i.f.",Space,Str "London:",Space,Str "documents",Space,Str "at",Space,Str "sight,"]]
                                      ,Div ("",[],[])
@@ -466,13 +466,13 @@
                                      ,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",Space,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",Space,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",Space,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",Space,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",Space,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",Space,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,Space,Str "Quam,",Space,Str "quae",Space,Str "contingit",Space,Str "maribus,'",Space,Str "dixisse,",Space,Str "'voluptas.'",LineBreak,Space,Str "Illa",Space,Str "negat;",Space,Str "placuit",Space,Str "quae",Space,Str "sit",Space,Str "sententia",Space,Str "docti",LineBreak,Space,Str "Quaerere",Space,Str "Tiresiae:",Space,Str "venus",Space,Str "huic",Space,Str "erat",Space,Str "utraque",Space,Str "nota.",LineBreak,Space,Str "Nam",Space,Str "duo",Space,Str "magnorum",Space,Str "viridi",Space,Str "coeuntia",Space,Str "silva",LineBreak,Space,Str "Corpora",Space,Str "serpentum",Space,Str "baculi",Space,Str "violaverat",Space,Str "ictu",LineBreak,Space,Str "Deque",Space,Str "viro",Space,Str "factus,",Space,Str "mirabile,",Space,Str "femina",Space,Str "septem",LineBreak,Space,Str "Egerat",Space,Str "autumnos;",Space,Str "octavo",Space,Str "rursus",Space,Str "eosdem",LineBreak,Space,Str "Vidit",Space,Str "et",Space,Str "'est",Space,Str "vestrae",Space,Str "si",Space,Str "tanta",Space,Str "potentia",Space,Str "plagae,'",LineBreak,Space,Str "Dixit",Space,Str "'ut",Space,Str "auctoris",Space,Str "sortem",Space,Str "in",Space,Str "contraria",Space,Str "mutet,",LineBreak,Space,Str "Nunc",Space,Str "quoque",Space,Str "vos",Space,Str "feriam!'",Space,Str "percussis",Space,Str "anguibus",Space,Str "isdem",LineBreak,Space,Str "Forma",Space,Str "prior",Space,Str "rediit",Space,Str "genetivaque",Space,Str "venit",Space,Str "imago.",LineBreak,Space,Str "Arbiter",Space,Str "hic",Space,Str "igitur",Space,Str "sumptus",Space,Str "de",Space,Str "lite",Space,Str "iocosa",LineBreak,Space,Str "Dicta",Space,Str "Iovis",Space,Str "firmat;",Space,Str "gravius",Space,Str "Saturnia",Space,Str "iusto",LineBreak,Space,Str "Nec",Space,Str "pro",Space,Str "materia",Space,Str "fertur",Space,Str "doluisse",Space,Str "suique",LineBreak,Space,Str "Iudicis",Space,Str "aeterna",Space,Str "damnavit",Space,Str "lumina",Space,Str "nocte,",LineBreak,Space,Str "At",Space,Str "pater",Space,Str "omnipotens",Space,Str "(neque",Space,Str "enim",Space,Str "licet",Space,Str "inrita",Space,Str "cuiquam",LineBreak,Space,Str "Facta",Space,Str "dei",Space,Str "fecisse",Space,Str "deo)",Space,Str "pro",Space,Str "lumine",Space,Str "adempto",LineBreak,Space,Str "Scire",Space,Str "futura",Space,Str "dedit",Space,Str "poenamque",Space,Str "levavit",Space,Str "honore.",LineBreak]]]]
+                                      [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",Space,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."]]]
+                                       [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 ("",[],[])
@@ -537,7 +537,7 @@
                                        ,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."]]]
+                                        [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 ("",[],[])
@@ -546,7 +546,7 @@
                                          [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."]]]
+                                         [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 ("",[],[])
@@ -560,12 +560,12 @@
                                          ,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",Space,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",Space,Str "Churches",Space,Str "(P.",Space,Str "S.",Space,Str "King",Space,Str "&",Space,Str "Son,",Space,Str "Ltd.)."]]]
+                                          [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",Space,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",Space,Str "Rhine-daughters."]]]
+                                           [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 ("",[],[])
@@ -592,7 +592,7 @@
                                             [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",Space,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",Space,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",Space,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",Space,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",Space,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.\""]]]]]]
+                                            [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 ("",[],[])
@@ -621,7 +621,7 @@
                                             [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",Space,Str "Maremma.\""]]]]
+                                             [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 ("",[],[])
@@ -651,12 +651,12 @@
                                               [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",Space,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.\""]]]
+                                              [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",Space,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,",Space,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",Space,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",Space,Str "pioneers",Space,Str "of",Space,Str "Buddhist",Space,Str "studies",Space,Str "in",Space,Str "the",Space,Str "Occident."]]]
+                                                [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",Space,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",Space,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."]]]
+                                                 [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"],[])
@@ -764,14 +764,14 @@
                                                    ,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",Space,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",Space,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.",Space,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",Space,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",Space,Str "\"water-dripping",Space,Str "song\"",Space,Str "is",Space,Str "justly",Space,Str "celebrated."]]]
+                                                    [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",Space,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):",Space,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",Space,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",Space,Str "could",Space,Str "actually",Space,Str "be",Space,Str "counted."]]]
+                                                    [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."]]]
                                                     ,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 ("",[],[])
@@ -783,7 +783,7 @@
                                                     ,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",Space,Str "auf",Space,Str "dem",LineBreak,Space,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",Space,Str "Abgrund",Space,Str "entlang",LineBreak,Space,Str "und",Space,Str "singt",Space,Str "dazu,",Space,Str "singt",Space,Str "betrunken",Space,Str "und",Space,Str "hymnisch",Space,Str "wie",Space,Str "Dmitri",Space,Str "Karamasoff",Space,Str "sang.",LineBreak,Space,Str "Ueber",Space,Str "diese",Space,Str "Lieder",Space,Str "lacht",Space,Str "der",Space,Str "Bsrger",Space,Str "beleidigt,",Space,Str "der",Space,Str "Heilige",LineBreak,Space,Str "und",Space,Str "Seher",Space,Str "hrt",Space,Str "sie",Space,Str "mit",Space,Str "Trvnen.\""]]]]
+                                                     [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"]]
@@ -823,7 +823,7 @@
                                                       ,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",Space,Str "wells."]]]
+                                                       [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"]]
@@ -859,7 +859,7 @@
                                                       ,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,",Space,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",Space,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",Space,Str "Sechzig",Space,Str "Upanishads",Space,Str "des",Space,Str "Veda,",Space,Str "p.",Space,Str "489."]]]
+                                                       [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 ("",[],[])
@@ -871,7 +871,7 @@
                                                        ,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,Space,Str "Ere",Space,Str "the",Space,Str "worm",Space,Str "pierce",Space,Str "your",Space,Str "winding-sheet,",Space,Str "ere",Space,Str "the",Space,Str "spider",LineBreak,Space,Str "Make",Space,Str "a",Space,Str "thin",Space,Str "curtain",Space,Str "for",Space,Str "your",Space,Str "epitaphs.\""]]]]
+                                                        [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 ("",[],[])
@@ -879,7 +879,7 @@
                                                         ,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,Space,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",Space,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",Space,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",Space,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",Space,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",Space,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",Space,Str "soul.\""]]]]
+                                                         [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 ("",[],[])
@@ -906,30 +906,30 @@
                                                          [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."]]]
+                                                          [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"],Space,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,Space,Str "'que",Space,Str "vos",Space,Str "guida",Space,Str "al",Space,Str "som",Space,Str "de",Space,Str "l'escalina,",LineBreak,Space,Str "'sovegna",Space,Str "vos",Space,Str "a",Space,Str "temps",Space,Str "de",Space,Str "ma",Space,Str "dolor.'",LineBreak,Space,Str "Poi",Space,Str "s'ascose",Space,Str "nel",Space,Str "foco",Space,Str "che",Space,Str "gli",Space,Str "affina.\""]]]]
+                                                           [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")]) [Space,Emph [Str "Quando",Space,Str "fiam",Space,Str "ceu",Space,Str "chelidon"],Space],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."]]]
+                                                            [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"],Space,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."]]]
+                                                             [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."]]]
                                                              ,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."]]]
+                                                              [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",Space,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",Space,Str "content",Space,Str "of",Space,Str "this",Space,Str "word."]]]]
+                                                               [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."]]]]
                                                                ,Div ("wasteland-content.xhtml#backmatter",["section"],[("type","backmatter")])
                                                                 [Div ("wasteland-content.xhtml#rearnotes",["section"],[("type","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",Space,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:",Space,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",Space,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",Space,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",Space,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",Space,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",Space,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.",Space,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",Space,Str "certain",Space,Str "references",Space,Str "to",Space,Str "vegetation",Space,Str "ceremonies."]
+                                                                 ,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"],[])
@@ -938,4 +938,4 @@
                                                                   [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,",Space,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",Space,Str "decay",Space,Str "of",Space,Str "eastern",Space,Str "Europe."]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
+                                                                  ,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."]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
diff --git a/tests/haddock-reader.native b/tests/haddock-reader.native
index b621890..7e36b2f 100644
--- a/tests/haddock-reader.native
+++ b/tests/haddock-reader.native
@@ -1,7 +1,7 @@
 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.",Space,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 "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.",Space,Str ">",Space,Str "This",Space,Str "sentence",Space,Str "is",Space,Str "not",Space,Str "code.",Space,Str ">>>",Space,Str "This",Space,Str "is",Space,Str "not",Space,Str "an",Space,Str "example."]
+,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"
@@ -10,8 +10,8 @@ Pandoc (Meta {unMeta = fromList []})
 ,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 "!",Space,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 ".",Space,Str "The",Space,Str "identifier",Space,Code ("",["haskell","identifier"],[]) "M.T",Space,Str "is",Space,Str "not",Space,Str "in",Space,Str "scope",Space,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?",Space,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 "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"]]
@@ -26,6 +26,6 @@ Pandoc (Meta {unMeta = fromList []})
    [[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")]]
+,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/tests/html-reader.native b/tests/html-reader.native
index 1d31416..6b7799a 100644
--- a/tests/html-reader.native
+++ b/tests/html-reader.native
@@ -2,7 +2,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
 [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 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"]
@@ -17,7 +17,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
 ,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,Space,Str "here."]
+,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:"]
@@ -200,7 +200,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
 ,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 [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."]]]
@@ -213,7 +213,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
 ,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 "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 "."]
@@ -269,53 +269,53 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
 ,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 "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 "."]
+,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 "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 "."]
+,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 "."]
+,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","")]
+,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 [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 "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."]
+,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 "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."]
diff --git a/tests/latex-reader.latex b/tests/latex-reader.latex
index 4324dbf..2ebdfed 100644
--- a/tests/latex-reader.latex
+++ b/tests/latex-reader.latex
@@ -845,31 +845,4 @@ indented.
 
 \$ \% \& \# \_ \{ \}
 
-\section{Block newcommands}
-
-See e.g. issues #1866, #1835
-
-\newcommand{\FIG}[3]{
-        \begin{figure}[h!]
-                \centering
-                \includegraphics[width=#2\columnwidth,angle=0]{#1}
-                \caption{#3}
-                \label{fig:#1}
-        \end{figure}
-}
-
-\newcommand{\separator}{\vspace{4em}}
-
-\separator
-
-\FIG{lalune.jpg}{0.5}{Test caption}
-
-\newcommand{\wbal}{The Wikibook about \LaTeX}
-
-\wbal is a good resource for learning \LaTeX.
-
-\separator with trailing inlines
-
-\FIG{lalune.jpg}{0.5}{Test caption} with trailing inlines
-
 \end{document}
diff --git a/tests/latex-reader.native b/tests/latex-reader.native
index fbc1911..3cffccc 100644
--- a/tests/latex-reader.native
+++ b/tests/latex-reader.native
@@ -1,9 +1,9 @@
 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",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",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 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"]
@@ -16,7 +16,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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",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 "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."]
 ,HorizontalRule
@@ -115,7 +115,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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",Space,Str "back."]]
+  ,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"]
@@ -217,15 +217,15 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
      [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",Space,Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"]
-,Para [Str "foo",Space,Str "bar",Space,Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"]
-,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Space,Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"],Space,Str "Here\8217s",Space,Str "a",Space,Str "simple",Space,Str "block:"]
-,Para [Str "foo",Space,Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
+,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",Space,Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"]
+,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 -->"
@@ -237,23 +237,23 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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 [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,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",Space,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,",Space,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",Space,Str "unescaped",Space,Str "spaces:",Space,Str "a^b",Space,Str "c^d,",Space,Str "a",Math InlineMath "\\sim",Str "b",Space,Str "c",Math InlineMath "\\sim",Str "d."]
+,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."]
 ,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.",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."]],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",Space,Quoted DoubleQuote [Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."]
+,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."]
@@ -268,11 +268,11 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
  ,[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:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]]
+ ,[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",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized.)"]]
+ ,[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 [] [AlignLeft,AlignLeft] [0.0,0.0]
@@ -302,7 +302,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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 "Backtick:",Space,Str "\8216"]
 ,Para [Str "Asterisk:",Space,Str "*"]
 ,Para [Str "Underscore:",Space,Str "_"]
 ,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
@@ -320,65 +320,56 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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 "."]
+,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 "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 "."]
+,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",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/",""),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 "."]
+,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","")]
+,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 [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","")]
+,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 "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,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."]
+,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."]
 ,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",Space,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",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",Space,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",Space,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,",Space,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",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
+,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",Space,Str "indented."]
+,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 "}"]
-,Header 1 ("block-newcommands",[],[]) [Str "Block",Space,Str "newcommands"]
-,Para [Str "See",Space,Str "e.g.",Space,Str "issues",Space,Str "#1866,",Space,Str "#1835"]
-,RawBlock (Format "latex") "\\vspace{4em}"
-,Para [RawInline (Format "latex") "\\centering",Image [Str "Test",Space,Str "caption",Span ("",[],[("data-label","fig:lalune.jpg")]) []] ("lalune.jpg","fig:")]
-,Para [Span ("",[],[]) [Str "The",Space,Str "Wikibook",Space,Str "about",Space,Str "LaTeX"],Str "is",Space,Str "a",Space,Str "good",Space,Str "resource",Space,Str "for",Space,Str "learning",Space,Str "LaTeX."]
-,RawBlock (Format "latex") "\\vspace{4em}"
-,Para [Str "with",Space,Str "trailing",Space,Str "inlines"]
-,Para [RawInline (Format "latex") "\\centering",Image [Str "Test",Space,Str "caption",Span ("",[],[("data-label","fig:lalune.jpg")]) []] ("lalune.jpg","fig:")]
-,Para [Str "with",Space,Str "trailing",Space,Str "inlines"]]
+,Para [Str "$",Space,Str "%",Space,Str "&",Space,Str "#",Space,Str "_",Space,Str "{",Space,Str "}"]]
diff --git a/tests/lhs-test-markdown.native b/tests/lhs-test-markdown.native
index 63037d9..b6d9083 100644
--- a/tests/lhs-test-markdown.native
+++ b/tests/lhs-test-markdown.native
@@ -1,7 +1,7 @@
 [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",Space,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]
+,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 ("",["sourceCode","literate","haskell"],[]) "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",Space,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",Space,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)."]
+,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
diff --git a/tests/lhs-test.html b/tests/lhs-test.html
index 5b5f9cc..e4a5b38 100644
--- a/tests/lhs-test.html
+++ b/tests/lhs-test.html
@@ -46,11 +46,14 @@
 </head>
 <body>
 <h1 id="lhs-test">lhs test</h1>
-<p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p>
+<p><code>unsplit</code> is an arrow that takes a pair of values and combines them to
+return a single value:</p>
 <div class="sourceCode"><pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="ot">unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=&gt;</span> (b <span class="ot">-&gt;</span> c <span class="ot">-&gt;</span> d) <span class="ot">-&gt;</span> a (b, c) d
 unsplit <span class="fu">=</span> arr <span class="fu">.</span> uncurry
           <span class="co">-- arr (\op (x,y) -&gt; x `op` y)</span></code></pre></div>
-<p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p>
+<p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a
+pair of values (one arrow on the first item of the pair and one arrow on the
+second item of the pair).</p>
 <pre><code>f *** g = first f &gt;&gt;&gt; second g</code></pre>
 <p>Block quote:</p>
 <blockquote>
diff --git a/tests/lhs-test.html+lhs b/tests/lhs-test.html+lhs
index 0124b84..41e9ca2 100644
--- a/tests/lhs-test.html+lhs
+++ b/tests/lhs-test.html+lhs
@@ -46,11 +46,14 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
 </head>
 <body>
 <h1 id="lhs-test">lhs test</h1>
-<p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p>
+<p><code>unsplit</code> is an arrow that takes a pair of values and combines them to
+return a single value:</p>
 <div class="sourceCode"><pre class="sourceCode literate literatehaskell"><code class="sourceCode literatehaskell"><span class="ot">&gt; unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=&gt;</span> (b <span class="ot">-&gt;</span> c <span class="ot">-&gt;</span> d) <span class="ot">-&gt;</span> a (b, c) d
 <span class="ot">&gt;</span> unsplit <span class="fu">=</span> arr <span class="fu">.</span> uncurry
 <span class="ot">&gt;</span>           <span class="co">-- arr (\op (x,y) -&gt; x `op` y)</span></code></pre></div>
-<p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p>
+<p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a
+pair of values (one arrow on the first item of the pair and one arrow on the
+second item of the pair).</p>
 <pre><code>f *** g = first f &gt;&gt;&gt; second g</code></pre>
 <p>Block quote:</p>
 <blockquote>
diff --git a/tests/lhs-test.latex b/tests/lhs-test.latex
index 2e2aba6..a5b0ff8 100644
--- a/tests/lhs-test.latex
+++ b/tests/lhs-test.latex
@@ -12,8 +12,7 @@
   \else
     \usepackage{fontspec}
   \fi
-  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
-  \newcommand{\euro}{€}
+  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
 \fi
 % use upquote if available, for straight quotes in verbatim environments
 \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
@@ -22,32 +21,10 @@
 \usepackage{microtype}
 \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
 }{}
-\makeatletter
-\@ifpackageloaded{hyperref}{}{%
-\ifxetex
-  \usepackage[setpagesize=false, % page size defined by xetex
-              unicode=false, % unicode breaks when used with xetex
-              xetex]{hyperref}
-\else
-  \usepackage[unicode=true]{hyperref}
-\fi
-}
-\@ifpackageloaded{color}{
-    \PassOptionsToPackage{usenames,dvipsnames}{color}
-}{%
-    \usepackage[usenames,dvipsnames]{color}
-}
-\makeatother
-\hypersetup{breaklinks=true,
-            bookmarks=true,
-            pdfauthor={},
-            pdftitle={},
-            colorlinks=true,
-            citecolor=blue,
-            urlcolor=blue,
-            linkcolor=magenta,
-            pdfborder={0 0 0}
-            }
+\usepackage{hyperref}
+\hypersetup{unicode=true,
+            pdfborder={0 0 0},
+            breaklinks=true}
 \urlstyle{same}  % don't use monospace font for urls
 \usepackage{color}
 \usepackage{fancyvrb}
@@ -87,15 +64,16 @@
 \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
 \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
 \newcommand{\NormalTok}[1]{{#1}}
+\IfFileExists{parskip.sty}{%
+\usepackage{parskip}
+}{% else
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
+}
 \setlength{\emergencystretch}{3em}  % prevent overfull lines
 \providecommand{\tightlist}{%
   \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
 \setcounter{secnumdepth}{0}
-
-\date{}
-
 % Redefines (sub)paragraphs to behave more like sections
 \ifx\paragraph\undefined\else
 \let\oldparagraph\paragraph
@@ -106,6 +84,8 @@
 \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
 \fi
 
+\date{}
+
 \begin{document}
 
 \section{lhs test}\label{lhs-test}
@@ -121,9 +101,9 @@ return a single value:
 \end{Highlighting}
 \end{Shaded}
 
-\texttt{(***)} combines two arrows into a new arrow by running the two arrows
-on a pair of values (one arrow on the first item of the pair and one arrow on
-the second item of the pair).
+\texttt{(***)} combines two arrows into a new arrow by running the two arrows on a
+pair of values (one arrow on the first item of the pair and one arrow on the
+second item of the pair).
 
 \begin{verbatim}
 f *** g = first f >>> second g
diff --git a/tests/lhs-test.latex+lhs b/tests/lhs-test.latex+lhs
index 7c293b2..8ab9a2e 100644
--- a/tests/lhs-test.latex+lhs
+++ b/tests/lhs-test.latex+lhs
@@ -12,8 +12,7 @@
   \else
     \usepackage{fontspec}
   \fi
-  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
-  \newcommand{\euro}{€}
+  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
 \fi
 % use upquote if available, for straight quotes in verbatim environments
 \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
@@ -22,44 +21,23 @@
 \usepackage{microtype}
 \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
 }{}
-\makeatletter
-\@ifpackageloaded{hyperref}{}{%
-\ifxetex
-  \usepackage[setpagesize=false, % page size defined by xetex
-              unicode=false, % unicode breaks when used with xetex
-              xetex]{hyperref}
-\else
-  \usepackage[unicode=true]{hyperref}
-\fi
-}
-\@ifpackageloaded{color}{
-    \PassOptionsToPackage{usenames,dvipsnames}{color}
-}{%
-    \usepackage[usenames,dvipsnames]{color}
-}
-\makeatother
-\hypersetup{breaklinks=true,
-            bookmarks=true,
-            pdfauthor={},
-            pdftitle={},
-            colorlinks=true,
-            citecolor=blue,
-            urlcolor=blue,
-            linkcolor=magenta,
-            pdfborder={0 0 0}
-            }
+\usepackage{hyperref}
+\hypersetup{unicode=true,
+            pdfborder={0 0 0},
+            breaklinks=true}
 \urlstyle{same}  % don't use monospace font for urls
 \usepackage{listings}
 \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
+\IfFileExists{parskip.sty}{%
+\usepackage{parskip}
+}{% else
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
+}
 \setlength{\emergencystretch}{3em}  % prevent overfull lines
 \providecommand{\tightlist}{%
   \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
 \setcounter{secnumdepth}{0}
-
-\date{}
-
 % Redefines (sub)paragraphs to behave more like sections
 \ifx\paragraph\undefined\else
 \let\oldparagraph\paragraph
@@ -70,6 +48,8 @@
 \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
 \fi
 
+\date{}
+
 \begin{document}
 
 \section{lhs test}\label{lhs-test}
@@ -83,9 +63,9 @@ unsplit = arr . uncurry
           -- arr (\op (x,y) -> x `op` y)
 \end{code}
 
-\texttt{(***)} combines two arrows into a new arrow by running the two arrows
-on a pair of values (one arrow on the first item of the pair and one arrow on
-the second item of the pair).
+\texttt{(***)} combines two arrows into a new arrow by running the two arrows on a
+pair of values (one arrow on the first item of the pair and one arrow on the
+second item of the pair).
 
 \begin{verbatim}
 f *** g = first f >>> second g
diff --git a/tests/lhs-test.markdown b/tests/lhs-test.markdown
index 75a253b..20949b7 100644
--- a/tests/lhs-test.markdown
+++ b/tests/lhs-test.markdown
@@ -1,8 +1,8 @@
 lhs test
 ========
 
-`unsplit` is an arrow that takes a pair of values and combines them to return
-a single value:
+`unsplit` is an arrow that takes a pair of values and combines them to
+return a single value:
 
 ``` {.sourceCode .literate .haskell}
 unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
diff --git a/tests/lhs-test.markdown+lhs b/tests/lhs-test.markdown+lhs
index 41dfba9..a6a894d 100644
--- a/tests/lhs-test.markdown+lhs
+++ b/tests/lhs-test.markdown+lhs
@@ -1,8 +1,8 @@
 lhs test
 ========
 
-`unsplit` is an arrow that takes a pair of values and combines them to return
-a single value:
+`unsplit` is an arrow that takes a pair of values and combines them to
+return a single value:
 
 > unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
 > unsplit = arr . uncurry
diff --git a/tests/lhs-test.native b/tests/lhs-test.native
index 63037d9..b6d9083 100644
--- a/tests/lhs-test.native
+++ b/tests/lhs-test.native
@@ -1,7 +1,7 @@
 [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",Space,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]
+,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 ("",["sourceCode","literate","haskell"],[]) "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",Space,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",Space,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)."]
+,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
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
index b046d44..0148e93 100644
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -1,14 +1,15 @@
-[Header 1 ("additional-markdown-reader-tests",[],[]) [Str "Additional",Space,Str "markdown",Space,Str "reader",Space,Str "tests"]
+[Para [Str "spanning",Space,Str "multiple",Space,Str "lines",SoftBreak,Str "%",Space,Str "Author",Space,Str "One",SoftBreak,Str "Author",Space,Str "Two;",Space,Str "Author",Space,Str "Three;",SoftBreak,Str "Author",Space,Str "Four"]
+,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")]
+,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"]
 ,Plain [RawInline (Format "tex") "\\placeformula "]
 ,RawBlock (Format "context") "\\startformula\n   L_{1} = L_{2}\n   \\stopformula"
 ,RawBlock (Format "context") "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"
 ,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",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,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","")]
+,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
@@ -22,7 +23,7 @@
 ,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",Space,RawInline (Format "html") "<!--\n- two\n-->"]]
+ [[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
@@ -42,9 +43,9 @@
 ,Para [Str "`hi"]
 ,Para [Str "there`"]
 ,Header 2 ("multilingual-urls",[],[]) [Str "Multilingual",Space,Str "URLs"]
-,Para [Link [Str "http://\27979.com?\27979=\27979"] ("http://\27979.com?\27979=\27979","")]
-,Para [Link [Str "foo"] ("/bar/\27979?x=\27979","title")]
-,Para [Link [Str "\27979@foo.\27979.baz"] ("mailto:\27979@foo.\27979.baz","")]
+,Para [Link ("",[],[]) [Str "http://\27979.com?\27979=\27979"] ("http://\27979.com?\27979=\27979","")]
+,Para [Link ("",[],[]) [Str "foo"] ("/bar/\27979?x=\27979","title")]
+,Para [Link ("",[],[]) [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."]]
@@ -55,9 +56,9 @@
 ,Header 2 ("macros",[],[]) [Str "Macros"]
 ,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","")]
+,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"]]
@@ -74,11 +75,11 @@
 ,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."]
+,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"]]
@@ -90,9 +91,9 @@
  [[Plain [Str "col",Space,Str "1"]]
  ,[Plain [Str "col",Space,Str "2"]]
  ,[Plain [Str "col",Space,Str "3"]]]
- [[[Para [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"]]
-  ,[Para [Str "b",Space,Str "b",Space,Str "2"]]
-  ,[Para [Str "c",Space,Str "c",Space,Str "2"]]]
+ [[[Para [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
+  ,[Para [Str "b",SoftBreak,Str "b",Space,Str "2"]]
+  ,[Para [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
  ,[[Para [Str "r2",Space,Str "d"]]
   ,[Para [Str "e"]]
   ,[Para [Str "f"]]]]
@@ -101,9 +102,9 @@
  [[]
  ,[]
  ,[]]
- [[[Para [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"]]
-  ,[Para [Str "b",Space,Str "b",Space,Str "2"]]
-  ,[Para [Str "c",Space,Str "c",Space,Str "2"]]]
+ [[[Para [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
+  ,[Para [Str "b",SoftBreak,Str "b",Space,Str "2"]]
+  ,[Para [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
  ,[[Para [Str "r2",Space,Str "d"]]
   ,[Para [Str "e"]]
   ,[Para [Str "f"]]]]
@@ -112,9 +113,9 @@
  [[]
  ,[]
  ,[]]
- [[[Para [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"]]
-  ,[Para [Str "b",Space,Str "b",Space,Str "2"]]
-  ,[Para [Str "c",Space,Str "c",Space,Str "2"]]]
+ [[[Para [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
+  ,[Para [Str "b",SoftBreak,Str "b",Space,Str "2"]]
+  ,[Para [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
  ,[[Para [Str "r2",Space,Str "d"]]
   ,[Para [Str "e"]]
   ,[Para [Str "f"]]]]
@@ -135,7 +136,7 @@
     [[Plain [Str "b"]]
     ,[Plain [Str "b",Space,Str "2"]]
     ,[Plain [Str "b",Space,Str "2"]]]]
-  ,[Para [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"]]]]
+  ,[Para [Str "c",SoftBreak,Str "c",Space,Str "2",SoftBreak,Str "c",Space,Str "2"]]]]
 ,Para [Str "Empty",Space,Str "cells"]
 ,Table [] [AlignDefault,AlignDefault] [5.555555555555555e-2,5.555555555555555e-2]
  [[]
@@ -143,23 +144,23 @@
  [[[]
   ,[]]]
 ,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 [Str "http://g\246\246gle.com"] ("http://g\246\246gle.com","")]
-,Para [Link [Str "me@ex\228mple.com"] ("mailto:me@ex\228mple.com","")]
-,Para [Link [Str "foobar"] ("/\252rl","\246\246!")]
+,Para [Link ("",[],[]) [Str "link"] ("/\252rl","\246\246!")]
+,Para [Link ("",[],[]) [Str "http://g\246\246gle.com"] ("http://g\246\246gle.com","")]
+,Para [Link ("",[],[]) [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))","")]
+,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","")]
+,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 = 0, citationHash = 0}] [Str "[@mapreduce]"],Space,Str "as",Space,Str "its",Space,Str "most",Space,Str "vocal",Space,Str "proponent."]
+,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 = 0, 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"] ("","")]
+,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."]]]]
diff --git a/tests/mediawiki-reader.native b/tests/mediawiki-reader.native
index 2f508c3..cf80d06 100644
--- a/tests/mediawiki-reader.native
+++ b/tests/mediawiki-reader.native
@@ -57,7 +57,7 @@ Pandoc (Meta {unMeta = fromList []})
 ,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"]],Space,Strikeout [Str "hello"]]
+,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"]
@@ -71,24 +71,26 @@ Pandoc (Meta {unMeta = fromList []})
  ,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","")]
+,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")]
+,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 [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")]
+,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"]]
@@ -121,7 +123,7 @@ Pandoc (Meta {unMeta = fromList []})
  ,[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."]
+,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"]]])
@@ -252,4 +254,4 @@ Pandoc (Meta {unMeta = fromList []})
 ,Para [Str "Paragraph",Space,Str "after",Space,Str "the",Space,Str "table."]
 ,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","")]]]]
+,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/tests/mediawiki-reader.wiki b/tests/mediawiki-reader.wiki
index 5da865b..862bb3b 100644
--- a/tests/mediawiki-reader.wiki
+++ b/tests/mediawiki-reader.wiki
@@ -171,6 +171,10 @@ http://pandoc.org
 
 [[File:example.jpg|frameless|border|30x40px|caption]]
 
+[[File:example.jpg|frameless|border|30px|caption]]
+
+[[File:example.jpg|page=4|30px|border|caption]]
+
 [[File:example.jpg]]
 
 [[Archivo:example_es.jpg]]
diff --git a/tests/odt/native/referenceToChapter.native b/tests/odt/native/referenceToChapter.native
index fc6c6cf..544fcaa 100644
--- a/tests/odt/native/referenceToChapter.native
+++ b/tests/odt/native/referenceToChapter.native
@@ -1 +1 @@
-[Header 1 ("a-chapter",[],[]) [Span ("anchor",[],[]) [],Str "A",Space,Str "chapter"],Para [Str "Some",Space,Str "text."],Header 1 ("another-chapter",[],[]) [Str "Another",Space,Str "chapter"],Para [Str "A",Space,Str "reference",Space,Str "to",Space,Str "."],Para [Str "A",Space,Str "reference",Space,Str "to",Space,Link [Str "A",Space,Str "chapter"] ("#anchor",""),Str "."]]
\ No newline at end of file
+[Header 1 ("a-chapter",[],[]) [Span ("anchor",[],[]) [],Str "A",Space,Str "chapter"],Para [Str "Some",Space,Str "text."],Header 1 ("another-chapter",[],[]) [Str "Another",Space,Str "chapter"],Para [Str "A",Space,Str "reference",Space,Str "to",Space,Str "."],Para [Str "A",Space,Str "reference",Space,Str "to",Space,Link ("",[],[]) [Str "A",Space,Str "chapter"] ("#anchor",""),Str "."]]
diff --git a/tests/odt/native/referenceToListItem.native b/tests/odt/native/referenceToListItem.native
index d009f8d..e64389c 100644
--- a/tests/odt/native/referenceToListItem.native
+++ b/tests/odt/native/referenceToListItem.native
@@ -1 +1 @@
-[OrderedList (1,Decimal,Period) [[Plain [Span ("anchor",[],[]) [],Str "A",Space,Str "list",Space,Str "item"]],[Plain [Str "Another",Space,Str "list",Space,Str "item"]]],Para [Str "A",Space,Str "reference",Space,Str "to",Space,Str "list",Space,Str "item",Space,Link [Str "1."] ("#anchor",""),Str "."],Para [],Para []]
\ No newline at end of file
+[OrderedList (1,Decimal,Period) [[Plain [Span ("anchor",[],[]) [],Str "A",Space,Str "list",Space,Str "item"]],[Plain [Str "Another",Space,Str "list",Space,Str "item"]]],Para [Str "A",Space,Str "reference",Space,Str "to",Space,Str "list",Space,Str "item",Space,Link ("",[],[]) [Str "1."] ("#anchor",""),Str "."],Para [],Para []]
diff --git a/tests/odt/native/referenceToText.native b/tests/odt/native/referenceToText.native
index 45f7ac4..1d80e2d 100644
--- a/tests/odt/native/referenceToText.native
+++ b/tests/odt/native/referenceToText.native
@@ -1 +1 @@
-[Para [Span ("an anchor",[],[]) [],Str "Some",Space,Str "text."],Para [Str "A",Space,Str "reference",Space,Str "to",Space,Link [Str "Some",Space,Str "text"] ("#an anchor",""),Str "."]]
\ No newline at end of file
+[Para [Span ("an anchor",[],[]) [],Str "Some",Space,Str "text."],Para [Str "A",Space,Str "reference",Space,Str "to",Space,Link ("",[],[]) [Str "Some",Space,Str "text"] ("#an anchor",""),Str "."]]
diff --git a/tests/opml-reader.native b/tests/opml-reader.native
index 14aff2c..0819116 100644
--- a/tests/opml-reader.native
+++ b/tests/opml-reader.native
@@ -7,7 +7,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "Dave",Spa
 ,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 ("",[],[]) [Link ("",[],[]) [Str "Reno"] ("http://www.reno.gov","")]
 ,Header 4 ("",[],[]) [Str "Las",Space,Str "Vegas"]
 ,Header 4 ("",[],[]) [Str "Ely"]
 ,Header 4 ("",[],[]) [Str "Gerlach"]
diff --git a/tests/pipe-tables.native b/tests/pipe-tables.native
index 9d499c9..63c2c17 100644
--- a/tests/pipe-tables.native
+++ b/tests/pipe-tables.native
@@ -83,4 +83,33 @@
  [[[Plain [Str "3"]]
   ,[Plain [Str "33"]]]
  ,[[Plain [Str "4"]]
-  ,[Plain [Str "44"]]]]]
+  ,[Plain [Str "44"]]]]
+,Para [Str "Long",Space,Str "pipe",Space,Str "table",Space,Str "with",Space,Str "relative",Space,Str "widths:"]
+,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.125,0.1375,0.5]
+ [[Plain [Str "Default1"]]
+ ,[Plain [Str "Default2"]]
+ ,[Plain [Str "Default3"]]]
+ [[[Plain [Str "123"]]
+  ,[Plain [Str "this",Space,Str "is",Space,Str "a",Space,Str "table",Space,Str "cell"]]
+  ,[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"]]]
+ ,[[Plain [Str "123"]]
+  ,[Plain [Str "123"]]
+  ,[Plain [Str "123"]]]]
+,Para [Str "Pipe",Space,Str "table",Space,Str "with",Space,Str "no",Space,Str "body:"]
+,Table [] [AlignDefault] [0.0]
+ [[Plain [Str "Header"]]]
+ []
+,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 [] [AlignLeft,AlignRight,AlignRight] [0.0,0.0,0.0]
+ [[]
+ ,[Plain [Str "IP_gene8-_1st"]]
+ ,[Plain [Str "IP_gene8+_1st"]]]
+ [[[Plain [Str "IP_gene8-_1st"]]
+  ,[Plain [Str "1.0000000"]]
+  ,[Plain [Str "0.4357325"]]]
+ ,[[Plain [Str "IP_gene8+_1st"]]
+  ,[Plain [Str "0.4357325"]]
+  ,[Plain [Str "1.0000000"]]]
+ ,[[Plain [Str "foo",Code ("",[],[]) "bar|baz"]]
+  ,[Plain [Str "and|escaped"]]
+  ,[Plain [Str "3.0000000"]]]]]
diff --git a/tests/pipe-tables.txt b/tests/pipe-tables.txt
index a880372..c27c711 100644
--- a/tests/pipe-tables.txt
+++ b/tests/pipe-tables.txt
@@ -59,3 +59,24 @@ Number of siblings | Salary
 ------------------:|:------
                  3 | 33
                  4 | 44
+
+Long pipe table with relative widths:
+
+| Default1 | Default2 | Default3 |
+ |---------|----------|---------------------------------------|
+|123|this is a table cell|and this is a really long table cell that will probably need wrapping|
+|123|123|123|
+
+Pipe table with no body:
+
+| Header |
+| ------ |
+
+Pipe table with tricky cell contents (see #2765):
+
+|               | IP_gene8-_1st| IP_gene8+_1st|
+|:--------------|-------------:|-------------:|
+|IP_gene8-_1st  |     1.0000000|     0.4357325|
+|IP_gene8+_1st  |     0.4357325|     1.0000000|
+|foo`bar|baz`   | and\|escaped |     3.0000000|
+
diff --git a/tests/rst-reader.native b/tests/rst-reader.native
index c7110ea..4752d76 100644
--- a/tests/rst-reader.native
+++ b/tests/rst-reader.native
@@ -1,14 +1,14 @@
 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",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",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."]
 ,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",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\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
+,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:"]
@@ -16,10 +16,10 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
+ [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.",Space,Str "It\8217s",Space,Str "indented",Space,Str "with",Space,Str "a",Space,Str "tab."]
+ [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:"]
@@ -95,7 +95,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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",Space,Str "back."]]
+  ,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."]]
  ,[Plain [Str "Item",Space,Str "2."]]
  ,[Plain [Str "Item",Space,Str "3."]]]
 ,Para [Str "Nested:"]
@@ -160,14 +160,14 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
   [([Str "address"],
     [[Para [Str "61",Space,Str "Main",Space,Str "St."]]])
   ,([Str "city"],
-    [[Para [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"]]])
+    [[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,",Space,Str "USA"]]])
+   [[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"]
@@ -210,20 +210,20 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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 "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 "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 "Explicit:",Space,Str "a",Space,Link ("",[],[]) [Str "URL"] ("/url/",""),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 "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 [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 "."]
+,Para [Image ("",[],[]) [Str "image"] ("lalune.jpg","")]
+,Para [Image ("",[],[("height","2343")]) [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"]
@@ -258,9 +258,9 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
  [[Plain [Str "col",Space,Str "1"]]
  ,[Plain [Str "col",Space,Str "2"]]
  ,[Plain [Str "col",Space,Str "3"]]]
- [[[Plain [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"]]
-  ,[Plain [Str "b",Space,Str "b",Space,Str "2"]]
-  ,[Plain [Str "c",Space,Str "c",Space,Str "2"]]]
+ [[[Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
+  ,[Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
+  ,[Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
  ,[[Plain [Str "r2",Space,Str "d"]]
   ,[Plain [Str "e"]]
   ,[Plain [Str "f"]]]]
@@ -269,9 +269,9 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
  [[]
  ,[]
  ,[]]
- [[[Plain [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"]]
-  ,[Plain [Str "b",Space,Str "b",Space,Str "2"]]
-  ,[Plain [Str "c",Space,Str "c",Space,Str "2"]]]
+ [[[Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
+  ,[Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
+  ,[Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
  ,[[Plain [Str "r2",Space,Str "d"]]
   ,[Plain [Str "e"]]
   ,[Plain [Str "f"]]]]
@@ -280,9 +280,9 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
  [[]
  ,[]
  ,[]]
- [[[Plain [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"]]
-  ,[Plain [Str "b",Space,Str "b",Space,Str "2"]]
-  ,[Plain [Str "c",Space,Str "c",Space,Str "2"]]]
+ [[[Plain [Str "r1",Space,Str "a",SoftBreak,Str "r1",Space,Str "bis"]]
+  ,[Plain [Str "b",SoftBreak,Str "b",Space,Str "2"]]
+  ,[Plain [Str "c",SoftBreak,Str "c",Space,Str "2"]]]
  ,[[Plain [Str "r2",Space,Str "d"]]
   ,[Plain [Str "e"]]
   ,[Plain [Str "f"]]]]
@@ -297,15 +297,15 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
     [[Plain [Str "b"]]
     ,[Plain [Str "b",Space,Str "2"]]
     ,[Plain [Str "b",Space,Str "2"]]]]
-  ,[Plain [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"]]]]
+  ,[Plain [Str "c",SoftBreak,Str "c",Space,Str "2",SoftBreak,Str "c",Space,Str "2"]]]]
 ,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",Space,Str "continuation",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",Space,Str "continuation",Space,Str "line"],Para [Str "and",Space,Str "a",Space,Str "second",Space,Str "para."]]]
+,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",Space,Str "display",Space,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"]
@@ -314,7 +314,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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 ".",Space,Str "Other",Space,Str "roles:",Space,Superscript [Str "super"],Str ",",Space,Subscript [Str "sub"],Str "."]
+,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."]
diff --git a/tests/s5-basic.html b/tests/s5-basic.html
index ac153d0..6fb57e4 100644
--- a/tests/s5-basic.html
+++ b/tests/s5-basic.html
@@ -4,7 +4,9 @@
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <meta http-equiv="Content-Style-Type" content="text/css" />
   <meta name="generator" content="pandoc" />
+  <meta name="version" content="S5 1.1" />
   <meta name="author" content="Sam Smith" />
+  <meta name="version" content="S5 1.1" />
   <meta name="author" content="Jen Jones" />
   <meta name="date" content="2006-07-15" />
   <title>My S5 Document</title>
@@ -32,9 +34,9 @@
 </div>
 <div class="presentation">
 <div class="titleslide slide">
-  <h1>My S5 Document</h1>
-  <h2>Sam Smith<br/>Jen Jones</h2>
-  <h3>July 15, 2006</h3>
+  <h1 class="title">My S5 Document</h1>
+  <h3 class="author">Sam Smith<br/>Jen Jones</h3>
+  <h4 class="date">July 15, 2006</h4>
 </div>
 <div id="first-slide" class="slide section level1">
 <h1>First slide</h1>
diff --git a/tests/s5-fancy.html b/tests/s5-fancy.html
index 818cca0..3a2a602 100644
--- a/tests/s5-fancy.html
+++ b/tests/s5-fancy.html
@@ -4,7 +4,9 @@
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <meta http-equiv="Content-Style-Type" content="text/css" />
   <meta name="generator" content="pandoc" />
+  <meta name="version" content="S5 1.1" />
   <meta name="author" content="Sam Smith" />
+  <meta name="version" content="S5 1.1" />
   <meta name="author" content="Jen Jones" />
   <meta name="date" content="2006-07-15" />
   <title>My S5 Document</title>
@@ -233,9 +235,9 @@
 </div>
 <div class="presentation">
 <div class="titleslide slide">
-  <h1>My S5 Document</h1>
-  <h2>Sam Smith<br/>Jen Jones</h2>
-  <h3>July 15, 2006</h3>
+  <h1 class="title">My S5 Document</h1>
+  <h3 class="author">Sam Smith<br/>Jen Jones</h3>
+  <h4 class="date">July 15, 2006</h4>
 </div>
 <div id="first-slide" class="slide section level1">
 <h1>First slide</h1>
diff --git a/tests/tables-rstsubset.native b/tests/tables-rstsubset.native
index 887d0ca..c98a955 100644
--- a/tests/tables-rstsubset.native
+++ b/tests/tables-rstsubset.native
@@ -63,11 +63,11 @@
  [[[Plain [Str "First"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "12.0"]]
-  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
+  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",SoftBreak,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
  ,[[Plain [Str "Second"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "5.0"]]
-  ,[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."]]]]
+  ,[Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]]
 ,Para [Str "Table:",Space,Str "Here's",Space,Str "the",Space,Str "caption.",Space,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."]
 ,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption:"]
 ,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625]
@@ -78,11 +78,11 @@
  [[[Plain [Str "First"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "12.0"]]
-  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
+  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",SoftBreak,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
  ,[[Plain [Str "Second"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "5.0"]]
-  ,[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."]]]]
+  ,[Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]]
 ,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
 ,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,0.1,0.1,0.1]
  [[]
@@ -110,8 +110,8 @@
  [[[Plain [Str "First"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "12.0"]]
-  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
+  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",SoftBreak,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
  ,[[Plain [Str "Second"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "5.0"]]
-  ,[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."]]]]]
+  ,[Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]]]
diff --git a/tests/tables.html b/tests/tables.html
index a9b2b24..0a9ea41 100644
--- a/tests/tables.html
+++ b/tests/tables.html
@@ -6,7 +6,7 @@
 <th align="right">Right</th>
 <th align="left">Left</th>
 <th align="center">Center</th>
-<th align="left">Default</th>
+<th>Default</th>
 </tr>
 </thead>
 <tbody>
@@ -14,19 +14,19 @@
 <td align="right">12</td>
 <td align="left">12</td>
 <td align="center">12</td>
-<td align="left">12</td>
+<td>12</td>
 </tr>
 <tr class="even">
 <td align="right">123</td>
 <td align="left">123</td>
 <td align="center">123</td>
-<td align="left">123</td>
+<td>123</td>
 </tr>
 <tr class="odd">
 <td align="right">1</td>
 <td align="left">1</td>
 <td align="center">1</td>
-<td align="left">1</td>
+<td>1</td>
 </tr>
 </tbody>
 </table>
@@ -37,7 +37,7 @@
 <th align="right">Right</th>
 <th align="left">Left</th>
 <th align="center">Center</th>
-<th align="left">Default</th>
+<th>Default</th>
 </tr>
 </thead>
 <tbody>
@@ -45,19 +45,19 @@
 <td align="right">12</td>
 <td align="left">12</td>
 <td align="center">12</td>
-<td align="left">12</td>
+<td>12</td>
 </tr>
 <tr class="even">
 <td align="right">123</td>
 <td align="left">123</td>
 <td align="center">123</td>
-<td align="left">123</td>
+<td>123</td>
 </tr>
 <tr class="odd">
 <td align="right">1</td>
 <td align="left">1</td>
 <td align="center">1</td>
-<td align="left">1</td>
+<td>1</td>
 </tr>
 </tbody>
 </table>
@@ -69,7 +69,7 @@
 <th align="right">Right</th>
 <th align="left">Left</th>
 <th align="center">Center</th>
-<th align="left">Default</th>
+<th>Default</th>
 </tr>
 </thead>
 <tbody>
@@ -77,24 +77,24 @@
 <td align="right">12</td>
 <td align="left">12</td>
 <td align="center">12</td>
-<td align="left">12</td>
+<td>12</td>
 </tr>
 <tr class="even">
 <td align="right">123</td>
 <td align="left">123</td>
 <td align="center">123</td>
-<td align="left">123</td>
+<td>123</td>
 </tr>
 <tr class="odd">
 <td align="right">1</td>
 <td align="left">1</td>
 <td align="center">1</td>
-<td align="left">1</td>
+<td>1</td>
 </tr>
 </tbody>
 </table>
 <p>Multiline table with caption:</p>
-<table>
+<table style="width:79%;">
 <caption>Here's the caption. It may span multiple lines.</caption>
 <colgroup>
 <col width="15%" />
@@ -126,7 +126,7 @@
 </tbody>
 </table>
 <p>Multiline table without caption:</p>
-<table>
+<table style="width:79%;">
 <colgroup>
 <col width="15%" />
 <col width="13%" />
@@ -180,7 +180,7 @@
 </tbody>
 </table>
 <p>Multiline table without column headers:</p>
-<table>
+<table style="width:79%;">
 <colgroup>
 <col width="15%" />
 <col width="13%" />
@@ -192,13 +192,13 @@
 <td align="center">First</td>
 <td align="left">row</td>
 <td align="right">12.0</td>
-<td align="left">Example of a row that spans multiple lines.</td>
+<td>Example of a row that spans multiple lines.</td>
 </tr>
 <tr class="even">
 <td align="center">Second</td>
 <td align="left">row</td>
 <td align="right">5.0</td>
-<td align="left">Here's another one. Note the blank line between rows.</td>
+<td>Here's another one. Note the blank line between rows.</td>
 </tr>
 </tbody>
 </table>
diff --git a/tests/tables.icml b/tests/tables.icml
index eb73af6..8ce645a 100644
--- a/tests/tables.icml
+++ b/tests/tables.icml
@@ -1,8 +1,9 @@
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Simple table with caption:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <Table AppliedTableStyle="TableStyle/Table" HeaderRowCount="1" BodyRowCount="3" ColumnCount="4">
   <Column Name="0" />
   <Column Name="1" />
@@ -12,125 +13,127 @@
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Right</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Left</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Center</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Default</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
 </Table>
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TableCaption">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Demonstration of simple table syntax.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Simple table without caption:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <Table AppliedTableStyle="TableStyle/Table" HeaderRowCount="1" BodyRowCount="3" ColumnCount="4">
   <Column Name="0" />
   <Column Name="1" />
@@ -140,123 +143,124 @@
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Right</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Left</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Center</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Default</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
 </Table>
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TableCaption">
-  <Br />
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Simple table indented two spaces:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <Table AppliedTableStyle="TableStyle/Table" HeaderRowCount="1" BodyRowCount="3" ColumnCount="4">
   <Column Name="0" />
   <Column Name="1" />
@@ -266,125 +270,127 @@
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Right</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Left</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Center</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Default</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:3" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
 </Table>
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TableCaption">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Demonstration of simple table syntax.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Multiline table with caption:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <Table AppliedTableStyle="TableStyle/Table" HeaderRowCount="1" BodyRowCount="2" ColumnCount="4">
   <Column Name="0" SingleColumnWidth="75.0" />
   <Column Name="1" SingleColumnWidth="68.75" />
@@ -394,97 +400,99 @@
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Centered Header</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Left Aligned</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Right Aligned</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Default aligned</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>First</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>row</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12.0</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Example of a row that spans multiple lines.</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Second</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>row</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>5.0</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Here's another one. Note the blank line between rows.</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
 </Table>
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TableCaption">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here's the caption. It may span multiple lines.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Multiline table without caption:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <Table AppliedTableStyle="TableStyle/Table" HeaderRowCount="1" BodyRowCount="2" ColumnCount="4">
   <Column Name="0" SingleColumnWidth="75.0" />
   <Column Name="1" SingleColumnWidth="68.75" />
@@ -494,95 +502,96 @@
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Centered Header</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Left Aligned</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Right Aligned</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Default aligned</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>First</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>row</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12.0</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Example of a row that spans multiple lines.</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Second</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>row</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>5.0</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Here's another one. Note the blank line between rows.</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
 </Table>
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TableCaption">
-  <Br />
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Table without column headers:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <Table AppliedTableStyle="TableStyle/Table" HeaderRowCount="0" BodyRowCount="3" ColumnCount="4">
   <Column Name="0" />
   <Column Name="1" />
@@ -592,95 +601,96 @@
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>123</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:2" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>1</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
 </Table>
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TableCaption">
-  <Br />
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Multiline table without column headers:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <Table AppliedTableStyle="TableStyle/Table" HeaderRowCount="0" BodyRowCount="2" ColumnCount="4">
   <Column Name="0" SingleColumnWidth="75.0" />
   <Column Name="1" SingleColumnWidth="68.75" />
@@ -690,59 +700,58 @@
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>First</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>row</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>12.0</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:0" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Example of a row that spans multiple lines.</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="0:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Second</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="1:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; LeftAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>row</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="2:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; RightAlign">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>5.0</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
   <Cell Name="3:1" AppliedCellStyle="CellStyle/Cell">
     <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar">
       <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
         <Content>Here's another one. Note the blank line between rows.</Content>
-      </CharacterStyleRange><Br />
+      </CharacterStyleRange>
     </ParagraphStyleRange>
   </Cell>
 </Table>
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TableCaption">
-  <Br />
-</ParagraphStyleRange>
+</ParagraphStyleRange>
\ No newline at end of file
diff --git a/tests/tables.latex b/tests/tables.latex
index 8506294..96cbc95 100644
--- a/tests/tables.latex
+++ b/tests/tables.latex
@@ -1,6 +1,6 @@
 Simple table with caption:
 
-\begin{longtable}[c]{@{}rlcl@{}}
+\begin{longtable}[]{@{}rlcl@{}}
 \caption{Demonstration of simple table syntax.}\tabularnewline
 \toprule
 Right & Left & Center & Default\tabularnewline
@@ -18,7 +18,7 @@ Right & Left & Center & Default\tabularnewline
 
 Simple table without caption:
 
-\begin{longtable}[c]{@{}rlcl@{}}
+\begin{longtable}[]{@{}rlcl@{}}
 \toprule
 Right & Left & Center & Default\tabularnewline
 \midrule
@@ -31,7 +31,7 @@ Right & Left & Center & Default\tabularnewline
 
 Simple table indented two spaces:
 
-\begin{longtable}[c]{@{}rlcl@{}}
+\begin{longtable}[]{@{}rlcl@{}}
 \caption{Demonstration of simple table syntax.}\tabularnewline
 \toprule
 Right & Left & Center & Default\tabularnewline
@@ -49,7 +49,7 @@ Right & Left & Center & Default\tabularnewline
 
 Multiline table with caption:
 
-\begin{longtable}[c]{@{}clrl@{}}
+\begin{longtable}[]{@{}clrl@{}}
 \caption{Here's the caption. It may span multiple lines.}\tabularnewline
 \toprule
 \begin{minipage}[b]{0.13\columnwidth}\centering\strut
@@ -98,7 +98,7 @@ Here's another one. Note the blank line between rows.
 
 Multiline table without caption:
 
-\begin{longtable}[c]{@{}clrl@{}}
+\begin{longtable}[]{@{}clrl@{}}
 \toprule
 \begin{minipage}[b]{0.13\columnwidth}\centering\strut
 Centered Header
@@ -134,7 +134,7 @@ Here's another one. Note the blank line between rows.
 
 Table without column headers:
 
-\begin{longtable}[c]{@{}rlcr@{}}
+\begin{longtable}[]{@{}rlcr@{}}
 \toprule
 12 & 12 & 12 & 12\tabularnewline
 123 & 123 & 123 & 123\tabularnewline
@@ -144,7 +144,7 @@ Table without column headers:
 
 Multiline table without column headers:
 
-\begin{longtable}[c]{@{}clrl@{}}
+\begin{longtable}[]{@{}clrl@{}}
 \toprule
 \begin{minipage}[t]{0.13\columnwidth}\centering\strut
 First
diff --git a/tests/tables.mediawiki b/tests/tables.mediawiki
index efde765..614c3ee 100644
--- a/tests/tables.mediawiki
+++ b/tests/tables.mediawiki
@@ -2,145 +2,145 @@ Simple table with caption:
 
 {|
 |+ Demonstration of simple table syntax.
-!align="right"|Right
-!Left
-!align="center"|Center
-!Default
-|-
-|align="right"|12
-|12
-|align="center"|12
-|12
-|-
-|align="right"|123
-|123
-|align="center"|123
-|123
-|-
-|align="right"|1
-|1
-|align="center"|1
-|1
+!align="right"| Right
+! Left
+!align="center"| Center
+! Default
+|-
+|align="right"| 12
+| 12
+|align="center"| 12
+| 12
+|-
+|align="right"| 123
+| 123
+|align="center"| 123
+| 123
+|-
+|align="right"| 1
+| 1
+|align="center"| 1
+| 1
 |}
 
 Simple table without caption:
 
 {|
-!align="right"|Right
-!Left
-!align="center"|Center
-!Default
-|-
-|align="right"|12
-|12
-|align="center"|12
-|12
-|-
-|align="right"|123
-|123
-|align="center"|123
-|123
-|-
-|align="right"|1
-|1
-|align="center"|1
-|1
+!align="right"| Right
+! Left
+!align="center"| Center
+! Default
+|-
+|align="right"| 12
+| 12
+|align="center"| 12
+| 12
+|-
+|align="right"| 123
+| 123
+|align="center"| 123
+| 123
+|-
+|align="right"| 1
+| 1
+|align="center"| 1
+| 1
 |}
 
 Simple table indented two spaces:
 
 {|
 |+ Demonstration of simple table syntax.
-!align="right"|Right
-!Left
-!align="center"|Center
-!Default
-|-
-|align="right"|12
-|12
-|align="center"|12
-|12
-|-
-|align="right"|123
-|123
-|align="center"|123
-|123
-|-
-|align="right"|1
-|1
-|align="center"|1
-|1
+!align="right"| Right
+! Left
+!align="center"| Center
+! Default
+|-
+|align="right"| 12
+| 12
+|align="center"| 12
+| 12
+|-
+|align="right"| 123
+| 123
+|align="center"| 123
+| 123
+|-
+|align="right"| 1
+| 1
+|align="center"| 1
+| 1
 |}
 
 Multiline table with caption:
 
 {|
 |+ Here's the caption. It may span multiple lines.
-!align="center" width="15%"|Centered Header
-!width="13%"|Left Aligned
-!align="right" width="16%"|Right Aligned
-!width="33%"|Default aligned
-|-
-|align="center"|First
-|row
-|align="right"|12.0
-|Example of a row that spans multiple lines.
-|-
-|align="center"|Second
-|row
-|align="right"|5.0
-|Here's another one. Note the blank line between rows.
+!align="center" width="15%"| Centered Header
+!width="13%"| Left Aligned
+!align="right" width="16%"| Right Aligned
+!width="33%"| Default aligned
+|-
+|align="center"| First
+| row
+|align="right"| 12.0
+| Example of a row that spans multiple lines.
+|-
+|align="center"| Second
+| row
+|align="right"| 5.0
+| Here's another one. Note the blank line between rows.
 |}
 
 Multiline table without caption:
 
 {|
-!align="center" width="15%"|Centered Header
-!width="13%"|Left Aligned
-!align="right" width="16%"|Right Aligned
-!width="33%"|Default aligned
-|-
-|align="center"|First
-|row
-|align="right"|12.0
-|Example of a row that spans multiple lines.
-|-
-|align="center"|Second
-|row
-|align="right"|5.0
-|Here's another one. Note the blank line between rows.
+!align="center" width="15%"| Centered Header
+!width="13%"| Left Aligned
+!align="right" width="16%"| Right Aligned
+!width="33%"| Default aligned
+|-
+|align="center"| First
+| row
+|align="right"| 12.0
+| Example of a row that spans multiple lines.
+|-
+|align="center"| Second
+| row
+|align="right"| 5.0
+| Here's another one. Note the blank line between rows.
 |}
 
 Table without column headers:
 
 {|
-|align="right"|12
-|12
-|align="center"|12
-|align="right"|12
-|-
-|align="right"|123
-|123
-|align="center"|123
-|align="right"|123
-|-
-|align="right"|1
-|1
-|align="center"|1
-|align="right"|1
+|align="right"| 12
+| 12
+|align="center"| 12
+|align="right"| 12
+|-
+|align="right"| 123
+| 123
+|align="center"| 123
+|align="right"| 123
+|-
+|align="right"| 1
+| 1
+|align="center"| 1
+|align="right"| 1
 |}
 
 Multiline table without column headers:
 
 {|
-|align="center" width="15%"|First
-|width="13%"|row
-|align="right" width="16%"|12.0
-|width="33%"|Example of a row that spans multiple lines.
-|-
-|align="center"|Second
-|row
-|align="right"|5.0
-|Here's another one. Note the blank line between rows.
+|align="center" width="15%"| First
+|width="13%"| row
+|align="right" width="16%"| 12.0
+|width="33%"| Example of a row that spans multiple lines.
+|-
+|align="center"| Second
+| row
+|align="right"| 5.0
+| Here's another one. Note the blank line between rows.
 |}
 
diff --git a/tests/tables.native b/tests/tables.native
index 00a7c59..a7f4fdc 100644
--- a/tests/tables.native
+++ b/tests/tables.native
@@ -53,33 +53,33 @@
   ,[Plain [Str "1"]]
   ,[Plain [Str "1"]]]]
 ,Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption:"]
-,Table [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,AlignLeft,AlignRight,AlignLeft] [0.15,0.1375,0.1625,0.3375]
- [[Plain [Str "Centered",Space,Str "Header"]]
- ,[Plain [Str "Left",Space,Str "Aligned"]]
- ,[Plain [Str "Right",Space,Str "Aligned"]]
+,Table [Str "Here's",Space,Str "the",Space,Str "caption.",SoftBreak,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."] [AlignCenter,AlignLeft,AlignRight,AlignLeft] [0.15,0.1375,0.1625,0.3375]
+ [[Plain [Str "Centered",SoftBreak,Str "Header"]]
+ ,[Plain [Str "Left",SoftBreak,Str "Aligned"]]
+ ,[Plain [Str "Right",SoftBreak,Str "Aligned"]]
  ,[Plain [Str "Default",Space,Str "aligned"]]]
  [[[Plain [Str "First"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "12.0"]]
-  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
+  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",SoftBreak,Str "multiple",Space,Str "lines."]]]
  ,[[Plain [Str "Second"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "5.0"]]
-  ,[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."]]]]
+  ,[Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]]
 ,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption:"]
 ,Table [] [AlignCenter,AlignLeft,AlignRight,AlignLeft] [0.15,0.1375,0.1625,0.3375]
- [[Plain [Str "Centered",Space,Str "Header"]]
- ,[Plain [Str "Left",Space,Str "Aligned"]]
- ,[Plain [Str "Right",Space,Str "Aligned"]]
+ [[Plain [Str "Centered",SoftBreak,Str "Header"]]
+ ,[Plain [Str "Left",SoftBreak,Str "Aligned"]]
+ ,[Plain [Str "Right",SoftBreak,Str "Aligned"]]
  ,[Plain [Str "Default",Space,Str "aligned"]]]
  [[[Plain [Str "First"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "12.0"]]
-  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
+  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",SoftBreak,Str "multiple",Space,Str "lines."]]]
  ,[[Plain [Str "Second"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "5.0"]]
-  ,[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."]]]]
+  ,[Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]]
 ,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
 ,Table [] [AlignRight,AlignLeft,AlignCenter,AlignRight] [0.0,0.0,0.0,0.0]
  [[]
@@ -107,8 +107,8 @@
  [[[Plain [Str "First"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "12.0"]]
-  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
+  ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",SoftBreak,Str "multiple",Space,Str "lines."]]]
  ,[[Plain [Str "Second"]]
   ,[Plain [Str "row"]]
   ,[Plain [Str "5.0"]]
-  ,[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."]]]]]
+  ,[Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]]]
diff --git a/tests/tables.tei b/tests/tables.tei
new file mode 100644
index 0000000..45b88b1
--- /dev/null
+++ b/tests/tables.tei
@@ -0,0 +1,171 @@
+<p>Simple table with caption:</p>
+<table>
+  <row role="label">
+    <cell><p>Right</p></cell>
+    <cell><p>Left</p></cell>
+    <cell><p>Center</p></cell>
+    <cell><p>Default</p></cell>
+  </row>
+  <row>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+  </row>
+  <row>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+  </row>
+  <row>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+  </row>
+</table>
+<p>Simple table without caption:</p>
+<table>
+  <row role="label">
+    <cell><p>Right</p></cell>
+    <cell><p>Left</p></cell>
+    <cell><p>Center</p></cell>
+    <cell><p>Default</p></cell>
+  </row>
+  <row>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+  </row>
+  <row>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+  </row>
+  <row>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+  </row>
+</table>
+<p>Simple table indented two spaces:</p>
+<table>
+  <row role="label">
+    <cell><p>Right</p></cell>
+    <cell><p>Left</p></cell>
+    <cell><p>Center</p></cell>
+    <cell><p>Default</p></cell>
+  </row>
+  <row>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+  </row>
+  <row>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+  </row>
+  <row>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+  </row>
+</table>
+<p>Multiline table with caption:</p>
+<table>
+  <row role="label">
+    <cell><p>Centered Header</p></cell>
+    <cell><p>Left Aligned</p></cell>
+    <cell><p>Right Aligned</p></cell>
+    <cell><p>Default aligned</p></cell>
+  </row>
+  <row>
+    <cell><p>First</p></cell>
+    <cell><p>row</p></cell>
+    <cell><p>12.0</p></cell>
+    <cell><p>Example of a row that spans multiple lines.</p></cell>
+  </row>
+  <row>
+    <cell><p>Second</p></cell>
+    <cell><p>row</p></cell>
+    <cell><p>5.0</p></cell>
+    <cell><p>Here's another one. Note the blank line between rows.</p></cell>
+  </row>
+</table>
+<p>Multiline table without caption:</p>
+<table>
+  <row role="label">
+    <cell><p>Centered Header</p></cell>
+    <cell><p>Left Aligned</p></cell>
+    <cell><p>Right Aligned</p></cell>
+    <cell><p>Default aligned</p></cell>
+  </row>
+  <row>
+    <cell><p>First</p></cell>
+    <cell><p>row</p></cell>
+    <cell><p>12.0</p></cell>
+    <cell><p>Example of a row that spans multiple lines.</p></cell>
+  </row>
+  <row>
+    <cell><p>Second</p></cell>
+    <cell><p>row</p></cell>
+    <cell><p>5.0</p></cell>
+    <cell><p>Here's another one. Note the blank line between rows.</p></cell>
+  </row>
+</table>
+<p>Table without column headers:</p>
+<table>
+  <row role="label">
+    <cell></cell>
+    <cell></cell>
+    <cell></cell>
+    <cell></cell>
+  </row>
+  <row>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+    <cell><p>12</p></cell>
+  </row>
+  <row>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+    <cell><p>123</p></cell>
+  </row>
+  <row>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+    <cell><p>1</p></cell>
+  </row>
+</table>
+<p>Multiline table without column headers:</p>
+<table>
+  <row role="label">
+    <cell></cell>
+    <cell></cell>
+    <cell></cell>
+    <cell></cell>
+  </row>
+  <row>
+    <cell><p>First</p></cell>
+    <cell><p>row</p></cell>
+    <cell><p>12.0</p></cell>
+    <cell><p>Example of a row that spans multiple lines.</p></cell>
+  </row>
+  <row>
+    <cell><p>Second</p></cell>
+    <cell><p>row</p></cell>
+    <cell><p>5.0</p></cell>
+    <cell><p>Here's another one. Note the blank line between rows.</p></cell>
+  </row>
+</table>
diff --git a/tests/test-pandoc.hs b/tests/test-pandoc.hs
index f7c2f0c..2488917 100644
--- a/tests/test-pandoc.hs
+++ b/tests/test-pandoc.hs
@@ -24,6 +24,7 @@ import qualified Tests.Writers.Plain
 import qualified Tests.Writers.AsciiDoc
 import qualified Tests.Writers.Docx
 import qualified Tests.Writers.RST
+import qualified Tests.Writers.TEI
 import qualified Tests.Shared
 import qualified Tests.Walk
 import Text.Pandoc.Shared (inDirectory)
@@ -44,6 +45,7 @@ tests = [ testGroup "Old" Tests.Old.tests
           , testGroup "AsciiDoc" Tests.Writers.AsciiDoc.tests
           , testGroup "Docx" Tests.Writers.Docx.tests
           , testGroup "RST" Tests.Writers.RST.tests
+          , testGroup "TEI" Tests.Writers.TEI.tests
           ]
         , testGroup "Readers"
           [ testGroup "LaTeX" Tests.Readers.LaTeX.tests
diff --git a/tests/testsuite.native b/tests/testsuite.native
index 0537209..fa234df 100644
--- a/tests/testsuite.native
+++ b/tests/testsuite.native
@@ -1,8 +1,8 @@
 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",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",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 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"]
@@ -15,14 +15,14 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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",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\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
+,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.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
+ [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}"
@@ -35,7 +35,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
   [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 "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"]
@@ -100,7 +100,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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",Space,Str "back."]]
+  ,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"]
@@ -130,18 +130,18 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
  ,[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"]
+ [[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",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"]]]]]
+   [[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)
  [[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,Period)
-   [[Plain [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",Space,Str "starting",Space,Str "with",Space,Str "4"]]
+   [[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"]]
@@ -194,7 +194,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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"]]])
+    ,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 }"
@@ -286,7 +286,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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 [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."]]]
@@ -295,14 +295,14 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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,",Space,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."]
+,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.",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."]],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",Space,Quoted DoubleQuote [Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."]
+,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."]
@@ -315,12 +315,12 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
  ,[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:",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]]
+ ,[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.",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized.)"]]
+ ,[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:"]
@@ -358,52 +358,52 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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 "."]
+,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 "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 "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 "."]
+,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 "."]
+,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 [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
+,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 [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,Link [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
+,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Link ("",[],[]) [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
 ,BlockQuote
- [Para [Str "Blockquoted:",Space,Link [Str "http://example.com/"] ("http://example.com/","")]]
+ [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,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."]
+,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",Space,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",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",Space,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",Space,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,",Space,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",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
+,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)
diff --git a/tests/textile-reader.native b/tests/textile-reader.native
index de0637f..79a5f52 100644
--- a/tests/textile-reader.native
+++ b/tests/textile-reader.native
@@ -1,16 +1,16 @@
 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."]
+[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's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
 ,HorizontalRule
 ,Header 1 ("headers",[],[]) [Str "Headers"]
-,Header 2 ("level-2-with-an-embeded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embeded",Space,Str "link"] ("http://www.example.com","")]
+,Header 2 ("level-2-with-an-embeded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link ("",[],[]) [Str "embeded",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 "Here's",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."]
+,Para [Str "Here's",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"]
@@ -84,19 +84,19 @@ Pandoc (Meta {unMeta = fromList []})
  ,([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 "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 [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 "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 "Elipses",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."]
+,Para [Str "Dashes",Space,Str ":",Space,Str "How",Space,Str "cool",Space,Str "--",Space,Str "automatic",Space,Str "dashes."]
+,Para [Str "Elipses",Space,Str ":",Space,Str "He",Space,Str "thought",Space,Str "and",Space,Str "thought",Space,Str "...",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,Str "\"I'd",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 [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."]
+,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 [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"]
@@ -114,7 +114,7 @@ Pandoc (Meta {unMeta = fromList []})
  ,[[Plain [Str "bella"]]
   ,[Plain [Str "45"]]
   ,[Plain [Str "f"]]]]
-,Para [Str "and",Space,Str "some",Space,Str "text",Space,Str "following",Space,Str "\8230"]
+,Para [Str "and",Space,Str "some",Space,Str "text",Space,Str "following",Space,Str "..."]
 ,Header 2 ("with-headers",[],[]) [Str "With",Space,Str "headers"]
 ,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
  [[Plain [Str "name"]]
@@ -130,10 +130,13 @@ Pandoc (Meta {unMeta = fromList []})
   ,[Plain [Str "45"]]
   ,[Plain [Str "f"]]]]
 ,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 "."]
+,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."]
-,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"]]
+,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 [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
  []
@@ -150,10 +153,11 @@ Pandoc (Meta {unMeta = fromList []})
 ,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",Space,Str "be",Space,RawInline (Format "html") "<div>",Str "inlined",RawInline (Format "html") "</div>",Space,Str "as",Space,Str "well."]
-,BulletList
- [[Plain [Str "this",Space,RawInline (Format "html") "<div>",Space,Str "won\8217t",Space,Str "produce",Space,Str "raw",Space,Str "html",Space,Str "blocks",Space,RawInline (Format "html") "</div>"]]
- ,[Plain [Str "but",Space,Str "this",Space,RawInline (Format "html") "<strong>",Space,Str "will",Space,Str "produce",Space,Str "inline",Space,Str "html",Space,RawInline (Format "html") "</strong>"]]]
+,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)"]
diff --git a/tests/textile-reader.textile b/tests/textile-reader.textile
index dab73b3..a9c80cc 100644
--- a/tests/textile-reader.textile
+++ b/tests/textile-reader.textile
@@ -207,6 +207,12 @@ h1. Attributes
 
 h2[en]{color:red}(foo bar #ident). HTML and CSS attributes are parsed in headers.
 
+h2=. Centered
+
+h2>. Right
+
+h2<>{color:blue}[en]. Justified
+
 as well as *(foo)inline attributes* of %{color:red} all kind%
 
 p{color:green}. and paragraph attributes, and table attributes.
@@ -228,10 +234,7 @@ However, <strong> raw HTML inlines </strong> are accepted, as well as :
   any *Raw HTML Block* with bold
 </div>
 
-Html blocks can be <div>inlined</div> as well. 
-
-* this <div> won't produce raw html blocks </div>
-* but this <strong> will produce inline html </strong>
+Html blocks can <div>interrupt paragraphs</div> as well.
 
 Can you prove that 2 < 3 ?
 
diff --git a/tests/twiki-reader.native b/tests/twiki-reader.native
index 6e199a1..1447dcc 100644
--- a/tests/twiki-reader.native
+++ b/tests/twiki-reader.native
@@ -30,7 +30,7 @@ Pandoc (Meta {unMeta = fromList []})
 ,Para [Str "between",Space,Str "blocks"]
 ,Header 1 ("linebreaks",[],[]) [Str "linebreaks"]
 ,Para [Str "hi",LineBreak,Str "there"]
-,Para [Str "hi",LineBreak,Space,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"]
@@ -43,10 +43,10 @@ Pandoc (Meta {unMeta = fromList []})
  ,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 [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"]
diff --git a/tests/txt2tags.native b/tests/txt2tags.native
index 189c099..2eb795f 100644
--- a/tests/txt2tags.native
+++ b/tests/txt2tags.native
@@ -1,15 +1,15 @@
 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.",Space,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",Space,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",Space,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",Space,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",Space,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",Space,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",Space,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 "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.",Space,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",Space,Str "current",Space,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.",Space,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",Space,Str "currently",Space,Str "open",Space,Str "paragraph."]
+,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"]
@@ -25,26 +25,26 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "author"]]
 ,HorizontalRule
 ,HorizontalRule
 ,HorizontalRule
-,Para [Strikeout [Str "-----"],Space,Strikeout [Str "-------",Space,Str "--------"]]
+,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,Emph [Str "u"],Space,Strikeout [Str "s"],Space,Code ("",[],[]) "m",Space,Str "r",Space,RawInline (Format "html") "t",Space,Str "i)",Space,Strong [Str "bo"],Space,Emph [Str "it"],Space,Emph [Str "un"],Space,Strikeout [Str "st"],Space,Code ("",[],[]) "mo",Space,Str "ra",Space,RawInline (Format "html") "tg",Space,Str "i)",Space,Strong [Str "bold"],Space,Emph [Str "ital"],Space,Emph [Str "undr"],Space,Strikeout [Str "strk"],Space,Code ("",[],[]) "mono",Space,Str "raw",Space,RawInline (Format "html") "tggd",Space,Str "i)",Space,Strong [Str "bo",Space,Str "ld"],Space,Emph [Str "it",Space,Str "al"],Space,Emph [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",Space,Str "i)",Space,Strong [Str "bo",Space,Str "*",Space,Str "ld"],Space,Emph [Str "it",Space,Str "/",Space,Str "al"],Space,Emph [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",Space,Str "i)",Space,Strong [Str "bo",Space,Str "**ld"],Space,Emph [Str "it",Space,Str "//al"],Space,Emph [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",Space,Str "i)",Space,Strong [Str "bo",Space,Str "**",Space,Str "ld"],Space,Emph [Str "it",Space,Str "//",Space,Str "al"],Space,Emph [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",Space,Str "i)",Space,Strong [Str "**bold**"],Space,Emph [Str "//ital//"],Space,Emph [Str "__undr__"],Space,Strikeout [Str "--strk--"],Space,Code ("",[],[]) "``mono``",Space,Str "\"\"raw\"\"",Space,RawInline (Format "html") "''tggd''",Space,Str "i)",Space,Strong [Str "*bold*"],Space,Emph [Str "/ital/"],Space,Emph [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,Emph [Str "_"],Space,Strikeout [Str "-"],Space,Code ("",[],[]) "`",Space,Str "\"",Space,RawInline (Format "html") "'",Space,Str "i)",Space,Strong [Str "**"],Space,Emph [Str "//"],Space,Emph [Str "__"],Space,Strikeout [Str "--"],Space,Code ("",[],[]) "``",Space,Str "\"\"",Space,RawInline (Format "html") "''",Space,Str "i)",Space,Strong [Str "***"],Space,Emph [Str "///"],Space,Emph [Str "___"],Space,Strikeout [Str "---"],Space,Code ("",[],[]) "```",Space,Str "\"\"\"",Space,RawInline (Format "html") "'''",Space,Str "i)",Space,Strong [Str "****"],Space,Emph [Str "////"],Space,Emph [Str "____"],Space,Strikeout [Str "----"],Space,Code ("",[],[]) "````",Space,Str "\"\"\"\"",Space,RawInline (Format "html") "''''",Space,Str "i)",Space,Strong [Str "*****"],Space,Emph [Str "/////"],Space,Emph [Str "_____"],Space,Strikeout [Str "-----"],Space,Code ("",[],[]) "`````",Space,Str "\"\"\"\"\"",Space,RawInline (Format "html") "'''''",Space,Str "i)",Space,Strong [Str "******"],Space,Emph [Str "//////"],Space,Emph [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 "''''",Space,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''",Space,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 "''",Space,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 "''"]
+,Para [Str "i)",Space,Strong [Str "b"],Space,Emph [Str "i"],Space,Emph [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,Emph [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,Emph [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,Emph [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,Emph [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,Emph [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,Emph [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,Emph [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,Emph [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,Emph [Str "_"],Space,Strikeout [Str "-"],Space,Code ("",[],[]) "`",Space,Str "\"",Space,RawInline (Format "html") "'",SoftBreak,Str "i)",Space,Strong [Str "**"],Space,Emph [Str "//"],Space,Emph [Str "__"],Space,Strikeout [Str "--"],Space,Code ("",[],[]) "``",Space,Str "\"\"",Space,RawInline (Format "html") "''",SoftBreak,Str "i)",Space,Strong [Str "***"],Space,Emph [Str "///"],Space,Emph [Str "___"],Space,Strikeout [Str "---"],Space,Code ("",[],[]) "```",Space,Str "\"\"\"",Space,RawInline (Format "html") "'''",SoftBreak,Str "i)",Space,Strong [Str "****"],Space,Emph [Str "////"],Space,Emph [Str "____"],Space,Strikeout [Str "----"],Space,Code ("",[],[]) "````",Space,Str "\"\"\"\"",Space,RawInline (Format "html") "''''",SoftBreak,Str "i)",Space,Strong [Str "*****"],Space,Emph [Str "/////"],Space,Emph [Str "_____"],Space,Strikeout [Str "-----"],Space,Code ("",[],[]) "`````",Space,Str "\"\"\"\"\"",Space,RawInline (Format "html") "'''''",SoftBreak,Str "i)",Space,Strong [Str "******"],Space,Emph [Str "//////"],Space,Emph [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",""),Space,Link [Str "mailto:user@domain.com"] ("user@domain.com",""),Str ".",Space,Link [Str "mailto:user@domain.com"] ("user@domain.com",""),Str ".",Space,Str "any",Space,Str "text.",Space,Str "any",Space,Str "text:",Space,Link [Str "mailto:user@domain.com"] ("user@domain.com",""),Str ".",Space,Str "any",Space,Str "text.",Space,Link [Str "label"] ("user@domain.com",""),Space,Link [Str "mailto:user@domain.com?subject=bla"] ("user@domain.com?subject=bla",""),Space,Link [Str "mailto:user@domain.com?subject=bla"] ("user@domain.com?subject=bla",""),Str ".",Space,Link [Str "mailto:user@domain.com?subject=bla"] ("user@domain.com?subject=bla",""),Str ",",Space,Link [Str "mailto:user@domain.com?subject=bla&cc=otheruser@domain.com"] ("user@domain.com?subject=bla&cc=otheruser@domain.com",""),Space,Link [Str "mailto:user@domain.com?subject=bla&cc=otheruser@domain.com"] ("user@domain.com?subject=bla&cc=otheruser@domain.com",""),Str ".",Space,Link [Str "mailto:user@domain.com?subject=bla&cc=otheruser@domain.com"] ("user@domain.com?subject=bla&cc=otheruser@domain.com",""),Str ",",Space,Link [Str "label"] ("user@domain.com?subject=bla&cc=otheruser@domain.com",""),Str ".",Space,Link [Str "label"] ("user@domain.com?subject=bla&cc=otheruser@domain.com.",""),Str ".",Space,Link [Str "http://www.domain.com"] ("http://www.domain.com",""),Space,Link [Str "http://www.domain.com/dir/"] ("http://www.domain.com/dir/",""),Space,Link [Str "http://www.domain.com/dir///"] ("http://www.domain.com/dir///",""),Space,Link [Str "http://www.domain.com."] ("http://www.domain.com.",""),Space,Link [Str "http://www.domain.com,"] ("http://www.domain.com,",""),Space,Link [Str "http://www.domain.com."] ("http://www.domain.com.",""),Space,Str "any",Space,Str "text.",Space,Link [Str "http://www.domain.com,"] ("http://www.domain.com,",""),Space,Str "any",Space,Str "text.",Space,Link [Str "http://www.domain.com/dir/."] ("http://www.domain.com/dir/.",""),Space,Str "any",Space,Str "text.",Space,Str "any",Space,Str "text:",Space,Link [Str "http://www.domain.com."] ("http://www.domain.com.",""),Space,Str "any",Space,Str "text.",Space,Str "any",Space,Str "text:",Space,Link [Str "http://www.domain.com/dir/."] ("http://www.domain.com/dir/.",""),Space,Str "any",Space,Str "text.",Space,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.",Space,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.",Space,Link [Str "http://www.domain.com/dir/#anchor"] ("http://www.domain.com/dir/#anchor",""),Space,Link [Str "http://www.domain.com/dir/index.html#anchor"] ("http://www.domain.com/dir/index.html#anchor",""),Space,Link [Str "http://www.domain.com/dir/index.html#anchor."] ("http://www.domain.com/dir/index.html#anchor.",""),Space,Link [Str "http://www.domain.com/dir/#anchor."] ("http://www.domain.com/dir/#anchor.",""),Space,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.",Space,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.",Space,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.",Space,Link [Str "http://domain.com?a=a@a.a&b=a+b+c."] ("http://domain.com?a=a@a.a&b=a+b+c.",""),Space,Link [Str "http://domain.com?a=a@a.a&b=a+b+c,"] ("http://domain.com?a=a@a.a&b=a+b+c,",""),Space,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.",""),Space,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@.",""),Space,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",""),Space,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",""),Space,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",""),Space,Link [Str "http://user:password@domain.com/bla.html."] ("http://user:password@domain.com/bla.html.",""),Space,Link [Str "http://user:password@domain.com/dir/."] ("http://user:password@domain.com/dir/.",""),Space,Link [Str "http://user:password@domain.com."] ("http://user:password@domain.com.",""),Space,Link [Str "http://user:@domain.com."] ("http://user:@domain.com.",""),Space,Link [Str "http://user@domain.com."] ("http://user@domain.com.",""),Space,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",""),Space,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",""),Space,Link [Str "label"] ("www.domain.com",""),Space,Str "[",Space,Str "label",Space,Link [Str "www.domain.com"] ("www.domain.com",""),Str "]",Space,Link [Str "label",Space] ("www.domain.com",""),Space,Link [Str "anchor",Space] ("http://www.domain.com/dir/index.html#anchor.",""),Space,Link [Str "login",Space] ("http://user:password@domain.com/bla.html",""),Space,Link [Str "form",Space] ("http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.",""),Space,Link [Str "form",Space,Str "&",Space,Str "anchor"] ("http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor",""),Space,Link [Str "login",Space,Str "&",Space,Str "form",Space] ("http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.",""),Space,Link [Str "local",Space,Str "link",Space,Str "up",Space] ("..",""),Space,Link [Str "local",Space,Str "link",Space,Str "file",Space] ("bla.html",""),Space,Link [Str "local",Space,Str "link",Space,Str "anchor",Space] ("#anchor",""),Space,Link [Str "local",Space,Str "link",Space,Str "file/anchor"] ("bla.html#anchor",""),Space,Link [Str "local",Space,Str "link",Space,Str "file/anchor"] ("bla.html#anchor.",""),Space,Link [Str "local",Space,Str "link",Space,Str "img",Space] ("abc.gif",""),Space,Link [Str "www.fake.com"] ("www.domain.com",""),Space,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",""),Space,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=+.@*_-",""),Space,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%.",Space,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%.",Space,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",""),Space,Link [Str "www.domain.com"] ("www.domain.com",""),Space,Link [Str "www2.domain.com"] ("www2.domain.com",""),Space,Link [Str "ftp.domain.com"] ("ftp.domain.com",""),Space,Link [Str "WWW.DOMAIN.COM"] ("WWW.DOMAIN.COM",""),Space,Link [Str "FTP.DOMAIN.COM"] ("FTP.DOMAIN.COM",""),Space,Link [Str "label"] ("www.domain.com",""),Space,Link [Str "label"] ("ftp.domain.com",""),Space,Link [Str "label"] ("WWW.DOMAIN.COM",""),Space,Link [Str "label"] ("FTP.DOMAIN.COM",""),Space,Str "[label",Space,Link [Str "www.domain.com"] ("www.domain.com",""),Space,Str "]",Space,Str "[label]",Space,Link [Str "www.domain.com"] ("www.domain.com",""),Str "]"]
+,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","")] ("http://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",""),Space,Image [] ("img.png",""),Space,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 [Image ("",[],[]) [] ("img.png","")]
+,Para [Link ("",[],[]) [Image ("",[],[]) [] ("img.png","")] ("http://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 "]"]
@@ -67,8 +67,8 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "author"]]
 ,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++++",Space,Str "++++++Not",Space,Str "Title",Space,Str "6++++++"]
-,Para [Str "+++++++Not",Space,Str "Title",Space,Str "7+++++++",Space,Str "+Not",Space,Str "Title+",Space,Str "[label1]",Space,Str "+Not",Space,Str "Title+[",Space,Str "label",Space,Str "]",Space,Str "+Not",Space,Str "Title+[la/bel]"]
+,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"]
@@ -88,61 +88,61 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "author"]]
 ,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====",Space,Str "======Not",Space,Str "Title",Space,Str "6======"]
-,Para [Str "=======Not",Space,Str "Title",Space,Str "7=======",Space,Str "=Not",Space,Str "Title=",Space,Str "[label1]",Space,Str "=Not",Space,Str "Title=[",Space,Str "label",Space,Str "]",Space,Str "=Not",Space,Str "Title=[la/bel]"]
+,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",Space,Str "character.",Space,Str "All",Space,Str "the",Space,Str "lines",Space,Str "of",Space,Str "the",Space,Str "paragraph",Space,Str "must",Space,Str "begin",Space,Str "with",Space,Str "a",Space,Str "TAB."]]
+ [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",Space,Str "block",Space,Str "depth.",Space,Str "This",Space,Str "is",Space,Str "quote",Space,Str "level",Space,Str "1."]
+ [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",Space,Str "level",Space,Str "2."]
+  [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",Space,Str "the",Space,Str "quote",Space,Str "level."]
+   [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",Space,Str "level",Space,Str "4."]]
+    [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",Space,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",Space,Str "by",Space,Str "one."]
+   [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",Space,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",Space,Str "in",Space,Str "any",Space,Str "way."]
+    [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",Space,Str "nesting",Space,Str "of",Space,Str "quotes.",Space,Str "There",Space,Str "is",Space,Str "only",Space,Str "one",Space,Str "quote",Space,Str "level."]
+ [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",Space,Str "TABs",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "define",Space,Str "the",Space,Str "quote",Space,Str "block,",Space,Str "it",Space,Str "always",Space,Str "will",Space,Str "be",Space,Str "level",Space,Str "1."]]]
+  [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.",Space,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",Space,Str "invalidate",Space,Str "the",Space,Str "mark.",Space,Str "It's",Space,Str "not",Space,Str "quote."]
+ [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",Space,Str "possible."]
- ,Para [Str "This",Space,Str "sample",Space,Str "are",Space,Str "two",Space,Str "separated",Space,Str "quoted",Space,Str "paragraphs,",Space,Str "not",Space,Str "a",Space,Str "quote",Space,Str "block",Space,Str "with",Space,Str "two",Space,Str "paragraphs",Space,Str "inside."]]
+ [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",Space,Str "currently",Space,Str "open",Space,Str "quote",Space,Str "block."]]
+ [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 "\"\"\"",Space,Str "Not",Space,Str "a",Space,Str "raw",Space,Str "area.",Space,Str "The",Space,Str "marks",Space,Str "must",Space,Str "be",Space,Str "at",Space,Str "the",Space,Str "line",Space,Str "beginning,",Space,Str "no",Space,Str "leading",Space,Str "spaces.",Space,Str "\"\"\""]
+,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"
@@ -150,7 +150,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "author"]]
 ,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 "```",Space,Str "Not",Space,Str "a",Space,Str "verbatim",Space,Str "area.",Space,Str "The",Space,Str "marks",Space,Str "must",Space,Str "be",Space,Str "at",Space,Str "the",Space,Str "line",Space,Str "beginning,",Space,Str "no",Space,Str "leading",Space,Str "spaces.",Space,Str "```"]
+,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
@@ -159,7 +159,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "author"]]
  ,([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."]
+,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."]]
@@ -173,7 +173,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "author"]]
  [[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.",Space,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 "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)"]
@@ -285,8 +285,8 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "author"]]
    [[Plain [Str "Level",Space,Str "2"]
     ,BulletList
      [[Plain [Str "Level",Space,Str "3"]]]
-    ,Plain [Str "-",Space,Str "Level",Space,Str "2"]]]
-  ,Plain [Str "-",Space,Str "Level",Space,Str "1"]]]
+    ,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."]]]
diff --git a/tests/writer.asciidoc b/tests/writer.asciidoc
index aebc529..8d09736 100644
--- a/tests/writer.asciidoc
+++ b/tests/writer.asciidoc
@@ -1,8 +1,7 @@
 Pandoc Test Suite
 =================
-:author: John MacFarlane
-:author: Anonymous
-:date: July 17, 2006
+John MacFarlane; Anonymous
+July 17, 2006
 
 This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
 markdown test suite.
@@ -81,11 +80,11 @@ ______________________
 --
 Code in a block quote:
 
---------------------
+....
 sub status {
     print "working";
 }
---------------------
+....
 
 A list:
 
@@ -117,7 +116,7 @@ Code Blocks
 
 Code:
 
---------------------------------------
+....
 ---- (should be four hyphens)
 
 sub status {
@@ -125,15 +124,15 @@ sub status {
 }
 
 this code block is indented by one tab
---------------------------------------
+....
 
 And:
 
---------------------------------------------
+....
     this code block is indented by two tabs
 
 These should not be escaped:  \$ \\ \> \[ \{
---------------------------------------------
+....
 
 '''''
 
@@ -326,9 +325,9 @@ _apple_::
 _orange_::
   orange fruit
   +
----------------------
+....
 { orange code block }
----------------------
+....
   +
   __________________
   orange block quote
@@ -394,17 +393,17 @@ foo
 
 This should be a code block, though:
 
--------
+....
 <div>
     foo
 </div>
--------
+....
 
 As should this:
 
---------------
+....
 <div>foo</div>
---------------
+....
 
 Now, nested:
 
@@ -416,17 +415,17 @@ Multiline:
 
 Code block:
 
-----------------
+....
 <!-- Comment -->
-----------------
+....
 
 Just plain comment, with trailing spaces on the line:
 
 Code:
 
-------
+....
 <hr />
-------
+....
 
 Hr’s:
 
@@ -617,9 +616,9 @@ Indented link:/url[thrice].
 
 This should [not][] be a link.
 
------------
+....
 [not]: /url
------------
+....
 
 Foo link:/url/[bar].
 
@@ -655,9 +654,9 @@ ________________________________
 
 Auto-links should not occur here: `<http://example.com/>`
 
-------------------------------
+....
 or here: <http://example.com/>
-------------------------------
+....
 
 '''''
 
diff --git a/tests/writer.context b/tests/writer.context
index 29af26d..04df661 100644
--- a/tests/writer.context
+++ b/tests/writer.context
@@ -1,27 +1,34 @@
-\startmode[*mkii]
-  \enableregime[utf-8]  
-  \setupcolors[state=start]
-\stopmode
-
 % Enable hyperlinks
-\setupinteraction[state=start, color=middleblue]
-
-\setuppapersize [letter][letter]
-\setuplayout    [width=middle,  backspace=1.5in, cutspace=1.5in,
-                 height=middle, topspace=0.75in, bottomspace=0.75in]
-
-\setuppagenumbering[location={footer,center}]
-
-\setupbodyfont[11pt]
-
+\setupinteraction
+  [state=start,
+  title={Pandoc Test Suite},
+  author={John MacFarlane; Anonymous},
+  style=,
+  color=,
+  contrastcolor=]
+% make chapter, section bookmarks visible when opening document
+\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
+\setupinteractionscreen[option=bookmark]
+\setuptagging[state=start]
+
+% use microtypography
+\definefontfeature[default][default][script=latn, protrusion=quality, expansion=quality, itlc=yes, textitalics=yes, onum=yes, pnum=yes]
+\definefontfeature[smallcaps][script=latn, protrusion=quality, expansion=quality, smcp=yes, onum=yes, pnum=yes]
+\setupalign[hz,hanging]
+\setupitaliccorrection[global, always]
+\setupbodyfontenvironment[default][em=italic] % use italic as em, not slanted
+\usemodule[simplefonts]
+\setmainfontfallback[DejaVu Serif][range={greekandcoptic, greekextended}, force=yes, rscale=auto]
 \setupwhitespace[medium]
 
-\setuphead[chapter]      [style=\tfd]
-\setuphead[section]      [style=\tfc]
-\setuphead[subsection]   [style=\tfb]
-\setuphead[subsubsection][style=\bf]
+\setuphead[chapter]            [style=\tfd,header=empty]
+\setuphead[section]            [style=\tfc]
+\setuphead[subsection]         [style=\tfb]
+\setuphead[subsubsection]      [style=\bf]
+\setuphead[subsubsubsection]   [style=\sc]
+\setuphead[subsubsubsubsection][style=\it]
 
-\setuphead[chapter, section, subsection, subsubsection][number=no]
+\setuphead[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][number=no]
 
 \definedescription
   [description]
@@ -35,23 +42,15 @@
 
 \setupthinrules[width=15em] % width of horizontal rules
 
-\setupdelimitedtext
-  [blockquote]
-  [before={\blank[medium]},
-   after={\blank[medium]},
-   indentnext=no,
-  ]
-
 
 \starttext
-\startalignment[center]
-  \blank[2*big]
+\startalignment[middle]
   {\tfd Pandoc Test Suite}
-  \blank[3*medium]
+  \smallskip
   {\tfa John MacFarlane\crlf Anonymous}
-  \blank[2*medium]
+  \smallskip
   {\tfa July 17, 2006}
-  \blank[3*medium]
+  \bigskip
 \stopalignment
 
 This is a set of tests for pandoc. Most of them are adapted from John Gruber's
@@ -545,11 +544,13 @@ Blank line after term, indented marker, alternate markers:
 Simple block on one line:
 
 foo
+
 And nested without indentation:
 
 foo
 
 bar
+
 Interpreted markdown in a table:
 
 This is {\em emphasized}
@@ -575,6 +576,7 @@ As should this:
 Now, nested:
 
 foo
+
 This should just be an HTML comment:
 
 Multiline:
diff --git a/tests/writer.dokuwiki b/tests/writer.dokuwiki
index fe1f829..79fcdde 100644
--- a/tests/writer.dokuwiki
+++ b/tests/writer.dokuwiki
@@ -459,7 +459,7 @@ Ellipses…and…and….
   * $\alpha \wedge \omega$
   * $223$
   * $p$-Tree
-  * Here’s some display math: $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
+  * Here’s some display math: $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
   * Here’s one that has a line break in it: $\alpha + \omega \times x^2$.
 
 These shouldn’t be math:
diff --git a/tests/writer.icml b/tests/writer.icml
index b6f5b5e..b498f56 100644
--- a/tests/writer.icml
+++ b/tests/writer.icml
@@ -215,6 +215,11 @@
           </TabList>
         </Properties>
       </ParagraphStyle>
+      <ParagraphStyle Self="ParagraphStyle/Caption" Name="Caption" LeftIndent="0">
+        <Properties>
+          <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
+        </Properties>
+      </ParagraphStyle>
       <ParagraphStyle Self="ParagraphStyle/CodeBlock" Name="CodeBlock" LeftIndent="0">
         <Properties>
           <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
@@ -257,6 +262,11 @@
           <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
         </Properties>
       </ParagraphStyle>
+      <ParagraphStyle Self="ParagraphStyle/Figure" Name="Figure" LeftIndent="0">
+        <Properties>
+          <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
+        </Properties>
+      </ParagraphStyle>
       <ParagraphStyle Self="ParagraphStyle/Footnote &gt; CodeBlock" Name="Footnote &gt; CodeBlock" LeftIndent="0">
         <Properties>
           <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
@@ -429,13 +439,15 @@
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This is a set of tests for pandoc. Most of them are adapted from John Gruber’s markdown test suite.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Headers</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Level 2 with an </Content>
@@ -444,79 +456,93 @@
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
       <Content>embedded link</Content>
     </CharacterStyleRange>
-  </HyperlinkTextSource><Br />
+  </HyperlinkTextSource>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header3">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Level 3 with </Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
     <Content>emphasis</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header4">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Level 4</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header5">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Level 5</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Level 1</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Level 2 with </Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
     <Content>emphasis</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header3">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Level 3</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>with no blank line</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Level 2</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>with no blank line</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Paragraphs</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s a regular paragraph.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>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.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s one with a bullet. * criminey.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>There should be a hard line break</Content>
@@ -526,85 +552,101 @@
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>here.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Block Quotes</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>E-mail style:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This is a block quote. It is pretty short.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Code in a block quote:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; CodeBlock">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>sub status {
     print &quot;working&quot;;
 }</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>A list:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; NumList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>item one</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; NumList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>item two</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Nested block quotes:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; Blockquote &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>nested</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; Blockquote &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>nested</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This should not be a block quote: 2 &gt; 1.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>And a following paragraph.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Code Blocks</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Code:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/CodeBlock">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>---- (should be four hyphens)
@@ -614,879 +656,1051 @@ sub status {
 }
 
 this code block is indented by one tab</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>And:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/CodeBlock">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>    this code block is indented by two tabs
 
 These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Lists</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Unordered</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Asterisks tight:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>asterisk 1</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>asterisk 2</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>asterisk 3</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Asterisks loose:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first &gt; Paragraph" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>asterisk 1</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>asterisk 2</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>asterisk 3</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Pluses tight:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Plus 1</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Plus 2</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Plus 3</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Pluses loose:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first &gt; Paragraph" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Plus 1</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Plus 2</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Plus 3</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Minuses tight:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Minus 1</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Minus 2</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Minus 3</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Minuses loose:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first &gt; Paragraph" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Minus 1</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Minus 2</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Minus 3</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Ordered</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Tight:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>First</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Second</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Third</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>and:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>One</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Two</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Three</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Loose using tabs:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; first &gt; Paragraph" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>First</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Second</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Third</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>and using spaces:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; first &gt; Paragraph" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>One</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Two</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Three</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Multiple paragraphs:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; first &gt; Paragraph" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Item 1, graf one.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; subParagraph &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>	</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Item 2.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Item 3.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Nested</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Tab</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Tab</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; BulList &gt; BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Tab</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s another:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>First</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Second:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Fee</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Fie</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Foe</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Third</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Same thing but with paragraphs:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; first &gt; Paragraph" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>First</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Second:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Fee</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Fie</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Foe</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Third</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Tabs and spaces</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first &gt; Paragraph" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>this is a list item indented with tabs</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>this is a list item indented with spaces</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; BulList &gt; first &gt; Paragraph" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>this is an example list item indented with tabs</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; BulList &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>this is an example list item indented with spaces</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Fancy list markers</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange NumberingStartAt="2" AppliedParagraphStyle="ParagraphStyle/NumList &gt; first &gt; beginsWith-2" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>begins with 2</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; beginsWith-2 &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>and now 3</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; subParagraph &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>	</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>with a continuation</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange NumberingStartAt="4" AppliedParagraphStyle="ParagraphStyle/NumList &gt; NumList &gt; first &gt; beginsWith-4 &gt; lowerRoman" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>sublist with roman numerals, starting with 4</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; NumList &gt; beginsWith-4 &gt; lowerRoman">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>more items</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; NumList &gt; NumList &gt; first &gt; upperAlpha" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>a subsublist</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; NumList &gt; NumList &gt; upperAlpha">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>a subsublist</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Nesting:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; first &gt; upperAlpha" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Upper Alpha</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; NumList &gt; first &gt; upperRoman" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Upper Roman.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange NumberingStartAt="6" AppliedParagraphStyle="ParagraphStyle/NumList &gt; NumList &gt; NumList &gt; first &gt; beginsWith-6" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Decimal start with 6</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange NumberingStartAt="3" AppliedParagraphStyle="ParagraphStyle/NumList &gt; NumList &gt; NumList &gt; NumList &gt; first &gt; beginsWith-3 &gt; lowerAlpha" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Lower alpha with paren</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Autonumbering:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Autonumber.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>More.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; NumList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Nested.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Should not be a list item:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>M.A. 2007</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>B. Williams</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Definition Lists</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Tight using spaces:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>apple</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>red fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>banana</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>yellow fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Tight using tabs:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>apple</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>red fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>banana</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>yellow fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Loose:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>apple</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>red fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>banana</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>yellow fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Multiple blocks with italics:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
     <Content>apple</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>red fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>contains seeds, crisp, pleasant to taste</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
     <Content>orange</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; CodeBlock">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>{ orange code block }</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Blockquote &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange block quote</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Multiple definitions, tight:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>apple</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>red fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>computer</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>bank</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Multiple definitions, loose:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>apple</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>red fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>computer</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>bank</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Blank line after term, indented marker, alternate markers:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>apple</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>red fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>computer</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListTerm">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>orange fruit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; NumList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>sublist</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/DefListDef &gt; NumList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>sublist</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>HTML Blocks</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Simple block on one line:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>foo</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>And nested without indentation:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>foo</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>bar</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Interpreted markdown in a table:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This is </Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
     <Content>emphasized</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>And this is </Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Bold">
     <Content>strong</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s a simple block:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>foo</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This should be a code block, though:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/CodeBlock">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>&lt;div&gt;
     foo
 &lt;/div&gt;</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>As should this:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/CodeBlock">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>&lt;div&gt;foo&lt;/div&gt;</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Now, nested:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>foo</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This should just be an HTML comment:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Multiline:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Code block:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/CodeBlock">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>&lt;!-- Comment --&gt;</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Just plain comment, with trailing spaces on the line:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Code:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/CodeBlock">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>&lt;hr /&gt;</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Hr’s:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Inline Markup</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This is </Content>
@@ -1502,8 +1716,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This is </Content>
@@ -1519,8 +1734,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>An </Content>
@@ -1532,13 +1748,15 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Bold Italic">
     <Content>This is strong and em.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>So is </Content>
@@ -1548,13 +1766,15 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content> word.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Bold Italic">
     <Content>This is strong and em.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>So is </Content>
@@ -1564,8 +1784,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content> word.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This is code: </Content>
@@ -1599,8 +1820,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Strikeout">
     <Content>This is </Content>
@@ -1610,8 +1832,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Strikeout">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Superscripts: a</Content>
@@ -1633,8 +1856,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Subscripts: H</Content>
@@ -1656,18 +1880,21 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>O.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Smart quotes, ellipses, dashes</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>“</Content>
@@ -1698,8 +1925,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>”</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>‘</Content>
@@ -1736,8 +1964,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content> are letters.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>‘</Content>
@@ -1783,8 +2012,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>’</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>‘</Content>
@@ -1806,8 +2036,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content> Were you alive in the 70’s?</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here is some quoted </Content>
@@ -1837,83 +2068,146 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Some dashes: one—two — three—four — five.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Dashes between numbers: 5–7, 255–66, 1987–1999.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Ellipses…and…and….</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>LaTeX</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first" NumberingContinue="false">
-  <Br />
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
-    <Content>2+2=4</Content>
-  </CharacterStyleRange><Br />
+    <Content>2</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content>+</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content>2</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content>=</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content>4</Content>
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
-  <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
-    <Content>x \in y</Content>
-  </CharacterStyleRange><Br />
-</ParagraphStyleRange>
+  <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
+    <Content>x</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content>∈</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
+    <Content>y</Content>
+  </CharacterStyleRange>
+</ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
-  <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
-    <Content>\alpha \wedge \omega</Content>
-  </CharacterStyleRange><Br />
-</ParagraphStyleRange>
+  <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
+    <Content>α</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content>∧</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
+    <Content>ω</Content>
+  </CharacterStyleRange>
+</ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>223</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
-  <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+  <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
     <Content>p</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>-Tree</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s some display math: </Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
-    <Content>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</Content>
-  </CharacterStyleRange><Br />
+    <Content>$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$</Content>
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s one that has a line break in it: </Content>
   </CharacterStyleRange>
-  <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
-    <Content>\alpha + \omega \times x^2</Content>
+  <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
+    <Content>α</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content>+</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
+    <Content>ω</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content>×</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content> </Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
+    <Content>x</Content>
+  </CharacterStyleRange><CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Superscript">
+    <Content>2</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>These shouldn’t be math:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>To get the famous equation, write </Content>
@@ -1923,8 +2217,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>$22,000 is a </Content>
@@ -1946,13 +2241,15 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content> is emphasized.)</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Shoes ($20) and socks ($5).</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Escaped </Content>
@@ -1968,163 +2265,195 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content> 23$.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s a LaTeX table:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Special Characters</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here is some unicode:</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>I hat: Î</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>o umlaut: ö</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>section: §</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>set membership: ∈</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>copyright: ©</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>AT&amp;T has an ampersand in their name.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>AT&amp;T is another way to write it.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This &amp; that.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>4 &lt; 5.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>6 &gt; 5.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Backslash: \</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Backtick: `</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Asterisk: *</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Underscore: _</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Left brace: {</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Right brace: }</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Left bracket: [</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Right bracket: ]</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Left paren: (</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Right paren: )</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Greater-than: &gt;</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Hash: #</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Period: .</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Bang: !</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Plus: +</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Minus: -</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Links</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Explicit</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Just a </Content>
@@ -2136,8 +2465,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <HyperlinkTextSource Self="htss-5" Name="title" Hidden="false">
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
@@ -2146,8 +2476,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <HyperlinkTextSource Self="htss-6" Name="title preceded by two spaces" Hidden="false">
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
@@ -2156,8 +2487,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <HyperlinkTextSource Self="htss-7" Name="title preceded by a tab" Hidden="false">
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
@@ -2166,36 +2498,41 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <HyperlinkTextSource Self="htss-8" Name="title with &quot;quotes&quot; in it" Hidden="false">
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
       <Content>URL and title</Content>
     </CharacterStyleRange>
-  </HyperlinkTextSource><Br />
+  </HyperlinkTextSource>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <HyperlinkTextSource Self="htss-9" Name="title with single quotes" Hidden="false">
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
       <Content>URL and title</Content>
     </CharacterStyleRange>
-  </HyperlinkTextSource><Br />
+  </HyperlinkTextSource>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <HyperlinkTextSource Self="htss-10" Name="" Hidden="false">
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
       <Content>with_underscore</Content>
     </CharacterStyleRange>
-  </HyperlinkTextSource><Br />
+  </HyperlinkTextSource>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <HyperlinkTextSource Self="htss-11" Name="" Hidden="false">
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
       <Content>Email link</Content>
     </CharacterStyleRange>
-  </HyperlinkTextSource><Br />
+  </HyperlinkTextSource>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <HyperlinkTextSource Self="htss-12" Name="" Hidden="false">
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
@@ -2204,13 +2541,15 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Reference</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Foo </Content>
@@ -2222,8 +2561,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Foo </Content>
@@ -2235,8 +2575,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Foo </Content>
@@ -2248,8 +2589,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>With </Content>
@@ -2261,8 +2603,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <HyperlinkTextSource Self="htss-17" Name="" Hidden="false">
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
@@ -2271,8 +2614,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content> by itself should be a link.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Indented </Content>
@@ -2284,8 +2628,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Indented </Content>
@@ -2297,8 +2642,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Indented </Content>
@@ -2310,18 +2656,21 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This should [not][] be a link.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/CodeBlock">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>[not]: /url</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Foo </Content>
@@ -2333,8 +2682,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Foo </Content>
@@ -2346,13 +2696,15 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>With ampersands</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s a </Content>
@@ -2364,8 +2716,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s a link with an amersand in the link text: </Content>
@@ -2377,8 +2730,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s an </Content>
@@ -2390,8 +2744,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here’s an </Content>
@@ -2403,13 +2758,15 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </HyperlinkTextSource>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Autolinks</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>With an ampersand: </Content>
@@ -2418,25 +2775,29 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
       <Content>http://example.com/?foo=1&amp;bar=2</Content>
     </CharacterStyleRange>
-  </HyperlinkTextSource><Br />
+  </HyperlinkTextSource>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>In a list?</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <HyperlinkTextSource Self="htss-28" Name="" Hidden="false">
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
       <Content>http://example.com/</Content>
     </CharacterStyleRange>
-  </HyperlinkTextSource><Br />
+  </HyperlinkTextSource>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BulList">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>It should.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>An e-mail address: </Content>
@@ -2445,8 +2806,9 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
       <Content>nobody@nowhere.net</Content>
     </CharacterStyleRange>
-  </HyperlinkTextSource><Br />
+  </HyperlinkTextSource>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Blockquoted: </Content>
@@ -2455,26 +2817,30 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
     <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
       <Content>http://example.com/</Content>
     </CharacterStyleRange>
-  </HyperlinkTextSource><Br />
+  </HyperlinkTextSource>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Auto-links should not occur here: </Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Code">
     <Content>&lt;http://example.com/&gt;</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/CodeBlock">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>or here: &lt;http://example.com/&gt;</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Images</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>From </Content>
@@ -2490,58 +2856,64 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content> by Georges Melies (1902):</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
-<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
+<Br />
+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Figure">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
-    <Rectangle Self="uec" ItemTransform="1 0 0 1 75 -50">
+    <Rectangle Self="uec" StrokeWeight="0" ItemTransform="1.00000 0 0 1.00000 75.00000 -75.00000">
       <Properties>
         <PathGeometry>
           <GeometryPathType PathOpen="false">
             <PathPointArray>
-              <PathPointType Anchor="-75 -50" LeftDirection="-75 -50" RightDirection="-75 -50" />
-              <PathPointType Anchor="-75 50" LeftDirection="-75 50" RightDirection="-75 50" />
-              <PathPointType Anchor="75 50" LeftDirection="75 50" RightDirection="75 50" />
-              <PathPointType Anchor="75 -50" LeftDirection="75 -50" RightDirection="75 -50" />
+              <PathPointType Anchor="-75.00000 -75.00000" LeftDirection="-75.00000 -75.00000" RightDirection="-75.00000 -75.00000" />
+              <PathPointType Anchor="-75.00000 75.00000" LeftDirection="-75.00000 75.00000" RightDirection="-75.00000 75.00000" />
+              <PathPointType Anchor="75.00000 75.00000" LeftDirection="75.00000 75.00000" RightDirection="75.00000 75.00000" />
+              <PathPointType Anchor="75.00000 -75.00000" LeftDirection="75.00000 -75.00000" RightDirection="75.00000 -75.00000" />
             </PathPointArray>
           </GeometryPathType>
         </PathGeometry>
       </Properties>
-      <Image Self="ue6" ItemTransform="1.0 0 0 1.0 -75 -50">
+      <Image Self="ue6" ItemTransform="1.00000 0 0 1.00000 -75.00000 -75.00000">
         <Properties>
           <Profile type="string">
             $ID/Embedded
-            <GraphicBounds Left="0" Top="0" Right="150" Bottom="100" />
           </Profile>
         </Properties>
         <Link Self="ueb" LinkResourceURI="file:lalune.jpg" />
       </Image>
     </Rectangle>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Caption">
+  <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
+    <Content>lalune</Content>
+  </CharacterStyleRange>
+</ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here is a movie </Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
-    <Rectangle Self="uec" ItemTransform="1 0 0 1 75 -50">
+    <Rectangle Self="uec" StrokeWeight="0" ItemTransform="1.00000 0 0 1.00000 10.00000 -11.00000">
       <Properties>
         <PathGeometry>
           <GeometryPathType PathOpen="false">
             <PathPointArray>
-              <PathPointType Anchor="-75 -50" LeftDirection="-75 -50" RightDirection="-75 -50" />
-              <PathPointType Anchor="-75 50" LeftDirection="-75 50" RightDirection="-75 50" />
-              <PathPointType Anchor="75 50" LeftDirection="75 50" RightDirection="75 50" />
-              <PathPointType Anchor="75 -50" LeftDirection="75 -50" RightDirection="75 -50" />
+              <PathPointType Anchor="-10.00000 -11.00000" LeftDirection="-10.00000 -11.00000" RightDirection="-10.00000 -11.00000" />
+              <PathPointType Anchor="-10.00000 11.00000" LeftDirection="-10.00000 11.00000" RightDirection="-10.00000 11.00000" />
+              <PathPointType Anchor="10.00000 11.00000" LeftDirection="10.00000 11.00000" RightDirection="10.00000 11.00000" />
+              <PathPointType Anchor="10.00000 -11.00000" LeftDirection="10.00000 -11.00000" RightDirection="10.00000 -11.00000" />
             </PathPointArray>
           </GeometryPathType>
         </PathGeometry>
       </Properties>
-      <Image Self="ue6" ItemTransform="1.0 0 0 1.0 -75 -50">
+      <Image Self="ue6" ItemTransform="1.00000 0 0 1.00000 -10.00000 -11.00000">
         <Properties>
           <Profile type="string">
             $ID/Embedded
-            <GraphicBounds Left="0" Top="0" Right="150" Bottom="100" />
           </Profile>
         </Properties>
         <Link Self="ueb" LinkResourceURI="file:movie.jpg" />
@@ -2550,13 +2922,15 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
   </CharacterStyleRange>
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content> icon.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Footnotes</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Here is a footnote reference,</Content>
@@ -2574,7 +2948,7 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
         </CharacterStyleRange>
         <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
           <Content>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.</Content>
-        </CharacterStyleRange><Br />
+        </CharacterStyleRange>
       </ParagraphStyleRange>
     </Footnote>
   </CharacterStyleRange>
@@ -2594,28 +2968,31 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
         </CharacterStyleRange>
         <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
           <Content>Here’s the long note. This one contains multiple blocks.</Content>
-        </CharacterStyleRange><Br />
+        </CharacterStyleRange>
       </ParagraphStyleRange>
+      <Br />
       <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Footnote &gt; Paragraph">
         <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
           <Content>	</Content>
         </CharacterStyleRange>
         <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
           <Content>Subsequent blocks are indented to show that they belong to the footnote (as with list items).</Content>
-        </CharacterStyleRange><Br />
+        </CharacterStyleRange>
       </ParagraphStyleRange>
+      <Br />
       <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Footnote &gt; CodeBlock">
         <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
           <Content>  { &lt;code&gt; }</Content>
-        </CharacterStyleRange><Br />
+        </CharacterStyleRange>
       </ParagraphStyleRange>
+      <Br />
       <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Footnote &gt; Paragraph">
         <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
           <Content>	</Content>
         </CharacterStyleRange>
         <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
           <Content>If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.</Content>
-        </CharacterStyleRange><Br />
+        </CharacterStyleRange>
       </ParagraphStyleRange>
     </Footnote>
   </CharacterStyleRange>
@@ -2661,11 +3038,12 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
         </CharacterStyleRange>
         <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
           <Content> verbatim characters, as well as [bracketed text].</Content>
-        </CharacterStyleRange><Br />
+        </CharacterStyleRange>
       </ParagraphStyleRange>
     </Footnote>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Blockquote &gt; Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>Notes can go in quotes.</Content>
@@ -2683,11 +3061,12 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
         </CharacterStyleRange>
         <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
           <Content>In quote.</Content>
-        </CharacterStyleRange><Br />
+        </CharacterStyleRange>
       </ParagraphStyleRange>
     </Footnote>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/NumList &gt; first" NumberingContinue="false">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>And in list items.</Content>
@@ -2705,15 +3084,16 @@ These should not be escaped:  \$ \\ \&gt; \[ \{</Content>
         </CharacterStyleRange>
         <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
           <Content>In list.</Content>
-        </CharacterStyleRange><Br />
+        </CharacterStyleRange>
       </ParagraphStyleRange>
     </Footnote>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
+<Br />
 <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
     <Content>This paragraph should not be part of the note, as it is not indented.</Content>
-  </CharacterStyleRange><Br />
+  </CharacterStyleRange>
 </ParagraphStyleRange>
 
   </Story>
diff --git a/tests/writer.latex b/tests/writer.latex
index 392c556..7e7a02f 100644
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -12,8 +12,7 @@
   \else
     \usepackage{fontspec}
   \fi
-  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
-  \newcommand{\euro}{€}
+  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
 \fi
 % use upquote if available, for straight quotes in verbatim environments
 \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
@@ -22,32 +21,12 @@
 \usepackage{microtype}
 \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
 }{}
-\makeatletter
-\@ifpackageloaded{hyperref}{}{%
-\ifxetex
-  \usepackage[setpagesize=false, % page size defined by xetex
-              unicode=false, % unicode breaks when used with xetex
-              xetex]{hyperref}
-\else
-  \usepackage[unicode=true]{hyperref}
-\fi
-}
-\@ifpackageloaded{color}{
-    \PassOptionsToPackage{usenames,dvipsnames}{color}
-}{%
-    \usepackage[usenames,dvipsnames]{color}
-}
-\makeatother
-\hypersetup{breaklinks=true,
-            bookmarks=true,
-            pdfauthor={John MacFarlane; Anonymous},
+\usepackage{hyperref}
+\hypersetup{unicode=true,
             pdftitle={Pandoc Test Suite},
-            colorlinks=true,
-            citecolor=blue,
-            urlcolor=blue,
-            linkcolor=magenta,
-            pdfborder={0 0 0}
-            }
+            pdfauthor={John MacFarlane; Anonymous},
+            pdfborder={0 0 0},
+            breaklinks=true}
 \urlstyle{same}  % don't use monospace font for urls
 \usepackage{fancyvrb}
 \VerbatimFootnotes % allows verbatim text in footnotes
@@ -63,17 +42,16 @@
 \usepackage[normalem]{ulem}
 % avoid problems with \sout in headers with hyperref:
 \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
+\IfFileExists{parskip.sty}{%
+\usepackage{parskip}
+}{% else
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
+}
 \setlength{\emergencystretch}{3em}  % prevent overfull lines
 \providecommand{\tightlist}{%
   \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
 \setcounter{secnumdepth}{0}
-
-\title{Pandoc Test Suite}
-\author{John MacFarlane \and Anonymous}
-\date{July 17, 2006}
-
 % Redefines (sub)paragraphs to behave more like sections
 \ifx\paragraph\undefined\else
 \let\oldparagraph\paragraph
@@ -84,6 +62,10 @@
 \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
 \fi
 
+\title{Pandoc Test Suite}
+\author{John MacFarlane \and Anonymous}
+\date{July 17, 2006}
+
 \begin{document}
 \maketitle
 
diff --git a/tests/writer.man b/tests/writer.man
index 4b07317..b0aece9 100644
--- a/tests/writer.man
+++ b/tests/writer.man
@@ -1,7 +1,5 @@
-.\" Automatically generated by Pandoc 1.15.1
-.\"
-.hy
 .TH "Pandoc Test Suite" "" "July 17, 2006" "" ""
+.hy
 .PP
 This is a set of tests for pandoc.
 Most of them are adapted from John Gruber's markdown test suite.
diff --git a/tests/writer.markdown b/tests/writer.markdown
index 6a0b980..d705bb0 100644
--- a/tests/writer.markdown
+++ b/tests/writer.markdown
@@ -4,7 +4,7 @@ author:
 - Anonymous
 date: 'July 17, 2006'
 title: Pandoc Test Suite
-...
+---
 
 This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
 markdown test suite.
diff --git a/tests/writer.native b/tests/writer.native
index 0537209..fa234df 100644
--- a/tests/writer.native
+++ b/tests/writer.native
@@ -1,8 +1,8 @@
 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",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",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 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"]
@@ -15,14 +15,14 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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",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\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
+,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.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
+ [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}"
@@ -35,7 +35,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
   [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 "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"]
@@ -100,7 +100,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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",Space,Str "back."]]
+  ,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"]
@@ -130,18 +130,18 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
  ,[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"]
+ [[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",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"]]]]]
+   [[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)
  [[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,Period)
-   [[Plain [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",Space,Str "starting",Space,Str "with",Space,Str "4"]]
+   [[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"]]
@@ -194,7 +194,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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"]]])
+    ,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 }"
@@ -286,7 +286,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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 [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."]]]
@@ -295,14 +295,14 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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,",Space,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."]
+,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.",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."]],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",Space,Quoted DoubleQuote [Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."]
+,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."]
@@ -315,12 +315,12 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
  ,[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:",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]]
+ ,[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.",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized.)"]]
+ ,[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:"]
@@ -358,52 +358,52 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
 ,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 "."]
+,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 "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 "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 "."]
+,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 "."]
+,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 [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
+,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 [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,Link [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
+,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Link ("",[],[]) [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
 ,BlockQuote
- [Para [Str "Blockquoted:",Space,Link [Str "http://example.com/"] ("http://example.com/","")]]
+ [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,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."]
+,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",Space,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",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",Space,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",Space,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,",Space,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",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
+,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)
diff --git a/tests/writer.rtf b/tests/writer.rtf
index 08d3c1f..a79ae6f 100644
--- a/tests/writer.rtf
+++ b/tests/writer.rtf
@@ -429,8 +429,8 @@ http://example.com/
 {\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}
 {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Images\par}
 {\pard \ql \f0 \sa180 \li0 \fi0 From \u8220"Voyage dans la Lune\u8221" by Georges Melies (1902):\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 {\pict\jpegblip\picw250\pich250\picwgoal3000\pichgoal3000 ffd8ffe000104a46494600010101007800780000ffdb00430006040506050406060506070706080a100a0a09090a140e0f0c1017141818171416161a1d251f1a1b231c1616202c20232627292a29191f2d302d283025282928ffdb0043010707070a080a130a0a13281a161a2828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828ffc000110800fa00fa03011100021101031101ffc4001c0000000701010000000000000000000000010203040506070008ffc4003e100002010303020404040502050500030001020300041105122106311322415107617181143291a1234252b1c115f016336272d1082443e1f1265382ffc40017010101010100000000000000000000000000010204ffc4001b11010101010003010000000000000000000001110212213141ffda000c03010002110311003f00dadd18a10a704f6a95ccc57e37750782b0d8d9ea0cd32e7c5446e07e9f4ad723119a7b89e61e348f260719278aad613cbb640002938c76a182b264fc87bd13009c0c019c76e3d68a072e1cf6f4cd502d330c28269a61bb39c923923d4fad44c08dccb95cfd28b8280769ee08a263891e1808739e4f1d8d149392172cc714050dbb9fde8960ed8c60b79b1ed44103b05c331dbdb1dc5026ac1946d20ff8140aa631c773ec738a0346a003bf93e9cf02801895e7b9a01886796c923bd0090a06393c76a0142003ce3d86680d8dd9392303f5341ccc1b3cf7a2c812c37e4923d381429757013209fa511c18146c9247a0f6a007900c0c671c6280854e086c673eb45c27c038fd68aedff2fda836ef881f136f25d5e6b7d1262964aa02b03f98fbf153131935edcc97576f35c33349212cc4f39f7ab26186dfce5b200f73451f7600dcb8cf27e7400c0b291914046c9e0718fde81371b8e7273f4ef4007691919240e714097f31f376e7b5008caee27807b0f5a02c8e1b3c6d27d33cd0201d839523144d1a149ae084b78da47638211771fd050d582c3a0faab5119b6d12f8ab1c06788a0fd4e2ac356fd1fe08754ddccaba849696309e598c9e2103fed1dcfdeadc44fea5ff00a7f956366d375e492403ca935bedcf1eea4ff6ac68a55efc1beb3b552574f8e7009ff933a927ec715bc82b3a8f4d6bba5ca1352d22fe061cf9a0383f71dea5119cc6c0baed3eaac0f1fad40897dcc3d81f7a052366c1007df3400f21edefc5008c28f30c9c5170ee4fc37830086395250a7c66770c18e78da31c0c63de8609b41f7c515c5172a30c3b76344a3e377cb2339cf7a242aea89808cce368272b8c1a2e107c672a49f5c1a181c9c7ae7da8a2119e7b1f5068099ffa68258a132062d8f9e0f34059502b61bf2824e681bb297ced2a71efda80f19c47b9c77fdbe74057c13e539cf3c1a0eeeb9c73f33405ddb4f18249c1e28062b79ae242902024465b9214614649e7bd0362a7249eddc513456e5720f38f5a1a98e96e95d6baa6ebc2d1ad1e65521649bb469f563534d6d7d31f04347d2a2fc5f535db6a0e83718906c887cbbe5a9a8bef44dce9f731ca9a2e89169d6d6f2184b1455dc07b11dcfeb4d16f119c649a681285b03d3e5500f87820ff006a0e098191de80ac9b8904647b55d11da9681a56a31f87a869f6970b8ffe4883629a289aefc16e92d441682da5b098f21ed9f033f353914d19b751fc08d66cc16d12fe2bf45ec92ff0df1fdbfb559ec667aff4eeb1a04db359d3ae6d40eccebe53f46ec7f5ab82263da7dcf3eb5174e5181076918c7de869503232491ee4515c1803824f03b51287f30e0e7d803449494832c157278a2e8c71fcb9f9d144639236824d01e142efb1768cfb9c7ef40512a818de78ff00a682518e7cc30ab9e00a02cce9953247bd41e467191ed9a04205ee99da4e4e3d283a524b0427b5026c18a8e082067db8341ce0e39ed409b6502907391edda80f2dfdc496f0c124ac6184b144cf0a4e338fd2894f7a7342d4ba9b568f4fd261f12571966270a8bfd47d8511bae85f02b47b7fc34bac5d5c5dc88a0c90ab6c8d9bedce3ef4d1ad691a6dae976a96d616d15b409f9638d70054a1dbc68ea51d4329f4619a8022b78e04548515117b05000a035c5c4702a995c26e3819f534047bcb68a458cce866719540724d02e41c0f7a012a40f6141cbc8e7bd01719e38e6838af1c0a04ca8206d3cd037bdb082fad9e0bd8a39e0718649141047d0d5d18f759fc0cd3af164b8e9999acae4e4f81236e898f7c0f55fed574615aee83a96817ef67abda3db4ebdb7f66f983d88a061bb8db9e3d45165076db83c1f950a53780d8247c80a2398f182724f1c7ad080c608cfa7a51a0062adc7afbd0130173bb9c5070f071cb37e82826106e8f615e01c9e680d6b35bc534be3c1e3831b2aa962bb188f2b71df1de819ae4b1048c7f57bd01a58268e332642ae0704f7cf6207af6a01b99e17b7b6416e227407c494139909ed9f4c0a04a4e501e0f1eb40d263e53dce7fa682c9d0bd13abf58dd6db18bc2b157c4975270ab8ef8f563f21447a73a03a1f4de8eb031582b497328066b97fcd21ff038edfde88b7e32703bd64188e7e6283864b73400cd804b67ca3268317eacea6d56ff005233592f8b6303f953fa4af7c2fa93417fe98b763e0ea171297bab98558068f695ce0e08fdbd281e5c6a57ba5e9d14d716ef7774f2ec112601da4f27ec2827ada74bab559a20e148fcae36b0f91140283729c77a0e0a7777a01dac68395719e39a029607cb901b19c501480ab9279f4a086ea8d0b48d76c0586b7143224a76c61ce1831fe93e86b43cd1f12fe19ea7d2533dcdbeebcd20b612651e68f9ece3fcf6fa5067cbcf20ff009a051724905411e94032799060723da8406d6c67e7ea68d0e1770fe5cfb5026c37039ef9a02eca098c91e6e01e71c500b1d8a49c12786cf6a06a4e256008e3d050119958007920e2801154e32fb4120927b014017eb1c523ac5209a356215c291b87be28957ef853f0d66eaa99352d515e1d190f947669ce7b0ffa7e74a8f4be996569a5d9c56b6704705b46bb5238d42851f2ac875712bc70b3c30f892019540704d01ad2669a0491936330c95ce7140b2e4939a03638c7e8680ae485e33bbe540d60d3ada162c90a02c7270a39340a4f28b68da4645007a8f6a069a746f73235ddcefc391e12b2e1916824948742c99382473c73404791c617695279dc0640f9502c578c9efeb4095cb4cb0830ba21cf999c6401f4f5a05061d430c8079a02e03b3004311c7d281b5e3cd676c65489ee594e4aafe6c7ae07a9a0a075bbea3a8ea96f047d3935ebc404f04ad29411e08e011d98fed416fd212ee5b05b4d5ad6300c615807f1171eaa49eff5ad418c7c55f8466dd66d57a521f20cbcd66a7247a9283dbe5418a63862479877cf1f6c5008e400bdf1ce684016fe53dfbd1a73794600e08ce3d6800377c8c7d6800a9cf75fd4503d91492460f7ee3d28247a7b459f5fd592d22711c206f9e563858a31f99cfd050583518ba75247b1d134f9aed21396d4669769931dc01c003f7a329c4d17458ac5b55d36c12e040a3f1da75c1cb04ede2447f7f6a94567ad7a66db4fbbb29ba7d65b8b4bd8ccd09c8231eaa07b8ab04a7c2cf87b3f53ea8d77abc72c1a5dabe2452bb5a561fc83e5ee7e541e988218ed2dd22b7855228d76a46a00000ec00a510bd4dd511f4fe84da95cc31f880022da4902b1e7d3e99ac86fd03d631f565b4ee6d4dbbc649009cab2e48c83f514165b8b94b6895c44f279c280839e78ce28178ae6de46748a789e453865570483ec6812d42e85a421fc37918b00a883924d024c6e99b7a2a966c0009e17dc9f9fed40f81c77e28139218e4ff9815b9cf23340a01c907b9140201038ed402fcafd28386464e4fd33c50272bc60032609cf00fbd024f722dc66f24822ddf972f8feff00e280f69b24844919cac9ce7de83a447f30ded823007b50459d6ecacb528349b979127651b1dc795f1f3f7a0990148054823dc5015d491c0a0c3be337c2ff00c489b5ee9c87172016b9b541c49ff5a8f7f71eb560c1fc43e0a47e1aa94277310431f91fa551c1727f29ed409b641c86e31839a3454805739c1f6a026f1fd740f64665fc8c31cfde82db79bb40e9e8f49b62eb7d7e8b717ec832c91ff247fa1dc7df2281bcc9369d671493c422b7911654c1215f92bb8827bf068624ba635392df5eb4b9924558ee5bc19b71cee43c6dc7cf34c657be8db0b0b9d0f51d2afe668934dbf9628ddb8c2b8c0073f3a80da37546a7d25174fd95dc125c69f7313ee5655dfc313bd483cf07b1f6a68d5b48d5ec758b612e9d7293211c8fe653f35ee2a084eb9e8bb1eafb3582fe496278f3e1c919fcb9f97ad03ee8dd017a6741b6d3229dae161057c5750a48249ec3eb4139238568f6a9e7b103b5037934cb3793c610a2cd9277a8da73f5140ee38f6280c4b11c65b934023006d50050030e4647de80c846de3b500fcf9fbd0197273ed4007b91400e580c8e45074a82400e72682b36fd2162b7f25ddc09af2766ceeb872db79cf00f6a0b3229550140e07007a50092db860673de818df473c862686dad6470d9cce3b7b63e740fa1de6252ebb5bd81cd00bee2d800d003a6464004763ce683ce9f1cbe1f1d3a67ea1d1a30b68edffba814708c7f9c63d0fafceaca31e6dc71e1f07daa82608c83819f7a1a11ce149238fd68d0a579ec682cfd27a7c3a86bd10bc38b3b756b8b93c1fe1a8c91f7381f7a034f752ea5aa5c5eb292f732128037619c018f6ec282e5a2cb047abda74d5ce9b6da80f136de4a496219b3e48c92000323ea73467519d3da5bb757dbda410ac90c77c23058f99007ee7ec31416882ee47d23acb5185caf8bab4691b1efe57fff0038a9457ee75a82f6e7429350466b482f2742c0f74241c80c38c64541a9cfa1e89ac0177d33ab3d8de28f2b5bca429f91140e2c7a9b5ae9fb85b6ea9b46b9b3c796fe040768f76ec0fafb1f9505df4ebdb3d4edd6e74db98ee216fe68ce47d280648f75e2485a44da385ddc13f4a025ddbdbea16a633286566ce55f9c8f6c502ad750db2c514f30dec428247e6340bbf04100b73402afb943ed2b9e30683836defe9403bc1e06734020e06280cafe8683a375941d841c77c1a0151b467b50159f00e4127e5402872371040c5046eb5aadbe9b1c02e2f6dad25b89047099c677b7b0140fe3f1010afc803f3018e68160c3041ee2823f5dba92d34db89a1d9e2843b03b6d05bd013560c1748d57aa2797c6b35bab78e6959dc47231580ff336dcfb03c1a58364b5bbb7d7fa7b7427f1f673830c8664285bd1815238fad20f2c7c41e979ba43aa2e2c1cb1b663bede438f3a13c7dc76fb5515e9065b851f7a02950002a09c51a1b83cf14176e90d3645e9ad7752752aac23b3439c066665c827e944d29a6410aea725c4567135bd840d3c88a723728c29c9efe6c50d3ee9545b0bf8ef2e6e3c2fc2c6f72f2920e5f19039ee4938a9a875d03278377acf52ddf867f036ef71923932bfe51fbd3475cdc369df0db4fb389d4ea37970fa9cc0b00511795ce7d4f181eb4cd2451755fc45ac16d637381b14ca36b641dfce723e4053170d6cb52bbb362f6d3cb19241f2b9029862f09f143549ba7e7d2eef6caf2797c66ee17fdfd69862d1a069da7dfdac579d17adcda5ea9e1a992376c4723e39e3b024fd7e94c458ac3e25dee8d31d3bae74e7b79002bf8b8549471db38f5f4ed4c165e943a06a328d4ba605b4b22a1523c420c64fbaf38a82d36f0ce7cf7463790729b53017e940e0b0ceceed8ce0500e1b70daa08f5c9ed41d271cd0132476e7d7ff00aa069797d2411168ed9a41fcc858211f73c5075acb25ca6fb82aa31e58a36c81f561dcd033d42169e158ac64b98151b3981c2966cf639f4a064c7a8ac55e4865b7d493701e1c8e52403ea3cbfda827e390ca3f2c914aa81991bd281cdacc2747215c60e0ee5c67e940cb51b0b2bcbd824bfb08ee1a252d1caea1821cfa67b1fa504982b2283ce08f518a08abb82f6dd0369a5662081e14ce40c7ae1b04fda82275cb0bfd4f4536f7114589a5412461f3e4ce4e0e060f63f6ab2893d3b4b5b5b78e22ed22aae3cc3cc7e64fad3449a22a461500007602a0cd7e3b74c26b5d2ad79147baf34eccca40e4a7f30ff3f6aba3cd0543267eb5427b86f1f4c76ef45d0eca1ad5ef224d13e1cf4fd9b22192fa67bc955f8c8c617fba9fb510d7a6ed3fd43a735e5b54964be658c048fb6cdd9e7eb8a186bac97d174e6d22e23437b7ac26b95e77c68bf950fa7279e2b22dba45b59e97a669fa4ea36aeff89cea9a90451fc355ff0096ad9f4ce3f41570675d4fa8c77da8de5cde5be26bc653171ca47dc1f6c9fed5562b97f70276808da7c24f0c1c63804e33fa8a2928c0e0383c8f7ed41d92a41393f4a2548595c2c37493db4cd04e8a08f139566edfef3445b6e7aeaf65d2df48ea2b11776ae02a93e564c772adef409f4ee8ba9a21d73a36fa579ad9f325afe599171ed9c30a960d5ba0fe2843abb47a6f510fc26a4c36890f9558fcc6783506a1147b510024e30339ce680d2c6ae9861eb9a009178a0205443b989e39cd01d8075e3047ce80563057ca381ed4011c4531e503d85013c91b804a21279c903341131cda8c3abdc8650f6d20c4321232adec3dc504bab2c113c9293bb1963df3408dd4b75e1efb2856463dbc43b4631fad047e9177ad4fe32ea16b1db4b8fe1aa92571f5f5a0916bc8e0895af5c46c17cd8c9ff7da80f6d736f7f6915c59cab35bc837238ed8a072a31c1ef4062870718a06f7702dc5b3c522ee4752ae0fa8230683c75d6ba3b74ef535fe984929149e4278ca9e47edfdab42058003763ed409f88ffd6dfad06b1f12ae612fa0c76e0b471e9916d23f973eb4158d3efeff004a984da5debc1295d8e4018dbf3145d583a2ad96f356bbd7f5d90dc59587f1e79a6392f28fcaa3ee47159444ea3aa5ddfc7acf50dcdc344d7a4dbc317f52641200f6000fdeb41b5ef51d8eab672ffa9e971c97c11638268e431a46000012a3b9a351567db823b11f3ef40948e428048207a8340ab48ae83cb83ee0f3428a982719edf3e68c9cc97d3fe15ad8c9be138f2bf38e7b8f6ef40f7a5f55bdd3f56b46d3649127f1405f08e7249c76f5fa50689d48ba5f545cdcbdb462cba9206411b2b055bb07d4fb1c73528d4fa8f52d62cf47b6b8d2e65fc458c49f8a818795c151939f977a823ba0fe253750eb7fe937b04293f9f6c90be41dbdc7ff006283473c1efc1a06f69776d73bbf0f2aca32572bc80470450284a46dfca19f819f5a04e799614def26c0bdce09cfd85045dc75769d12dc3c3e2491db0dd3c85195235f7c91cfd066ae0cdba9be31f4ec61a386c1ef9d4ee473e45cfb1cf34c101d3ff1ac9d481d46c628ed24751881880833f988e7b0fa5328dfed2f2def2ce2b9b79925b791772ca87208f7a60182ee2b95cc0c48f53823fbd40ac658b30f4f4a086d4ee1d75bb6b78f4e965596366fc5211b23238008fde81f43692da5bc30d97831a0397dc09e3d714087506bf61a2c4cd77324726d2caaec141f9fd2ae0c435bf8c57173ad7876f7a2daca10489121244cdf319ce3dbf5a834fe81f881a6f57bcb6ba7c53c72c11873e28cee1db391dbef4199ff00ea4348116a5a66a8a8a04aad04847a90723f6ad7d18c312ddc02a3815423ba0f63fa541687bd9efe1b533b3c9e0a78473e899e318a09bd0ba6eef543e3b2bd8e9b10064bd9e4da001dc81401aeeb29a984d0ba7d5e1d06d4e6594f06523bc8e7f5c0ac8af752dfc17d7090d9218ec6d9447129ee71fcc4fb9cd6842ab10dc0014f3e5a2c1704b671dfdc734525226dc939e283a362c7f940344a380393df144733e2276e38f5efcd01b4bbbfc3dda4a9298a44395902e4a9c70682660d4265d62de40b1bdc1545054f95c8fe627df141af7c3af8808f3dd68dd5d2a45765884b8908d8c3b6c27b7a77a945d7a5fa474bd2ba8e4d5748b28624955d5d8b13b79ee9e983d8d40a753758c7a46b96f6114725dc92279a2810b3a64f94900763cfafa503fd3b59b79ed84da34713c0cd890f0a158fa1f981de826e1b548959fc4dc5cee24b6467e59ed4101ff19e9f676baa5d6a72c50adb4ad1ac790ccc076200f7ad41e7df881d79a87576a5f87b0f161d381db1c2a36e7e6d8ff3416bf87ff082c6f208ef7a82f22b9761bd6d619785f6dc477fa53705ab57f83bd297ceb1e9caf67708db9c4526723e849e3e94f212dd25d117fd29a8c09a76b534fa39cf8b6b71ced38e36fb73417f52e64548e34007e673e9f21ef590a1c918c90718dc281a69b68f67118d9da5058b798f6fa7fe280daadd1b2d36eae70710c4d263df0a4d583cc7a668fd4bf11b5837d7c93dcd9a3146959822a0e781f4cfa55161e9dd7fa67a4f55b9e9aea3e9f81fc09ca0ba118998fcdb2338c7b528d39f4cd2ba76e2d357d292df4eb391809963420ce1b1b576fa1e7359119f1eb4e17dd033ca172d6b2a4df303383fdeb5c8f2eef3bce4e0e335684cb0c9f354160d36f64b0baf16072b91b5f03391f43c51aab23a5debe91c4fad4d73689e6fc3a290573ff4f03e59f4a3280d67581ce916567f84b58ce0a1fccec3d58fa9a084de08c90464e4d1a8e419059b201f4a05630a176918efc50176293872c17bf14042aa0125b03db14046c60b60123fde6827fa0c68edd5365ff11346ba6292ee64194240c807e59a32b7fc51bfe8bd5ed5db424860beb62b89218422ce09c11c01dbbd0660ae110bf1bf2154838dbebfefeb41a8f4cdac7f117458f4d9ecd2df53b4cf81a822808c47255c0f7c8e7fb54a2ec2cfabba3b4b4b8d3af12eedad40926b0f070a13f9b633649f7a82eba6ea4357d321d4ecad512daf20df26e016507fa4fbfaf3e98f9d067dd2bd2faac9aa4d72d72d1e9510ca46a7631c7a320e18f1dfd7bd059afb7da816d23de4ba5de211346a1e4785f190548e4648c63b64e6b43ce9d5baafe3b539c5b452dbda46c638a167cb281c73ee4ff9340e3a3fa5f5aea4ba58f4bb57dbfcf2b02a8bf7f7a0de3a5fa0b50d2a2d92eb3e048c0a97c867dbedcf6a944e5cf4f6b76d1b3d8ea42795066266c87c81c65b9cfaf15048e83af3cd64abac08edaf01546c38dae4e0657ee6826e5b892de3702292e2545ddb55700fd0fbfca81c4b3bc718716eef9eeaa402280d14ab3c0b2c65c06fe571823ed40df56b217fa6dd5ab9216689a33f2c8c558307e83b8d77a37aaa7d22f2512c28768800c9954671b3d33ebef568d0ef7a7749eb0b5bbbb162d657b32b46d2e1564c8ed9c5644d1b0b9bbd261d2a440af6cb0e2e5b1e7dbc1238e0f7a0375b696daa7496a3a4dac8a92cf078685b271db04d391e40d5ec4586a1716de2a49e0c8c85d3b120f715ba1899173ff305413070abd89cfe9f5a2d3ee9c8639fa874eb6b804c52dc46b20c9f302c3bd11e84d47e1af4d5dc6521d3e3b662c19a58721ff5a9a321f89bd27a374b456d158dccd34d333332c9b4b2afbe47a7cb1f7aa33d2bc0d8c0f1c8f6a2c14b6d501b39cf63450897380c319e3de8065031c038f7ed40d8faf1ce41e4d004876a8dc3cc7e743025c956c818028c904579e7f0e15695c9c0541924f6c00283d0bf07f42d6b48820b8d62d20b2b58d656404959e52f83c8ff00fcfafbd4a35bb06f12391a48dd55cee2b2f3818ed8f6a8158a159890f02242079147623e631c502b0db436d1ecb7458d4738038fb0a087d6eeb508f48bb7d32d95750752b6c26c905b3ddb6f61eb574794f5cb6b9d0fa9678b512b25d24bbe52b8c1638278fbd582c57ff12afaed45b5bc0d0d8a8c08a2731ee3eec5793f40450466a1d59af446293c186cd53ca0c36eab93dc649e49fbd048e89f1675ed35e301e293919dcbf9867b37cbe94a35fe94ea4d33aba6824306dc48015750d86c6e247b0cf63591a40b8dc23fc30f14138dcac3000f9d03687547f12e8dd5af816b13148dddbcd29039c0f6f6f7a0eb5d62caf5636825db70c9bc4328f0dc0271c8a090627d3073ce681acf6505ccf14d35bc2f2c2731bb28254fb8a075144a83ca806792400334049ee6281e2496408656d880ff0031f61fa50446bd76058ea1b9e21025a3bb48afe71df9c7b71de9c8f196a0de23ca7b827d4f7add117e0cbfd4b5059392369663ff004e71c51aa97e8f555eadd258f2bf8a889cff00dc28cbd0bf123a926e96d163bdb74490bca2321c678209ff001591e71eafd7a7d7ef45cde2c20aae144638033fb9ad2e1b5e69d058da431ccf21d4a5c3b4631b62523807feaf5c7a50222f2d648c25f5aeec8c2cd19dae3d3e87e944d3eb7e90d425b49ef2292de38224f1505c3f8724a9eeaa7bd0d57a60406059436306868a7803839c7ad1a158039c13f4a33a716767f8cb9b6b55e1ae2458813e9938cd07a9f42d0b4de99b4b7d1f41b58ff19b03c93ba06607fa8b1f5f619a5b8266d74a65d42da6ba90cce996dcdc8c9fff006a5a2c2635083b05ef83eb5028076341db4b1ed9f7a04651fc41db18ed419d75b744dbea335fcb0db0335f2057901c05da73c8f9d5d18a75174a3f4c47335e35da4ce418a489374254f707d463d33565d1529b569a489a17944b06ec8057d71dcd037b4b6b8bfba31584124b27e62a8a4f1ea68357f83da7ea5a76bfe0912453ccabb49194653cb60f6ce3dfda983d196cd108c2401711f9768e306b2297d73fc6d02773a8b591922693c5004bb9d72542fa2f6efde8314ff867aeeec27500b77bb5670e36ca19b1dff2e7f2fd2837ce8bd5dd348b78b552219022870d9c46e792a4f6c608a0b846c8e03232b29ec41cd0199f1410fd4b24b1e8f712c0a5e4452d851e6c639dbf3238a0afa42ba77475e4ba8470896681da45180b18da76af3c9029c8f26dc1df2b9c606e273e86b743331924f27f4a82c12280e59b008e79f6a2d4d74188ff00e30d203a82ad7519c1ff00b860d11ba7c5e86c9fa3afae6f4091e043e021270b21e01c7dcd6479ab4dd3aeb56be4b7b184cf2b301b57d07bfd2b4bad0fe25e9f6960ba7c7a55ac50cd750335ccaade7723b83b8f6e38a2207a5ba4e7ea3d93780cb616ca53781f99fbff009a0b675a5be9765d43a75a6ad3b25adb4185429b831c70303dfdfd2831eb8954ca48f3827819c71ed406b2b1b9bf9a5fc1c4ce2253238047957dc9345d122b792eee522811a495ce1157b93ed444ff0049f476b1aaf51c761345269d25be269259570c833c6077249e062a68f53e8ef0da69509d4ae225b92a04af232ab16f98cf1f4a5a266d4dbca8af13a329ecca723f51502d14f0cb9f05d1c8ee01c91f6a0393b4edfe63c8a031608859b38f97340d84d04e5846eae50f9829ce3eb400fb24466041f5e3d2823f56d22db57b192d6e61468a41c823ff0035651916bbf04ada7badda5cad6d1b72c09dc33f2a6875d25f0865d06fe2bc6d4c4d3282026cca8cfafcfd29a34cd234a10c768f711a78f1bb392a3001208e3ec69a26a58d640c832091c90706a084ea1d3eeafdadf4f86da3166c0b4b397c18f046140f5ce4d04f4702436e91c28a9122e028ed8a0a9f5a5b6a09a1bc5a135bc72cce048b3c5bc15c638f9d59043fc2db997481aa69dae49e1cb6bb643239211939e467818f97bd305965ebce9a10bc8da9dbaa2679dd9ce3d8530572cfac87566ab05ae9f1490692b9696e1f833738555f96793504df5f25945d2576b7ec16dc46792381c7b7ad5e60f234980e42f6c9c56a82ec3eff00bd4124e49700f1c646e3cd169ce9575f83d52cee324347323f6e3861ff008a23d47d4ba6a75074fdcd8ef317e2e2ff0098bdd4706a60c3f4ae8cd5f44eb8fc3e97248a638cbc73bf90483d463b373e9574685abf42a6b5649fea72bbdeac4a8d3b018cfae31f7a6895b6b29b41d30d8e9f6bbed9213e1b7a994e724fcbb5064bd7835a9752d3af75d8116354778f660788cbd9483dbb0a0cd20b2b8d43528ad2088bdcccf854039cff00e2827a0d34e9da1de896f2182492efc0976f998aa827d3d334113a74aa9a9298628e74570478bc0c7cf1da83724bb8246d3e6416b0384da61b5501c9f5c3704f152c037561a95f5fce61d3ad6db4ab950f34b331dd9f4191db8fdcd406d67a675ab4b6d325d1af248272a43430315ddec7038f6ad4b3f448bf47eb71cb69abddebf21d5e26896203846c30c8603b9c6452d9835901405660376319ac84bf13180779d8bb82827d4fb0a06f777367a75acd7170f1430a9f331200cfceae061a0cf6dac692d7365266191db0578f5edf3a6075a6c9278b3433188a467860d96fbd40fe540471409aa0c1140750001ed8ed4058e15133c983960077edf6a06faade5c5b7822d2d926766cb967da2341dd8f0727d85033d27597d62e2ee3163756915bbf8799d71e2f19dcbf2a092b88dd9a311950a0e5b70ce47fe6ac18af53f5b69da9752dd69da9ca906876e24465d9e69881c6ff005c679c0aa2bfd267a347512c93dbb5d42d90d3c800b68c9ce0ec3cfa528db74ad034db5905ee8be1ac728dc153984f3f980f4fb56453be2de8f647a6aff53796596f0aed46798ec033ce149c0fb0ad71479c9bb9dc3bf3c55a0b95f65a825150b481a407b93c0fda8a29c06671dc93803bd131eafd0af6dffe18d2ee25982a4b04603b7a9c631fad03bbe586381bc5945b96385718c827db3eb5288eb8ba934eb15fc3c535f05427796dcccdec7150637d5bd55d5362b7975aa4d0d919018adec8637807bb60723000e4f7cd58203538aefa8aeb478a7b9beba924547b8774cf8608036a80704639cf1f9855d1a7f4c68b67a03de5e5d59dad8d988c62e1c0f107a1e7fdf7a082ea6d07a6e3e99375a7cb6b3db093c727701e2360f7f53dfb50653d4130d42ee18f48b3f0232a15218936963ebf5fbd06dbf0cfa74855b9d46e04b730c6144691e12307d33ea7de8348ba6b5478a279a004f98c479247b81f5a9438805ac0be2e02e73c9ef8fbd40c2346d43578eefc40da7da1dc8b8eefea4fcb9fef419beabf12a4bcebcb2d2fa7ee0dc58492084b30236bb6467dce383f6a0b87556a67a7f4d95a0bbb5468816f0a69c78b2e072572719ce78357079dfab3af2e7a92c963b88d94abbbf91cedc93edf418aa2c5f0dbe2a6a9a0c90d8de34773a6a8da1186d6403fa48fec682d9adeb7a9b4c9d572dacc9a6c9700456e5ca910e000ecbd8e580352fb1ae7476bd6dd49a325e5a9f3025245fe961dea097523cc0919a032af039a006936c81423104649c703ef40dcce64bc3035a87b6f0c378f9fe7cf2b8fdf340a4b6e25962915d94a67807839f7a043586922b5636ec44c061063f31f6ab079d7fe19b7eb2d4efeef55d5d74f992e9a0fc3a441dcb13927b838c9aa2d4bf042c618e178efee6e18104870172318edf5c1e6945bbe1a748ea7d2315edbea3a99bcb190030c401010e4e783ee0fa56455be3d6b90c1a6268d69e17f1486900ee98ec29ccc183119419e7e55ba11f089f523ef5058363a8059fb8e31e9421b491056c01819e28d3d0ff07eea3d53a1e3b6b8db235aca63c139c0eea68ca47a9fa6ef757b83ff00bf68ad428c2f248c7a8f9fcea518df516adac74e7544f63a2ea172f1800291e6cee19ec78cd5826344e85b6bad25ba8fade5b99dae0ee11efc71e858f7e7d054a2d7d39a75ae8f7b6b00b8917f1516624b78429da327cec493db1db1d8540cf4aea28f58d6aeae2f6dd64b498082d880488d149fcea7d4939ab04175e6850a8d32de3b78e380c8de32c4db4e18e430fef543cf86fd0d691b4fabdf6648b3b2db69ce7dd87be68342d2f4fb9b5b891af1a28a2dc05bc5036d001e0eef7352884b961a2ea9aa7555c885e08d45b5bc52b61b686c120fb939fb541276bd4b61d53624d942e2f6200bc32290633e99f4233416dd3ad3f0d611c0c77b632e71dc9ef41156dd27a45addcb3dbd9c513b1dd941821bdc7b558333b9f873757fd69a85e3f813e9c7723b5d93265d872473c11544a68ff08fa75e290b42ec4e4124e70738fa5048e89f0f745d2aeadd2decedda6525c975121183c77f7a945c754d0e0d563682ed43425369403bff00bcd58308ba7d5fe13f5a05889974a9d8b46aede4914f707d88ff001528ddf4fd7edb54d1a1d56c312dab2e64dbc9418e78f5c541296d70b716d1cd6f8789977230ecc280cb7519b816f212b205de4e0843ce300f6cfcb39a0545c42cee88e0b458ddec33ee680eac92266360debc7b5056fad2d354b9b189745744be121daf27e550548ce3d4d58324d07a725e98ea2b7ff5381f5169a7579d021fe13904ee43ddfbe49038ab46e76cf05cc714f6d309232a4a98ce54fd6b2196bb7f2e9b631b2c427b891b6851db3eff002007341e5bf887aa2ea3d4f77378be381e42fdb711ed5a1554395caf1cd07617dcd04fc85402101da791421b49920331381c60d1a69bf02f56f03a925b12c162b98c955f775e47df19a32d99b518268e4491668704a79d4aeec7b7bd4a30feb7e9144d76e265697c3e2693631674273803e556087d76f35fd49859e9925ccf611141106f2e182e3241f727f5a94681a268f79ad1b1b8b9dd66b1c2b1ce9bb06361c1e7bf3fe6a096b0d3ba57488e485b52b40909c386901607d47bf7a0ae758eb69ac4d15be81a748f0a9c35cc90b2eff4c03c1c638a0b77405c5d5d45f87be5fe359a88b81b401dc1c7d38fb50586fed18ea3015790091591e447c1518c8c7a0a0a5754d8c9d49a8d9f4ee9dba0b3b5224b9692327728f627e7c6682f9a7e996b6b3a8b6b748a348820c7720761412c064e3041ce282b5d4bd73d3bd3f33daea97ac2e540dd0a292dc8cd043c1f15ba2a7923b65bb910371b9a12141f9d02edf13ba2ade56857551e5e77244c54fd0e280746ebfe99bbbd655d56dcdc9ce08465565f4ee3bfca82d53eb3a6dac3e25c5f5ba646402e33fa77a0aff5b74ad8757e9ca972844aa37c520fcca7d3f5ab067bd369a8f467544d626c98e9f7118f0200e4465c903049c8c9e6ad1b24334b6fa6249716cab20037c309dd83db03b5640dddac3764a4f02cb1103863919fa7a1a06d6f600c37162911b7b252b87dc773f1927393f4a079f868edae1ae6328a8b1ed38e30050226e85d5dc1f879011b3c47c2f604719f9d01eff4f4b83e3c6b18bb452b1cac9b8a83de80b16e8208a3b7b58e1407cc061427cc0ff1560ce7a8f592d69a97504cad2dac01a2b53900c3e9e51ea58f727d0551e73bfb86b99a49a46dcf21c96340dc13804f20f6f9501c0e3b8a0963316fcc4607007f57bd084d64dec01200ce483468ff0040d525d1755b4d4206ff0095207c11dc67ff0019a18f56584f6daad9dade4211e39104a8ded9152b235cd8c530613229c8c1c8ef50472e81690ee00322b0c100f0debdbb7ca8111ace856371358cba85aa5cc407891ccf83f2ef4048b4ad2e59bf116769672c72f99dd1437239078e2824a4d3e1b94559234110e781839fa0a0561b38ad532a12319c86c6307e740a9732a3a00cac870cd8e0faf0681be8b6db965bb909df3c85806eeabced5a09523647e6e0fef419a6adf116daf7ac34be9dd1da686e7f1ca2e243b76320ce57df9ff1560cc3e3f470ff00c78255b842b35bc6c4af9b6e323d3e95467b6365f8dbcf062beb68c119595d8aaff6e282422e9899b4f6bb5d46cda2562a76316c1078f4a0859e1b9b762c0bf94f0e84feb4125a57505c58ea70dd5d0174a986d92b1c13f6f5a0de7a5be366877260b5d42dee2d2423124a487507ebdf15289dd3fac7a7bab6feded74d61733473acdb5a162142ff00313d81ed505fa58fc6d809380c1b9f5c502e0e05040ea367a85dea454de2ff00a610375b04c16c7a16ef8340b5f6930dce9375636acf6a278f04c5dd4f1dbf4a084e91d06f3a52dee62bbd4a2b882494ced3c8a448063b63b638fde803ab7ae749b2b3096d792c93c8c109b55dcd18ce3710473ffdd043dc758dc5869044565aa5dda4c3c2b7bc78c1f14e3963db03e7c0ab066bf1327d41ba76ca6bc48ecad24c456f6b0c87cf8e4bbfa138c0fa9aa3297c83dd4e28395811cf2680a5b93c7ed413cd1ff0f3c797b8031406645236b0508406f30e68ba49c051b97d0e0e7d28ad57e19f575c5be8f269515dac772877c11bc464dea7ba8c739ce78f9d3193bb8ebfea2bcbd6b5b6b8b58bb7f13c2f0ce31cf0deb4c0f2dbad6d743d2ee99efae752d6c02a86e0054524f6383c7ff94c0b6af274c75149a46a5a82c46f1e1479fc3190bd8156fbe7f4a960bf74e9d253f1167a3ac09e0856610e3041ec7f6c540f67b892cee7f8d18368232ef2af2508c7047cf340ead5bf130accc9b1186541e723d09ffc5033bbb1b82d74d6b37f1244daa1b38073df3f4a08eeb1d3b50d4fa6a5b4d32f12cef1902ee73e523d476fde8306eb0d3fabfa4ba92c278af67bb7281606472f90bdd58558253a6afb40ea1d62283a8b461a66a6f931cf6a7c2466f7cfb939e7b5515fbed3747b5eb8f06eb78d35080a2ec9719c76f98049a0b4ebdd37d1bad869acbf0b03c5c16b29444adf50ded41995f68564a263a66b31cd02be152505493f51c1a088bab69ad1bc179e320f07c37c8a0692b46c4995f0381db39a0b2fc34e971d57d4705bc8db6c50ef9dd97b81fcbf7381528f5ae97a1d8e996d1db69b0c7648855b10a81b80f43c739c54134147b9a036063279fb5046e957726a0f2cfe04915b06db1788305ffeac7a0a00d72f8d9c491c06337533050ac7185cf2df6a06da2da4293488f34973328c34aea428c9ec3eded40ee7d2ad249448f6b133820ee2833df3fde819ea96897461b05b87815f2ee919e5d47704fa039ab079b3e326b70eafd4ef6d6650d8e9ebf868b69c8247723efebf2aa280eb9193ebedc5002a124e015340018fb8fde82cf32b1603d0678cd02406dce3008e47ce81b499c331383c9c9f5a2e9c69377369f7d6f796a4acf148acb83fb511e91b3b3d0bab745b7d45acedd8e3732b71b1fd73f7a5a19eafd09a56a0a96b1c705b49c48510761ce4fcfbd4d0d752826b2b583476fc3daacb295b79d768de8a32b1e71f989e49f6a7d14dd1af5ba275a45b8b093c054492ea769092373765c1da4679fbd306e36ba9595fe9f0dcdbcc92c33e1579cf27d0d409ea178f68521b6b76926ee8a7853f7ff140bc768d78f6f73748d1cd103b543f0091cf6efc502f7319dac194371d8b6326829f0c501d7ae6fa568d5d4942c806d4db81839f53c8cd59456fae6e628749b5bab8b1865b08e4726588ec11e7f2e49071c93da9a31dd4341d675e9a5bad374f9858162d0b4ac70e18f0573df35a0c759f87bd53a404f174f965dfff00f479b1ef570576e34bd4b4cc0bdb3b9b7258a00e846e3f2a94376475cee4914af7ca9150685f09ba61efb52fc7dd69bf8eb7c158d1d0b47bb38f37efde968d6eeb4eb5e91d6ad25b660aee59974db6881690918e31ce39279e062a5a34bb57b88adedd1e379679065d80036679e6a07e8391bce7e940c659ef5afe1286de3b16f2b8903094b7b2fa7ce81eb380c4260ed193f2a0cd6fa5d4a4ea0fc7bdadcce923158a3039db83c038e3ef41a0e96b2ad8a35e009291b8a939d9f227e43bd590436bbd6fa269202c974b7123602c76e779624e00e29833bf897d493e896525dbcb2a6b5a9c3e1456b91b6d60cf989c7f31f7a60c02490961ebcf3eb541308e39e067b507007b96007a67fb50178f97eb4165ce18165c2927b773fad023202d9c8dbb7818ff003408300b87f2f1c107d0d0c15a4f2e339c90467f6a18bdfc2cea8ff4bd561b4b9ba686d6e64552c4f954e7d7e46a60f4688d240af1b2bc6cbf5047ca960617ba658de1b792f2d94a5ab33461b18524633fa1a81b5c8b5168967369d23c0e0a24622dc981d81c76aba29df0bb48d660d52fceb88d069f04aeb69130037127f37b9c0ed9a8350781240bbc06da72323b1f7a0eb8816e633192ebc8c9472a78fa50349b4c83c068e24f0ddbcc1c13b837be4d055b57e98b996d4db5b4a893dc1e6620b6ccf2c467efc504ce97a38d3f4d874bf09af6d46e2f25cb82724e791db15650a43f878b51fc34f3da8f132b6d6a98c80a39ff007e99aba249631b58b9047239ec3e55368aeeb7d2da6f52c0eb7f16e87f2c6e836ba90724ab7a67b55d115ac7c3e8aed2182def4c56a14096368959a423d77e3229a27b41e9d8343b01069c8a8dc9660aa3713df3c64d4a1c695d3d6b67a8cba94b9b8d4e61869e4e4a8c636a7f4afcaa09a485519caae19b966f7a0435196582c656b74df3e308beec7b50629375775b691ac5bdb6b16d6378779f019b00a31cf391c9c2f1daae0b35ef52f5374de88d77aa45a6cd25ddc0108694ee2188c28007603d6a0d16c92430a4b2ed3230dc401855cfa0a0a07c45d7b5db9d462e9ee960b14b2ee134ef8c850012147ec78ab0670b643a2efae753d72686e6e2da211db42176079c8e768f65e39f7aa332d6f58bbd635096f6fe6692695b24f603d801e82823cb900ee00e68006460051dfd680ed9f0c905b713d8d006d5f5419fa505a18f94e40501b1b81a04186d62402c87be3d6810b81290aea8467201231cd1749dbc437f9f1e201db3de8ba07dc0175c027f28a335b17c26f888d6b6d0e8fabf892a29c453b1e547f49f7a946d6424f08236491c833ee0835073294888894120700f0280813c40a6711bc8843e00fca7d3ef40e41dc081f9a811681c6f7565329185623b7e9de812b3bcf11ff0b74563bd50494cf120071b97e5fda80d7577046c9019d5669dbc340324eec67fb734103d5da96bf67a7cf0e916f6e2765f25ddc4c11107ab1c8c647cce2816d3ec7f0f6564cae6e67da375e6d52cc4af2e4fb13ed4145f899d47b3499f4bb6d46cda49b69b92921565c3648e3dd40c81cd5c0ae89f13ec246d3e379ed2d6da180b5d34849da1780b128e49271c9f4a60ba685d5fa36bc42d95c324ec7090cc9b1d87b81ed50588958977cacaaa3b9341c655f12348d1dcb8dc1946540f99a019e2134454eeda7bed3839cd052fe2136b536b5d3563a1ca53c49da4b9507198940ce7e5c9fbe281c6b7a974cf4ee4ea7242d76dc784a3c595b3e9b464e3f6ad0ac745ccbd4fadcbabea42da56959a382ce7460d6b1a93c01f97272093ebf6a82f1ad6af0e9da5cb3cecf6902216919f82aa3818c7a9f4c530649a9f5269ba7429d472239bc991a1b0d3c3152880f0f23039e7bf3de90635ab6a377aa5ebdcdecef2c9239e59f3827e5ed54302195fcc38cd01245395c1f5f4a05b606538e483c501b6939e3b5077860f3914165754c33e549000dbe87de813b820c27fa7baafb8a04a69c98e281e42618c795338033df1f3a06c03e4e029247007ad010093c35674da71f977640340081a190658e41c820f141b0fc33f8926c218b4ed609366a02249bb2d19ce3ea4528dbece68eead926b7916689c643a9e0d643387521fea2f693c2d6efc786ee46d9bfed3eff2a04669edf5295ff057a60bd865309246d3bbbedc1efef41d63a8dec9ab4fa7dd4510fc3c69234ca186e2d9c003b7a67bd034bad0a5bb96e25d575267889cc1b54446d9bd0a37bfbfbd02925945a72cba8dddc48b3f87b1e58f23c623f292bdb7fa7cf38a0a5750f54ebba56a9a67fc516b6d6fd3970ea9234677c8dc7f38f6e4640ce282d1ac4b16bfa72c1d2bad430cd1ba822061865f5007d3daac19cf547c189357d561bbd3eee683c62cd786e9b73337b8c7bd512bd39f06adedec2de0d5ae639da372e6485363107f97767b505cee755d03a5e58ac228659af123184b7b733322e38c91dbf5a943ab3d52e64b49ee755d2e64950e238e35f10c884e17cbe87dc540e6d7509a4f110e9f7566a471712850abf6ce463e6280bacea36fd33a4497f773cf32c698dcc4beee33938edc7ad05534aea683ae61d64c4d2a69b6b88d16d5ca5c303f3e386cf61db140e27b5e99e96b64bdd562b6b30aa36c6c37cac7dc9eec6b42c1a66a962fa70beb6b516d0cbe76322f86c78f6c66831bf8b5d5d2dfa35a5dce60b1933b6ce3c788769f2b331ec1b8fd2831b79649984b239773c1dc68129725c1c640e73400ec781d8fb1a03c4a85d0c8582640257bd01e51fc42236263c9c67be280429c6037eb405dbf5fd682c2a0bb976cf07d3fc5009279ef8ec4e68193a9902b28e7dc71fb501d95b098e0f6dd9e0d0049131019b047b8390281bb292484e47c8500c4f242c3076bf704704739a0be7c3febfbae9a5daf23cd017c7e19fb107bb67d0f6fd6837cd2757d1fab34f4f05e37dde630b1c3a91edf4f7159103d6eb7da65fdbdf59dadb5e2460ac876ed9e1c8c060f9efe9c8a0a75cfc42d5742d2ee5a7e9dbb494b6d6b9bc930cce4f940e3cd81ed4160e98f88315e689fff0022b57664199cc5196f0c7a164ef8f98cd0589baffa68590985eb15c0db1985839f6c2919340b69d03f5285bdd6f4bf021424db4329cb153fccc3d09c76a090d3340d2f479a7bab3b38e2924e5e451cfd280d7dafe936f6c5e4bd89813b02a36589ce318a0358dc35cc4e17f9bf234cdbb78fa0c607a7340e6cec20b1596610c6934b8323226379edda81da8dcb9ec40a042f50b5bb21645473b58b11dbd7bfca8304f8add5d67a9ea8ba5d8ea72c1a4d8a952f10f2c920e368cf71e99fad5833dd0754d6ed66bdb2e9a91a5babb2a310465a57c1ddc1038e7bd5171d3748b8d46ee1ff005298dc6a764c27d4eeaee7fe1c01795881c9e7804fe940dbe287c4b6d75a1b1d1c986d62277c91bf131f4c0f6fad0663737135d3b497124924871f98e7803007d2811dc5b83903dc0a0333f03be7de8122df2c9a05a11e5f51f7a05ce7071804fca8033e5da0734020b0183bb23e5416269577ed0e5323078ceeefdff6a03dbcd62914c2f629a47c622689800879e4fbd046f9d8a2a03e31385c0e73da8b83ca590947dcaead8208e73da8849b3e19ce704f7c5015586d006431f5cf61f3a04ee586ff002481c8fe6191408f0011eb8e30682774dea9bbb5784492ca6385832e1ca95e3d2834be9df8c312e2db5eb4375080337000f1303d18763591a469baef4d755989ec6f6dae5a23e20b599406dd8e080ddbed41272f4dd8caf1c86d163910f9595882a3d718a035edd695d3b6a926b57d0ac65b10b4e06eedd863bf141077fd7af2782bd3fa26a1a8891d57c630948c0279393dcd04cf5875258f4de9f0cb7b7b6d66d2b81ba752d85f5214724fed41036bd79d2fe319d7a8f4b9c81e58de2f04827b9ce09a07a3acecf54b790685ace8697606009e52c377b7f2e682b097d7d36acf0f55df5edbdc0977412468cb6ce3be10af3c63b9c8a0b0751f505be9690dd5d752436f62a3fe4c6448f3b7b0c64e38f615734651f107e3045ac42b67a7693018633b965bc1bc838ee173807bf7cd33065baaeb1a95f2c11dfcd2bc51fe48880aa3e8a062a8b059f595df4ae9a74de9e9ec499d43c97b1427c6e47e525bb63e4282ad3ea3712893c599dbc4259c1627713c927de81043950df97db1406da8411c92063be280230839627078e79a0390a71b5bb5003a8c1232338e4507025573e9fbd02a0e41dc0e680c3691cf714053bb34160895dc16f291d98d02322aa39f3e14707ffaa06f202a5bb0c7201f4a343aca51090497efdfbfce89840c8db8e46573923ff14410b00490d9f5c1a0425dd8ce4673e873cd0265e4dbe7041ed814009b8cbb8e5863bd07163b7716e0607b6698060b96b7b9478dc8643918247ee39a60b7e97f133a8b4e0c63d4ee597380923970a3ef4c0e13e25dfcfab457ba95bdbddb212016501867b9cfbfda982f907c74b282da34874a9048aa479c83838edc62982b7ac7c42d235cd67f15ac5b40c366418a2cb0c1c81e6f5e31db14c160d035de8cd4a3f18ea96562cc37359dfe9cac887fef039fd6b39446f56ea5d13a9dca4579a922496b1975b8d22dfc3566cf9557230703be715ac1431d4d2275325d7fae6b4f6f182a93ef1e32a9f41938f6a60afeb1a95c5fea53dccf772cf2c8c489240031f627e7565c0d67bbf160487c1801073bc0c31f91f953420f2bc8c7c52cc540032738a809905c0f4fa501940208e73df34028e703938a0577ae013f4a001300db4f03b71407461ce0502dca8c9c7dcf6a003fafcbdcd0070bc1e0fd734070db467b8a04cb9c9e68274b93bcb1daa40200ed4099765249ec476cf340849b8b264823bf34689ee009cb671df1409bc8e8b8e770e3ec68984d9c953cf97be2860b248caaebc107dc67f7a184c31232db88fd451031ce50e76039f5c8045026efb8f93279e0fd680b239504f0483d88ef409ee25bb90c79c0e050151c6e21b39ce783eb40adbcc2cefa17bdb61322387781c950e3dbdf9c8a066f28790b22e013db3dbef54726081e63c6460d34191b1bb0720f634060e7600412c781502409c8e3d7b500ed71dbef8ed40243f181c0a02e5d4e0fad006f644e4819e3b501f7e3049e7b501bc43b4e391da80558003392d40a23305e320d02e64cf998e1bf5a032b0c927b8e68049c8c8e71c6280377043118f4e680bbff00de0504ddbb3128371c1c64668024e59f3cd02521254e4fad1a2107e48fe6a6809ddb9e78a029e1463d05027ffc744a6c3857c7b1a205ff00e637fbf4a02b12b1794e39f4a02024e7249ed409924720906800005173fd7404989698ee39e4f7a04cf723d07a501fff0097ed406ffe36a018ff00281e99a037f4d0731f3bfd28007e53400ff99a810248c0cf140bc60123233cff008a0557f9beb4056eff007a07109243e79a03778b27bfbd02b128c27039a054001b818a06609de793da815006070283ffd9}\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 Here is a movie {\pict\jpegblip\picw20\pich22\picwgoal400\pichgoal440 ffd8ffe000104a46494600010101004800480000fffe0050546869732061727420697320696e20746865207075626c696320646f6d61696e2e204b6576696e204875676865732c206b6576696e68406569742e636f6d2c2053657074656d6265722031393935ffdb00430001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ffdb00430101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ffc00011080016001403012200021101031101ffc4001a000100020301000000000000000000000000080905060a07ffc400231000010501000300010500000000000000060304050708020001090a11153976b7ffc400160101010100000000000000000000000000060800ffc400261101000102050109000000000000000000010200030405061121b33134365154717475b4ffda000c03010002110311003f00a90cf388f366a62aa720ed6ae07f96901f3831d973452b8cf36fe3570fc908e46d466433e5dd954f2e96992d9e498c7753faa44916e016ca91cc7d88b38fe60a5b97737defcbcc539c98d336a57f4fc2ca9a486bf07ab575ad9a3af4df221d8215e36df86c4504ff0024574551b3d687ee0575757b3ad64e311ee62bd94158d37e24198c43973099f1fc0c41614d950246513a081abf76cfe7061f6863281e6352fd1670949c148dd6dfb0d25f5b3689b1d5c965b0eacbf4e0932ad28e22ab9ae945633f4744bd3c8cee0a7fdf085b9000f449c5f7afa30b83e0b6fd7b0c8429c9467ff9715347c891e25fa24a205861aa715e6a09bd0488237dc2723414d9891381524e8ca7c0894664f835653631ab55ee7e3de433e4ff001b30949124e4c10c8b6ad0a479b3f9c937b2cf5bc0095ad600a0a41a0e9faee174a1c605e161c6c7a313539650b0113190f1a8368e60d5b24f30ff008ea7f0bf867fa6595feeb6978f1fe0f9c26177f4d63a51a9235184750e7d18811339cd000000c75f000e00380380ae390c350def826ed42ad051fa6f501c50f9b699c3b69cbeb76476d202bf3ac985b6e0e968be66572893e6a744540bd9722e5c87956848629bc2559306bd113e8653d3b6aff651dfad7a3ac8b02958cba02a93ccf525757039bae6cff090e1d90688e8aa233ee86a4c4a3e0586d6b2340522e47dcb7d0046d8a5acb05a123ee25d2b230b2ada6e2e2f9ede3c05202520ec2487b0d56562529d8b3393bca76adca4ec1bca508abb001babc007915d84fe3dd14e207e3c62f8379da2a3b861fb6629d28dba53b6ea388ebfed866bf6dfb553455e91ed547ae92e9445253a4fdf3efb4f8ebdfbe7d3c78f1ee0bb9e13e358e942a4ed49e22cff00eeb35fdd7ebfffd9} icon.\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 {\pict\jpegblip\picw250\pich250\picwgoal3000\pichgoal3000\bin ffd8ffe000104a46494600010101007800780000ffdb00430006040506050406060506070706080a100a0a09090a140e0f0c1017141818171416161a1d251f1a1b231c1616202c20232627292a29191f2d302d283025282928ffdb0043010707070a080a130a0a13281a161a2828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828ffc000110800fa00fa03011100021101031101ffc4001c0000000701010000000000000000000000010203040506070008ffc4003e100002010303020404040502050500030001020300041105122106311322415107617181143291a1234252b1c115f016336272d1082443e1f1265382ffc40017010101010100000000000000000000000000010204ffc4001b11010101010003010000000000000000000001110212213141ffda000c03010002110311003f00dadd18a10a704f6a95ccc57e37750782b0d8d9ea0cd32e7c5446e07e9f4ad723119a7b89e61e348f260719278aad613cbb640002938c76a182b264fc87bd13009c0c019c76e3d68a072e1cf6f4cd502d330c28269a61bb39c923923d4fad44c08dccb95cfd28b8280769ee08a263891e1808739e4f1d8d149392172cc714050dbb9fde8960ed8c60b79b1ed44103b05c331dbdb1dc5026ac1946d20ff8140aa631c773ec738a0346a003bf93e9cf02801895e7b9a01886796c923bd0090a06393c76a0142003ce3d86680d8dd9392303f5341ccc1b3cf7a2c812c37e4923d381429757013209fa511c18146c9247a0f6a007900c0c671c6280854e086c673eb45c27c038fd68aedff2fda836ef881f136f25d5e6b7d1262964aa02b03f98fbf153131935edcc97576f35c33349212cc4f39f7ab26186dfce5b200f73451f7600dcb8cf27e7400c0b291914046c9e0718fde81371b8e7273f4ef4007691919240e714097f31f376e7b5008caee27807b0f5a02c8e1b3c6d27d33cd0201d839523144d1a149ae084b78da47638211771fd050d582c3a0faab5119b6d12f8ab1c06788a0fd4e2ac356fd1fe08754ddccaba849696309e598c9e2103fed1dcfdeadc44fea5ff00a7f956366d375e492403ca935bedcf1eea4ff6ac68a55efc1beb3b552574f8e7009ff933a927ec715bc82b3a8f4d6bba5ca1352d22fe061cf9a0383f71dea5119cc6c0baed3eaac0f1fad40897dcc3d81f7a052366c1007df3400f21edefc5008c28f30c9c5170ee4fc37830086395250a7c66770c18e78da31c0c63de8609b41f7c515c5172a30c3b76344a3e377cb2339cf7a242aea89808cce368272b8c1a2e107c672a49f5c1a181c9c7ae7da8a2119e7b1f5068099ffa68258a132062d8f9e0f34059502b61bf2824e681bb297ced2a71efda80f19c47b9c77fdbe74057c13e539cf3c1a0eeeb9c73f33405ddb4f18249c1e28062b79ae242902024465b9214614649e7bd0362a7249eddc513456e5720f38f5a1a98e96e95d6baa6ebc2d1ad1e65521649bb469f563534d6d7d31f04347d2a2fc5f535db6a0e83718906c887cbbe5a9a8bef44dce9f731ca9a2e89169d6d6f2184b1455dc07b11dcfeb4d16f119c649a681285b03d3e5500f87820ff006a0e098191de80ac9b8904647b55d11da9681a56a31f87a869f6970b8ffe4883629a289aefc16e92d441682da5b098f21ed9f033f353914d19b751fc08d66cc16d12fe2bf45ec92ff0df1fdbfb559ec667aff4eeb1a04db359d3ae6d40eccebe53f46ec7f5ab82263da7dcf3eb5174e5181076918c7de869503232491ee4515c1803824f03b51287f30e0e7d803449494832c157278a2e8c71fcb9f9d144639236824d01e142efb1768cfb9c7ef40512a818de78ff00a682518e7cc30ab9e00a02cce9953247bd41e467191ed9a04205ee99da4e4e3d283a524b0427b5026c18a8e082067db8341ce0e39ed409b6502907391edda80f2dfdc496f0c124ac6184b144cf0a4e338fd2894f7a7342d4ba9b568f4fd261f12571966270a8bfd47d8511bae85f02b47b7fc34bac5d5c5dc88a0c90ab6c8d9bedce3ef4d1ad691a6dae976a96d616d15b409f9638d70054a1dbc68ea51d4329f4619a8022b78e04548515117b05000a035c5c4702a995c26e3819f534047bcb68a458cce866719540724d02e41c0f7a012a40f6141cbc8e7bd01719e38e6838af1c0a04ca8206d3cd037bdb082fad9e0bd8a39e0718649141047d0d5d18f759fc0cd3af164b8e9999acae4e4f81236e898f7c0f55fed574615aee83a96817ef67abda3db4ebdb7f66f983d88a061bb8db9e3d45165076db83c1f950a53780d8247c80a2398f182724f1c7ad080c608cfa7a51a0062adc7afbd0130173bb9c5070f071cb37e82826106e8f615e01c9e680d6b35bc534be3c1e3831b2aa962bb188f2b71df1de819ae4b1048c7f57bd01a58268e332642ae0704f7cf6207af6a01b99e17b7b6416e227407c494139909ed9f4c0a04a4e501e0f1eb40d263e53dce7fa682c9d0bd13abf58dd6db18bc2b157c4975270ab8ef8f563f21447a73a03a1f4de8eb031582b497328066b97fcd21ff038edfde88b7e32703bd64188e7e6283864b73400cd804b67ca3268317eacea6d56ff005233592f8b6303f953fa4af7c2fa93417fe98b763e0ea171297bab98558068f695ce0e08fdbd281e5c6a57ba5e9d14d716ef7774f2ec112601da4f27ec2827ada74bab559a20e148fcae36b0f91140283729c77a0e0a7777a01dac68395719e39a029607cb901b19c501480ab9279f4a086ea8d0b48d76c0586b7143224a76c61ce1831fe93e86b43cd1f12fe19ea7d2533dcdbeebcd20b612651e68f9ece3fcf6fa5067cbcf20ff009a051724905411e94032799060723da8406d6c67e7ea68d0e1770fe5cfb5026c37039ef9a02eca098c91e6e01e71c500b1d8a49c12786cf6a06a4e256008e3d050119958007920e2801154e32fb4120927b014017eb1c523ac5209a356215c291b87be28957ef853f0d66eaa99352d515e1d190f947669ce7b0ffa7e74a8f4be996569a5d9c56b6704705b46bb5238d42851f2ac875712bc70b3c30f892019540704d01ad2669a0491936330c95ce7140b2e4939a03638c7e8680ae485e33bbe540d60d3ada162c90a02c7270a39340a4f28b68da4645007a8f6a069a746f73235ddcefc391e12b2e1916824948742c99382473c73404791c617695279dc0640f9502c578c9efeb4095cb4cb0830ba21cf999c6401f4f5a05061d430c8079a02e03b3004311c7d281b5e3cd676c65489ee594e4aafe6c7ae07a9a0a075bbea3a8ea96f047d3935ebc404f04ad29411e08e011d98fed416fd212ee5b05b4d5ad6300c615807f1171eaa49eff5ad418c7c55f8466dd66d57a521f20cbcd66a7247a9283dbe5418a63862479877cf1f6c5008e400bdf1ce684016fe53dfbd1a73794600e08ce3d6800377c8c7d6800a9cf75fd4503d91492460f7ee3d28247a7b459f5fd592d22711c206f9e563858a31f99cfd050583518ba75247b1d134f9aed21396d4669769931dc01c003f7a329c4d17458ac5b55d36c12e040a3f1da75c1cb04ede2447f7f6a94567ad7a66db4fbbb29ba7d65b8b4bd8ccd09c8231eaa07b8ab04a7c2cf87b3f53ea8d77abc72c1a5dabe2452bb5a561fc83e5ee7e541e988218ed2dd22b7855228d76a46a00000ec00a510bd4dd511f4fe84da95cc31f880022da4902b1e7d3e99ac86fd03d631f565b4ee6d4dbbc649009cab2e48c83f514165b8b94b6895c44f279c280839e78ce28178ae6de46748a789e453865570483ec6812d42e85a421fc37918b00a883924d024c6e99b7a2a966c0009e17dc9f9fed40f81c77e28139218e4ff9815b9cf23340a01c907b9140201038ed402fcafd28386464e4fd33c50272bc60032609cf00fbd024f722dc66f24822ddf972f8feff00e280f69b24844919cac9ce7de83a447f30ded823007b50459d6ecacb528349b979127651b1dc795f1f3f7a0990148054823dc5015d491c0a0c3be337c2ff00c489b5ee9c87172016b9b541c49ff5a8f7f71eb560c1fc43e0a47e1aa94277310431f91fa551c1727f29ed409b641c86e31839a3454805739c1f6a026f1fd740f64665fc8c31cfde82db79bb40e9e8f49b62eb7d7e8b717ec832c91ff247fa1dc7df2281bcc9369d671493c422b7911654c1215f92bb8827bf068624ba635392df5eb4b9924558ee5bc19b71cee43c6dc7cf34c657be8db0b0b9d0f51d2afe668934dbf9628ddb8c2b8c0073f3a80da37546a7d25174fd95dc125c69f7313ee5655dfc313bd483cf07b1f6a68d5b48d5ec758b612e9d7293211c8fe653f35ee2a084eb9e8bb1eafb3582fe496278f3e1c919fcb9f97ad03ee8dd017a6741b6d3229dae161057c5750a48249ec3eb4139238568f6a9e7b103b5037934cb3793c610a2cd9277a8da73f5140ee38f6280c4b11c65b934023006d50050030e4647de80c846de3b500fcf9fbd0197273ed4007b91400e580c8e45074a82400e72682b36fd2162b7f25ddc09af2766ceeb872db79cf00f6a0b3229550140e07007a50092db860673de818df473c862686dad6470d9cce3b7b63e740fa1de6252ebb5bd81cd00bee2d800d003a6464004763ce683ce9f1cbe1f1d3a67ea1d1a30b68edffba814708c7f9c63d0fafceaca31e6dc71e1f07daa82608c83819f7a1a11ce149238fd68d0a579ec682cfd27a7c3a86bd10bc38b3b756b8b93c1fe1a8c91f7381f7a034f752ea5aa5c5eb292f732128037619c018f6ec282e5a2cb047abda74d5ce9b6da80f136de4a496219b3e48c92000323ea73467519d3da5bb757dbda410ac90c77c23058f99007ee7ec31416882ee47d23acb5185caf8bab4691b1efe57fff0038a9457ee75a82f6e7429350466b482f2742c0f74241c80c38c64541a9cfa1e89ac0177d33ab3d8de28f2b5bca429f91140e2c7a9b5ae9fb85b6ea9b46b9b3c796fe040768f76ec0fafb1f9505df4ebdb3d4edd6e74db98ee216fe68ce47d280648f75e2485a44da385ddc13f4a025ddbdbea16a633286566ce55f9c8f6c502ad750db2c514f30dec428247e6340bbf04100b73402afb943ed2b9e30683836defe9403bc1e06734020e06280cafe8683a375941d841c77c1a0151b467b50159f00e4127e5402872371040c5046eb5aadbe9b1c02e2f6dad25b89047099c677b7b0140fe3f1010afc803f3018e68160c3041ee2823f5dba92d34db89a1d9e2843b03b6d05bd013560c1748d57aa2797c6b35bab78e6959dc47231580ff336dcfb03c1a58364b5bbb7d7fa7b7427f1f673830c8664285bd1815238fad20f2c7c41e979ba43aa2e2c1cb1b663bede438f3a13c7dc76fb5515e9065b851f7a02950002a09c51a1b83cf14176e90d3645e9ad7752752aac23b3439c066665c827e944d29a6410aea725c4567135bd840d3c88a723728c29c9efe6c50d3ee9545b0bf8ef2e6e3c2fc2c6f72f2920e5f19039ee4938a9a875d03278377acf52ddf867f036ef71923932bfe51fbd3475cdc369df0db4fb389d4ea37970fa9cc0b00511795ce7d4f181eb4cd2451755fc45ac16d637381b14ca36b641dfce723e4053170d6cb52bbb362f6d3cb19241f2b9029862f09f143549ba7e7d2eef6caf2797c66ee17fdfd69862d1a069da7dfdac579d17adcda5ea9e1a992376c4723e39e3b024fd7e94c458ac3e25dee8d31d3bae74e7b79002bf8b8549471db38f5f4ed4c165e943a06a328d4ba605b4b22a1523c420c64fbaf38a82d36f0ce7cf7463790729b53017e940e0b0ceceed8ce0500e1b70daa08f5c9ed41d271cd0132476e7d7ff00aa069797d2411168ed9a41fcc858211f73c5075acb25ca6fb82aa31e58a36c81f561dcd033d42169e158ac64b98151b3981c2966cf639f4a064c7a8ac55e4865b7d493701e1c8e52403ea3cbfda827e390ca3f2c914aa81991bd281cdacc2747215c60e0ee5c67e940cb51b0b2bcbd824bfb08ee1a252d1caea1821cfa67b1fa504982b2283ce08f518a08abb82f6dd0369a5662081e14ce40c7ae1b04fda82275cb0bfd4f4536f7114589a5412461f3e4ce4e0e060f63f6ab2893d3b4b5b5b78e22ed22aae3cc3cc7e64fad3449a22a461500007602a0cd7e3b74c26b5d2ad79147baf34eccca40e4a7f30ff3f6aba3cd0543267eb5427b86f1f4c76ef45d0eca1ad5ef224d13e1cf4fd9b22192fa67bc955f8c8c617fba9fb510d7a6ed3fd43a735e5b54964be658c048fb6cdd9e7eb8a186bac97d174e6d22e23437b7ac26b95e77c68bf950fa7279e2b22dba45b59e97a669fa4ea36aeff89cea9a90451fc355ff0096ad9f4ce3f41570675d4fa8c77da8de5cde5be26bc653171ca47dc1f6c9fed5562b97f70276808da7c24f0c1c63804e33fa8a2928c0e0383c8f7ed41d92a41393f4a2548595c2c37493db4cd04e8a08f139566edfef3445b6e7aeaf65d2df48ea2b11776ae02a93e564c772adef409f4ee8ba9a21d73a36fa579ad9f325afe599171ed9c30a960d5ba0fe2843abb47a6f510fc26a4c36890f9558fcc6783506a1147b510024e30339ce680d2c6ae9861eb9a009178a0205443b989e39cd01d8075e3047ce80563057ca381ed4011c4531e503d85013c91b804a21279c903341131cda8c3abdc8650f6d20c4321232adec3dc504bab2c113c9293bb1963df3408dd4b75e1efb2856463dbc43b4631fad047e9177ad4fe32ea16b1db4b8fe1aa92571f5f5a0916bc8e0895af5c46c17cd8c9ff7da80f6d736f7f6915c59cab35bc837238ed8a072a31c1ef4062870718a06f7702dc5b3c522ee4752ae0fa8230683c75d6ba3b74ef535fe984929149e4278ca9e47edfdab42058003763ed409f88ffd6dfad06b1f12ae612fa0c76e0b471e9916d23f973eb4158d3efeff004a984da5debc1295d8e4018dbf3145d583a2ad96f356bbd7f5d90dc59587f1e79a6392f28fcaa3ee47159444ea3aa5ddfc7acf50dcdc344d7a4dbc317f52641200f6000fdeb41b5ef51d8eab672ffa9e971c97c11638268e431a46000012a3b9a351567db823b11f3ef40948e428048207a8340ab48ae83cb83ee0f3428a982719edf3e68c9cc97d3fe15ad8c9be138f2bf38e7b8f6ef40f7a5f55bdd3f56b46d3649127f1405f08e7249c76f5fa50689d48ba5f545cdcbdb462cba9206411b2b055bb07d4fb1c73528d4fa8f52d62cf47b6b8d2e65fc458c49f8a818795c151939f977a823ba0fe253750eb7fe937b04293f9f6c90be41dbdc7ff006283473c1efc1a06f69776d73bbf0f2aca32572bc80470450284a46dfca19f819f5a04e799614def26c0bdce09cfd85045dc75769d12dc3c3e2491db0dd3c85195235f7c91cfd066ae0cdba9be31f4ec61a386c1ef9d4ee473e45cfb1cf34c101d3ff1ac9d481d46c628ed24751881880833f988e7b0fa5328dfed2f2def2ce2b9b79925b791772ca87208f7a60182ee2b95cc0c48f53823fbd40ac658b30f4f4a086d4ee1d75bb6b78f4e965596366fc5211b23238008fde81f43692da5bc30d97831a0397dc09e3d714087506bf61a2c4cd77324726d2caaec141f9fd2ae0c435bf8c57173ad7876f7a2daca10489121244cdf319ce3dbf5a834fe81f881a6f57bcb6ba7c53c72c11873e28cee1db391dbef4199ff00ea4348116a5a66a8a8a04aad04847a90723f6ad7d18c312ddc02a3815423ba0f63fa541687bd9efe1b533b3c9e0a78473e899e318a09bd0ba6eef543e3b2bd8e9b10064bd9e4da001dc81401aeeb29a984d0ba7d5e1d06d4e6594f06523bc8e7f5c0ac8af752dfc17d7090d9218ec6d9447129ee71fcc4fb9cd6842ab10dc0014f3e5a2c1704b671dfdc734525226dc939e283a362c7f940344a380393df144733e2276e38f5efcd01b4bbbfc3dda4a9298a44395902e4a9c70682660d4265d62de40b1bdc1545054f95c8fe627df141af7c3af8808f3dd68dd5d2a45765884b8908d8c3b6c27b7a77a945d7a5fa474bd2ba8e4d5748b28624955d5d8b13b79ee9e983d8d40a753758c7a46b96f6114725dc92279a2810b3a64f94900763cfafa503fd3b59b79ed84da34713c0cd890f0a158fa1f981de826e1b548959fc4dc5cee24b6467e59ed4101ff19e9f676baa5d6a72c50adb4ad1ac790ccc076200f7ad41e7df881d79a87576a5f87b0f161d381db1c2a36e7e6d8ff3416bf87ff082c6f208ef7a82f22b9761bd6d619785f6dc477fa53705ab57f83bd297ceb1e9caf67708db9c4526723e849e3e94f212dd25d117fd29a8c09a76b534fa39cf8b6b71ced38e36fb73417f52e64548e34007e673e9f21ef590a1c918c90718dc281a69b68f67118d9da5058b798f6fa7fe280daadd1b2d36eae70710c4d263df0a4d583cc7a668fd4bf11b5837d7c93dcd9a3146959822a0e781f4cfa55161e9dd7fa67a4f55b9e9aea3e9f81fc09ca0ba118998fcdb2338c7b528d39f4cd2ba76e2d357d292df4eb391809963420ce1b1b576fa1e7359119f1eb4e17dd033ca172d6b2a4df303383fdeb5c8f2eef3bce4e0e335684cb0c9f354160d36f64b0baf16072b91b5f03391f43c51aab23a5debe91c4fad4d73689e6fc3a290573ff4f03e59f4a3280d67581ce916567f84b58ce0a1fccec3d58fa9a084de08c90464e4d1a8e419059b201f4a05630a176918efc50176293872c17bf14042aa0125b03db14046c60b60123fde6827fa0c68edd5365ff11346ba6292ee64194240c807e59a32b7fc51bfe8bd5ed5db424860beb62b89218422ce09c11c01dbbd0660ae110bf1bf2154838dbebfefeb41a8f4cdac7f117458f4d9ecd2df53b4cf81a822808c47255c0f7c8e7fb54a2ec2cfabba3b4b4b8d3af12eedad40926b0f070a13f9b633649f7a82eba6ea4357d321d4ecad512daf20df26e016507fa4fbfaf3e98f9d067dd2bd2faac9aa4d72d72d1e9510ca46a7631c7a320e18f1dfd7bd059afb7da816d23de4ba5de211346a1e4785f190548e4648c63b64e6b43ce9d5baafe3b539c5b452dbda46c638a167cb281c73ee4ff9340e3a3fa5f5aea4ba58f4bb57dbfcf2b02a8bf7f7a0de3a5fa0b50d2a2d92eb3e048c0a97c867dbedcf6a944e5cf4f6b76d1b3d8ea42795066266c87c81c65b9cfaf15048e83af3cd64abac08edaf01546c38dae4e0657ee6826e5b892de3702292e2545ddb55700fd0fbfca81c4b3bc718716eef9eeaa402280d14ab3c0b2c65c06fe571823ed40df56b217fa6dd5ab9216689a33f2c8c558307e83b8d77a37aaa7d22f2512c28768800c9954671b3d33ebef568d0ef7a7749eb0b5bbbb162d657b32b46d2e1564c8ed9c5644d1b0b9bbd261d2a440af6cb0e2e5b1e7dbc1238e0f7a0375b696daa7496a3a4dac8a92cf078685b271db04d391e40d5ec4586a1716de2a49e0c8c85d3b120f715ba1899173ff305413070abd89cfe9f5a2d3ee9c8639fa874eb6b804c52dc46b20c9f302c3bd11e84d47e1af4d5dc6521d3e3b662c19a58721ff5a9a321f89bd27a374b456d158dccd34d333332c9b4b2afbe47a7cb1f7aa33d2bc0d8c0f1c8f6a2c14b6d501b39cf63450897380c319e3de8065031c038f7ed40d8faf1ce41e4d004876a8dc3cc7e743025c956c818028c904579e7f0e15695c9c0541924f6c00283d0bf07f42d6b48820b8d62d20b2b58d656404959e52f83c8ff00fcfafbd4a35bb06f12391a48dd55cee2b2f3818ed8f6a8158a159890f02242079147623e631c502b0db436d1ecb7458d4738038fb0a087d6eeb508f48bb7d32d95750752b6c26c905b3ddb6f61eb574794f5cb6b9d0fa9678b512b25d24bbe52b8c1638278fbd582c57ff12afaed45b5bc0d0d8a8c08a2731ee3eec5793f40450466a1d59af446293c186cd53ca0c36eab93dc649e49fbd048e89f1675ed35e301e293919dcbf9867b37cbe94a35fe94ea4d33aba6824306dc48015750d86c6e247b0cf63591a40b8dc23fc30f14138dcac3000f9d03687547f12e8dd5af816b13148dddbcd29039c0f6f6f7a0eb5d62caf5636825db70c9bc4328f0dc0271c8a090627d3073ce681acf6505ccf14d35bc2f2c2731bb28254fb8a075144a83ca806792400334049ee6281e2496408656d880ff0031f61fa50446bd76058ea1b9e21025a3bb48afe71df9c7b71de9c8f196a0de23ca7b827d4f7add117e0cbfd4b5059392369663ff004e71c51aa97e8f555eadd258f2bf8a889cff00dc28cbd0bf123a926e96d163bdb74490bca2321c678209ff001591e71eafd7a7d7ef45cde2c20aae144638033fb9ad2e1b5e69d058da431ccf21d4a5c3b4631b62523807feaf5c7a50222f2d648c25f5aeec8c2cd19dae3d3e87e944d3eb7e90d425b49ef2292de38224f1505c3f8724a9eeaa7bd0d57a60406059436306868a7803839c7ad1a158039c13f4a33a716767f8cb9b6b55e1ae2458813e9938cd07a9f42d0b4de99b4b7d1f41b58ff19b03c93ba06607fa8b1f5f619a5b8266d74a65d42da6ba90cce996dcdc8c9fff006a5a2c2635083b05ef83eb5028076341db4b1ed9f7a04651fc41db18ed419d75b744dbea335fcb0db0335f2057901c05da73c8f9d5d18a75174a3f4c47335e35da4ce418a489374254f707d463d33565d1529b569a489a17944b06ec8057d71dcd037b4b6b8bfba31584124b27e62a8a4f1ea68357f83da7ea5a76bfe0912453ccabb49194653cb60f6ce3dfda983d196cd108c2401711f9768e306b2297d73fc6d02773a8b591922693c5004bb9d72542fa2f6efde8314ff867aeeec27500b77bb5670e36ca19b1dff2e7f2fd2837ce8bd5dd348b78b552219022870d9c46e792a4f6c608a0b846c8e03232b29ec41cd0199f1410fd4b24b1e8f712c0a5e4452d851e6c639dbf3238a0afa42ba77475e4ba8470896681da45180b18da76af3c9029c8f26dc1df2b9c606e273e86b743331924f27f4a82c12280e59b008e79f6a2d4d74188ff00e30d203a82ad7519c1ff00b860d11ba7c5e86c9fa3afae6f4091e043e021270b21e01c7dcd6479ab4dd3aeb56be4b7b184cf2b301b57d07bfd2b4bad0fe25e9f6960ba7c7a55ac50cd750335ccaade7723b83b8f6e38a2207a5ba4e7ea3d93780cb616ca53781f99fbff009a0b675a5be9765d43a75a6ad3b25adb4185429b831c70303dfdfd2831eb8954ca48f3827819c71ed406b2b1b9bf9a5fc1c4ce2253238047957dc9345d122b792eee522811a495ce1157b93ed444ff0049f476b1aaf51c761345269d25be269259570c833c6077249e062a68f53e8ef0da69509d4ae225b92a04af232ab16f98cf1f4a5a266d4dbca8af13a329ecca723f51502d14f0cb9f05d1c8ee01c91f6a0393b4edfe63c8a031608859b38f97340d84d04e5846eae50f9829ce3eb400fb24466041f5e3d2823f56d22db57b192d6e61468a41c823ff0035651916bbf04ada7badda5cad6d1b72c09dc33f2a6875d25f0865d06fe2bc6d4c4d3282026cca8cfafcfd29a34cd234a10c768f711a78f1bb392a3001208e3ec69a26a58d640c832091c90706a084ea1d3eeafdadf4f86da3166c0b4b397c18f046140f5ce4d04f4702436e91c28a9122e028ed8a0a9f5a5b6a09a1bc5a135bc72cce048b3c5bc15c638f9d59043fc2db997481aa69dae49e1cb6bb643239211939e467818f97bd305965ebce9a10bc8da9dbaa2679dd9ce3d8530572cfac87566ab05ae9f1490692b9696e1f833738555f96793504df5f25945d2576b7ec16dc46792381c7b7ad5e60f234980e42f6c9c56a82ec3eff00bd4124e49700f1c646e3cd169ce9575f83d52cee324347323f6e3861ff008a23d47d4ba6a75074fdcd8ef317e2e2ff0098bdd4706a60c3f4ae8cd5f44eb8fc3e97248a638cbc73bf90483d463b373e9574685abf42a6b5649fea72bbdeac4a8d3b018cfae31f7a6895b6b29b41d30d8e9f6bbed9213e1b7a994e724fcbb5064bd7835a9752d3af75d8116354778f660788cbd9483dbb0a0cd20b2b8d43528ad2088bdcccf854039cff00e2827a0d34e9da1de896f2182492efc0976f998aa827d3d334113a74aa9a9298628e74570478bc0c7cf1da83724bb8246d3e6416b0384da61b5501c9f5c3704f152c037561a95f5fce61d3ad6db4ab950f34b331dd9f4191db8fdcd406d67a675ab4b6d325d1af248272a43430315ddec7038f6ad4b3f448bf47eb71cb69abddebf21d5e26896203846c30c8603b9c6452d9835901405660376319ac84bf13180779d8bb82827d4fb0a06f777367a75acd7170f1430a9f331200cfceae061a0cf6dac692d7365266191db0578f5edf3a6075a6c9278b3433188a467860d96fbd40fe540471409aa0c1140750001ed8ed4058e15133c983960077edf6a06faade5c5b7822d2d926766cb967da2341dd8f0727d85033d27597d62e2ee3163756915bbf8799d71e2f19dcbf2a092b88dd9a311950a0e5b70ce47fe6ac18af53f5b69da9752dd69da9ca906876e24465d9e69881c6ff005c679c0aa2bfd267a347512c93dbb5d42d90d3c800b68c9ce0ec3cfa528db74ad034db5905ee8be1ac728dc153984f3f980f4fb56453be2de8f647a6aff53796596f0aed46798ec033ce149c0fb0ad71479c9bb9dc3bf3c55a0b95f65a825150b481a407b93c0fda8a29c06671dc93803bd131eafd0af6dffe18d2ee25982a4b04603b7a9c631fad03bbe586381bc5945b96385718c827db3eb5288eb8ba934eb15fc3c535f05427796dcccdec7150637d5bd55d5362b7975aa4d0d919018adec8637807bb60723000e4f7cd58203538aefa8aeb478a7b9beba924547b8774cf8608036a80704639cf1f9855d1a7f4c68b67a03de5e5d59dad8d988c62e1c0f107a1e7fdf7a082ea6d07a6e3e99375a7cb6b3db093c727701e2360f7f53dfb50653d4130d42ee18f48b3f0232a15218936963ebf5fbd06dbf0cfa74855b9d46e04b730c6144691e12307d33ea7de8348ba6b5478a279a004f98c479247b81f5a9438805ac0be2e02e73c9ef8fbd40c2346d43578eefc40da7da1dc8b8eefea4fcb9fef419beabf12a4bcebcb2d2fa7ee0dc58492084b30236bb6467dce383f6a0b87556a67a7f4d95a0bbb5468816f0a69c78b2e072572719ce78357079dfab3af2e7a92c963b88d94abbbf91cedc93edf418aa2c5f0dbe2a6a9a0c90d8de34773a6a8da1186d6403fa48fec682d9adeb7a9b4c9d572dacc9a6c9700456e5ca910e000ecbd8e580352fb1ae7476bd6dd49a325e5a9f3025245fe961dea097523cc0919a032af039a006936c81423104649c703ef40dcce64bc3035a87b6f0c378f9fe7cf2b8fdf340a4b6e25962915d94a67807839f7a043586922b5636ec44c061063f31f6ab079d7fe19b7eb2d4efeef55d5d74f992e9a0fc3a441dcb13927b838c9aa2d4bf042c618e178efee6e18104870172318edf5c1e6945bbe1a748ea7d2315edbea3a99bcb190030c401010e4e783ee0fa56455be3d6b90c1a6268d69e17f1486900ee98ec29ccc183119419e7e55ba11f089f523ef5058363a8059fb8e31e9421b491056c01819e28d3d0ff07eea3d53a1e3b6b8db235aca63c139c0eea68ca47a9fa6ef757b83ff00bf68ad428c2f248c7a8f9fcea518df516adac74e7544f63a2ea172f1800291e6cee19ec78cd5826344e85b6bad25ba8fade5b99dae0ee11efc71e858f7e7d054a2d7d39a75ae8f7b6b00b8917f1516624b78429da327cec493db1db1d8540cf4aea28f58d6aeae2f6dd64b498082d880488d149fcea7d4939ab04175e6850a8d32de3b78e380c8de32c4db4e18e430fef543cf86fd0d691b4fabdf6648b3b2db69ce7dd87be68342d2f4fb9b5b891af1a28a2dc05bc5036d001e0eef7352884b961a2ea9aa7555c885e08d45b5bc52b61b686c120fb939fb541276bd4b61d53624d942e2f6200bc32290633e99f4233416dd3ad3f0d611c0c77b632e71dc9ef41156dd27a45addcb3dbd9c513b1dd941821bdc7b558333b9f873757fd69a85e3f813e9c7723b5d93265d872473c11544a68ff08fa75e290b42ec4e4124e70738fa5048e89f0f745d2aeadd2decedda6525c975121183c77f7a945c754d0e0d563682ed43425369403bff00bcd58308ba7d5fe13f5a05889974a9d8b46aede4914f707d88ff001528ddf4fd7edb54d1a1d56c312dab2e64dbc9418e78f5c541296d70b716d1cd6f8789977230ecc280cb7519b816f212b205de4e0843ce300f6cfcb39a0545c42cee88e0b458ddec33ee680eac92266360debc7b5056fad2d354b9b189745744be121daf27e550548ce3d4d58324d07a725e98ea2b7ff5381f5169a7579d021fe13904ee43ddfbe49038ab46e76cf05cc714f6d309232a4a98ce54fd6b2196bb7f2e9b631b2c427b891b6851db3eff002007341e5bf887aa2ea3d4f77378be381e42fdb711ed5a1554395caf1cd07617dcd04fc85402101da791421b49920331381c60d1a69bf02f56f03a925b12c162b98c955f775e47df19a32d99b518268e4491668704a79d4aeec7b7bd4a30feb7e9144d76e265697c3e2693631674273803e556087d76f35fd49859e9925ccf611141106f2e182e3241f727f5a94681a268f79ad1b1b8b9dd66b1c2b1ce9bb06361c1e7bf3fe6a096b0d3ba57488e485b52b40909c386901607d47bf7a0ae758eb69ac4d15be81a748f0a9c35cc90b2eff4c03c1c638a0b77405c5d5d45f87be5fe359a88b81b401dc1c7d38fb50586fed18ea3015790091591e447c1518c8c7a0a0a5754d8c9d49a8d9f4ee9dba0b3b5224b9692327728f627e7c6682f9a7e996b6b3a8b6b748a348820c7720761412c064e3041ce282b5d4bd73d3bd3f33daea97ac2e540dd0a292dc8cd043c1f15ba2a7923b65bb910371b9a12141f9d02edf13ba2ade56857551e5e77244c54fd0e280746ebfe99bbbd655d56dcdc9ce08465565f4ee3bfca82d53eb3a6dac3e25c5f5ba646402e33fa77a0aff5b74ad8757e9ca972844aa37c520fcca7d3f5ab067bd369a8f467544d626c98e9f7118f0200e4465c903049c8c9e6ad1b24334b6fa6249716cab20037c309dd83db03b5640dddac3764a4f02cb1103863919fa7a1a06d6f600c37162911b7b252b87dc773f1927393f4a079f868edae1ae6328a8b1ed38e30050226e85d5dc1f879011b3c47c2f604719f9d01eff4f4b83e3c6b18bb452b1cac9b8a83de80b16e8208a3b7b58e1407cc061427cc0ff1560ce7a8f592d69a97504cad2dac01a2b53900c3e9e51ea58f727d0551e73bfb86b99a49a46dcf21c96340dc13804f20f6f9501c0e3b8a0963316fcc4607007f57bd084d64dec01200ce483468ff0040d525d1755b4d4206ff0095207c11dc67ff0019a18f56584f6daad9dade4211e39104a8ded9152b235cd8c530613229c8c1c8ef50472e81690ee00322b0c100f0debdbb7ca8111ace856371358cba85aa5cc407891ccf83f2ef4048b4ad2e59bf116769672c72f99dd1437239078e2824a4d3e1b94559234110e781839fa0a0561b38ad532a12319c86c6307e740a9732a3a00cac870cd8e0faf0681be8b6db965bb909df3c85806eeabced5a09523647e6e0fef419a6adf116daf7ac34be9dd1da686e7f1ca2e243b76320ce57df9ff1560cc3e3f470ff00c78255b842b35bc6c4af9b6e323d3e95467b6365f8dbcf062beb68c119595d8aaff6e282422e9899b4f6bb5d46cda2562a76316c1078f4a0859e1b9b762c0bf94f0e84feb4125a57505c58ea70dd5d0174a986d92b1c13f6f5a0de7a5be366877260b5d42dee2d2423124a487507ebdf15289dd3fac7a7bab6feded74d61733473acdb5a162142ff00313d81ed505fa58fc6d809380c1b9f5c502e0e05040ea367a85dea454de2ff00a610375b04c16c7a16ef8340b5f6930dce9375636acf6a278f04c5dd4f1dbf4a084e91d06f3a52dee62bbd4a2b882494ced3c8a448063b63b638fde803ab7ae749b2b3096d792c93c8c109b55dcd18ce3710473ffdd043dc758dc5869044565aa5dda4c3c2b7bc78c1f14e3963db03e7c0ab066bf1327d41ba76ca6bc48ecad24c456f6b0c87cf8e4bbfa138c0fa9aa3297c83dd4e28395811cf2680a5b93c7ed413cd1ff0f3c797b8031406645236b0508406f30e68ba49c051b97d0e0e7d28ad57e19f575c5be8f269515dac772877c11bc464dea7ba8c739ce78f9d3193bb8ebfea2bcbd6b5b6b8b58bb7f13c2f0ce31cf0deb4c0f2dbad6d743d2ee99efae752d6c02a86e0054524f6383c7ff94c0b6af274c75149a46a5a82c46f1e1479fc3190bd8156fbe7f4a960bf74e9d253f1167a3ac09e0856610e3041ec7f6c540f67b892cee7f8d18368232ef2af2508c7047cf340ead5bf130accc9b1186541e723d09ffc5033bbb1b82d74d6b37f1244daa1b38073df3f4a08eeb1d3b50d4fa6a5b4d32f12cef1902ee73e523d476fde8306eb0d3fabfa4ba92c278af67bb7281606472f90bdd58558253a6afb40ea1d62283a8b461a66a6f931cf6a7c2466f7cfb939e7b5515fbed3747b5eb8f06eb78d35080a2ec9719c76f98049a0b4ebdd37d1bad869acbf0b03c5c16b29444adf50ded41995f68564a263a66b31cd02be152505493f51c1a088bab69ad1bc179e320f07c37c8a0692b46c4995f0381db39a0b2fc34e971d57d4705bc8db6c50ef9dd97b81fcbf7381528f5ae97a1d8e996d1db69b0c7648855b10a81b80f43c739c54134147b9a036063279fb5046e957726a0f2cfe04915b06db1788305ffeac7a0a00d72f8d9c491c06337533050ac7185cf2df6a06da2da4293488f34973328c34aea428c9ec3eded40ee7d2ad249448f6b133820ee2833df3fde819ea96897461b05b87815f2ee919e5d47704fa039ab079b3e326b70eafd4ef6d6650d8e9ebf868b69c8247723efebf2aa280eb9193ebedc5002a124e015340018fb8fde82cf32b1603d0678cd02406dce3008e47ce81b499c331383c9c9f5a2e9c69377369f7d6f796a4acf148acb83fb511e91b3b3d0bab745b7d45acedd8e3732b71b1fd73f7a5a19eafd09a56a0a96b1c705b49c48510761ce4fcfbd4d0d752826b2b583476fc3daacb295b79d768de8a32b1e71f989e49f6a7d14dd1af5ba275a45b8b093c054492ea769092373765c1da4679fbd306e36ba9595fe9f0dcdbcc92c33e1579cf27d0d409ea178f68521b6b76926ee8a7853f7ff140bc768d78f6f73748d1cd103b543f0091cf6efc502f7319dac194371d8b6326829f0c501d7ae6fa568d5d4942c806d4db81839f53c8cd59456fae6e628749b5bab8b1865b08e4726588ec11e7f2e49071c93da9a31dd4341d675e9a5bad374f9858162d0b4ac70e18f0573df35a0c759f87bd53a404f174f965dfff00f479b1ef570576e34bd4b4cc0bdb3b9b7258a00e846e3f2a94376475cee4914af7ca9150685f09ba61efb52fc7dd69bf8eb7c158d1d0b47bb38f37efde968d6eeb4eb5e91d6ad25b660aee59974db6881690918e31ce39279e062a5a34bb57b88adedd1e379679065d80036679e6a07e8391bce7e940c659ef5afe1286de3b16f2b8903094b7b2fa7ce81eb380c4260ed193f2a0cd6fa5d4a4ea0fc7bdadcce923158a3039db83c038e3ef41a0e96b2ad8a35e009291b8a939d9f227e43bd590436bbd6fa269202c974b7123602c76e779624e00e29833bf897d493e896525dbcb2a6b5a9c3e1456b91b6d60cf989c7f31f7a60c02490961ebcf3eb541308e39e067b507007b96007a67fb50178f97eb4165ce18165c2927b773fad023202d9c8dbb7818ff003408300b87f2f1c107d0d0c15a4f2e339c90467f6a18bdfc2cea8ff4bd561b4b9ba686d6e64552c4f954e7d7e46a60f4688d240af1b2bc6cbf5047ca960617ba658de1b792f2d94a5ab33461b18524633fa1a81b5c8b5168967369d23c0e0a24622dc981d81c76aba29df0bb48d660d52fceb88d069f04aeb69130037127f37b9c0ed9a8350781240bbc06da72323b1f7a0eb8816e633192ebc8c9472a78fa50349b4c83c068e24f0ddbcc1c13b837be4d055b57e98b996d4db5b4a893dc1e6620b6ccf2c467efc504ce97a38d3f4d874bf09af6d46e2f25cb82724e791db15650a43f878b51fc34f3da8f132b6d6a98c80a39ff007e99aba249631b58b9047239ec3e55368aeeb7d2da6f52c0eb7f16e87f2c6e836ba90724ab7a67b55d115ac7c3e8aed2182def4c56a14096368959a423d77e3229a27b41e9d8343b01069c8a8dc9660aa3713df3c64d4a1c695d3d6b67a8cba94b9b8d4e61869e4e4a8c636a7f4afcaa09a485519caae19b966f7a0435196582c656b74df3e308beec7b50629375775b691ac5bdb6b16d6378779f019b00a31cf391c9c2f1daae0b35ef52f5374de88d77aa45a6cd25ddc0108694ee2188c28007603d6a0d16c92430a4b2ed3230dc401855cfa0a0a07c45d7b5db9d462e9ee960b14b2ee134ef8c850012147ec78ab0670b643a2efae753d72686e6e2da211db42176079c8e768f65e39f7aa332d6f58bbd635096f6fe6692695b24f603d801e82823cb900ee00e68006460051dfd680ed9f0c905b713d8d006d5f5419fa505a18f94e40501b1b81a04186d62402c87be3d6810b81290aea8467201231cd1749dbc437f9f1e201db3de8ba07dc0175c027f28a335b17c26f888d6b6d0e8fabf892a29c453b1e547f49f7a946d6424f08236491c833ee0835073294888894120700f0280813c40a6711bc8843e00fca7d3ef40e41dc081f9a811681c6f7565329185623b7e9de812b3bcf11ff0b74563bd50494cf120071b97e5fda80d7577046c9019d5669dbc340324eec67fb734103d5da96bf67a7cf0e916f6e2765f25ddc4c11107ab1c8c647cce2816d3ec7f0f6564cae6e67da375e6d52cc4af2e4fb13ed4145f899d47b3499f4bb6d46cda49b69b92921565c3648e3dd40c81cd5c0ae89f13ec246d3e379ed2d6da180b5d34849da1780b128e49271c9f4a60ba685d5fa36bc42d95c324ec7090cc9b1d87b81ed50588958977cacaaa3b9341c655f12348d1dcb8dc1946540f99a019e2134454eeda7bed3839cd052fe2136b536b5d3563a1ca53c49da4b9507198940ce7e5c9fbe281c6b7a974cf4ee4ea7242d76dc784a3c595b3e9b464e3f6ad0ac745ccbd4fadcbabea42da56959a382ce7460d6b1a93c01f97272093ebf6a82f1ad6af0e9da5cb3cecf6902216919f82aa3818c7a9f4c530649a9f5269ba7429d472239bc991a1b0d3c3152880f0f23039e7bf3de90635ab6a377aa5ebdcdecef2c9239e59f3827e5ed54302195fcc38cd01245395c1f5f4a05b606538e483c501b6939e3b5077860f3914165754c33e549000dbe87de813b820c27fa7baafb8a04a69c98e281e42618c795338033df1f3a06c03e4e029247007ad010093c35674da71f977640340081a190658e41c820f141b0fc33f8926c218b4ed609366a02249bb2d19ce3ea4528dbece68eead926b7916689c643a9e0d643387521fea2f693c2d6efc786ee46d9bfed3eff2a04669edf5295ff057a60bd865309246d3bbbedc1efef41d63a8dec9ab4fa7dd4510fc3c69234ca186e2d9c003b7a67bd034bad0a5bb96e25d575267889cc1b54446d9bd0a37bfbfbd02925945a72cba8dddc48b3f87b1e58f23c623f292bdb7fa7cf38a0a5750f54ebba56a9a67fc516b6d6fd3970ea9234677c8dc7f38f6e4640ce282d1ac4b16bfa72c1d2bad430cd1ba822061865f5007d3daac19cf547c189357d561bbd3eee683c62cd786e9b73337b8c7bd512bd39f06adedec2de0d5ae639da372e6485363107f97767b505cee755d03a5e58ac228659af123184b7b733322e38c91dbf5a943ab3d52e64b49ee755d2e64950e238e35f10c884e17cbe87dc540e6d7509a4f110e9f7566a471712850abf6ce463e6280bacea36fd33a4497f773cf32c698dcc4beee33938edc7ad05534aea683ae61d64c4d2a69b6b88d16d5ca5c303f3e386cf61db140e27b5e99e96b64bdd562b6b30aa36c6c37cac7dc9eec6b42c1a66a962fa70beb6b516d0cbe76322f86c78f6c66831bf8b5d5d2dfa35a5dce60b1933b6ce3c788769f2b331ec1b8fd2831b79649984b239773c1dc68129725c1c640e73400ec781d8fb1a03c4a85d0c8582640257bd01e51fc42236263c9c67be280429c6037eb405dbf5fd682c2a0bb976cf07d3fc5009279ef8ec4e68193a9902b28e7dc71fb501d95b098e0f6dd9e0d0049131019b047b8390281bb292484e47c8500c4f242c3076bf704704739a0be7c3febfbae9a5daf23cd017c7e19fb107bb67d0f6fd6837cd2757d1fab34f4f05e37dde630b1c3a91edf4f7159103d6eb7da65fdbdf59dadb5e2460ac876ed9e1c8c060f9efe9c8a0a75cfc42d5742d2ee5a7e9dbb494b6d6b9bc930cce4f940e3cd81ed4160e98f88315e689fff0022b57664199cc5196f0c7a164ef8f98cd0589baffa68590985eb15c0db1985839f6c2919340b69d03f5285bdd6f4bf021424db4329cb153fccc3d09c76a090d3340d2f479a7bab3b38e2924e5e451cfd280d7dafe936f6c5e4bd89813b02a36589ce318a0358dc35cc4e17f9bf234cdbb78fa0c607a7340e6cec20b1596610c6934b8323226379edda81da8dcb9ec40a042f50b5bb21645473b58b11dbd7bfca8304f8add5d67a9ea8ba5d8ea72c1a4d8a952f10f2c920e368cf71e99fad5833dd0754d6ed66bdb2e9a91a5babb2a310465a57c1ddc1038e7bd5171d3748b8d46ee1ff005298dc6a764c27d4eeaee7fe1c01795881c9e7804fe940dbe287c4b6d75a1b1d1c986d62277c91bf131f4c0f6fad0663737135d3b497124924871f98e7803007d2811dc5b83903dc0a0333f03be7de8122df2c9a05a11e5f51f7a05ce7071804fca8033e5da0734020b0183bb23e5416269577ed0e5323078ceeefdff6a03dbcd62914c2f629a47c622689800879e4fbd046f9d8a2a03e31385c0e73da8b83ca590947dcaead8208e73da8849b3e19ce704f7c5015586d006431f5cf61f3a04ee586ff002481c8fe6191408f0011eb8e30682774dea9bbb5784492ca6385832e1ca95e3d2834be9df8c312e2db5eb4375080337000f1303d18763591a469baef4d755989ec6f6dae5a23e20b599406dd8e080ddbed41272f4dd8caf1c86d163910f9595882a3d718a035edd695d3b6a926b57d0ac65b10b4e06eedd863bf141077fd7af2782bd3fa26a1a8891d57c630948c0279393dcd04cf5875258f4de9f0cb7b7b6d66d2b81ba752d85f5214724fed41036bd79d2fe319d7a8f4b9c81e58de2f04827b9ce09a07a3acecf54b790685ace8697606009e52c377b7f2e682b097d7d36acf0f55df5edbdc0977412468cb6ce3be10af3c63b9c8a0b0751f505be9690dd5d752436f62a3fe4c6448f3b7b0c64e38f615734651f107e3045ac42b67a7693018633b965bc1bc838ee173807bf7cd33065baaeb1a95f2c11dfcd2bc51fe48880aa3e8a062a8b059f595df4ae9a74de9e9ec499d43c97b1427c6e47e525bb63e4282ad3ea3712893c599dbc4259c1627713c927de81043950df97db1406da8411c92063be280230839627078e79a0390a71b5bb5003a8c1232338e4507025573e9fbd02a0e41dc0e680c3691cf714053bb34160895dc16f291d98d02322aa39f3e14707ffaa06f202a5bb0c7201f4a343aca51090497efdfbfce89840c8db8e46573923ff14410b00490d9f5c1a0425dd8ce4673e873cd0265e4dbe7041ed814009b8cbb8e5863bd07163b7716e0607b6698060b96b7b9478dc8643918247ee39a60b7e97f133a8b4e0c63d4ee597380923970a3ef4c0e13e25dfcfab457ba95bdbddb212016501867b9cfbfda982f907c74b282da34874a9048aa479c83838edc62982b7ac7c42d235cd67f15ac5b40c366418a2cb0c1c81e6f5e31db14c160d035de8cd4a3f18ea96562cc37359dfe9cac887fef039fd6b39446f56ea5d13a9dca4579a922496b1975b8d22dfc3566cf9557230703be715ac1431d4d2275325d7fae6b4f6f182a93ef1e32a9f41938f6a60afeb1a95c5fea53dccf772cf2c8c489240031f627e7565c0d67bbf160487c1801073bc0c31f91f953420f2bc8c7c52cc540032738a809905c0f4fa501940208e73df34028e703938a0577ae013f4a001300db4f03b71407461ce0502dca8c9c7dcf6a003fafcbdcd0070bc1e0fd734070db467b8a04cb9c9e68274b93bcb1daa40200ed4099765249ec476cf340849b8b264823bf34689ee009cb671df1409bc8e8b8e770e3ec68984d9c953cf97be2860b248caaebc107dc67f7a184c31232db88fd451031ce50e76039f5c8045026efb8f93279e0fd680b239504f0483d88ef409ee25bb90c79c0e050151c6e21b39ce783eb40adbcc2cefa17bdb61322387781c950e3dbdf9c8a066f28790b22e013db3dbef54726081e63c6460d34191b1bb0720f634060e7600412c781502409c8e3d7b500ed71dbef8ed40243f181c0a02e5d4e0fad006f644e4819e3b501f7e3049e7b501bc43b4e391da80558003392d40a23305e320d02e64cf998e1bf5a032b0c927b8e68049c8c8e71c6280377043118f4e680bbff00de0504ddbb3128371c1c64668024e59f3cd02521254e4fad1a2107e48fe6a6809ddb9e78a029e1463d05027ffc744a6c3857c7b1a205ff00e637fbf4a02b12b1794e39f4a02024e7249ed409924720906800005173fd7404989698ee39e4f7a04cf723d07a501fff0097ed406ffe36a018ff00281e99a037f4d0731f3bfd28007e53400ff99a810248c0cf140bc60123233cff008a0557f9beb4056eff007a07109243e79a03778b27bfbd02b128c27039a054001b818a06609de793da815006070283ffd9}\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 Here is a movie {\pict\jpegblip\picw20\pich22\picwgoal400\pichgoal440\bin ffd8ffe000104a46494600010101004800480000fffe0050546869732061727420697320696e20746865207075626c696320646f6d61696e2e204b6576696e204875676865732c206b6576696e68406569742e636f6d2c2053657074656d6265722031393935ffdb00430001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ffdb00430101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ffc00011080016001403012200021101031101ffc4001a000100020301000000000000000000000000080905060a07ffc400231000010501000300010500000000000000060304050708020001090a11153976b7ffc400160101010100000000000000000000000000060800ffc400261101000102050109000000000000000000010200030405061121b33134365154717475b4ffda000c03010002110311003f00a90cf388f366a62aa720ed6ae07f96901f3831d973452b8cf36fe3570fc908e46d466433e5dd954f2e96992d9e498c7753faa44916e016ca91cc7d88b38fe60a5b97737defcbcc539c98d336a57f4fc2ca9a486bf07ab575ad9a3af4df221d8215e36df86c4504ff0024574551b3d687ee0575757b3ad64e311ee62bd94158d37e24198c43973099f1fc0c41614d950246513a081abf76cfe7061f6863281e6352fd1670949c148dd6dfb0d25f5b3689b1d5c965b0eacbf4e0932ad28e22ab9ae945633f4744bd3c8cee0a7fdf085b9000f449c5f7afa30b83e0b6fd7b0c8429c9467ff9715347c891e25fa24a205861aa715e6a09bd0488237dc2723414d9891381524e8ca7c0894664f835653631ab55ee7e3de433e4ff001b30949124e4c10c8b6ad0a479b3f9c937b2cf5bc0095ad600a0a41a0e9faee174a1c605e161c6c7a313539650b0113190f1a8368e60d5b24f30ff008ea7f0bf867fa6595feeb6978f1fe0f9c26177f4d63a51a9235184750e7d18811339cd000000c75f000e00380380ae390c350def826ed42ad051fa6f501c50f9b699c3b69cbeb76476d202bf3ac985b6e0e968be66572893e6a744540bd9722e5c87956848629bc2559306bd113e8653d3b6aff651dfad7a3ac8b02958cba02a93ccf525757039bae6cff090e1d90688e8aa233ee86a4c4a3e0586d6b2340522e47dcb7d0046d8a5acb05a123ee25d2b230b2ada6e2e2f9ede3c05202520ec2487b0d56562529d8b3393bca76adca4ec1bca508abb001babc007915d84fe3dd14e207e3c62f8379da2a3b861fb6629d28dba53b6ea388ebfed866bf6dfb553455e91ed547ae92e9445253a4fdf3efb4f8ebdfbe7d3c78f1ee0bb9e13e358e942a4ed49e22cff00eeb35fdd7ebfffd9} icon.\par}
 {\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}
 {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Footnotes\par}
 {\pard \ql \f0 \sa180 \li0 \fi0 Here is a footnote reference,{\super\chftn}{\*\footnote\chftn\~\plain\pard {\pard \ql \f0 \sa180 \li0 \fi0 Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.\par}
diff --git a/tests/writer.tei b/tests/writer.tei
new file mode 100644
index 0000000..41f2587
--- /dev/null
+++ b/tests/writer.tei
@@ -0,0 +1,861 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TEI xmlns="http://www.tei-c.org/ns/1.0">
+<teiHeader>
+  <fileDesc>
+    <titleStmt>
+      <title>Pandoc Test Suite</title>
+      <author>John MacFarlane</author>
+      <author>Anonymous</author>
+    </titleStmt>
+    <publicationStmt>
+      <p></p>
+          </publicationStmt>
+    <sourceDesc>
+      <p>Produced by pandoc.</p>
+    </sourceDesc>
+  </fileDesc>
+</teiHeader>
+<text>
+<body>
+<p>This is a set of tests for pandoc. Most of them are adapted from John
+Gruber’s markdown test suite.</p>
+<milestone unit="undefined" type="separator" rendition="line" />
+<div type="level1">
+  <head>Headers</head>
+  <div type="level2">
+    <head>Level 2 with an <ref target="/url">embedded link</ref></head>
+    <div type="level3">
+      <head>Level 3 with <hi rendition="simple:italic">emphasis</hi></head>
+      <div type="level4">
+        <head>Level 4</head>
+        <div type="level5">
+          <head>Level 5</head>
+          <p></p>
+        </div>
+      </div>
+    </div>
+  </div>
+</div>
+<div type="level1">
+  <head>Level 1</head>
+  <div type="level2">
+    <head>Level 2 with <hi rendition="simple:italic">emphasis</hi></head>
+    <div type="level3">
+      <head>Level 3</head>
+      <p>with no blank line</p>
+    </div>
+  </div>
+  <div type="level2">
+    <head>Level 2</head>
+    <p>with no blank line</p>
+    <milestone unit="undefined" type="separator" rendition="line" />
+  </div>
+</div>
+<div type="level1">
+  <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>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" />
+</div>
+<div type="level1">
+  <head>Block Quotes</head>
+  <p>E-mail style:</p>
+  <quote>
+    <p>This is a block quote. It is pretty short.</p>
+  </quote>
+  <quote>
+    <p>Code in a block quote:</p>
+    <ab type='codeblock '>
+sub status {
+    print &quot;working&quot;;
+}
+</ab>
+    <p>A list:</p>
+    <list type="ordered:arabic">
+      <item>
+        <p>item one</p>
+      </item>
+      <item>
+        <p>item two</p>
+      </item>
+    </list>
+    <p>Nested block quotes:</p>
+    <quote>
+      <p>nested</p>
+    </quote>
+    <quote>
+      <p>nested</p>
+    </quote>
+  </quote>
+  <p>This should not be a block quote: 2 &gt; 1.</p>
+  <p>And a following paragraph.</p>
+  <milestone unit="undefined" type="separator" rendition="line" />
+</div>
+<div type="level1">
+  <head>Code Blocks</head>
+  <p>Code:</p>
+  <ab type='codeblock '>
+---- (should be four hyphens)
+
+sub status {
+    print &quot;working&quot;;
+}
+
+this code block is indented by one tab
+</ab>
+  <p>And:</p>
+  <ab type='codeblock '>
+    this code block is indented by two tabs
+
+These should not be escaped:  \$ \\ \&gt; \[ \{
+</ab>
+  <milestone unit="undefined" type="separator" rendition="line" />
+</div>
+<div type="level1">
+  <head>Lists</head>
+  <div type="level2">
+    <head>Unordered</head>
+    <p>Asterisks tight:</p>
+    <list type="unordered">
+      <item>
+        <p>asterisk 1</p>
+      </item>
+      <item>
+        <p>asterisk 2</p>
+      </item>
+      <item>
+        <p>asterisk 3</p>
+      </item>
+    </list>
+    <p>Asterisks loose:</p>
+    <list type="unordered">
+      <item>
+        <p>asterisk 1</p>
+      </item>
+      <item>
+        <p>asterisk 2</p>
+      </item>
+      <item>
+        <p>asterisk 3</p>
+      </item>
+    </list>
+    <p>Pluses tight:</p>
+    <list type="unordered">
+      <item>
+        <p>Plus 1</p>
+      </item>
+      <item>
+        <p>Plus 2</p>
+      </item>
+      <item>
+        <p>Plus 3</p>
+      </item>
+    </list>
+    <p>Pluses loose:</p>
+    <list type="unordered">
+      <item>
+        <p>Plus 1</p>
+      </item>
+      <item>
+        <p>Plus 2</p>
+      </item>
+      <item>
+        <p>Plus 3</p>
+      </item>
+    </list>
+    <p>Minuses tight:</p>
+    <list type="unordered">
+      <item>
+        <p>Minus 1</p>
+      </item>
+      <item>
+        <p>Minus 2</p>
+      </item>
+      <item>
+        <p>Minus 3</p>
+      </item>
+    </list>
+    <p>Minuses loose:</p>
+    <list type="unordered">
+      <item>
+        <p>Minus 1</p>
+      </item>
+      <item>
+        <p>Minus 2</p>
+      </item>
+      <item>
+        <p>Minus 3</p>
+      </item>
+    </list>
+  </div>
+  <div type="level2">
+    <head>Ordered</head>
+    <p>Tight:</p>
+    <list type="ordered:arabic">
+      <item>
+        <p>First</p>
+      </item>
+      <item>
+        <p>Second</p>
+      </item>
+      <item>
+        <p>Third</p>
+      </item>
+    </list>
+    <p>and:</p>
+    <list type="ordered:arabic">
+      <item>
+        <p>One</p>
+      </item>
+      <item>
+        <p>Two</p>
+      </item>
+      <item>
+        <p>Three</p>
+      </item>
+    </list>
+    <p>Loose using tabs:</p>
+    <list type="ordered:arabic">
+      <item>
+        <p>First</p>
+      </item>
+      <item>
+        <p>Second</p>
+      </item>
+      <item>
+        <p>Third</p>
+      </item>
+    </list>
+    <p>and using spaces:</p>
+    <list type="ordered:arabic">
+      <item>
+        <p>One</p>
+      </item>
+      <item>
+        <p>Two</p>
+      </item>
+      <item>
+        <p>Three</p>
+      </item>
+    </list>
+    <p>Multiple paragraphs:</p>
+    <list type="ordered:arabic">
+      <item>
+        <p>Item 1, graf one.</p>
+        <p>Item 1. graf two. The quick brown fox jumped over the lazy dog’s
+        back.</p>
+      </item>
+      <item>
+        <p>Item 2.</p>
+      </item>
+      <item>
+        <p>Item 3.</p>
+      </item>
+    </list>
+  </div>
+  <div type="level2">
+    <head>Nested</head>
+    <list type="unordered">
+      <item>
+        <p>Tab</p>
+        <list type="unordered">
+          <item>
+            <p>Tab</p>
+            <list type="unordered">
+              <item>
+                <p>Tab</p>
+              </item>
+            </list>
+          </item>
+        </list>
+      </item>
+    </list>
+    <p>Here’s another:</p>
+    <list type="ordered:arabic">
+      <item>
+        <p>First</p>
+      </item>
+      <item>
+        <p>Second:</p>
+        <list type="unordered">
+          <item>
+            <p>Fee</p>
+          </item>
+          <item>
+            <p>Fie</p>
+          </item>
+          <item>
+            <p>Foe</p>
+          </item>
+        </list>
+      </item>
+      <item>
+        <p>Third</p>
+      </item>
+    </list>
+    <p>Same thing but with paragraphs:</p>
+    <list type="ordered:arabic">
+      <item>
+        <p>First</p>
+      </item>
+      <item>
+        <p>Second:</p>
+        <list type="unordered">
+          <item>
+            <p>Fee</p>
+          </item>
+          <item>
+            <p>Fie</p>
+          </item>
+          <item>
+            <p>Foe</p>
+          </item>
+        </list>
+      </item>
+      <item>
+        <p>Third</p>
+      </item>
+    </list>
+  </div>
+  <div type="level2">
+    <head>Tabs and spaces</head>
+    <list type="unordered">
+      <item>
+        <p>this is a list item indented with tabs</p>
+      </item>
+      <item>
+        <p>this is a list item indented with spaces</p>
+        <list type="unordered">
+          <item>
+            <p>this is an example list item indented with tabs</p>
+          </item>
+          <item>
+            <p>this is an example list item indented with spaces</p>
+          </item>
+        </list>
+      </item>
+    </list>
+  </div>
+  <div type="level2">
+    <head>Fancy list markers</head>
+    <list type="ordered:arabic">
+      <item n="2">
+        <p>begins with 2</p>
+      </item>
+      <item>
+        <p>and now 3</p>
+        <p>with a continuation</p>
+        <list type="ordered:lowerroman">
+          <item n="4">
+            <p>sublist with roman numerals, starting with 4</p>
+          </item>
+          <item>
+            <p>more items</p>
+            <list type="ordered:upperalpha">
+              <item>
+                <p>a subsublist</p>
+              </item>
+              <item>
+                <p>a subsublist</p>
+              </item>
+            </list>
+          </item>
+        </list>
+      </item>
+    </list>
+    <p>Nesting:</p>
+    <list type="ordered:upperalpha">
+      <item>
+        <p>Upper Alpha</p>
+        <list type="ordered:upperroman">
+          <item>
+            <p>Upper Roman.</p>
+            <list type="ordered:arabic">
+              <item n="6">
+                <p>Decimal start with 6</p>
+                <list type="ordered:loweralpha">
+                  <item n="3">
+                    <p>Lower alpha with paren</p>
+                  </item>
+                </list>
+              </item>
+            </list>
+          </item>
+        </list>
+      </item>
+    </list>
+    <p>Autonumbering:</p>
+    <list>
+      <item>
+        <p>Autonumber.</p>
+      </item>
+      <item>
+        <p>More.</p>
+        <list>
+          <item>
+            <p>Nested.</p>
+          </item>
+        </list>
+      </item>
+    </list>
+    <p>Should not be a list item:</p>
+    <p>M.A. 2007</p>
+    <p>B. Williams</p>
+    <milestone unit="undefined" type="separator" rendition="line" />
+  </div>
+</div>
+<div type="level1">
+  <head>Definition Lists</head>
+  <p>Tight using spaces:</p>
+  <list type="definition">
+    <label>
+      apple
+    </label>
+    <item>
+      <p>red fruit</p>
+    </item>
+    <label>
+      orange
+    </label>
+    <item>
+      <p>orange fruit</p>
+    </item>
+    <label>
+      banana
+    </label>
+    <item>
+      <p>yellow fruit</p>
+    </item>
+  </list>
+  <p>Tight using tabs:</p>
+  <list type="definition">
+    <label>
+      apple
+    </label>
+    <item>
+      <p>red fruit</p>
+    </item>
+    <label>
+      orange
+    </label>
+    <item>
+      <p>orange fruit</p>
+    </item>
+    <label>
+      banana
+    </label>
+    <item>
+      <p>yellow fruit</p>
+    </item>
+  </list>
+  <p>Loose:</p>
+  <list type="definition">
+    <label>
+      apple
+    </label>
+    <item>
+      <p>red fruit</p>
+    </item>
+    <label>
+      orange
+    </label>
+    <item>
+      <p>orange fruit</p>
+    </item>
+    <label>
+      banana
+    </label>
+    <item>
+      <p>yellow fruit</p>
+    </item>
+  </list>
+  <p>Multiple blocks with italics:</p>
+  <list type="definition">
+    <label>
+      <hi rendition="simple:italic">apple</hi>
+    </label>
+    <item>
+      <p>red fruit</p>
+      <p>contains seeds, crisp, pleasant to taste</p>
+    </item>
+    <label>
+      <hi rendition="simple:italic">orange</hi>
+    </label>
+    <item>
+      <p>orange fruit</p>
+      <ab type='codeblock '>
+{ orange code block }
+</ab>
+      <quote>
+        <p>orange block quote</p>
+      </quote>
+    </item>
+  </list>
+  <p>Multiple definitions, tight:</p>
+  <list type="definition">
+    <label>
+      apple
+    </label>
+    <item>
+      <p>red fruit</p>
+      <p>computer</p>
+    </item>
+    <label>
+      orange
+    </label>
+    <item>
+      <p>orange fruit</p>
+      <p>bank</p>
+    </item>
+  </list>
+  <p>Multiple definitions, loose:</p>
+  <list type="definition">
+    <label>
+      apple
+    </label>
+    <item>
+      <p>red fruit</p>
+      <p>computer</p>
+    </item>
+    <label>
+      orange
+    </label>
+    <item>
+      <p>orange fruit</p>
+      <p>bank</p>
+    </item>
+  </list>
+  <p>Blank line after term, indented marker, alternate markers:</p>
+  <list type="definition">
+    <label>
+      apple
+    </label>
+    <item>
+      <p>red fruit</p>
+      <p>computer</p>
+    </item>
+    <label>
+      orange
+    </label>
+    <item>
+      <p>orange fruit</p>
+      <list type="ordered:arabic">
+        <item>
+          <p>sublist</p>
+        </item>
+        <item>
+          <p>sublist</p>
+        </item>
+      </list>
+    </item>
+  </list>
+</div>
+<div type="level1">
+  <head>HTML Blocks</head>
+  <p>Simple block on one line:</p>
+  <p>foo</p>
+  <p>And nested without indentation:</p>
+  <p>foo</p>
+  <p>bar</p>
+  <p>Interpreted markdown in a table:</p>
+  <p>This is <hi rendition="simple:italic">emphasized</hi></p>
+  <p>And this is <hi rendition="simple:bold">strong</hi></p>
+  <p>Here’s a simple block:</p>
+  <p>foo</p>
+  <p>This should be a code block, though:</p>
+  <ab type='codeblock '>
+&lt;div&gt;
+    foo
+&lt;/div&gt;
+</ab>
+  <p>As should this:</p>
+  <ab type='codeblock '>
+&lt;div&gt;foo&lt;/div&gt;
+</ab>
+  <p>Now, nested:</p>
+  <p>foo</p>
+  <p>This should just be an HTML comment:</p>
+  <p>Multiline:</p>
+  <p>Code block:</p>
+  <ab type='codeblock '>
+&lt;!-- Comment --&gt;
+</ab>
+  <p>Just plain comment, with trailing spaces on the line:</p>
+  <p>Code:</p>
+  <ab type='codeblock '>
+&lt;hr /&gt;
+</ab>
+  <p>Hr’s:</p>
+  <milestone unit="undefined" type="separator" rendition="line" />
+</div>
+<div type="level1">
+  <head>Inline Markup</head>
+  <p>This is <hi rendition="simple:italic">emphasized</hi>, and so
+  <hi rendition="simple:italic">is this</hi>.</p>
+  <p>This is <hi rendition="simple:bold">strong</hi>, and so
+  <hi rendition="simple:bold">is this</hi>.</p>
+  <p>An <hi rendition="simple:italic"><ref target="/url">emphasized
+  link</ref></hi>.</p>
+  <p><hi rendition="simple:bold"><hi rendition="simple:italic">This is strong
+  and em.</hi></hi></p>
+  <p>So is
+  <hi rendition="simple:bold"><hi rendition="simple:italic">this</hi></hi>
+  word.</p>
+  <p><hi rendition="simple:bold"><hi rendition="simple:italic">This is strong
+  and em.</hi></hi></p>
+  <p>So is
+  <hi rendition="simple:bold"><hi rendition="simple:italic">this</hi></hi>
+  word.</p>
+  <p>This is code: <seg type="code">&gt;</seg>, <seg type="code">$</seg>,
+  <seg type="code">\</seg>, <seg type="code">\$</seg>,
+  <seg type="code">&lt;html&gt;</seg>.</p>
+  <p><hi rendition="simple:strikethrough">This is
+  <hi rendition="simple:italic">strikeout</hi>.</hi></p>
+  <p>Superscripts: a<hi rendition="simple:superscript">bc</hi>d
+  a<hi rendition="simple:superscript"><hi rendition="simple:italic">hello</hi></hi>
+  a<hi rendition="simple:superscript">hello there</hi>.</p>
+  <p>Subscripts: H<hi rendition="simple:subscript">2</hi>O,
+  H<hi rendition="simple:subscript">23</hi>O,
+  H<hi rendition="simple:subscript">many of them</hi>O.</p>
+  <p>These should not be superscripts or subscripts, because of the unescaped
+  spaces: a^b c^d, a~b c~d.</p>
+  <milestone unit="undefined" type="separator" rendition="line" />
+</div>
+<div type="level1">
+  <head>Smart quotes, ellipses, dashes</head>
+  <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>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>
+  <p>Some dashes: one—two — three—four — five.</p>
+  <p>Dashes between numbers: 5–7, 255–66, 1987–1999.</p>
+  <p>Ellipses…and…and….</p>
+  <milestone unit="undefined" type="separator" rendition="line" />
+</div>
+<div type="level1">
+  <head>LaTeX</head>
+  <list type="unordered">
+    <item>
+      <p></p>
+    </item>
+    <item>
+      <p><formula notation="TeX">2+2=4</formula></p>
+    </item>
+    <item>
+      <p><formula notation="TeX">x \in y</formula></p>
+    </item>
+    <item>
+      <p><formula notation="TeX">\alpha \wedge \omega</formula></p>
+    </item>
+    <item>
+      <p><formula notation="TeX">223</formula></p>
+    </item>
+    <item>
+      <p><formula notation="TeX">p</formula>-Tree</p>
+    </item>
+    <item>
+      <p>Here’s some display math: <figure type="math">
+        <formula notation="TeX">\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</formula>
+      </figure></p>
+    </item>
+    <item>
+      <p>Here’s one that has a line break in it:
+      <formula notation="TeX">\alpha + \omega \times x^2</formula>.</p>
+    </item>
+  </list>
+  <p>These shouldn’t be math:</p>
+  <list type="unordered">
+    <item>
+      <p>To get the famous equation, write
+      <seg type="code">$e = mc^2$</seg>.</p>
+    </item>
+    <item>
+      <p>$22,000 is a <hi rendition="simple:italic">lot</hi> of money. So is
+      $34,000. (It worked if <quote>lot</quote> is emphasized.)</p>
+    </item>
+    <item>
+      <p>Shoes ($20) and socks ($5).</p>
+    </item>
+    <item>
+      <p>Escaped <seg type="code">$</seg>: $73
+      <hi rendition="simple:italic">this should be emphasized</hi> 23$.</p>
+    </item>
+  </list>
+  <p>Here’s a LaTeX table:</p>
+  <milestone unit="undefined" type="separator" rendition="line" />
+</div>
+<div type="level1">
+  <head>Special Characters</head>
+  <p>Here is some unicode:</p>
+  <list type="unordered">
+    <item>
+      <p>I hat: Î</p>
+    </item>
+    <item>
+      <p>o umlaut: ö</p>
+    </item>
+    <item>
+      <p>section: §</p>
+    </item>
+    <item>
+      <p>set membership: ∈</p>
+    </item>
+    <item>
+      <p>copyright: ©</p>
+    </item>
+  </list>
+  <p>AT&amp;T has an ampersand in their name.</p>
+  <p>AT&amp;T is another way to write it.</p>
+  <p>This &amp; that.</p>
+  <p>4 &lt; 5.</p>
+  <p>6 &gt; 5.</p>
+  <p>Backslash: \</p>
+  <p>Backtick: `</p>
+  <p>Asterisk: *</p>
+  <p>Underscore: _</p>
+  <p>Left brace: {</p>
+  <p>Right brace: }</p>
+  <p>Left bracket: [</p>
+  <p>Right bracket: ]</p>
+  <p>Left paren: (</p>
+  <p>Right paren: )</p>
+  <p>Greater-than: &gt;</p>
+  <p>Hash: #</p>
+  <p>Period: .</p>
+  <p>Bang: !</p>
+  <p>Plus: +</p>
+  <p>Minus: -</p>
+  <milestone unit="undefined" type="separator" rendition="line" />
+</div>
+<div type="level1">
+  <head>Links</head>
+  <div type="level2">
+    <head>Explicit</head>
+    <p>Just a <ref target="/url/">URL</ref>.</p>
+    <p><ref target="/url/">URL and title</ref>.</p>
+    <p><ref target="/url/">URL and title</ref>.</p>
+    <p><ref target="/url/">URL and title</ref>.</p>
+    <p><ref target="/url/">URL and title</ref></p>
+    <p><ref target="/url/">URL and title</ref></p>
+    <p><ref target="/url/with_underscore">with_underscore</ref></p>
+    <p>Email link (nobody@nowhere.net)</p>
+    <p><ref target="">Empty</ref>.</p>
+  </div>
+  <div type="level2">
+    <head>Reference</head>
+    <p>Foo <ref target="/url/">bar</ref>.</p>
+    <p>Foo <ref target="/url/">bar</ref>.</p>
+    <p>Foo <ref target="/url/">bar</ref>.</p>
+    <p>With <ref target="/url/">embedded [brackets]</ref>.</p>
+    <p><ref target="/url/">b</ref> by itself should be a link.</p>
+    <p>Indented <ref target="/url">once</ref>.</p>
+    <p>Indented <ref target="/url">twice</ref>.</p>
+    <p>Indented <ref target="/url">thrice</ref>.</p>
+    <p>This should [not][] be a link.</p>
+    <ab type='codeblock '>
+[not]: /url
+</ab>
+    <p>Foo <ref target="/url/">bar</ref>.</p>
+    <p>Foo <ref target="/url/">biz</ref>.</p>
+  </div>
+  <div type="level2">
+    <head>With ampersands</head>
+    <p>Here’s a <ref target="http://example.com/?foo=1&amp;bar=2">link with an
+    ampersand in the URL</ref>.</p>
+    <p>Here’s a link with an amersand in the link text:
+    <ref target="http://att.com/">AT&amp;T</ref>.</p>
+    <p>Here’s an <ref target="/script?foo=1&amp;bar=2">inline link</ref>.</p>
+    <p>Here’s an <ref target="/script?foo=1&amp;bar=2">inline link in pointy
+    braces</ref>.</p>
+  </div>
+  <div type="level2">
+    <head>Autolinks</head>
+    <p>With an ampersand:
+    <ref target="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</ref></p>
+    <list type="unordered">
+      <item>
+        <p>In a list?</p>
+      </item>
+      <item>
+        <p><ref target="http://example.com/">http://example.com/</ref></p>
+      </item>
+      <item>
+        <p>It should.</p>
+      </item>
+    </list>
+    <p>An e-mail address: nobody@nowhere.net</p>
+    <quote>
+      <p>Blockquoted:
+      <ref target="http://example.com/">http://example.com/</ref></p>
+    </quote>
+    <p>Auto-links should not occur here:
+    <seg type="code">&lt;http://example.com/&gt;</seg></p>
+    <ab type='codeblock '>
+or here: &lt;http://example.com/&gt;
+</ab>
+    <milestone unit="undefined" type="separator" rendition="line" />
+  </div>
+</div>
+<div type="level1">
+  <head>Images</head>
+  <p>From <quote>Voyage dans la Lune</quote> by Georges Melies (1902):</p>
+  <p><figure>
+    <head>lalune</head>
+    <graphic url="lalune.jpg" />
+    <figDesc>fig:Voyage dans la Lune</figDesc>
+  </figure></p>
+  <p>Here is a movie <figure>
+    <head>movie</head>
+    <graphic url="movie.jpg" />
+  </figure> icon.</p>
+  <milestone unit="undefined" type="separator" rendition="line" />
+</div>
+<div type="level1">
+  <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>
+  </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
+    (as with list items).</p>
+    <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>
+  </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>
+    <p>This is <hi rendition="simple:italic">easier</hi> to type. Inline notes
+    may contain <ref target="http://google.com">links</ref> and
+    <seg type="code">]</seg> verbatim characters, as well as [bracketed
+    text].</p>
+  </note></p>
+  <quote>
+    <p>Notes can go in quotes.<note>
+      <p>In quote.</p>
+    </note></p>
+  </quote>
+  <list type="ordered:arabic">
+    <item>
+      <p>And in list items.<note>
+        <p>In list.</p>
+      </note></p>
+    </item>
+  </list>
+  <p>This paragraph should not be part of the note, as it is not indented.</p>
+</div>
+</body>
+</text>
+</TEI>
diff --git a/tests/writers-lang-and-dir.context b/tests/writers-lang-and-dir.context
new file mode 100644
index 0000000..66dab9e
--- /dev/null
+++ b/tests/writers-lang-and-dir.context
@@ -0,0 +1,109 @@
+% Enable hyperlinks
+\setupinteraction
+  [state=start,
+  style=,
+  color=,
+  contrastcolor=]
+% make chapter, section bookmarks visible when opening document
+\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
+\setupinteractionscreen[option=bookmark]
+\setuptagging[state=start]
+
+% use microtypography
+\definefontfeature[default][default][script=latn, protrusion=quality, expansion=quality, itlc=yes, textitalics=yes, onum=yes, pnum=yes]
+\definefontfeature[smallcaps][script=latn, protrusion=quality, expansion=quality, smcp=yes, onum=yes, pnum=yes]
+\setupalign[hz,hanging]
+\setupitaliccorrection[global, always]
+\setupbodyfontenvironment[default][em=italic] % use italic as em, not slanted
+\usemodule[simplefonts]
+\setmainfontfallback[DejaVu Serif][range={greekandcoptic, greekextended}, force=yes, rscale=auto]
+\setupwhitespace[medium]
+
+\setuphead[chapter]            [style=\tfd,header=empty]
+\setuphead[section]            [style=\tfc]
+\setuphead[subsection]         [style=\tfb]
+\setuphead[subsubsection]      [style=\bf]
+\setuphead[subsubsubsection]   [style=\sc]
+\setuphead[subsubsubsubsection][style=\it]
+
+\setuphead[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][number=no]
+
+\definedescription
+  [description]
+  [headstyle=bold, style=normal, location=hanging, width=broad, margin=1cm, alternative=hanging]
+
+\setupitemize[autointro]    % prevent orphan list intro
+\setupitemize[indentnext=no]
+
+\setupfloat[figure][default={here,nonumber}]
+\setupfloat[table][default={here,nonumber}]
+
+\setupthinrules[width=15em] % width of horizontal rules
+
+
+\starttext
+
+\section[empty-divs-and-spans]{Empty Divs and Spans}
+
+Some text and
+
+div contents
+
+and more text.
+
+Next paragraph with a span and a word-thatincludesaspanright?
+
+\section[directionality]{Directionality}
+
+Some text and
+
+\startalignment[righttoleft]
+rtl div contents
+
+\stopalignment
+
+and more text.
+
+\startalignment[lefttoright]
+and a ltr div. with a {\righttoleft rtl span}.
+
+\stopalignment
+
+Next paragraph with a {\righttoleft rtl span} and a
+word-that-includesa{\lefttoright ltrspan}right?
+
+\section[languages]{Languages}
+
+Some text and
+
+\start\language[de]
+German div contents
+
+\stop
+
+and more text.
+
+Next paragraph with a \start\language[en-gb]British span\stop  and a
+word-that-includesa\start\language[de-ch]Swiss German span\stop right?
+
+Some \start\language[es]Spanish text\stop .
+
+\section[combined]{Combined}
+
+Some text and
+
+\start\language[fr]
+\startalignment[righttoleft]
+French rtl div contents
+
+\stopalignment
+\stop
+
+and more text.
+
+Next paragraph with a \start\language[en-gb]{\lefttoright British ltr
+span}\stop  and a
+word-that-includesa\start\language[de-ch]{\lefttoright Swiss German ltr
+span}\stop right?
+
+\stoptext
diff --git a/tests/writers-lang-and-dir.latex b/tests/writers-lang-and-dir.latex
new file mode 100644
index 0000000..056809a
--- /dev/null
+++ b/tests/writers-lang-and-dir.latex
@@ -0,0 +1,146 @@
+\documentclass[english,]{article}
+\usepackage{lmodern}
+\usepackage{amssymb,amsmath}
+\usepackage{ifxetex,ifluatex}
+\usepackage{fixltx2e} % provides \textsubscript
+\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
+  \usepackage[T1]{fontenc}
+  \usepackage[utf8]{inputenc}
+\else % if luatex or xelatex
+  \ifxetex
+    \usepackage{mathspec}
+  \else
+    \usepackage{fontspec}
+  \fi
+  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
+\fi
+% use upquote if available, for straight quotes in verbatim environments
+\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
+% use microtype if available
+\IfFileExists{microtype.sty}{%
+\usepackage{microtype}
+\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
+}{}
+\usepackage{hyperref}
+\hypersetup{unicode=true,
+            pdfborder={0 0 0},
+            breaklinks=true}
+\urlstyle{same}  % don't use monospace font for urls
+\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
+  \usepackage[shorthands=off,ngerman,british,ngerman,spanish,french,main=english]{babel}
+  \newcommand{\textgerman}[2][]{\foreignlanguage{ngerman}{#2}}
+  \newenvironment{german}[1]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}}
+  \newcommand{\textenglish}[2][]{\foreignlanguage{british}{#2}}
+  \newenvironment{english}[1]{\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}[1]{\begin{otherlanguage}{french}}{\end{otherlanguage}}
+\else
+  \usepackage{polyglossia}
+  \setmainlanguage[]{english}
+  \setotherlanguage[]{german}
+  \setotherlanguage[variant=british]{english}
+  \setotherlanguage[variant=swiss]{german}
+  \setotherlanguage[]{spanish}
+  \setotherlanguage[]{french}
+\fi
+\IfFileExists{parskip.sty}{%
+\usepackage{parskip}
+}{% else
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{6pt plus 2pt minus 1pt}
+}
+\setlength{\emergencystretch}{3em}  % prevent overfull lines
+\providecommand{\tightlist}{%
+  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
+\setcounter{secnumdepth}{0}
+% Redefines (sub)paragraphs to behave more like sections
+\ifx\paragraph\undefined\else
+\let\oldparagraph\paragraph
+\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
+\fi
+\ifx\subparagraph\undefined\else
+\let\oldsubparagraph\subparagraph
+\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
+\fi
+\ifxetex
+  % load bidi as late as possible as it modifies e.g. graphicx
+    \usepackage{bidi}
+  \fi
+\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
+  \TeXXeTstate=1
+  \newcommand{\RL}[1]{\beginR #1\endR}
+  \newcommand{\LR}[1]{\beginL #1\endL}
+  \newenvironment{RTL}{\beginR}{\endR}
+  \newenvironment{LTR}{\beginL}{\endL}
+\fi
+
+\date{}
+
+\begin{document}
+
+\section{Empty Divs and Spans}\label{empty-divs-and-spans}
+
+Some text and
+
+div contents
+
+and more text.
+
+Next paragraph with a {span} and a word-thatincludesa{span}right?
+
+\section{Directionality}\label{directionality}
+
+Some text and
+
+\begin{RTL}
+rtl div contents
+\end{RTL}
+
+and more text.
+
+\begin{LTR}
+and a ltr div. with a \RL{rtl span}.
+\end{LTR}
+
+Next paragraph with a \RL{rtl span} and a
+word-that-includesa\LR{ltrspan}right?
+
+\section{Languages}\label{languages}
+
+Some text and
+
+\begin{german}
+
+German div contents
+
+\end{german}
+
+and more text.
+
+Next paragraph with a \textenglish[variant=british]{British span} and a
+word-that-includesa\textgerman[variant=swiss]{Swiss German span}right?
+
+Some \textspanish{Spanish text}.
+
+\section{Combined}\label{combined}
+
+Some text and
+
+\begin{RTL}
+\begin{french}
+
+French rtl div contents
+
+\end{french}
+\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?
+
+\end{document}
diff --git a/tests/writers-lang-and-dir.native b/tests/writers-lang-and-dir.native
new file mode 100644
index 0000000..504bcf3
--- /dev/null
+++ b/tests/writers-lang-and-dir.native
@@ -0,0 +1,23 @@
+Pandoc (Meta {unMeta = fromList []})
+[Header 1 ("empty-divs-and-spans",[],[]) [Str "Empty",Space,Str "Divs",Space,Str "and",Space,Str "Spans"]
+,Plain [Str "Some",Space,Str "text",Space,Str "and"]
+,Div ("",[],[]) [Para [Str "div",Space,Str "contents"]]
+,Para [Str "and",Space,Str "more",Space,Str "text."]
+,Para [Str "Next",Space,Str "paragraph",Space,Str "with",Space,Str "a",Space,Span ("",[],[]) [Str "span"],Space,Str "and",Space,Str "a",Space,Str "word-thatincludesa",Span ("",[],[]) [Str "span"],Str "right?"]
+,Header 1 ("directionality",[],[]) [Str "Directionality"]
+,Plain [Str "Some",Space,Str "text",Space,Str "and"]
+,Div ("",[],[("dir","rtl")]) [Para [Str "rtl",Space,Str "div",Space,Str "contents"]]
+,Para [Str "and",Space,Str "more",Space,Str "text."]
+,Div ("",[],[("dir","ltr")]) [Para [Str "and",Space,Str "a",Space,Str "ltr",Space,Str "div.",Space,Str "with",Space,Str "a",Space,Span ("",[],[("dir","rtl")]) [Str "rtl",Space,Str "span"],Str "."]]
+,Para [Str "Next",Space,Str "paragraph",Space,Str "with",Space,Str "a",Space,Span ("",[],[("dir","rtl")]) [Str "rtl",Space,Str "span"],Space,Str "and",Space,Str "a",Space,Str "word-that-includesa",Span ("",[],[("dir","ltr")]) [Str "ltrspan"],Str "right?"]
+,Header 1 ("languages",[],[]) [Str "Languages"]
+,Plain [Str "Some",Space,Str "text",Space,Str "and"]
+,Div ("",[],[("lang","de")]) [Para [Str "German",Space,Str "div",Space,Str "contents"]]
+,Para [Str "and",Space,Str "more",Space,Str "text."]
+,Para [Str "Next",Space,Str "paragraph",Space,Str "with",Space,Str "a",Space,Span ("",[],[("lang","en-GB")]) [Str "British",Space,Str "span"],Space,Str "and",Space,Str "a",Space,Str "word-that-includesa",Span ("",[],[("lang","de-CH")]) [Str "Swiss",Space,Str "German",Space,Str "span"],Str "right?"]
+,Para [Str "Some",Space,Span ("",[],[("lang","es")]) [Str "Spanish",Space,Str "text"],Str "."]
+,Header 1 ("combined",[],[]) [Str "Combined"]
+,Plain [Str "Some",Space,Str "text",Space,Str "and"]
+,Div ("",[],[("lang","fr"),("dir","rtl")]) [Para [Str "French",Space,Str "rtl",Space,Str "div",Space,Str "contents"]]
+,Para [Str "and",Space,Str "more",Space,Str "text."]
+,Para [Str "Next",Space,Str "paragraph",Space,Str "with",Space,Str "a",Space,Span ("",[],[("lang","en-GB"),("dir","ltr")]) [Str "British",Space,Str "ltr",Space,Str "span"],Space,Str "and",Space,Str "a",Space,Str "word-that-includesa",Span ("",[],[("lang","de-CH"),("dir","ltr")]) [Str "Swiss",Space,Str "German",Space,Str "ltr",Space,Str "span"],Str "right?"]]
diff --git a/trypandoc/Makefile b/trypandoc/Makefile
index 29942ac..b53758d 100644
--- a/trypandoc/Makefile
+++ b/trypandoc/Makefile
@@ -1,7 +1,7 @@
 CGIBIN=/home/website/cgi-bin
 TRYPANDOC=/home/website/html/pandoc/try/
 CGI=${CGIBIN}/trypandoc
-BIN=../dist/build/trypandoc/trypandoc
+BIN=../.cabal-sandbox/bin/trypandoc
 
 install: ${CGI} ${TRYPANDOC}/index.html
 
diff --git a/trypandoc/index.html b/trypandoc/index.html
index 88e020e..c46f4d1 100644
--- a/trypandoc/index.html
+++ b/trypandoc/index.html
@@ -78,21 +78,21 @@
       from
       </label>
       <select id="from">
-        <option value="markdown" selected>Markdown</option>
-        <option value="markdown_strict">Markdown/strict</option>
-        <option value="markdown_phpextra">PHP Markdown Extra</option>
-        <option value="markdown_github">GitHub Markdown</option>
+        <option value="docbook">DocBook</option>
+        <option value="haddock">Haddock markup</option>
+        <option value="html">HTML</option>
+        <option value="latex">LaTeX</option>
+        <option value="markdown" selected>Markdown (pandoc)</option>
+        <option value="markdown_strict">Markdown (strict)</option>
+        <option value="markdown_phpextra">Markdown (PHP Markdown Extra)</option>
+        <option value="markdown_github">Markdown (GitHub)</option>
+        <option value="mediawiki">MediaWiki</option>
         <option value="markdown_mmd">MultiMarkdown</option>
+        <option value="opml">OPML</option>
+        <option value="org">Org Mode</option>
         <option value="rst">reStructuredText</option>
         <option value="textile">Textile</option>
-        <option value="latex">LaTeX</option>
-        <option value="html">HTML</option>
-        <option value="docbook">DocBook</option>
-        <option value="opml">OPML</option>
-        <option value="org">Emacs Org Mode</option>
         <option value="t2t">Txt2Tags</option>
-        <option value="mediawiki">MediaWiki</option>
-        <option value="haddock">Haddock markup</option>
       </select>
       <br/>
       <textarea id="text" maxlength="3000" rows="15"></textarea>
@@ -102,33 +102,33 @@
       to
       </label>
       <select id="to">
+        <option value="asciidoc">AsciiDoc</option>
+        <option value="context">ConTeXt</option>
+        <option value="docbook">DocBook</option>
+        <option value="dokuwiki">DokuWiki</option>
+        <option value="dzslides">DZSlides</option>
+        <option value="man">Groff man</option>
         <option value="html" selected>HTML</option>
         <option value="html5">HTML 5</option>
-        <option value="markdown">Markdown</option>
-        <option value="markdown_strict">Markdown/strict</option>
-        <option value="markdown_phpextra">PHP Markdown Extra</option>
-        <option value="markdown_github">GitHub Markdown</option>
+        <option value="icml">ICML</option>
+        <option value="latex">LaTeX</option>
+        <option value="beamer">LaTeX Beamer</option>
+        <option value="markdown">Markdown (pandoc)</option>
+        <option value="markdown_strict">Markdown (strict)</option>
+        <option value="markdown_phpextra">Markdown (PHP Markdown Extra)</option>
+        <option value="markdown_github">Markdown (GitHub)</option>
         <option value="markdown_mmd">MultiMarkdown</option>
         <option value="rst">reStructuredText</option>
-        <option value="asciidoc">AsciiDoc</option>
         <option value="textile">Textile</option>
         <option value="mediawiki">MediaWiki</option>
-        <option value="dokuwiki">DokuWiki</option>
-        <option value="org">Emacs Org Mode</option>
-        <option value="latex">LaTeX</option>
-        <option value="beamer">LaTeX Beamer</option>
-        <option value="context">ConTeXt</option>
-        <option value="man">Groff man</option>
-        <option value="texinfo">Texinfo</option>
-        <option value="docbook">DocBook</option>
-        <option value="opml">OPML</option>
-        <option value="icml">ICML</option>
+        <option value="org">Org Mode</option>
         <option value="opendocument">OpenDocument</option>
+        <option value="opml">OPML</option>
         <option value="rtf">RTF</option>
-        <option value="dzslides">DZSlides</option>
-        <option value="slidy">Slidy</option>
         <option value="S5">S5</option>
         <option value="slideous">Slideous</option>
+        <option value="slidy">Slidy</option>
+        <option value="texinfo">Texinfo</option>
       </select>
       <br/>
       <pre id="results"></pre>
@@ -137,7 +137,7 @@
 </div>
 <footer>
  <p class="version">pandoc <span id="version"></span></p>
- <p>&copy; 2013&ndash;2014 <a href="http://johnmacfarlane.net">John MacFarlane</a></p>
+ <p>&copy; 2013&ndash;2015 <a href="http://johnmacfarlane.net">John MacFarlane</a></p>
 </footer>
 </body>
 </html>
diff --git a/windows/make-windows-installer.bat b/windows/make-windows-installer.bat
index cac5d97..d3d9bb7 100644
--- a/windows/make-windows-installer.bat
+++ b/windows/make-windows-installer.bat
@@ -1,20 +1,13 @@
 @echo off
-cd ..
-cabal update
-cabal sandbox init
-cabal clean
-cabal install hsb2hs
+stack install --test
 if %errorlevel% neq 0 exit /b %errorlevel%
-cabal install -v1 --force --reinstall --flags="embed_data_files" . pandoc-citeproc
+for /f "delims=" %%a in ('stack path --local-bin-path') do @set BINPATH=%%a
+%BINPATH%\pandoc.exe -s -S ..\README -o README.html
 if %errorlevel% neq 0 exit /b %errorlevel%
-strip .\.cabal-sandbox\bin\pandoc.exe
-strip .\.cabal-sandbox\bin\pandoc-citeproc.exe
-.\.cabal-sandbox\bin\pandoc.exe -s --template data\templates\default.html -S README -o README.html
+%BINPATH%\pandoc.exe -s ..\COPYING -t rtf -S -o COPYING.rtf
 if %errorlevel% neq 0 exit /b %errorlevel%
-.\.cabal-sandbox\bin\pandoc.exe -s --template data\templates\default.rtf COPYING -t rtf -S -o COPYING.rtf
-if %errorlevel% neq 0 exit /b %errorlevel%
-copy COPYRIGHT COPYRIGHT.txt
-for /f "tokens=1-2 delims= " %%a in ('.\.cabal-sandbox\bin\pandoc --version') do (
+copy ..\COPYRIGHT COPYRIGHT.txt
+for /f "tokens=1-2 delims= " %%a in ('%BINPATH%\pandoc.exe --version') do (
   @set VERSION=%%b
   goto :next
   )
@@ -24,9 +17,8 @@ if "%VERSION%" == "" (
   exit /b 1 
 )
 echo Detected version %VERSION%
-cd windows
 echo Creating msi...
-candle -dVERSION=%VERSION% pandoc.wxs
+candle -dVERSION=%VERSION% -dBINPATH=%BINPATH% pandoc.wxs
 if %errorlevel% neq 0 exit /b %errorlevel%
 light  -sw1076 -ext WixUIExtension -ext WixUtilExtension -out pandoc-%VERSION%-windows.msi pandoc.wixobj
 if %errorlevel% neq 0 exit /b %errorlevel%
diff --git a/windows/pandoc.wxs b/windows/pandoc.wxs
index c1465ff..d19ed81 100644
--- a/windows/pandoc.wxs
+++ b/windows/pandoc.wxs
@@ -41,11 +41,11 @@
                            KeyPath="yes"/>
             <RemoveFolder Id="APPLICATIONFOLDER" On="uninstall"/>
             <File Id="pandocEXE" Name="pandoc.exe"
-                  Source="..\.cabal-sandbox\bin\pandoc.exe" />
+                  Source="$(var.BINPATH)\pandoc.exe" />
             <File Id="pandocCOPYRIGHT" Name="COPYRIGHT.txt"
-                  Source="..\COPYRIGHT.txt" />
+                  Source="COPYRIGHT.txt" />
             <File Id="pandocCOPYING" Name="COPYING.rtf"
-                  Source="..\COPYING.rtf" />
+                  Source="COPYING.rtf" />
           </Component>
 
           <Component Id="CitationSupport"
@@ -55,13 +55,13 @@
                            Name="Version" Type="string" Value="[ProductVersion]"
                            KeyPath="yes"/>
             <File Id="pandoc_citeprocEXE" Name="pandoc-citeproc.exe"
-                  Source="..\.cabal-sandbox\bin\pandoc-citeproc.exe" />
+                  Source="$(var.BINPATH)\pandoc-citeproc.exe" />
           </Component>
 
           <Component Id="Documentation"
                      Guid="A8D54A76-1A3D-4647-8327-81B69D39D8A3">
             <File Id="pandocREADME" Name="Pandoc User's Guide.html"
-                  Source="..\README.html" KeyPath="yes">
+                  Source="README.html" KeyPath="yes">
               <Shortcut Id="ApplicationStartMenuShortcut"
                         Directory="ApplicationProgramsFolder"
                         Name="Pandoc User’s Guide" Advertise="yes" />
@@ -163,7 +163,7 @@
     <Property Id="ALLUSERS" Value="2" Secure="yes" />
     <Property Id="MSIINSTALLPERUSER" Value="1" />
 
-    <WixVariable Id="WixUILicenseRtf" Value="..\COPYING.rtf" />
+    <WixVariable Id="WixUILicenseRtf" Value="COPYING.rtf" />
 
     <UI Id="MyWixUI_Advanced">
       <UIRef Id="WixUI_Advanced" />
diff --git a/windows/stack.yaml b/windows/stack.yaml
new file mode 100644
index 0000000..312b39e
--- /dev/null
+++ b/windows/stack.yaml
@@ -0,0 +1,21 @@
+flags:
+  pandoc:
+    trypandoc: false
+    https: true
+    embed_data_files: true
+    old-locale: false
+    network-uri: true
+  pandoc-citeproc:
+    bibutils: true
+    embed_data_files: true
+    unicode_collation: false
+    test_citeproc: false
+    debug: false
+packages:
+- '..'
+- '../../pandoc-citeproc'
+extra-deps:
+- 'aeson-0.11.1.1'
+- 'texmath-0.8.5'
+- 'highlighting-kate-0.6.2'
+resolver: lts-5.8
