diff --git a/README b/README
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 % Pandoc User's Guide
 % John MacFarlane
-% July 15, 2015
+% November 12, 2015
 
 Synopsis
 ========
@@ -24,34 +24,34 @@
 [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.
+on systems where LaTeX or ConTeXt 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 @@
 [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
@@ -124,11 +124,11 @@
 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 +143,12 @@
 
     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 +167,7 @@
 --------------
 
 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
 
@@ -189,8 +189,13 @@
 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 to create a PDF.
+To do this, specify an output file with a `.pdf` extension,
+as before, but add `-t context` to the command line.
 
+PDF output can be controlled using [variables for LaTeX]
+or [variables for ConTeXt].
+
 [`amsfonts`]: https://ctan.org/pkg/amsfonts
 [`amsmath`]: https://ctan.org/pkg/amsmath
 [`lm`]: https://ctan.org/pkg/lm
@@ -247,10 +252,10 @@
 
 :   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 +266,20 @@
     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`
@@ -355,9 +360,9 @@
 
 :   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,10 +372,8 @@
 :   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`
+    abbreviations, such as "Mr." (Note: This option is selected automatically
+    when the output format is `latex` or `context`, unless `--no-tex-ligatures`
     is used.)
 
 `--old-dashes`
@@ -394,12 +397,12 @@
 :   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.
 
 `--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
@@ -613,12 +616,12 @@
 
 `--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`
@@ -689,12 +692,13 @@
 :   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.
 
@@ -751,7 +755,7 @@
 
 :   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 +775,7 @@
     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 +964,13 @@
     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
 
@@ -992,9 +996,9 @@
 customize the `default.latex` template.
 
 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.
 
@@ -1006,7 +1010,7 @@
 
 `title`, `author`, `date`
 :   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][Extension: `pandoc_title_block`],
     which allows for multiple authors, or through a YAML metadata block:
 
@@ -1016,9 +1020,15 @@
         - Peter Abelard
         ...
 
+`subtitle`
+:   document subtitle; also used as subject in PDF metadata
+
 `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
     values)
@@ -1026,6 +1036,9 @@
 `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)
@@ -1047,12 +1060,21 @@
     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 overriden.
+    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 +1087,6 @@
     (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`).
 
@@ -1105,44 +1123,44 @@
 LaTeX variables are used when [creating a PDF].
 
 `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
 
 `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`);
@@ -1150,14 +1168,14 @@
 
 `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
+    and citation links, using options available through
     [`color`] package, e.g. `red`, `green`, `magenta`, `cyan`, `blue`, `black`
 
 `hidelinks`
 :   enables `hidelinks` option for [`hyperref`], disabling link color
 
 `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
@@ -1168,25 +1186,19 @@
     as sections, changing the appearance of nested headings in some classes
 
 `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`
 
 [`article`]: https://ctan.org/pkg/article
 [`report`]: https://ctan.org/pkg/report
@@ -1196,6 +1208,61 @@
 [`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
+
+`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`
+:   color for links, e.g. `red`, `blue` (see [ConTeXt Color])
+
+`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 +1333,18 @@
 
 [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 +1361,7 @@
 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 +1418,7 @@
 
 #### 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 +1485,11 @@
 
   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 +1590,7 @@
 
 #### 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 +1624,7 @@
 
 #### 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 +1709,7 @@
 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 +1763,7 @@
       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 +1799,7 @@
         + 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 +1813,18 @@
     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 +1832,7 @@
 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 +1848,7 @@
 
 #### 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 +1935,7 @@
 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 +2007,14 @@
     +   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 +2027,7 @@
 
         { 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 +2155,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.
+output, try widening it in the Markdown source.
 
 Headers may be omitted in multiline tables as well as simple tables:
 
@@ -2165,7 +2232,7 @@
 is no information available about relative widths.  If you want content
 to wrap within cells, use multiline or grid tables.
 
-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 +2333,7 @@
 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 +2342,7 @@
 
 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 +2350,7 @@
 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 +2377,7 @@
 
 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 +2414,12 @@
 
     <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 +2429,7 @@
 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.
@@ -2454,7 +2521,7 @@
 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 +2654,7 @@
 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 +2663,15 @@
 
 #### 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 +2692,12 @@
 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 +2735,7 @@
     \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 +2831,7 @@
 
     [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
@@ -2837,7 +2904,7 @@
 
 #### 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]
 
@@ -2916,7 +2983,7 @@
 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
@@ -3058,10 +3125,10 @@
 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 +3147,10 @@
 use with East Asian languages where spaces are not used between words,
 but text is divided into lines for readability.
 
+#### 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 +3166,8 @@
 
 #### 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` ####
@@ -3178,7 +3249,7 @@
 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)
@@ -3190,7 +3261,7 @@
 :   `pipe_tables`, `raw_html`, `tex_math_single_backslash`,
     `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)
@@ -3204,11 +3275,11 @@
 `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 +3289,15 @@
   (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 +3465,12 @@
 -------------
 
 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 +3494,14 @@
 `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 +3588,20 @@
 [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://www.sixbarsjail.it/tmp/bach_toccata.mp3"
+     data-external="1" type="audio/mpeg"></source>
+    </audio>
+
 Literate Haskell support
 ========================
 
@@ -3522,12 +3610,12 @@
 `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 +3641,7 @@
 
     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 +3703,7 @@
 Andreas Lööw,
 Andrew Dunning,
 Antoine Latter,
+Arata Mizuki,
 Arlo O'Keeffe,
 Artyom Kazak,
 Ben Gamari,
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,3 +1,209 @@
+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
+    (mb21).  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` (mb21).
+    + 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://www.sixbarsjail.it/tmp/bach_toccata.mp3"
+         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 (mb21, #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.
@@ -14,7 +220,7 @@
   * 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.
@@ -205,7 +411,7 @@
       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).
diff --git a/data/templates/default.asciidoc b/data/templates/default.asciidoc
--- a/data/templates/default.asciidoc
+++ b/data/templates/default.asciidoc
@@ -1,14 +1,23 @@
 $if(titleblock)$
 $title$
-$for(author)$
-:author: $author$
-$endfor$
+$if(author)$
+$for(author)$$author$$sep$; $endfor$
+$endif$
 $if(date)$
-:date: $date$
+$date$
 $endif$
+$if(keywords)$
+:keywords: $for(keywords)$$keywords$$sep$, $endfor$
+$endif$
 $if(toc)$
 :toc:
 $endif$
+
+$endif$
+$if(abstract)$
+[abstract]
+== Abstract
+$abstract$
 
 $endif$
 $for(header-includes)$
diff --git a/data/templates/default.beamer b/data/templates/default.beamer
--- a/data/templates/default.beamer
+++ b/data/templates/default.beamer
@@ -21,7 +21,7 @@
 \setbeamertemplate{caption label separator}{: }
 \setbeamercolor{caption name}{fg=normal text.fg}
 $if(fontfamily)$
-\usepackage[$fontfamilyoptions$]{$fontfamily$}
+\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
 $else$
 \usepackage{lmodern}
 $endif$
@@ -40,23 +40,23 @@
   \else
     \usepackage{fontspec}
   \fi
-  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
+  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
   \newcommand{\euro}{€}
 $if(mainfont)$
-    \setmainfont[$mainfontoptions$]{$mainfont$}
+    \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
 $endif$
 $if(sansfont)$
-    \setsansfont[$sansfontoptions$]{$sansfont$}
+    \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
 $endif$
 $if(monofont)$
-    \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$monofontoptions$$endif$]{$monofont$}
+    \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}
 $endif$
 $if(mathfont)$
-    \setmathfont(Digits,Latin,Greek)[$mathfontoptions$]{$mathfont$}
+    \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
 $endif$
 $if(CJKmainfont)$
     \usepackage{xeCJK}
-    \setCJKmainfont[$CJKoptions$]{$CJKmainfont$}
+    \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
 $endif$
 \fi
 % use upquote if available, for straight quotes in verbatim environments
@@ -67,16 +67,20 @@
 \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
 }{}
 $if(lang)$
-\ifxetex
+\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
+  \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
+$if(babel-newcommands)$
+  $babel-newcommands$
+$endif$
+\else
   \usepackage{polyglossia}
   \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}
 $for(polyglossia-otherlangs)$
   \setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$}
 $endfor$
-\else
-  \usepackage[shorthands=off,$babel-lang$]{babel}
 \fi
 $endif$
+\newif\ifbibliography
 $if(natbib)$
 \usepackage{natbib}
 \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
@@ -120,6 +124,10 @@
 \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
 $endif$
 
+% Prevent slide breaks in the middle of a paragraph:
+\widowpenalties 1 10000
+\raggedbottom
+
 % Comment these out if you don't want a slide with just the
 % part/section/subsection/subsubsection title:
 \AtBeginPart{
@@ -128,9 +136,12 @@
   \frame{\partpage}
 }
 \AtBeginSection{
-  \let\insertsectionnumber\relax
-  \let\sectionname\relax
-  \frame{\sectionpage}
+  \ifbibliography
+  \else
+    \let\insertsectionnumber\relax
+    \let\sectionname\relax
+    \frame{\sectionpage}
+  \fi
 }
 \AtBeginSubsection{
   \let\insertsubsectionnumber\relax
@@ -214,6 +225,7 @@
 $endif$
 $endif$
 \begin{frame}[allowframebreaks]{$biblio-title$}
+\bibliographytrue
 \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
 \end{frame}
 
@@ -221,6 +233,7 @@
 $endif$
 $if(biblatex)$
 \begin{frame}[allowframebreaks]{$biblio-title$}
+\bibliographytrue
 \printbibliography[heading=none]
 \end{frame}
 
diff --git a/data/templates/default.context b/data/templates/default.context
--- a/data/templates/default.context
+++ b/data/templates/default.context
@@ -1,7 +1,3 @@
-\startmode[*mkii]
-  \enableregime[utf-8]  
-  \setupcolors[state=start]
-\stopmode
 $if(context-lang)$
 \mainlanguage[$context-lang$]
 $endif$
@@ -9,28 +5,80 @@
 \setupalign[$context-dir$]
 \setupdirections[bidi=on,method=two]
 $endif$
-
 % Enable hyperlinks
-\setupinteraction[state=start, color=middleblue]
-
-\setuppapersize [$if(papersize)$$papersize$$else$letter$endif$][$if(papersize)$$papersize$$else$letter$endif$]
-\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,
+$if(title)$
+  title={$title$},
+$endif$
+$if(subtitle)$
+  subtitle={$subtitle$},
+$endif$
+$if(author)$
+  author={$for(author)$$author$$sep$; $endfor$},
+$endif$
+$if(keywords)$
+  keyword={$for(keywords)$$keywords$$sep$; $endfor$},
+$endif$
+  style=$linkstyle$,
+  color=$linkcolor$,
+  contrastcolor=$linkcontrastcolor$]
+% make chapter, section bookmarks visible when opening document
+\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
+\setupinteractionscreen[option=bookmark]
+\setuptagging[state=start]
 
-\setupwhitespace[medium]
+$if(papersize)$
+\setuppapersize[$for(papersize)$$papersize$$sep$,$endfor$]
+$endif$
+$if(layout)$
+\setuplayout[$for(layout)$$layout$$sep$,$endfor$]
+$endif$
+$if(pagenumbering)$
+\setuppagenumbering[$for(pagenumbering)$$pagenumbering$$sep$,$endfor$]
+$endif$
+% use microtypography
+\definefontfeature[default][default][protrusion=quality,expansion=quality,onum=yes,pnum=yes]
+\definefontfeature[smallcaps][smallcaps][protrusion=quality,expansion=quality,onum=yes,pnum=yes]
+\setupalign[hz,hanging]
+\setupbodyfontenvironment[default][em=italic] % use italic as em, not slanted
+$if(mainfont)$
+\definefontfamily[mainfont][serif][$mainfont$]
+$endif$
+$if(sansfont)$
+\definefontfamily[sansfont][sans][$sansfont$]
+$endif$
+$if(monofont)$
+\definefontfamily[monofont][mono][$monofont$][features=none]
+$endif$
+$if(mathfont)$
+\definefontfamily[mathfont][math][$mathfont$]
+$endif$
+\setupbodyfont[mainfont$if(fontsize)$,$fontsize$$endif$]
+\setupwhitespace[$if(whitespace)$$whitespace$$else$medium$endif$]
+$if(indenting)$
+\setupindenting[$for(indenting)$$indenting$$sep$,$endfor$]
+$endif$
+$if(interlinespace)$
+\setupinterlinespace[$for(interlinespace)$$interlinespace$$sep$,$endfor$]
+$endif$
 
-\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]
 
+$if(headertext)$
+\setupheadertexts$for(headertext)$[$headertext$]$endfor$
+$endif$
+$if(footertext)$
+\setupfootertexts$for(footertext)$[$footertext$]$endfor$
+$endif$
 $if(number-sections)$
 $else$
-\setuphead[chapter, section, subsection, subsubsection][number=no]
+\setuphead[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][number=no]
 $endif$
 
 \definedescription
@@ -45,42 +93,50 @@
 
 \setupthinrules[width=15em] % width of horizontal rules
 
-\setupdelimitedtext
-  [blockquote]
-  [before={\blank[medium]},
-   after={\blank[medium]},
-   indentnext=no,
-  ]
-
-$if(toc)$
-\setupcombinedlist[content][list={$placelist$}]
-
+\setuphead[title][
+  style={\tfd\raggedcenter},
+  before={\startalignment[middle]},
+  after={
+$if(subtitle)$
+    \smallskip
+    {\tfa $subtitle$}
 $endif$
+$if(author)$
+    \smallskip
+    {\tfa $for(author)$$author$$sep$\crlf $endfor$}
+$endif$
+$if(date)$
+    \smallskip
+    {\tfa $date$}
+$endif$
+    \bigskip\stopalignment}]
+
 $for(header-includes)$
 $header-includes$
 $endfor$
 
 \starttext
 $if(title)$
-\startalignment[center]
-  \blank[2*big]
-  {\tfd $title$}
-$if(author)$
-  \blank[3*medium]
-  {\tfa $for(author)$$author$$sep$\crlf $endfor$}
-$endif$
-$if(date)$
-  \blank[2*medium]
-  {\tfa $date$}
+\title{$title$}
 $endif$
-  \blank[3*medium]
-\stopalignment
+$if(abstract)$
+\midaligned{\it Abstract}
+\startnarrower[2*middle]
+$abstract$
+\stopnarrower
+\blank[big]
 $endif$
 $for(include-before)$
 $include-before$
 $endfor$
 $if(toc)$
-\placecontent
+\completecontent
+$endif$
+$if(lot)$
+\completelistoftables
+$endif$
+$if(lof)$
+\completelistoffigures
 $endif$
 
 $body$
diff --git a/data/templates/default.dzslides b/data/templates/default.dzslides
--- a/data/templates/default.dzslides
+++ b/data/templates/default.dzslides
@@ -1,14 +1,21 @@
 <!DOCTYPE html>
-<head>
-<meta charset="utf-8">
+<head$if(lang)$ lang="$lang$"$endif$$if(dir)$ dir="$dir$"$endif$>
+  <meta charset="utf-8">
+  <meta name="generator" content="pandoc">
 $for(author-meta)$
-  <meta name="author" content="$author-meta$" />
+  <meta name="author" content="$author-meta$">
 $endfor$
 $if(date-meta)$
-  <meta name="dcterms.date" content="$date-meta$" />
+  <meta name="dcterms.date" content="$date-meta$">
 $endif$
-  <title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
+$if(keywords)$
+  <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$">
+$endif$
+  <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
   <style type="text/css">code{white-space: pre;}</style>
+$if(quotes)$
+  <style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
+$endif$
 $if(highlighting-css)$
   <style type="text/css">
 $highlighting-css$
@@ -16,40 +23,87 @@
 $endif$
 $if(css)$
 $for(css)$
-  <link rel="stylesheet" href="$css$" $if(html5)$$else$type="text/css" $endif$/>
+  <link rel="stylesheet" href="$css$">
 $endfor$
 $else$
+<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet'>
+
 <style>
-  html { background-color: black; }
-  body { background-color: white; border-radius: 12px}
+  html, .view body { background-color: black; counter-reset: slideidx; }
+  body, .view section { background-color: white; border-radius: 12px }
   /* A section is a slide. It's size is 800x600, and this will never change */
-  section {
-      font-family: Arial, serif;
-      font-size: 20pt;
-    }
-  address, blockquote, dl, fieldset, form, h1, h2, h3, h4, h5, h6, hr, ol, p, pre, table, ul, dl { padding: 10px 20px 10px 20px; }
-  h1, h2, h3 {
+  section, .view head > title {
+      /* The font from Google */
+      font-family: 'Oswald', arial, serif;
+      font-size: 30px;
+  }
+
+  .view section:after {
+    counter-increment: slideidx;
+    content: counter(slideidx, decimal-leading-zero);
+    position: absolute; bottom: -80px; right: 100px;
+    color: white;
+  }
+
+  .view head > title {
+    color: white;
     text-align: center;
-    margin: 10pt 10pt 20pt 10pt;
+    margin: 1em 0 1em 0;
   }
-  ul, ol {
-    margin: 10px 10px 10px 50px;
+
+  h1, h2 {
+    margin-top: 200px;
+    text-align: center;
+    font-size: 80px;
   }
-  section.titleslide h1 { margin-top: 200px; }
-  h1.title { margin-top: 150px; }
-  h1 { font-size: 180%; }
-  h2 { font-size: 120%; }
-  h3 { font-size: 100%; }
-  q { quotes: "“" "”" "‘" "’"; }
-  blockquote { font-style: italic }
-  /* Figures are displayed full-page, with the caption on
-     top of the image/video */
+  h3 {
+    margin: 100px 0 50px 100px;
+  }
+
+  ul {
+      margin: 50px 200px;
+  }
+  li > ul {
+      margin: 15px 50px;
+  }
+
+  p {
+    margin: 75px;
+    font-size: 50px;
+  }
+
+  blockquote {
+    height: 100%;
+    background-color: black;
+    color: white;
+    font-size: 60px;
+    padding: 50px;
+  }
+  blockquote:before {
+    content: open-quote;
+  }
+  blockquote:after {
+    content: close-quote;
+  }
+
+  /* Figures are displayed full-page, with the caption
+     on top of the image/video */
   figure {
     background-color: black;
+    width: 100%;
+    height: 100%;
   }
+  figure > * {
+    position: absolute;
+  }
+  figure > img, figure > video {
+    width: 100%; height: 100%;
+  }
   figcaption {
     margin: 70px;
+    font-size: 50px;
   }
+
   footer {
     position: absolute;
     bottom: 0;
@@ -66,12 +120,22 @@
      https://developer.mozilla.org/en/CSS/CSS_transitions
      How to use CSS3 Transitions: */
   section {
-      -moz-transition: left 400ms linear 0s;
-      -webkit-transition: left 400ms linear 0s;
-      -ms-transition: left 400ms linear 0s;
-      transition: left 400ms linear 0s;
+    -moz-transition: left 400ms linear 0s;
+    -webkit-transition: left 400ms linear 0s;
+    -ms-transition: left 400ms linear 0s;
+    transition: left 400ms linear 0s;
   }
+  .view section {
+    -moz-transition: none;
+    -webkit-transition: none;
+    -ms-transition: none;
+    transition: none;
+  }
 
+  .view section[aria-selected] {
+    border: 5px red solid;
+  }
+
   /* Before */
   section { left: -150%; }
   /* Now */
@@ -85,10 +149,17 @@
   .incremental > * { opacity: 1; }
 
   /* The current item */
-  .incremental > *[aria-selected] { color: red; opacity: 1; }
+  .incremental > *[aria-selected] { opacity: 1; }
 
   /* The items to-be-selected */
-  .incremental > *[aria-selected] ~ * { opacity: 0.2; }
+  .incremental > *[aria-selected] ~ * { opacity: 0; }
+
+  /* The progressbar, at the bottom of the slides, show the global
+     progress of the presentation. */
+  #progress-bar {
+    height: 2px;
+    background: #AAA;
+  }
 </style>
 $endif$
 $if(math)$
@@ -105,10 +176,9 @@
 $if(subtitle)$
   <h1 class="subtitle">$subtitle$</h1>
 $endif$
-$for(author)$
-  <h2 class="author">$author$</h2>
-$endfor$
-  <h3 class="date">$date$</h3>
+  <footer>
+    $if(author)$<span class="author">$for(author)$$author$$sep$, $endfor$</span>$endif$ · $if(date)$<span class="date">$date$</span>$endif$
+  </footer>
 </section>
 $endif$
 $for(include-before)$
diff --git a/data/templates/default.html b/data/templates/default.html
--- a/data/templates/default.html
+++ b/data/templates/default.html
@@ -10,7 +10,10 @@
 $if(date-meta)$
   <meta name="date" content="$date-meta$" />
 $endif$
-  <title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
+$if(keywords)$
+  <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
+$endif$
+  <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
   <style type="text/css">code{white-space: pre;}</style>
 $if(quotes)$
   <style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
@@ -21,7 +24,7 @@
   </style>
 $endif$
 $for(css)$
-  <link rel="stylesheet" href="$css$" $if(html5)$$else$type="text/css" $endif$/>
+  <link rel="stylesheet" href="$css$" type="text/css" />
 $endfor$
 $if(math)$
   $math$
diff --git a/data/templates/default.html5 b/data/templates/default.html5
--- a/data/templates/default.html5
+++ b/data/templates/default.html5
@@ -10,7 +10,10 @@
 $if(date-meta)$
   <meta name="dcterms.date" content="$date-meta$">
 $endif$
-  <title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
+$if(keywords)$
+  <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$">
+$endif$
+  <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
   <style type="text/css">code{white-space: pre;}</style>
 $if(quotes)$
   <style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
diff --git a/data/templates/default.icml b/data/templates/default.icml
--- a/data/templates/default.icml
+++ b/data/templates/default.icml
@@ -30,7 +30,7 @@
     </RootCellStyleGroup>
   <Story Self="pandoc_story"
       TrackChanges="false"
-      StoryTitle="$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$"
+      StoryTitle="$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$"
       AppliedTOCStyle="n"
       AppliedNamedGrid="n" >
     <StoryPreference OpticalMarginAlignment="true" OpticalMarginSize="12" />
diff --git a/data/templates/default.latex b/data/templates/default.latex
--- a/data/templates/default.latex
+++ b/data/templates/default.latex
@@ -1,6 +1,6 @@
 \documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
 $if(fontfamily)$
-\usepackage[$fontfamilyoptions$]{$fontfamily$}
+\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
 $else$
 \usepackage{lmodern}
 $endif$
@@ -23,23 +23,23 @@
   \else
     \usepackage{fontspec}
   \fi
-  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
+  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
   \newcommand{\euro}{€}
 $if(mainfont)$
-    \setmainfont[$mainfontoptions$]{$mainfont$}
+    \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
 $endif$
 $if(sansfont)$
-    \setsansfont[$sansfontoptions$]{$sansfont$}
+    \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
 $endif$
 $if(monofont)$
-    \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$monofontoptions$$endif$]{$monofont$}
+    \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}
 $endif$
 $if(mathfont)$
-    \setmathfont(Digits,Latin,Greek)[$mathfontoptions$]{$mathfont$}
+    \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
 $endif$
 $if(CJKmainfont)$
     \usepackage{xeCJK}
-    \setCJKmainfont[$CJKoptions$]{$CJKmainfont$}
+    \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
 $endif$
 \fi
 % use upquote if available, for straight quotes in verbatim environments
@@ -52,42 +52,43 @@
 $if(geometry)$
 \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
 $endif$
-\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={$author-meta$},
+\usepackage{hyperref}
+\PassOptionsToPackage{usenames,dvipsnames}{color} % color is loaded by hyperref
+\hypersetup{unicode=true,
+$if(title-meta)$
             pdftitle={$title-meta$},
+$endif$
+$if(author-meta)$
+            pdfauthor={$author-meta$},
+$endif$
+$if(subtitle)$
+            pdfsubject={$subtitle$},
+$endif$
+$if(keywords)$
+            pdfkeywords={$for(keywords)$$keywords$$sep$; $endfor$},
+$endif$
+$if(colorlinks)$
             colorlinks=true,
-            citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,
-            urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
-            linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
-            pdfborder={0 0 0}
-            $if(hidelinks)$,hidelinks,$endif$}
+            linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
+            citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
+            urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
+$else$
+            pdfborder={0 0 0},
+$endif$
+            breaklinks=true}
 \urlstyle{same}  % don't use monospace font for urls
 $if(lang)$
-\ifxetex
+\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
+  \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
+$if(babel-newcommands)$
+  $babel-newcommands$
+$endif$
+\else
   \usepackage{polyglossia}
   \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}
 $for(polyglossia-otherlangs)$
   \setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$}
 $endfor$
-\else
-  \usepackage[shorthands=off,$babel-lang$]{babel}
 \fi
 $endif$
 $if(natbib)$
@@ -207,7 +208,9 @@
 $endfor$
 $if(toc)$
 {
+$if(colorlinks)$
 \hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$black$endif$}
+$endif$
 \setcounter{tocdepth}{$toc-depth$}
 \tableofcontents
 }
diff --git a/data/templates/default.man b/data/templates/default.man
--- a/data/templates/default.man
+++ b/data/templates/default.man
@@ -1,8 +1,10 @@
 $if(has-tables)$
 .\"t
 $endif$
+$if(pandoc-version)$
 .\" Automatically generated by Pandoc $pandoc-version$
 .\"
+$endif$
 $if(adjusting)$
 .ad $adjusting$
 $endif$
diff --git a/data/templates/default.opendocument b/data/templates/default.opendocument
--- a/data/templates/default.opendocument
+++ b/data/templates/default.opendocument
@@ -3,7 +3,9 @@
   <office:font-face-decls>
     <style:font-face style:name="Courier New" style:font-family-generic="modern" style:font-pitch="fixed" svg:font-family="'Courier New'" />
   </office:font-face-decls>
-  $automatic-styles$
+  <office:automatic-styles>
+    $automatic-styles$
+  </office:automatic-styles>
 $for(header-includes)$
   $header-includes$
 $endfor$
diff --git a/data/templates/default.revealjs b/data/templates/default.revealjs
--- a/data/templates/default.revealjs
+++ b/data/templates/default.revealjs
@@ -9,12 +9,18 @@
 $if(date-meta)$
   <meta name="dcterms.date" content="$date-meta$">
 $endif$
+$if(keywords)$
+  <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$">
+$endif$
   <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
   <meta name="apple-mobile-web-app-capable" content="yes">
   <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
-  <link rel="stylesheet" href="$revealjs-url$/css/reveal.css"/>
+  <link rel="stylesheet" href="$revealjs-url$/css/reveal.css">
   <style type="text/css">code{white-space: pre;}</style>
+$if(quotes)$
+  <style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
+$endif$
 $if(highlighting-css)$
   <style type="text/css">
 $highlighting-css$
@@ -55,14 +61,16 @@
 
 $if(title)$
 <section>
-    <h1 class="title">$title$</h1>
+  <h1 class="title">$title$</h1>
 $if(subtitle)$
   <h1 class="subtitle">$subtitle$</h1>
 $endif$
 $for(author)$
-    <h2 class="author">$author$</h2>
+  <h2 class="author">$author$</h2>
 $endfor$
-    <h3 class="date">$date$</h3>
+$if(date)$
+  <h3 class="date">$date$</h3>
+$endif$
 </section>
 $endif$
 $if(toc)$
diff --git a/data/templates/default.s5 b/data/templates/default.s5
--- a/data/templates/default.s5
+++ b/data/templates/default.s5
@@ -1,20 +1,27 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$$if(dir)$ dir="$dir$"$endif$>
 <head>
   <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" />
 $for(author-meta)$
+  <meta name="version" content="S5 1.1" />
   <meta name="author" content="$author-meta$" />
 $endfor$
 $if(date-meta)$
   <meta name="date" content="$date-meta$" />
 $endif$
-  <title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
+$if(keywords)$
+  <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
+$endif$
+  <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
   <style type="text/css">code{white-space: pre;}</style>
   <!-- configuration parameters -->
   <meta name="defaultView" content="slideshow" />
   <meta name="controlVis" content="hidden" />
+$if(quotes)$
+  <style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
+$endif$
 $if(highlighting-css)$
   <style type="text/css">
 $highlighting-css$
@@ -53,12 +60,16 @@
 <div class="presentation">
 $if(title)$
 <div class="titleslide slide">
-  <h1>$title$</h1>
+  <h1 class="title">$title$</h1>
 $if(subtitle)$
-  <h1 class="subtitle">$subtitle$</h1>
+  <h2 class="subtitle">$subtitle$</h2>
 $endif$
-  <h2>$for(author)$$author$$sep$<br/>$endfor$</h2>
-  <h3>$date$</h3>
+$if(author)$
+  <h3 class="author">$for(author)$$author$$sep$<br/>$endfor$</h3>
+$endif$
+$if(date)$
+  <h4 class="date">$date$</h4>
+$endif$
 </div>
 $endif$
 $body$
diff --git a/data/templates/default.slideous b/data/templates/default.slideous
--- a/data/templates/default.slideous
+++ b/data/templates/default.slideous
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$>
+<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$$if(dir)$ dir="$dir$"$endif$>
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <meta http-equiv="Content-Style-Type" content="text/css" />
@@ -12,8 +12,14 @@
 $if(date-meta)$
   <meta name="date" content="$date-meta$" />
 $endif$
-  <title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
+$if(keywords)$
+  <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
+$endif$
+  <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
   <style type="text/css">code{white-space: pre;}</style>
+$if(quotes)$
+  <style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
+$endif$
 $if(highlighting-css)$
   <style type="text/css">
 $highlighting-css$
diff --git a/data/templates/default.slidy b/data/templates/default.slidy
--- a/data/templates/default.slidy
+++ b/data/templates/default.slidy
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$>
+<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$$if(dir)$ dir="$dir$"$endif$>
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <meta http-equiv="Content-Style-Type" content="text/css" />
@@ -12,8 +12,14 @@
 $if(date-meta)$
   <meta name="date" content="$date-meta$" />
 $endif$
-  <title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
+$if(keywords)$
+  <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
+$endif$
+  <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
   <style type="text/css">code{white-space: pre;}</style>
+$if(quotes)$
+  <style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
+$endif$
 $if(highlighting-css)$
   <style type="text/css">
 $highlighting-css$
@@ -47,9 +53,11 @@
 $if(subtitle)$
   <h1 class="subtitle">$subtitle$</h1>
 $endif$
+$if(author)$
   <p class="author">
 $for(author)$$author$$sep$<br/>$endfor$
   </p>
+$endif$
 $if(date)$
   <p class="date">$date$</p>
 $endif$
diff --git a/man/pandoc.1 b/man/pandoc.1
--- a/man/pandoc.1
+++ b/man/pandoc.1
@@ -1,5 +1,5 @@
 .\"t
-.TH PANDOC 1 "July 15, 2015" ""
+.TH PANDOC 1 "November 12, 2015" "pandoc 1.15.2"
 .SH NAME
 pandoc - general markup converter
 .SH SYNOPSIS
@@ -20,33 +20,34 @@
 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.
+It can also produce PDF output on systems where LaTeX or ConTeXt 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 @@
 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 @@
 \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 @@
 \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 @@
 .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]
@@ -190,7 +191,12 @@
 \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.
+Alternatively, pandoc can use ConTeXt 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[] to the command line.
+.PP
+PDF output can be controlled using variables for LaTeX or variables for
+ConTeXt.
 .SS \f[C]hsmarkdown\f[]
 .PP
 A user who wants a drop\-in replacement for \f[C]Markdown.pl\f[] may
@@ -209,10 +215,10 @@
 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 +231,10 @@
 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 +243,11 @@
 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[]
@@ -350,9 +356,9 @@
 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,11 +371,8 @@
 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
+"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.)
 .RS
 .RE
@@ -399,12 +402,12 @@
 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]\-\-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.
@@ -674,13 +677,13 @@
 .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
@@ -771,12 +774,13 @@
 \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
@@ -844,7 +848,7 @@
 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 +875,7 @@
 \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 +1090,7 @@
 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 +1098,7 @@
 .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
@@ -1150,7 +1154,7 @@
 .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,11 +1170,22 @@
 .fi
 .RE
 .TP
+.B \f[C]subtitle\f[]
+document subtitle; also used as subject in PDF metadata
+.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
 .B \f[C]header\-includes\f[]
 contents specified by \f[C]\-H/\-\-include\-in\-header\f[] (may have
 multiple values)
@@ -1183,6 +1198,11 @@
 .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)
@@ -1209,14 +1229,23 @@
 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 overriden.
+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 +1262,6 @@
 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
@@ -1276,39 +1300,38 @@
 LaTeX variables are used when creating a PDF.
 .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]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 +1339,14 @@
 .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 +1356,9 @@
 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
@@ -1347,8 +1371,8 @@
 .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.
+and citation links, 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[]
 .RS
@@ -1361,7 +1385,7 @@
 .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
@@ -1379,39 +1403,105 @@
 .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[]
 .RS
 .RE
+.SS Variables for ConTeXt
 .TP
-.B \f[C]bibliography\f[]
-bibliography to use for resolving references
+.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]biblio\-style\f[]
-bibliography style in LaTeX, when used with \f[C]\-\-natbib\f[]
+.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]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[]
+color for links, e.g.
+\f[C]red\f[], \f[C]blue\f[] (see ConTeXt Color)
+.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
 .TP
 .B \f[C]section\f[]
@@ -1515,16 +1605,16 @@
 .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 +1631,8 @@
 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 +1695,7 @@
 .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 +1797,27 @@
 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 +1966,7 @@
 .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 +2005,7 @@
 .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 +2111,7 @@
 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 +2185,7 @@
 \f[]
 .fi
 .PP
-But markdown also allows a "lazy" format:
+But Markdown also allows a "lazy" format:
 .IP
 .nf
 \f[C]
@@ -2145,7 +2234,7 @@
 \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 +2253,12 @@
 .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 +2268,7 @@
 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 +2292,7 @@
 .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 +2384,7 @@
 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 +2474,7 @@
 .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 +2484,7 @@
 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 +2500,7 @@
 \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 +2654,7 @@
 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
@@ -2658,7 +2747,7 @@
 widths.
 If you want content to wrap within cells, use multiline or grid tables.
 .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 +2880,7 @@
 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 +2895,7 @@
 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 +2904,7 @@
 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 +2936,7 @@
 .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 +2993,7 @@
 \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 +3003,7 @@
 .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 +3014,7 @@
 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.
@@ -3040,7 +3129,7 @@
 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 +3301,7 @@
 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 +3310,16 @@
 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 +3348,13 @@
 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 +3398,7 @@
 .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.
@@ -3432,7 +3521,7 @@
 \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.
@@ -3522,7 +3611,7 @@
 .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 +3754,7 @@
 \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[]
@@ -3851,10 +3940,10 @@
 (either BibTeX or BibLaTeX).
 .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 +3960,9 @@
 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]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 +3978,8 @@
 .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[]
@@ -3958,7 +4050,7 @@
 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)
@@ -3976,7 +4068,8 @@
 \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
@@ -3995,10 +4088,10 @@
 \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 +4102,13 @@
 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 +4312,14 @@
 .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>
@@ -4255,10 +4348,11 @@
 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 EPUB METADATA
+.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
@@ -4384,6 +4478,24 @@
 \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://www.sixbarsjail.it/tmp/bach_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
@@ -4393,14 +4505,14 @@
 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.
@@ -4432,7 +4544,7 @@
 \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
@@ -4494,9 +4606,10 @@
 .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.
diff --git a/pandoc.cabal b/pandoc.cabal
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,5 +1,5 @@
 Name:            pandoc
-Version:         1.15.1.1
+Version:         1.15.2
 Cabal-Version:   >= 1.10
 Build-Type:      Custom
 License:         GPL
@@ -239,7 +239,7 @@
 
 Flag old-locale
   Description:   Use old-locale and time < 1.5
-  Default:       True
+  Default:       False
 
 Library
   Build-Depends: base >= 4.2 && <5,
@@ -250,7 +250,7 @@
                  parsec >= 3.1 && < 3.2,
                  mtl >= 1.1 && < 2.3,
                  filepath >= 1.1 && < 1.5,
-                 process >= 1 && < 1.3,
+                 process >= 1 && < 1.4,
                  directory >= 1 && < 1.3,
                  bytestring >= 0.9 && < 0.11,
                  text >= 0.11 && < 1.3,
@@ -310,7 +310,10 @@
                       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,
@@ -388,6 +391,7 @@
                    Text.Pandoc.Writers.Shared,
                    Text.Pandoc.Asciify,
                    Text.Pandoc.MIME,
+                   Text.Pandoc.Emoji,
                    Text.Pandoc.Parsing,
                    Text.Pandoc.UUID,
                    Text.Pandoc.ImageSize,
@@ -396,9 +400,9 @@
                    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
 
@@ -429,14 +433,20 @@
                     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,12 +454,14 @@
     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,
@@ -458,7 +470,7 @@
                   text >= 0.11 && < 1.3,
                   directory >= 1 && < 1.3,
                   filepath >= 1.1 && < 1.5,
-                  process >= 1 && < 1.3,
+                  process >= 1 && < 1.4,
                   highlighting-kate >= 0.6 && < 0.7,
                   Diff >= 0.2 && < 0.4,
                   test-framework >= 0.3 && < 0.9,
@@ -494,18 +506,19 @@
                   Tests.Writers.LaTeX
                   Tests.Writers.Docx
                   Tests.Writers.RST
-                  Prelude
   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
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -1173,6 +1173,7 @@
 
   let laTeXOutput = "latex" `isPrefixOf` writerName' ||
                     "beamer" `isPrefixOf` writerName'
+  let conTeXtOutput = "context" `isPrefixOf` writerName'
 
   writer <- if ".lua" `isSuffixOf` writerName'
                -- note:  use non-lowercased version writerName
@@ -1256,7 +1257,7 @@
                                 _ -> Nothing
 
   let readerOpts = def{ readerSmart = smart || (texLigatures &&
-                          (laTeXOutput || "context" `isPrefixOf` writerName'))
+                          (laTeXOutput || conTeXtOutput))
                       , readerStandalone = standalone'
                       , readerParseRaw = parseRaw
                       , readerColumns = columns
@@ -1367,17 +1368,20 @@
     PureStringWriter f
       | pdfOutput -> do
               -- make sure writer is latex or beamer
-              unless laTeXOutput $
+              unless (laTeXOutput || conTeXtOutput) $
                 err 47 $ "cannot produce pdf output with " ++ writerName' ++
                          " writer"
 
+              let texprog = if conTeXtOutput
+                              then "context"
+                              else latexEngine
               -- check for latex program
-              mbLatex <- findExecutable latexEngine
+              mbLatex <- findExecutable texprog
               when (mbLatex == Nothing) $
-                   err 41 $ latexEngine ++ " not found. " ++
-                     latexEngine ++ " is needed for pdf output."
+                   err 41 $ texprog ++ " not found. " ++
+                     texprog ++ " is needed for pdf output."
 
-              res <- makePDF latexEngine f writerOptions doc'
+              res <- makePDF texprog f writerOptions doc'
               case res of
                    Right pdf -> writeBinary pdf
                    Left err' -> do
diff --git a/prelude/Prelude.hs b/prelude/Prelude.hs
--- 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
@@ -26,14 +27,4 @@
 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/Compat/Monoid.hs b/src/Text/Pandoc/Compat/Monoid.hs
new file mode 100644
--- /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/Emoji.hs b/src/Text/Pandoc/Emoji.hs
new file mode 100644
--- /dev/null
+++ b/src/Text/Pandoc/Emoji.hs
@@ -0,0 +1,905 @@
+{-
+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
+  [ ("100", "\x1f4af")
+  , ("1234", "\x1f522")
+  , ("smile", "\x1f604")
+  , ("smiley", "\x1f603")
+  , ("grinning", "\x1f600")
+  , ("blush", "\x1f60a")
+  , ("relaxed", "\x263a\fe0f")
+  , ("wink", "\x1f609")
+  , ("heart_eyes", "\x1f60d")
+  , ("kissing_heart", "\x1f618")
+  , ("kissing_closed_eyes", "\x1f61a")
+  , ("kissing", "\x1f617")
+  , ("kissing_smiling_eyes", "\x1f619")
+  , ("stuck_out_tongue_winking_eye", "\x1f61c")
+  , ("stuck_out_tongue_closed_eyes", "\x1f61d")
+  , ("stuck_out_tongue", "\x1f61b")
+  , ("flushed", "\x1f633")
+  , ("grin", "\x1f601")
+  , ("pensive", "\x1f614")
+  , ("relieved", "\x1f60c")
+  , ("unamused", "\x1f612")
+  , ("disappointed", "\x1f61e")
+  , ("persevere", "\x1f623")
+  , ("cry", "\x1f622")
+  , ("joy", "\x1f602")
+  , ("sob", "\x1f62d")
+  , ("sleepy", "\x1f62a")
+  , ("disappointed_relieved", "\x1f625")
+  , ("cold_sweat", "\x1f630")
+  , ("sweat_smile", "\x1f605")
+  , ("sweat", "\x1f613")
+  , ("weary", "\x1f629")
+  , ("tired_face", "\x1f62b")
+  , ("fearful", "\x1f628")
+  , ("scream", "\x1f631")
+  , ("angry", "\x1f620")
+  , ("rage", "\x1f621")
+  , ("triumph", "\x1f624")
+  , ("confounded", "\x1f616")
+  , ("laughing", "\x1f606")
+  , ("satisfied", "\x1f606")
+  , ("yum", "\x1f60b")
+  , ("mask", "\x1f637")
+  , ("sunglasses", "\x1f60e")
+  , ("sleeping", "\x1f634")
+  , ("dizzy_face", "\x1f635")
+  , ("astonished", "\x1f632")
+  , ("worried", "\x1f61f")
+  , ("frowning", "\x1f626")
+  , ("anguished", "\x1f627")
+  , ("smiling_imp", "\x1f608")
+  , ("imp", "\x1f47f")
+  , ("open_mouth", "\x1f62e")
+  , ("grimacing", "\x1f62c")
+  , ("neutral_face", "\x1f610")
+  , ("confused", "\x1f615")
+  , ("hushed", "\x1f62f")
+  , ("no_mouth", "\x1f636")
+  , ("innocent", "\x1f607")
+  , ("smirk", "\x1f60f")
+  , ("expressionless", "\x1f611")
+  , ("man_with_gua_pi_mao", "\x1f472")
+  , ("man_with_turban", "\x1f473")
+  , ("cop", "\x1f46e")
+  , ("construction_worker", "\x1f477")
+  , ("guardsman", "\x1f482")
+  , ("baby", "\x1f476")
+  , ("boy", "\x1f466")
+  , ("girl", "\x1f467")
+  , ("man", "\x1f468")
+  , ("woman", "\x1f469")
+  , ("older_man", "\x1f474")
+  , ("older_woman", "\x1f475")
+  , ("person_with_blond_hair", "\x1f471")
+  , ("angel", "\x1f47c")
+  , ("princess", "\x1f478")
+  , ("smiley_cat", "\x1f63a")
+  , ("smile_cat", "\x1f638")
+  , ("heart_eyes_cat", "\x1f63b")
+  , ("kissing_cat", "\x1f63d")
+  , ("smirk_cat", "\x1f63c")
+  , ("scream_cat", "\x1f640")
+  , ("crying_cat_face", "\x1f63f")
+  , ("joy_cat", "\x1f639")
+  , ("pouting_cat", "\x1f63e")
+  , ("japanese_ogre", "\x1f479")
+  , ("japanese_goblin", "\x1f47a")
+  , ("see_no_evil", "\x1f648")
+  , ("hear_no_evil", "\x1f649")
+  , ("speak_no_evil", "\x1f64a")
+  , ("skull", "\x1f480")
+  , ("alien", "\x1f47d")
+  , ("hankey", "\x1f4a9")
+  , ("poop", "\x1f4a9")
+  , ("shit", "\x1f4a9")
+  , ("fire", "\x1f525")
+  , ("sparkles", "\x2728")
+  , ("star2", "\x1f31f")
+  , ("dizzy", "\x1f4ab")
+  , ("boom", "\x1f4a5")
+  , ("collision", "\x1f4a5")
+  , ("anger", "\x1f4a2")
+  , ("sweat_drops", "\x1f4a6")
+  , ("droplet", "\x1f4a7")
+  , ("zzz", "\x1f4a4")
+  , ("dash", "\x1f4a8")
+  , ("ear", "\x1f442")
+  , ("eyes", "\x1f440")
+  , ("nose", "\x1f443")
+  , ("tongue", "\x1f445")
+  , ("lips", "\x1f444")
+  , ("+1", "\x1f44d")
+  , ("thumbsup", "\x1f44d")
+  , ("-1", "\x1f44e")
+  , ("thumbsdown", "\x1f44e")
+  , ("ok_hand", "\x1f44c")
+  , ("facepunch", "\x1f44a")
+  , ("punch", "\x1f44a")
+  , ("fist", "\x270a")
+  , ("v", "\x270c\fe0f")
+  , ("wave", "\x1f44b")
+  , ("hand", "\x270b")
+  , ("raised_hand", "\x270b")
+  , ("open_hands", "\x1f450")
+  , ("point_up_2", "\x1f446")
+  , ("point_down", "\x1f447")
+  , ("point_right", "\x1f449")
+  , ("point_left", "\x1f448")
+  , ("raised_hands", "\x1f64c")
+  , ("pray", "\x1f64f")
+  , ("point_up", "\x261d\fe0f")
+  , ("clap", "\x1f44f")
+  , ("muscle", "\x1f4aa")
+  , ("walking", "\x1f6b6")
+  , ("runner", "\x1f3c3")
+  , ("running", "\x1f3c3")
+  , ("dancer", "\x1f483")
+  , ("couple", "\x1f46b")
+  , ("family", "\x1f46a")
+  , ("two_men_holding_hands", "\x1f46c")
+  , ("two_women_holding_hands", "\x1f46d")
+  , ("couplekiss", "\x1f48f")
+  , ("couple_with_heart", "\x1f491")
+  , ("dancers", "\x1f46f")
+  , ("ok_woman", "\x1f646")
+  , ("no_good", "\x1f645")
+  , ("information_desk_person", "\x1f481")
+  , ("raising_hand", "\x1f64b")
+  , ("massage", "\x1f486")
+  , ("haircut", "\x1f487")
+  , ("nail_care", "\x1f485")
+  , ("bride_with_veil", "\x1f470")
+  , ("person_with_pouting_face", "\x1f64e")
+  , ("person_frowning", "\x1f64d")
+  , ("bow", "\x1f647")
+  , ("tophat", "\x1f3a9")
+  , ("crown", "\x1f451")
+  , ("womans_hat", "\x1f452")
+  , ("athletic_shoe", "\x1f45f")
+  , ("mans_shoe", "\x1f45e")
+  , ("shoe", "\x1f45e")
+  , ("sandal", "\x1f461")
+  , ("high_heel", "\x1f460")
+  , ("boot", "\x1f462")
+  , ("shirt", "\x1f455")
+  , ("tshirt", "\x1f455")
+  , ("necktie", "\x1f454")
+  , ("womans_clothes", "\x1f45a")
+  , ("dress", "\x1f457")
+  , ("running_shirt_with_sash", "\x1f3bd")
+  , ("jeans", "\x1f456")
+  , ("kimono", "\x1f458")
+  , ("bikini", "\x1f459")
+  , ("briefcase", "\x1f4bc")
+  , ("handbag", "\x1f45c")
+  , ("pouch", "\x1f45d")
+  , ("purse", "\x1f45b")
+  , ("eyeglasses", "\x1f453")
+  , ("ribbon", "\x1f380")
+  , ("closed_umbrella", "\x1f302")
+  , ("lipstick", "\x1f484")
+  , ("yellow_heart", "\x1f49b")
+  , ("blue_heart", "\x1f499")
+  , ("purple_heart", "\x1f49c")
+  , ("green_heart", "\x1f49a")
+  , ("heart", "\x2764\fe0f")
+  , ("broken_heart", "\x1f494")
+  , ("heartpulse", "\x1f497")
+  , ("heartbeat", "\x1f493")
+  , ("two_hearts", "\x1f495")
+  , ("sparkling_heart", "\x1f496")
+  , ("revolving_hearts", "\x1f49e")
+  , ("cupid", "\x1f498")
+  , ("love_letter", "\x1f48c")
+  , ("kiss", "\x1f48b")
+  , ("ring", "\x1f48d")
+  , ("gem", "\x1f48e")
+  , ("bust_in_silhouette", "\x1f464")
+  , ("busts_in_silhouette", "\x1f465")
+  , ("speech_balloon", "\x1f4ac")
+  , ("footprints", "\x1f463")
+  , ("thought_balloon", "\x1f4ad")
+  , ("dog", "\x1f436")
+  , ("wolf", "\x1f43a")
+  , ("cat", "\x1f431")
+  , ("mouse", "\x1f42d")
+  , ("hamster", "\x1f439")
+  , ("rabbit", "\x1f430")
+  , ("frog", "\x1f438")
+  , ("tiger", "\x1f42f")
+  , ("koala", "\x1f428")
+  , ("bear", "\x1f43b")
+  , ("pig", "\x1f437")
+  , ("pig_nose", "\x1f43d")
+  , ("cow", "\x1f42e")
+  , ("boar", "\x1f417")
+  , ("monkey_face", "\x1f435")
+  , ("monkey", "\x1f412")
+  , ("horse", "\x1f434")
+  , ("sheep", "\x1f411")
+  , ("elephant", "\x1f418")
+  , ("panda_face", "\x1f43c")
+  , ("penguin", "\x1f427")
+  , ("bird", "\x1f426")
+  , ("baby_chick", "\x1f424")
+  , ("hatched_chick", "\x1f425")
+  , ("hatching_chick", "\x1f423")
+  , ("chicken", "\x1f414")
+  , ("snake", "\x1f40d")
+  , ("turtle", "\x1f422")
+  , ("bug", "\x1f41b")
+  , ("bee", "\x1f41d")
+  , ("honeybee", "\x1f41d")
+  , ("ant", "\x1f41c")
+  , ("beetle", "\x1f41e")
+  , ("snail", "\x1f40c")
+  , ("octopus", "\x1f419")
+  , ("shell", "\x1f41a")
+  , ("tropical_fish", "\x1f420")
+  , ("fish", "\x1f41f")
+  , ("dolphin", "\x1f42c")
+  , ("flipper", "\x1f42c")
+  , ("whale", "\x1f433")
+  , ("whale2", "\x1f40b")
+  , ("cow2", "\x1f404")
+  , ("ram", "\x1f40f")
+  , ("rat", "\x1f400")
+  , ("water_buffalo", "\x1f403")
+  , ("tiger2", "\x1f405")
+  , ("rabbit2", "\x1f407")
+  , ("dragon", "\x1f409")
+  , ("racehorse", "\x1f40e")
+  , ("goat", "\x1f410")
+  , ("rooster", "\x1f413")
+  , ("dog2", "\x1f415")
+  , ("pig2", "\x1f416")
+  , ("mouse2", "\x1f401")
+  , ("ox", "\x1f402")
+  , ("dragon_face", "\x1f432")
+  , ("blowfish", "\x1f421")
+  , ("crocodile", "\x1f40a")
+  , ("camel", "\x1f42b")
+  , ("dromedary_camel", "\x1f42a")
+  , ("leopard", "\x1f406")
+  , ("cat2", "\x1f408")
+  , ("poodle", "\x1f429")
+  , ("feet", "\x1f43e")
+  , ("paw_prints", "\x1f43e")
+  , ("bouquet", "\x1f490")
+  , ("cherry_blossom", "\x1f338")
+  , ("tulip", "\x1f337")
+  , ("four_leaf_clover", "\x1f340")
+  , ("rose", "\x1f339")
+  , ("sunflower", "\x1f33b")
+  , ("hibiscus", "\x1f33a")
+  , ("maple_leaf", "\x1f341")
+  , ("leaves", "\x1f343")
+  , ("fallen_leaf", "\x1f342")
+  , ("herb", "\x1f33f")
+  , ("ear_of_rice", "\x1f33e")
+  , ("mushroom", "\x1f344")
+  , ("cactus", "\x1f335")
+  , ("palm_tree", "\x1f334")
+  , ("evergreen_tree", "\x1f332")
+  , ("deciduous_tree", "\x1f333")
+  , ("chestnut", "\x1f330")
+  , ("seedling", "\x1f331")
+  , ("blossom", "\x1f33c")
+  , ("globe_with_meridians", "\x1f310")
+  , ("sun_with_face", "\x1f31e")
+  , ("full_moon_with_face", "\x1f31d")
+  , ("new_moon_with_face", "\x1f31a")
+  , ("new_moon", "\x1f311")
+  , ("waxing_crescent_moon", "\x1f312")
+  , ("first_quarter_moon", "\x1f313")
+  , ("moon", "\x1f314")
+  , ("waxing_gibbous_moon", "\x1f314")
+  , ("full_moon", "\x1f315")
+  , ("waning_gibbous_moon", "\x1f316")
+  , ("last_quarter_moon", "\x1f317")
+  , ("waning_crescent_moon", "\x1f318")
+  , ("last_quarter_moon_with_face", "\x1f31c")
+  , ("first_quarter_moon_with_face", "\x1f31b")
+  , ("crescent_moon", "\x1f319")
+  , ("earth_africa", "\x1f30d")
+  , ("earth_americas", "\x1f30e")
+  , ("earth_asia", "\x1f30f")
+  , ("volcano", "\x1f30b")
+  , ("milky_way", "\x1f30c")
+  , ("stars", "\x1f320")
+  , ("star", "\x2b50")
+  , ("sunny", "\x2600\fe0f")
+  , ("partly_sunny", "\x26c5")
+  , ("cloud", "\x2601\fe0f")
+  , ("zap", "\x26a1")
+  , ("umbrella", "\x2614")
+  , ("snowflake", "\x2744\fe0f")
+  , ("snowman", "\x26c4")
+  , ("cyclone", "\x1f300")
+  , ("foggy", "\x1f301")
+  , ("rainbow", "\x1f308")
+  , ("ocean", "\x1f30a")
+  , ("bamboo", "\x1f38d")
+  , ("gift_heart", "\x1f49d")
+  , ("dolls", "\x1f38e")
+  , ("school_satchel", "\x1f392")
+  , ("mortar_board", "\x1f393")
+  , ("flags", "\x1f38f")
+  , ("fireworks", "\x1f386")
+  , ("sparkler", "\x1f387")
+  , ("wind_chime", "\x1f390")
+  , ("rice_scene", "\x1f391")
+  , ("jack_o_lantern", "\x1f383")
+  , ("ghost", "\x1f47b")
+  , ("santa", "\x1f385")
+  , ("christmas_tree", "\x1f384")
+  , ("gift", "\x1f381")
+  , ("tanabata_tree", "\x1f38b")
+  , ("tada", "\x1f389")
+  , ("confetti_ball", "\x1f38a")
+  , ("balloon", "\x1f388")
+  , ("crossed_flags", "\x1f38c")
+  , ("crystal_ball", "\x1f52e")
+  , ("movie_camera", "\x1f3a5")
+  , ("camera", "\x1f4f7")
+  , ("video_camera", "\x1f4f9")
+  , ("vhs", "\x1f4fc")
+  , ("cd", "\x1f4bf")
+  , ("dvd", "\x1f4c0")
+  , ("minidisc", "\x1f4bd")
+  , ("floppy_disk", "\x1f4be")
+  , ("computer", "\x1f4bb")
+  , ("iphone", "\x1f4f1")
+  , ("phone", "\x260e\fe0f")
+  , ("telephone", "\x260e\fe0f")
+  , ("telephone_receiver", "\x1f4de")
+  , ("pager", "\x1f4df")
+  , ("fax", "\x1f4e0")
+  , ("satellite", "\x1f4e1")
+  , ("tv", "\x1f4fa")
+  , ("radio", "\x1f4fb")
+  , ("loud_sound", "\x1f50a")
+  , ("sound", "\x1f509")
+  , ("speaker", "\x1f508")
+  , ("mute", "\x1f507")
+  , ("bell", "\x1f514")
+  , ("no_bell", "\x1f515")
+  , ("loudspeaker", "\x1f4e2")
+  , ("mega", "\x1f4e3")
+  , ("hourglass_flowing_sand", "\x23f3")
+  , ("hourglass", "\x231b")
+  , ("alarm_clock", "\x23f0")
+  , ("watch", "\x231a")
+  , ("unlock", "\x1f513")
+  , ("lock", "\x1f512")
+  , ("lock_with_ink_pen", "\x1f50f")
+  , ("closed_lock_with_key", "\x1f510")
+  , ("key", "\x1f511")
+  , ("mag_right", "\x1f50e")
+  , ("bulb", "\x1f4a1")
+  , ("flashlight", "\x1f526")
+  , ("high_brightness", "\x1f506")
+  , ("low_brightness", "\x1f505")
+  , ("electric_plug", "\x1f50c")
+  , ("battery", "\x1f50b")
+  , ("mag", "\x1f50d")
+  , ("bathtub", "\x1f6c1")
+  , ("bath", "\x1f6c0")
+  , ("shower", "\x1f6bf")
+  , ("toilet", "\x1f6bd")
+  , ("wrench", "\x1f527")
+  , ("nut_and_bolt", "\x1f529")
+  , ("hammer", "\x1f528")
+  , ("door", "\x1f6aa")
+  , ("smoking", "\x1f6ac")
+  , ("bomb", "\x1f4a3")
+  , ("gun", "\x1f52b")
+  , ("hocho", "\x1f52a")
+  , ("knife", "\x1f52a")
+  , ("pill", "\x1f48a")
+  , ("syringe", "\x1f489")
+  , ("moneybag", "\x1f4b0")
+  , ("yen", "\x1f4b4")
+  , ("dollar", "\x1f4b5")
+  , ("pound", "\x1f4b7")
+  , ("euro", "\x1f4b6")
+  , ("credit_card", "\x1f4b3")
+  , ("money_with_wings", "\x1f4b8")
+  , ("calling", "\x1f4f2")
+  , ("e-mail", "\x1f4e7")
+  , ("inbox_tray", "\x1f4e5")
+  , ("outbox_tray", "\x1f4e4")
+  , ("email", "\x2709\fe0f")
+  , ("envelope", "\x2709\fe0f")
+  , ("envelope_with_arrow", "\x1f4e9")
+  , ("incoming_envelope", "\x1f4e8")
+  , ("postal_horn", "\x1f4ef")
+  , ("mailbox", "\x1f4eb")
+  , ("mailbox_closed", "\x1f4ea")
+  , ("mailbox_with_mail", "\x1f4ec")
+  , ("mailbox_with_no_mail", "\x1f4ed")
+  , ("postbox", "\x1f4ee")
+  , ("package", "\x1f4e6")
+  , ("memo", "\x1f4dd")
+  , ("pencil", "\x1f4dd")
+  , ("page_facing_up", "\x1f4c4")
+  , ("page_with_curl", "\x1f4c3")
+  , ("bookmark_tabs", "\x1f4d1")
+  , ("bar_chart", "\x1f4ca")
+  , ("chart_with_upwards_trend", "\x1f4c8")
+  , ("chart_with_downwards_trend", "\x1f4c9")
+  , ("scroll", "\x1f4dc")
+  , ("clipboard", "\x1f4cb")
+  , ("date", "\x1f4c5")
+  , ("calendar", "\x1f4c6")
+  , ("card_index", "\x1f4c7")
+  , ("file_folder", "\x1f4c1")
+  , ("open_file_folder", "\x1f4c2")
+  , ("scissors", "\x2702\fe0f")
+  , ("pushpin", "\x1f4cc")
+  , ("paperclip", "\x1f4ce")
+  , ("black_nib", "\x2712\fe0f")
+  , ("pencil2", "\x270f\fe0f")
+  , ("straight_ruler", "\x1f4cf")
+  , ("triangular_ruler", "\x1f4d0")
+  , ("closed_book", "\x1f4d5")
+  , ("green_book", "\x1f4d7")
+  , ("blue_book", "\x1f4d8")
+  , ("orange_book", "\x1f4d9")
+  , ("notebook", "\x1f4d3")
+  , ("notebook_with_decorative_cover", "\x1f4d4")
+  , ("ledger", "\x1f4d2")
+  , ("books", "\x1f4da")
+  , ("book", "\x1f4d6")
+  , ("open_book", "\x1f4d6")
+  , ("bookmark", "\x1f516")
+  , ("name_badge", "\x1f4db")
+  , ("microscope", "\x1f52c")
+  , ("telescope", "\x1f52d")
+  , ("newspaper", "\x1f4f0")
+  , ("art", "\x1f3a8")
+  , ("clapper", "\x1f3ac")
+  , ("microphone", "\x1f3a4")
+  , ("headphones", "\x1f3a7")
+  , ("musical_score", "\x1f3bc")
+  , ("musical_note", "\x1f3b5")
+  , ("notes", "\x1f3b6")
+  , ("musical_keyboard", "\x1f3b9")
+  , ("violin", "\x1f3bb")
+  , ("trumpet", "\x1f3ba")
+  , ("saxophone", "\x1f3b7")
+  , ("guitar", "\x1f3b8")
+  , ("space_invader", "\x1f47e")
+  , ("video_game", "\x1f3ae")
+  , ("black_joker", "\x1f0cf")
+  , ("flower_playing_cards", "\x1f3b4")
+  , ("mahjong", "\x1f004")
+  , ("game_die", "\x1f3b2")
+  , ("dart", "\x1f3af")
+  , ("football", "\x1f3c8")
+  , ("basketball", "\x1f3c0")
+  , ("soccer", "\x26bd")
+  , ("baseball", "\x26be\fe0f")
+  , ("tennis", "\x1f3be")
+  , ("8ball", "\x1f3b1")
+  , ("rugby_football", "\x1f3c9")
+  , ("bowling", "\x1f3b3")
+  , ("golf", "\x26f3")
+  , ("mountain_bicyclist", "\x1f6b5")
+  , ("bicyclist", "\x1f6b4")
+  , ("checkered_flag", "\x1f3c1")
+  , ("horse_racing", "\x1f3c7")
+  , ("trophy", "\x1f3c6")
+  , ("ski", "\x1f3bf")
+  , ("snowboarder", "\x1f3c2")
+  , ("swimmer", "\x1f3ca")
+  , ("surfer", "\x1f3c4")
+  , ("fishing_pole_and_fish", "\x1f3a3")
+  , ("coffee", "\x2615")
+  , ("tea", "\x1f375")
+  , ("sake", "\x1f376")
+  , ("baby_bottle", "\x1f37c")
+  , ("beer", "\x1f37a")
+  , ("beers", "\x1f37b")
+  , ("cocktail", "\x1f378")
+  , ("tropical_drink", "\x1f379")
+  , ("wine_glass", "\x1f377")
+  , ("fork_and_knife", "\x1f374")
+  , ("pizza", "\x1f355")
+  , ("hamburger", "\x1f354")
+  , ("fries", "\x1f35f")
+  , ("poultry_leg", "\x1f357")
+  , ("meat_on_bone", "\x1f356")
+  , ("spaghetti", "\x1f35d")
+  , ("curry", "\x1f35b")
+  , ("fried_shrimp", "\x1f364")
+  , ("bento", "\x1f371")
+  , ("sushi", "\x1f363")
+  , ("fish_cake", "\x1f365")
+  , ("rice_ball", "\x1f359")
+  , ("rice_cracker", "\x1f358")
+  , ("rice", "\x1f35a")
+  , ("ramen", "\x1f35c")
+  , ("stew", "\x1f372")
+  , ("oden", "\x1f362")
+  , ("dango", "\x1f361")
+  , ("egg", "\x1f373")
+  , ("bread", "\x1f35e")
+  , ("doughnut", "\x1f369")
+  , ("custard", "\x1f36e")
+  , ("icecream", "\x1f366")
+  , ("ice_cream", "\x1f368")
+  , ("shaved_ice", "\x1f367")
+  , ("birthday", "\x1f382")
+  , ("cake", "\x1f370")
+  , ("cookie", "\x1f36a")
+  , ("chocolate_bar", "\x1f36b")
+  , ("candy", "\x1f36c")
+  , ("lollipop", "\x1f36d")
+  , ("honey_pot", "\x1f36f")
+  , ("apple", "\x1f34e")
+  , ("green_apple", "\x1f34f")
+  , ("tangerine", "\x1f34a")
+  , ("lemon", "\x1f34b")
+  , ("cherries", "\x1f352")
+  , ("grapes", "\x1f347")
+  , ("watermelon", "\x1f349")
+  , ("strawberry", "\x1f353")
+  , ("peach", "\x1f351")
+  , ("melon", "\x1f348")
+  , ("banana", "\x1f34c")
+  , ("pear", "\x1f350")
+  , ("pineapple", "\x1f34d")
+  , ("sweet_potato", "\x1f360")
+  , ("eggplant", "\x1f346")
+  , ("tomato", "\x1f345")
+  , ("corn", "\x1f33d")
+  , ("house", "\x1f3e0")
+  , ("house_with_garden", "\x1f3e1")
+  , ("school", "\x1f3eb")
+  , ("office", "\x1f3e2")
+  , ("post_office", "\x1f3e3")
+  , ("hospital", "\x1f3e5")
+  , ("bank", "\x1f3e6")
+  , ("convenience_store", "\x1f3ea")
+  , ("love_hotel", "\x1f3e9")
+  , ("hotel", "\x1f3e8")
+  , ("wedding", "\x1f492")
+  , ("church", "\x26ea")
+  , ("department_store", "\x1f3ec")
+  , ("european_post_office", "\x1f3e4")
+  , ("city_sunrise", "\x1f307")
+  , ("city_sunset", "\x1f306")
+  , ("japanese_castle", "\x1f3ef")
+  , ("european_castle", "\x1f3f0")
+  , ("tent", "\x26fa")
+  , ("factory", "\x1f3ed")
+  , ("tokyo_tower", "\x1f5fc")
+  , ("japan", "\x1f5fe")
+  , ("mount_fuji", "\x1f5fb")
+  , ("sunrise_over_mountains", "\x1f304")
+  , ("sunrise", "\x1f305")
+  , ("night_with_stars", "\x1f303")
+  , ("statue_of_liberty", "\x1f5fd")
+  , ("bridge_at_night", "\x1f309")
+  , ("carousel_horse", "\x1f3a0")
+  , ("ferris_wheel", "\x1f3a1")
+  , ("fountain", "\x26f2")
+  , ("roller_coaster", "\x1f3a2")
+  , ("ship", "\x1f6a2")
+  , ("boat", "\x26f5")
+  , ("sailboat", "\x26f5")
+  , ("speedboat", "\x1f6a4")
+  , ("rowboat", "\x1f6a3")
+  , ("anchor", "\x2693")
+  , ("rocket", "\x1f680")
+  , ("airplane", "\x2708\fe0f")
+  , ("seat", "\x1f4ba")
+  , ("helicopter", "\x1f681")
+  , ("steam_locomotive", "\x1f682")
+  , ("tram", "\x1f68a")
+  , ("station", "\x1f689")
+  , ("mountain_railway", "\x1f69e")
+  , ("train2", "\x1f686")
+  , ("bullettrain_side", "\x1f684")
+  , ("bullettrain_front", "\x1f685")
+  , ("light_rail", "\x1f688")
+  , ("metro", "\x1f687")
+  , ("monorail", "\x1f69d")
+  , ("train", "\x1f68b")
+  , ("railway_car", "\x1f683")
+  , ("trolleybus", "\x1f68e")
+  , ("bus", "\x1f68c")
+  , ("oncoming_bus", "\x1f68d")
+  , ("blue_car", "\x1f699")
+  , ("oncoming_automobile", "\x1f698")
+  , ("car", "\x1f697")
+  , ("red_car", "\x1f697")
+  , ("taxi", "\x1f695")
+  , ("oncoming_taxi", "\x1f696")
+  , ("articulated_lorry", "\x1f69b")
+  , ("truck", "\x1f69a")
+  , ("rotating_light", "\x1f6a8")
+  , ("police_car", "\x1f693")
+  , ("oncoming_police_car", "\x1f694")
+  , ("fire_engine", "\x1f692")
+  , ("ambulance", "\x1f691")
+  , ("minibus", "\x1f690")
+  , ("bike", "\x1f6b2")
+  , ("aerial_tramway", "\x1f6a1")
+  , ("suspension_railway", "\x1f69f")
+  , ("mountain_cableway", "\x1f6a0")
+  , ("tractor", "\x1f69c")
+  , ("barber", "\x1f488")
+  , ("busstop", "\x1f68f")
+  , ("ticket", "\x1f3ab")
+  , ("vertical_traffic_light", "\x1f6a6")
+  , ("traffic_light", "\x1f6a5")
+  , ("warning", "\x26a0\fe0f")
+  , ("construction", "\x1f6a7")
+  , ("beginner", "\x1f530")
+  , ("fuelpump", "\x26fd")
+  , ("izakaya_lantern", "\x1f3ee")
+  , ("lantern", "\x1f3ee")
+  , ("slot_machine", "\x1f3b0")
+  , ("hotsprings", "\x2668\fe0f")
+  , ("moyai", "\x1f5ff")
+  , ("circus_tent", "\x1f3aa")
+  , ("performing_arts", "\x1f3ad")
+  , ("round_pushpin", "\x1f4cd")
+  , ("triangular_flag_on_post", "\x1f6a9")
+  , ("jp", "\x1f1ef\1f1f5")
+  , ("kr", "\x1f1f0\1f1f7")
+  , ("de", "\x1f1e9\1f1ea")
+  , ("cn", "\x1f1e8\1f1f3")
+  , ("us", "\x1f1fa\1f1f8")
+  , ("fr", "\x1f1eb\1f1f7")
+  , ("es", "\x1f1ea\1f1f8")
+  , ("it", "\x1f1ee\1f1f9")
+  , ("ru", "\x1f1f7\1f1fa")
+  , ("gb", "\x1f1ec\1f1e7")
+  , ("uk", "\x1f1ec\1f1e7")
+  , ("one", "1\fe0f\20e3")
+  , ("two", "2\fe0f\20e3")
+  , ("three", "3\fe0f\20e3")
+  , ("four", "4\fe0f\20e3")
+  , ("five", "5\fe0f\20e3")
+  , ("six", "6\fe0f\20e3")
+  , ("seven", "7\fe0f\20e3")
+  , ("eight", "8\fe0f\20e3")
+  , ("nine", "9\fe0f\20e3")
+  , ("zero", "0\fe0f\20e3")
+  , ("keycap_ten", "\x1f51f")
+  , ("hash", "#\fe0f\20e3")
+  , ("symbols", "\x1f523")
+  , ("arrow_up", "\x2b06\fe0f")
+  , ("arrow_down", "\x2b07\fe0f")
+  , ("arrow_left", "\x2b05\fe0f")
+  , ("arrow_right", "\x27a1\fe0f")
+  , ("capital_abcd", "\x1f520")
+  , ("abcd", "\x1f521")
+  , ("abc", "\x1f524")
+  , ("arrow_upper_right", "\x2197\fe0f")
+  , ("arrow_upper_left", "\x2196\fe0f")
+  , ("arrow_lower_right", "\x2198\fe0f")
+  , ("arrow_lower_left", "\x2199\fe0f")
+  , ("left_right_arrow", "\x2194\fe0f")
+  , ("arrow_up_down", "\x2195\fe0f")
+  , ("arrows_counterclockwise", "\x1f504")
+  , ("arrow_backward", "\x25c0\fe0f")
+  , ("arrow_forward", "\x25b6\fe0f")
+  , ("arrow_up_small", "\x1f53c")
+  , ("arrow_down_small", "\x1f53d")
+  , ("leftwards_arrow_with_hook", "\x21a9\fe0f")
+  , ("arrow_right_hook", "\x21aa\fe0f")
+  , ("information_source", "\x2139\fe0f")
+  , ("rewind", "\x23ea")
+  , ("fast_forward", "\x23e9")
+  , ("arrow_double_up", "\x23eb")
+  , ("arrow_double_down", "\x23ec")
+  , ("arrow_heading_down", "\x2935\fe0f")
+  , ("arrow_heading_up", "\x2934\fe0f")
+  , ("ok", "\x1f197")
+  , ("twisted_rightwards_arrows", "\x1f500")
+  , ("repeat", "\x1f501")
+  , ("repeat_one", "\x1f502")
+  , ("new", "\x1f195")
+  , ("up", "\x1f199")
+  , ("cool", "\x1f192")
+  , ("free", "\x1f193")
+  , ("ng", "\x1f196")
+  , ("signal_strength", "\x1f4f6")
+  , ("cinema", "\x1f3a6")
+  , ("koko", "\x1f201")
+  , ("u6307", "\x1f22f")
+  , ("u7a7a", "\x1f233")
+  , ("u6e80", "\x1f235")
+  , ("u5408", "\x1f234")
+  , ("u7981", "\x1f232")
+  , ("ideograph_advantage", "\x1f250")
+  , ("u5272", "\x1f239")
+  , ("u55b6", "\x1f23a")
+  , ("u6709", "\x1f236")
+  , ("u7121", "\x1f21a")
+  , ("restroom", "\x1f6bb")
+  , ("mens", "\x1f6b9")
+  , ("womens", "\x1f6ba")
+  , ("baby_symbol", "\x1f6bc")
+  , ("wc", "\x1f6be")
+  , ("potable_water", "\x1f6b0")
+  , ("put_litter_in_its_place", "\x1f6ae")
+  , ("parking", "\x1f17f\fe0f")
+  , ("wheelchair", "\x267f")
+  , ("no_smoking", "\x1f6ad")
+  , ("u6708", "\x1f237\fe0f")
+  , ("u7533", "\x1f238")
+  , ("sa", "\x1f202\fe0f")
+  , ("m", "\x24c2\fe0f")
+  , ("passport_control", "\x1f6c2")
+  , ("baggage_claim", "\x1f6c4")
+  , ("left_luggage", "\x1f6c5")
+  , ("customs", "\x1f6c3")
+  , ("accept", "\x1f251")
+  , ("secret", "\x3299\fe0f")
+  , ("congratulations", "\x3297\fe0f")
+  , ("cl", "\x1f191")
+  , ("sos", "\x1f198")
+  , ("id", "\x1f194")
+  , ("no_entry_sign", "\x1f6ab")
+  , ("underage", "\x1f51e")
+  , ("no_mobile_phones", "\x1f4f5")
+  , ("do_not_litter", "\x1f6af")
+  , ("non-potable_water", "\x1f6b1")
+  , ("no_bicycles", "\x1f6b3")
+  , ("no_pedestrians", "\x1f6b7")
+  , ("children_crossing", "\x1f6b8")
+  , ("no_entry", "\x26d4")
+  , ("eight_spoked_asterisk", "\x2733\fe0f")
+  , ("sparkle", "\x2747\fe0f")
+  , ("negative_squared_cross_mark", "\x274e")
+  , ("white_check_mark", "\x2705")
+  , ("eight_pointed_black_star", "\x2734\fe0f")
+  , ("heart_decoration", "\x1f49f")
+  , ("vs", "\x1f19a")
+  , ("vibration_mode", "\x1f4f3")
+  , ("mobile_phone_off", "\x1f4f4")
+  , ("a", "\x1f170\fe0f")
+  , ("b", "\x1f171\fe0f")
+  , ("ab", "\x1f18e")
+  , ("o2", "\x1f17e\fe0f")
+  , ("diamond_shape_with_a_dot_inside", "\x1f4a0")
+  , ("loop", "\x27bf")
+  , ("recycle", "\x267b\fe0f")
+  , ("aries", "\x2648")
+  , ("taurus", "\x2649")
+  , ("gemini", "\x264a")
+  , ("cancer", "\x264b")
+  , ("leo", "\x264c")
+  , ("virgo", "\x264d")
+  , ("libra", "\x264e")
+  , ("scorpius", "\x264f")
+  , ("sagittarius", "\x2650")
+  , ("capricorn", "\x2651")
+  , ("aquarius", "\x2652")
+  , ("pisces", "\x2653")
+  , ("ophiuchus", "\x26ce")
+  , ("six_pointed_star", "\x1f52f")
+  , ("atm", "\x1f3e7")
+  , ("chart", "\x1f4b9")
+  , ("heavy_dollar_sign", "\x1f4b2")
+  , ("currency_exchange", "\x1f4b1")
+  , ("copyright", "©\fe0f")
+  , ("registered", "®\fe0f")
+  , ("tm", "\x2122\fe0f")
+  , ("x", "\x274c")
+  , ("bangbang", "\x203c\fe0f")
+  , ("interrobang", "\x2049\fe0f")
+  , ("exclamation", "\x2757")
+  , ("heavy_exclamation_mark", "\x2757")
+  , ("question", "\x2753")
+  , ("grey_exclamation", "\x2755")
+  , ("grey_question", "\x2754")
+  , ("o", "\x2b55")
+  , ("top", "\x1f51d")
+  , ("end", "\x1f51a")
+  , ("back", "\x1f519")
+  , ("on", "\x1f51b")
+  , ("soon", "\x1f51c")
+  , ("arrows_clockwise", "\x1f503")
+  , ("clock12", "\x1f55b")
+  , ("clock1230", "\x1f567")
+  , ("clock1", "\x1f550")
+  , ("clock130", "\x1f55c")
+  , ("clock2", "\x1f551")
+  , ("clock230", "\x1f55d")
+  , ("clock3", "\x1f552")
+  , ("clock330", "\x1f55e")
+  , ("clock4", "\x1f553")
+  , ("clock430", "\x1f55f")
+  , ("clock5", "\x1f554")
+  , ("clock530", "\x1f560")
+  , ("clock6", "\x1f555")
+  , ("clock7", "\x1f556")
+  , ("clock8", "\x1f557")
+  , ("clock9", "\x1f558")
+  , ("clock10", "\x1f559")
+  , ("clock11", "\x1f55a")
+  , ("clock630", "\x1f561")
+  , ("clock730", "\x1f562")
+  , ("clock830", "\x1f563")
+  , ("clock930", "\x1f564")
+  , ("clock1030", "\x1f565")
+  , ("clock1130", "\x1f566")
+  , ("heavy_multiplication_x", "\x2716\fe0f")
+  , ("heavy_plus_sign", "\x2795")
+  , ("heavy_minus_sign", "\x2796")
+  , ("heavy_division_sign", "\x2797")
+  , ("spades", "\x2660\fe0f")
+  , ("hearts", "\x2665\fe0f")
+  , ("clubs", "\x2663\fe0f")
+  , ("diamonds", "\x2666\fe0f")
+  , ("white_flower", "\x1f4ae")
+  , ("heavy_check_mark", "\x2714\fe0f")
+  , ("ballot_box_with_check", "\x2611\fe0f")
+  , ("radio_button", "\x1f518")
+  , ("link", "\x1f517")
+  , ("curly_loop", "\x27b0")
+  , ("wavy_dash", "\x3030\fe0f")
+  , ("part_alternation_mark", "\x303d\fe0f")
+  , ("trident", "\x1f531")
+  , ("black_medium_square", "\x25fc\fe0f")
+  , ("white_medium_square", "\x25fb\fe0f")
+  , ("black_medium_small_square", "\x25fe")
+  , ("white_medium_small_square", "\x25fd")
+  , ("black_small_square", "\x25aa\fe0f")
+  , ("white_small_square", "\x25ab\fe0f")
+  , ("small_red_triangle", "\x1f53a")
+  , ("black_square_button", "\x1f532")
+  , ("white_square_button", "\x1f533")
+  , ("black_circle", "\x26ab")
+  , ("white_circle", "\x26aa")
+  , ("red_circle", "\x1f534")
+  , ("large_blue_circle", "\x1f535")
+  , ("small_red_triangle_down", "\x1f53b")
+  , ("white_large_square", "\x2b1c")
+  , ("black_large_square", "\x2b1b")
+  , ("large_orange_diamond", "\x1f536")
+  , ("large_blue_diamond", "\x1f537")
+  , ("small_orange_diamond", "\x1f538")
+  , ("small_blue_diamond", "\x1f539")
+  ]
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
 {-
 Copyright (C) 2012-2015 John MacFarlane <jgm@berkeley.edu>
 
@@ -54,6 +54,7 @@
 import Text.Pandoc.MediaBag (MediaBag)
 import Data.Data (Data)
 import Data.Typeable (Typeable)
+import GHC.Generics (Generic)
 
 -- | Individually selectable syntax extensions.
 data Extension =
@@ -105,6 +106,7 @@
     | Ext_ignore_line_breaks  -- ^ Newlines in paragraphs are ignored
     | 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 +115,7 @@
     | 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
@@ -203,6 +205,7 @@
   , Ext_intraword_underscores
   , Ext_strikeout
   , Ext_hard_line_breaks
+  , Ext_emoji
   , Ext_lists_without_preceding_blankline
   , Ext_shortcut_reference_links
   ]
@@ -256,7 +259,7 @@
        , readerDefaultImageExtension :: String -- ^ Default extension for images
        , readerTrace           :: Bool -- ^ Print debugging info
        , readerTrackChanges    :: TrackChanges
-} deriving (Show, Read, Data, Typeable)
+} deriving (Show, Read, Data, Typeable, Generic)
 
 instance Default ReaderOptions
   where def = ReaderOptions{
@@ -278,7 +281,7 @@
 -- 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 +291,18 @@
                     | 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 +311,13 @@
                       | 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 writers
 data WriterOptions = WriterOptions
@@ -361,7 +364,7 @@
   , 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
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -34,6 +34,7 @@
 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)
@@ -47,7 +48,7 @@
 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.Shared (fetchItem', warn, withTempDir, inDirectory)
 import Text.Pandoc.Options (WriterOptions(..))
 import Text.Pandoc.MIME (extensionFromMimeType, getMimeType)
 import Text.Pandoc.Process (pipeProcess)
@@ -71,7 +72,9 @@
   doc' <- handleImages opts tmpdir doc
   let source = writer opts doc'
       args   = writerLaTeXArgs opts
-  tex2pdf' (writerVerbose opts) args tmpdir program source
+  case program of
+     "context" -> context2pdf (writerVerbose opts) tmpdir source
+     _ -> tex2pdf' (writerVerbose opts) args tmpdir program source
 
 handleImages :: WriterOptions
              -> FilePath      -- ^ temp dir to store images
@@ -166,6 +169,14 @@
      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,
@@ -224,3 +235,55 @@
                    else return Nothing
          return (exit, out <> err, 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
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -185,6 +185,7 @@
                                         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
@@ -1210,7 +1211,8 @@
   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 ":.#$%&-+?<>~/") <|>
+                 (oneOf ":/" <* lookAhead (char '/'))
   let key = firstChar:rest
   return (suppress_author, key)
 
diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs
--- a/src/Text/Pandoc/Pretty.hs
+++ b/src/Text/Pandoc/Pretty.hs
@@ -80,6 +80,7 @@
 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
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -75,6 +75,7 @@
                            , envFont          :: Maybe Font
                            , envCharStyles    :: CharStyleMap
                            , envParStyles     :: ParStyleMap
+                           , envLocation      :: DocumentLocation
                            }
                deriving Show
 
@@ -87,7 +88,7 @@
 type D = ExceptT DocxError (Reader ReaderEnv)
 
 runD :: D a -> ReaderEnv -> Either DocxError a
-runD dx re = runReader (runExceptT dx ) re
+runD dx re = runReader (runExceptT dx) re
 
 maybeToD :: Maybe a -> D a
 maybeToD (Just a) = return a
@@ -140,7 +141,13 @@
 -- (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 RelationshipType = DocumentRel | FootnoteRel | EndnoteRel
+--                       deriving Show
+
+data Relationship = Relationship DocumentLocation RelId Target
                   deriving Show
 
 data Notes = Notes NameSpaces
@@ -255,7 +262,8 @@
       rels      = archiveToRelationships archive
       media     = archiveToMedia archive
       (styles, parstyles) = archiveToStyles archive
-      rEnv = ReaderEnv notes numbering rels media Nothing styles parstyles
+      rEnv =
+        ReaderEnv notes numbering rels media Nothing styles parstyles InDocument
   doc <- runD (archiveToDocument archive) rEnv
   return $ Docx doc
 
@@ -362,29 +370,30 @@
   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 =
@@ -596,13 +605,16 @@
     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)
@@ -657,9 +669,10 @@
 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
@@ -699,7 +712,7 @@
   , Just fnId <- findAttr (elemName ns "w" "id") ref = 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
@@ -708,7 +721,7 @@
   , Just enId <- findAttr (elemName ns "w" "id") ref = 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 []
 elemToRun ns element
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs
--- a/src/Text/Pandoc/Readers/EPUB.hs
+++ b/src/Text/Pandoc/Readers/EPUB.hs
@@ -16,6 +16,7 @@
 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
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -66,7 +66,7 @@
 import Network.URI (isURI)
 import Text.Pandoc.Error
 import Text.Pandoc.CSS (foldOrElse, pickStyleAttrProps)
-
+import Text.Pandoc.Compat.Monoid ((<>))
 import Text.Parsec.Error
 
 
@@ -948,6 +948,7 @@
                        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
--- a/src/Text/Pandoc/Readers/Haddock.hs
+++ b/src/Text/Pandoc/Readers/Haddock.hs
@@ -16,6 +16,7 @@
 
 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
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -886,7 +886,7 @@
              string "\\begin"
              name <- braced'
              guard $ name `elem` ["verbatim", "Verbatim", "lstlisting",
-                                  "minted", "alltt"]
+                                  "minted", "alltt", "comment"]
              manyTill anyChar (try $ string $ "\\end{" ++ name ++ "}")
 
 blob' :: IncludeParser
@@ -1039,6 +1039,7 @@
   , ("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
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -39,6 +39,7 @@
 import Data.Char ( isSpace, isAlphaNum, toLower )
 import Data.Maybe
 import Text.Pandoc.Definition
+import Text.Pandoc.Emoji (emojis)
 import qualified Data.Text as T
 import Data.Text (Text)
 import qualified Data.Yaml as Yaml
@@ -62,6 +63,7 @@
 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 +328,22 @@
 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
@@ -1321,7 +1322,7 @@
 gridTableFooter :: MarkdownParser [Char]
 gridTableFooter = blanklines
 
-pipeBreak :: MarkdownParser [Alignment]
+pipeBreak :: MarkdownParser ([Alignment], [Int])
 pipeBreak = try $ do
   nonindentSpaces
   openPipe <- (True <$ char '|') <|> return False
@@ -1331,16 +1332,22 @@
   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
+  (lines', rawRows) <- unzip <$> many (withRaw pipeTableRow)
+  let maxlength = maximum $ map length rawRows
+  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
@@ -1369,19 +1376,20 @@
                  ils' | B.isNull ils' -> mempty
                       | otherwise   -> B.plain $ ils') cells'
 
-pipeTableHeaderPart :: Parser [Char] st Alignment
+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 ()
@@ -1460,6 +1468,7 @@
                 , exampleRef
                 , smart
                 , return . B.singleton <$> charRef
+                , emoji
                 , symbol
                 , ltSign
                 ] <?> "inline"
@@ -1890,6 +1899,21 @@
                                          not (isCloseBlockTag x))
                              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
 
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -39,6 +39,7 @@
 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 )
diff --git a/src/Text/Pandoc/Readers/Odt/Arrows/State.hs b/src/Text/Pandoc/Readers/Odt/Arrows/State.hs
--- a/src/Text/Pandoc/Readers/Odt/Arrows/State.hs
+++ b/src/Text/Pandoc/Readers/Odt/Arrows/State.hs
@@ -46,6 +46,7 @@
 
 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
--- a/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs
+++ b/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs
@@ -46,7 +46,7 @@
 
 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 = 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 @@
 
 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 >>> 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
--- a/src/Text/Pandoc/Readers/Odt/ContentReader.hs
+++ b/src/Text/Pandoc/Readers/Odt/ContentReader.hs
@@ -145,7 +145,7 @@
 fromStyles :: (a -> Styles -> b) -> OdtReaderSafe a b
 fromStyles f =     keepingTheValue
                      (getExtraState >>^ styleSet)
-               >>§ f
+               >>% f
 
 --
 getStyleByName :: OdtReader StyleName Style
@@ -162,7 +162,7 @@
 --
 switchCurrentListStyle :: OdtReaderSafe (Maybe ListStyle) (Maybe ListStyle)
 switchCurrentListStyle =     keepingTheValue getExtraState
-                         >>§ swapCurrentListStyle
+                         >>% swapCurrentListStyle
                          >>> first setExtraState
                          >>^ snd
 
@@ -170,7 +170,7 @@
 pushStyle :: OdtReaderSafe Style Style
 pushStyle =     keepingTheValue (
                   (     keepingTheValue getExtraState
-                    >>§ pushStyle'
+                    >>% pushStyle'
                   )
                   >>> setExtraState
                 )
@@ -470,7 +470,7 @@
 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 +497,14 @@
 --
 -- | 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
--- a/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs
+++ b/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs
@@ -41,7 +41,7 @@
 
 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
--- a/src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs
+++ b/src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs
@@ -331,7 +331,7 @@
   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 @@
                          -> 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 @@
                                 (XML.qName >>^ (&&).(== name) )
                                   ^&&&^
                                 (XML.qIRI  >>^ (==) )
-                              ) >>§ (.)
-                            ) &&& lookupNSiri nsID >>§ ($)
+                              ) >>% (.)
+                            ) &&& lookupNSiri nsID >>% ($)
 -}
 
 --
@@ -487,7 +487,7 @@
                          -> 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 @@
                         -> 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 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 @@
                         -> 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 @@
                        -> 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 @@
                                               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 @@
                                               >>^ 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
--- a/src/Text/Pandoc/Readers/Odt/Namespaces.hs
+++ b/src/Text/Pandoc/Readers/Odt/Namespaces.hs
diff --git a/src/Text/Pandoc/Readers/Odt/StyleReader.hs b/src/Text/Pandoc/Readers/Odt/StyleReader.hs
--- a/src/Text/Pandoc/Readers/Odt/StyleReader.hs
+++ b/src/Text/Pandoc/Readers/Odt/StyleReader.hs
@@ -174,7 +174,7 @@
 findPitch =     ( lookupAttr NsStyle "font-pitch"
                   `ifFailedDo`     findAttr NsStyle "font-name"
                                >>? (     keepingTheValue getExtraState
-                                     >>§ M.lookup
+                                     >>% M.lookup
                                      >>^ maybeToChoice
                                    )
                 )
@@ -447,7 +447,7 @@
 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
--- 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-2015 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 @@
 
 {- |
    Module      : Text.Pandoc.Readers.Org
-   Copyright   : Copyright (C) 2014 Albert Krewinkel
+   Copyright   : Copyright (C) 2014-2015 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           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
@@ -140,6 +141,7 @@
                       , orgStateMeta                 :: Meta
                       , orgStateMeta'                :: F Meta
                       , orgStateNotes'               :: OrgNoteTable
+                      , orgStateParserContext        :: ParserContext
                       , orgStateIdentifiers          :: [String]
                       , orgStateHeaderMap            :: M.Map Inlines String
                       }
@@ -181,6 +183,7 @@
                         , orgStateMeta = nullMeta
                         , orgStateMeta' = return nullMeta
                         , orgStateNotes' = []
+                        , orgStateParserContext = NullState
                         , orgStateIdentifiers = []
                         , orgStateHeaderMap = M.empty
                         }
@@ -291,6 +294,23 @@
        <* 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 +533,16 @@
 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 +551,17 @@
 
 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 "-_"
@@ -699,7 +731,7 @@
 
 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 +923,13 @@
 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 +994,22 @@
                    -> 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)
@@ -1549,8 +1588,11 @@
 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 +1600,10 @@
 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 +1611,7 @@
 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
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -48,7 +48,7 @@
 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.
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -64,6 +64,7 @@
 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 +80,12 @@
 -- | 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
diff --git a/src/Text/Pandoc/Readers/Txt2Tags.hs b/src/Text/Pandoc/Readers/Txt2Tags.hs
--- a/src/Text/Pandoc/Readers/Txt2Tags.hs
+++ b/src/Text/Pandoc/Readers/Txt2Tags.hs
@@ -34,6 +34,7 @@
 
 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)
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -135,7 +135,7 @@
       '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
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -129,6 +129,7 @@
 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)
@@ -913,9 +914,9 @@
 -- | 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/Templates.hs b/src/Text/Pandoc/Templates.hs
--- a/src/Text/Pandoc/Templates.hs
+++ b/src/Text/Pandoc/Templates.hs
@@ -98,6 +98,7 @@
 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/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -157,17 +157,21 @@
 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
@@ -346,11 +350,15 @@
               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
@@ -376,6 +384,9 @@
                else if level' == 0
                        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
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -60,6 +60,7 @@
 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 ((<|>))
@@ -1069,8 +1070,8 @@
                    [ 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
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -816,7 +816,8 @@
              -> 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
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -31,6 +31,7 @@
 -}
 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
@@ -593,8 +594,15 @@
                 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]
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -39,9 +39,9 @@
 import Text.Printf ( printf )
 import Network.URI ( isURI, unEscapeString )
 import Data.Aeson (object, (.=))
-import Data.List ( (\\), isInfixOf, stripPrefix, intercalate, intersperse )
+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 )
 import qualified Data.Text as T
 import Control.Applicative ((<|>))
 import Control.Monad.State
@@ -145,6 +145,8 @@
   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 context  =  defField "toc" (writerTableOfContents options) $
                   defField "toc-depth" (show (writerTOCDepth options -
                                               if stBook st
@@ -179,18 +181,50 @@
                          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") $
                   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)
@@ -338,29 +372,48 @@
   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
   inNote <- gets stInNote
+  modify $ \st -> st{ stInMinipage = True, stNotes = [] }
   capt <- inlineListToLaTeX txt
+  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 txt (src,tit))
+  let footnotes = notesToLaTeX notes
   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}"
+                    ("\\caption" <> captForLof <> braces capt) $$
+                    "\\end{figure}" $$
+                    footnotes
 -- . . . indicates pause in beamer slides
 blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do
   beamer <- writerBeamer `fmap` gets stOptions
@@ -389,7 +442,7 @@
   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 }
@@ -602,19 +655,21 @@
   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
@@ -629,19 +684,12 @@
 defListItemToLaTeX :: ([Inline], [[Block]]) -> State WriterState Doc
 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 term'' = if any isInternalLink term
-                    then braces term'
-                    else term'
     def'  <- liftM vsep $ mapM blockListToLaTeX defs
     return $ case defs of
      (((Header _ _ _) : _) : _) ->
-       "\\item" <> brackets term'' <> " ~ " $$ def'
+       "\\item" <> brackets term' <> " ~ " $$ def'
      _                          ->
-       "\\item" <> brackets term'' $$ def'
+       "\\item" <> brackets term' $$ def'
 
 -- | Craft the section header, inserting the secton reference, if supplied.
 sectionHeader :: Bool    -- True for unnumbered
@@ -676,8 +724,7 @@
   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
+                       then text "\\hypertarget"
                                 <> braces lab
                                 <> braces x
                        else x)
@@ -751,17 +798,20 @@
   ref <- toLabel id'
   let linkAnchor = if null id'
                       then empty
-                      else "\\protect\\hyperdef{}" <> braces (text ref) <>
-                             braces ("\\label" <> braces (text ref))
+                      else "\\protect\\hypertarget" <> braces (text ref) <>
+                             braces empty
   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
+     (case lookup "lang" kvs of
+        Just lng -> let (l, o) = toPolyglossia $ splitBy (=='-') lng
+                        ops = if null o then "" else brackets (text o)
+                    in  \c -> char '\\' <> "text" <> text l <> ops <> braces c
+        Nothing  -> id)
+    ) `fmap` inlineListToLaTeX ils
 inlineToLaTeX (Emph lst) =
   inlineListToLaTeX lst >>= return . inCmd "emph"
 inlineToLaTeX (Strong lst) =
@@ -846,7 +896,7 @@
 inlineToLaTeX (Link txt ('#':ident, _)) = do
   contents <- inlineListToLaTeX txt
   lab <- toLabel ident
-  return $ text "\\hyperref" <> brackets (text lab) <> braces contents
+  return $ text "\\protect\\hyperlink" <> braces (text lab) <> braces contents
 inlineToLaTeX (Link txt (src, _)) =
   case txt of
         [Str x] | escapeURI x == src ->  -- autolink
@@ -1002,6 +1052,30 @@
 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 +1093,11 @@
 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 +1119,7 @@
 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"
@@ -1142,3 +1217,7 @@
     fromIso "ur"  = "urdu"
     fromIso "vi"  = "vietnamese"
     fromIso _     = ""
+
+deNote :: Inline -> Inline
+deNote (Note _) = RawInline (Format "latex") ""
+deNote x = x
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -191,8 +191,7 @@
       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
diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs
--- a/src/Text/Pandoc/Writers/Textile.hs
+++ b/src/Text/Pandoc/Writers/Textile.hs
@@ -44,6 +44,7 @@
 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 +52,8 @@
 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
@@ -218,7 +220,7 @@
         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 +229,14 @@
         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 +264,13 @@
   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 +287,8 @@
 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
diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs
--- a/tests/Tests/Old.hs
+++ b/tests/Tests/Old.hs
@@ -165,6 +165,12 @@
           [ "opendocument" , "context" , "texinfo", "icml"
           , "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
@@ -196,7 +202,8 @@
     , 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
--- a/tests/Tests/Readers/Docx.hs
+++ b/tests/Tests/Readers/Docx.hs
@@ -189,6 +189,10 @@
             "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/Markdown.hs b/tests/Tests/Readers/Markdown.hs
--- a/tests/Tests/Readers/Markdown.hs
+++ b/tests/Tests/Readers/Markdown.hs
@@ -181,6 +181,13 @@
           , "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")
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs
--- a/tests/Tests/Readers/Org.hs
+++ b/tests/Tests/Readers/Org.hs
@@ -264,6 +264,16 @@
                            )
                            "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
@@ -529,6 +539,17 @@
           "* 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"
@@ -820,7 +841,7 @@
           unlines [ "- PLL :: phase-locked loop"
                   , "- TTL ::"
                   , "  transistor-transistor logic"
-                  , "- PSK::phase-shift keying"
+                  , "- PSK :: phase-shift keying"
                   , ""
                   , "  a digital modulation scheme"
                   ] =?>
@@ -859,6 +880,10 @@
                   , 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 +895,14 @@
                      , 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 +1127,15 @@
                    , ": 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 +1250,7 @@
                         ]
           in codeBlockWith ( "", classes, params) "code body\n"
       ]
+
     , testGroup "Smart punctuation"
       [ test orgSmart "quote before ellipses"
         ("'...hi'"
@@ -1228,5 +1271,13 @@
       , 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/Writers/LaTeX.hs b/tests/Tests/Writers/LaTeX.hs
--- a/tests/Tests/Writers/LaTeX.hs
+++ b/tests/Tests/Writers/LaTeX.hs
@@ -42,7 +42,7 @@
         , 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/docx/link_in_notes.docx b/tests/docx/link_in_notes.docx
new file mode 100644
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
--- /dev/null
+++ b/tests/docx/link_in_notes.native
@@ -0,0 +1,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/lhs-test.latex b/tests/lhs-test.latex
--- a/tests/lhs-test.latex
+++ b/tests/lhs-test.latex
@@ -12,7 +12,7 @@
   \else
     \usepackage{fontspec}
   \fi
-  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
+  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
   \newcommand{\euro}{€}
 \fi
 % use upquote if available, for straight quotes in verbatim environments
@@ -22,32 +22,11 @@
 \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}
+\PassOptionsToPackage{usenames,dvipsnames}{color} % color is loaded by hyperref
+\hypersetup{unicode=true,
+            pdfborder={0 0 0},
+            breaklinks=true}
 \urlstyle{same}  % don't use monospace font for urls
 \usepackage{color}
 \usepackage{fancyvrb}
diff --git a/tests/lhs-test.latex+lhs b/tests/lhs-test.latex+lhs
--- a/tests/lhs-test.latex+lhs
+++ b/tests/lhs-test.latex+lhs
@@ -12,7 +12,7 @@
   \else
     \usepackage{fontspec}
   \fi
-  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
+  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
   \newcommand{\euro}{€}
 \fi
 % use upquote if available, for straight quotes in verbatim environments
@@ -22,32 +22,11 @@
 \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}
+\PassOptionsToPackage{usenames,dvipsnames}{color} % color is loaded by 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}}{}
diff --git a/tests/pipe-tables.native b/tests/pipe-tables.native
--- a/tests/pipe-tables.native
+++ b/tests/pipe-tables.native
@@ -83,4 +83,15 @@
  [[[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"]]]]]
diff --git a/tests/pipe-tables.txt b/tests/pipe-tables.txt
--- a/tests/pipe-tables.txt
+++ b/tests/pipe-tables.txt
@@ -59,3 +59,10 @@
 ------------------:|:------
                  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|
diff --git a/tests/s5-basic.html b/tests/s5-basic.html
--- 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
--- 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.html b/tests/tables.html
--- a/tests/tables.html
+++ b/tests/tables.html
@@ -94,7 +94,7 @@
 </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%" />
diff --git a/tests/textile-reader.native b/tests/textile-reader.native
--- a/tests/textile-reader.native
+++ b/tests/textile-reader.native
@@ -1,5 +1,5 @@
 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","")]
@@ -8,9 +8,9 @@
 ,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"]
@@ -87,9 +87,9 @@
 ,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","")]
@@ -114,7 +114,7 @@
  ,[[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"]]
@@ -152,7 +152,7 @@
 ,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 "this",Space,RawInline (Format "html") "<div>",Space,Str "won't",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 "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"]
diff --git a/tests/writer.asciidoc b/tests/writer.asciidoc
--- 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.
diff --git a/tests/writer.context b/tests/writer.context
--- a/tests/writer.context
+++ b/tests/writer.context
@@ -1,27 +1,32 @@
-\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][protrusion=quality,expansion=quality,onum=yes,pnum=yes]
+\definefontfeature[smallcaps][smallcaps][protrusion=quality,expansion=quality,onum=yes,pnum=yes]
+\setupalign[hz,hanging]
+\setupbodyfontenvironment[default][em=italic] % use italic as em, not slanted
+\setupbodyfont[mainfont]
 \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,24 +40,19 @@
 
 \setupthinrules[width=15em] % width of horizontal rules
 
-\setupdelimitedtext
-  [blockquote]
-  [before={\blank[medium]},
-   after={\blank[medium]},
-   indentnext=no,
-  ]
+\setuphead[title][
+  style={\tfd\raggedcenter},
+  before={\startalignment[middle]},
+  after={
+    \smallskip
+    {\tfa John MacFarlane\crlf Anonymous}
+    \smallskip
+    {\tfa July 17, 2006}
+    \bigskip\stopalignment}]
 
 
 \starttext
-\startalignment[center]
-  \blank[2*big]
-  {\tfd Pandoc Test Suite}
-  \blank[3*medium]
-  {\tfa John MacFarlane\crlf Anonymous}
-  \blank[2*medium]
-  {\tfa July 17, 2006}
-  \blank[3*medium]
-\stopalignment
+\title{Pandoc Test Suite}
 
 This is a set of tests for pandoc. Most of them are adapted from John Gruber's
 markdown test suite.
@@ -545,11 +545,13 @@
 Simple block on one line:
 
 foo
+
 And nested without indentation:
 
 foo
 
 bar
+
 Interpreted markdown in a table:
 
 This is {\em emphasized}
@@ -575,6 +577,7 @@
 Now, nested:
 
 foo
+
 This should just be an HTML comment:
 
 Multiline:
diff --git a/tests/writer.latex b/tests/writer.latex
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -12,7 +12,7 @@
   \else
     \usepackage{fontspec}
   \fi
-  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
+  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
   \newcommand{\euro}{€}
 \fi
 % use upquote if available, for straight quotes in verbatim environments
@@ -22,32 +22,13 @@
 \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}
+\PassOptionsToPackage{usenames,dvipsnames}{color} % color is loaded by 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
diff --git a/tests/writer.man b/tests/writer.man
--- a/tests/writer.man
+++ b/tests/writer.man
@@ -1,5 +1,3 @@
-.\" Automatically generated by Pandoc 1.15.1
-.\"
 .hy
 .TH "Pandoc Test Suite" "" "July 17, 2006" "" ""
 .PP
diff --git a/tests/writers-lang-and-dir.native b/tests/writers-lang-and-dir.native
new file mode 100644
--- /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
--- 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
 
