diff --git a/AUTHORS.md b/AUTHORS.md
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -99,6 +99,7 @@
 - Dmitry Pogodin
 - Dmitry Volodin
 - Douglas Calvert
+- Edwin Török
 - Eigil Rischel
 - Elliot Bobrow
 - Emanuel Evans
diff --git a/MANUAL.txt b/MANUAL.txt
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -1,7 +1,7 @@
 ---
 title: Pandoc User's Guide
 author: John MacFarlane
-date: December 15, 2023
+date: January 5, 2024
 ---
 
 # Synopsis
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,75 @@
 # Revision history for pandoc
 
+## pandoc 3.1.11.1 (2023-01-05)
+
+  * Docx reader:
+
+    + Fix HYPERLINK with only switch and no argument (#9246).
+
+  * Org reader:
+
+    + Parse caption and label for grid tables (#9279).
+
+  * MediaWiki reader:
+
+    + Handle multiline math in list items (#9293).
+
+  * OPML writer:
+
+    + Respect `--wrap` options & `--columns` in contents of notes (#9297).
+
+  * ODT/OpenDocument writers:
+
+    + Properly handle highlighting styles (#9287). These styles were
+      going into an `office:styles` element in `content.xml`, but this
+      is invalid. Instead they must go in `styles.xml`. The variable
+      `highlighting-styles` no longer has any effect on the default
+      opendocument template, and highlighting styles are not included
+      in `opendocument` output.
+
+  * Markdown writer:
+
+    + Add table identifier at end of caption if present (#9279).
+
+  * Text.Pandoc.PDF:
+
+    + Expand list of environment variables to display in verbose output
+      (#9303).
+    + Ensure that we find all the LaTeX warnings requiring a rerun (#9284).
+      This should fix a regression from 3.1.9 that led to incorrect
+      alignments in tables (and possibly other issues).
+
+  * Docx writer:
+
+    + Ensure that pandoc's output validates (Edwin Török, #9273, #9269,
+      John MacFarlane, #9265, #9266, #9264).
+    + Don't emit empty table rows, which seem to cause problems for
+      Word (#9224).
+
+  * LaTeX writer:
+
+    + Omit superfluous page locator label when used with `--natbib` or
+      `--biblatex` (#9275). These will treat a bare number as a
+      page locator, and they will be able to localize it. Note that the
+      recognition of the locator label is locale-sensitive; if `lang` is
+      `de`, then `S. 33` is a page reference, and `p. 33` is not!
+
+  * Text.Pandoc.Chunks: Fine tune `makeChunks` (#9281).
+
+    + Ensure that chunks not based on sections (those with the
+      "preamble" class) get unique identifiers, by appending chunk number.
+    + This will also ensure that they get unique path names when
+      the path is generated from the identifier.
+
+  * Default HTML5 template: remove html5shiv (and support for IE < 9).
+
+  * Makefile:
+
+    + Fix `make quick-stack`: `j` was expecting a number (Edwin Török).
+    + Run built pandoc (instead of pandoc in path).
+    + Add `validate-epub` target, using `epubcheck` to test the golden files.
+    + Add `validate-docx-golden-tests` target.
+
 ## pandoc 3.1.11 (2023-12-15)
 
   * Typst writer:
diff --git a/data/docx/word/document.xml b/data/docx/word/document.xml
--- a/data/docx/word/document.xml
+++ b/data/docx/word/document.xml
@@ -52,7 +52,6 @@
     </w:p>
     <w:p>
       <w:pPr>
-        <w:pStyle w:val="Compact" />
         <w:pStyle w:val="Abstract" />
       </w:pPr>
       <w:r>
@@ -266,14 +265,13 @@
     <w:tbl>
       <w:tblPr>
         <w:tblStyle w:val="Table" />
-        <w:tblW w:type="pct" w:w="0.0" />
         <w:tblLook w:firstRow="1" />
         <w:tblCaption w:val="Table caption." />
       </w:tblPr>
       <w:tblGrid />
       <w:tr>
         <w:trPr>
-          <w:cnfStyle w:firstRow="1" />
+          <w:cnfStyle w:firstRow="1" w:val="100000000000" />
         </w:trPr>
         <w:tc>
           <w:tcPr>
diff --git a/data/docx/word/settings.xml b/data/docx/word/settings.xml
--- a/data/docx/word/settings.xml
+++ b/data/docx/word/settings.xml
@@ -4,10 +4,6 @@
   <w:embedSystemFonts />
   <w:proofState w:spelling="clean" w:grammar="clean" />
   <w:stylePaneFormatFilter w:val="0004" />
-  <w:footnotePr>
-    <w:footnote w:id="-1" />
-    <w:footnote w:id="0" />
-  </w:footnotePr>
   <w:doNotTrackMoves />
   <w:defaultTabStop w:val="720" />
   <w:drawingGridHorizontalSpacing w:val="360" />
@@ -16,6 +12,10 @@
   <w:displayVerticalDrawingGridEvery w:val="0" />
   <w:characterSpacingControl w:val="doNotCompress" />
   <w:savePreviewPicture />
+  <w:footnotePr>
+    <w:footnote w:id="-1" />
+    <w:footnote w:id="0" />
+  </w:footnotePr>
   <w:rsids>
   </w:rsids>
   <m:mathPr>
diff --git a/data/docx/word/styles.xml b/data/docx/word/styles.xml
--- a/data/docx/word/styles.xml
+++ b/data/docx/word/styles.xml
@@ -24,10 +24,10 @@
     <w:name w:val="Body Text" />
     <w:basedOn w:val="Normal" />
     <w:link w:val="BodyTextChar" />
+    <w:qFormat />
     <w:pPr>
       <w:spacing w:before="180" w:after="180" />
     </w:pPr>
-    <w:qFormat />
   </w:style>
   <w:style w:type="paragraph" w:customStyle="1" w:styleId="FirstParagraph">
     <w:name w:val="First Paragraph" />
@@ -107,14 +107,14 @@
     <w:pPr>
       <w:keepNext />
       <w:keepLines />
-      <w:jc w:val="center" />
       <w:spacing w:before="300" w:after="0" />
+      <w:jc w:val="center" />
     </w:pPr>
     <w:rPr>
+      <w:b />
+      <w:color w:val="345A8A" />
       <w:sz w:val="20" />
       <w:szCs w:val="20" />
-      <w:b />
-      <w:color w:val="345A8A" />>
     </w:rPr>
   </w:style>
   <w:style w:type="paragraph" w:customStyle="1" w:styleId="Abstract">
@@ -220,8 +220,8 @@
     </w:pPr>
     <w:rPr>
       <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi" />
-      <w:i />
       <w:bCs />
+      <w:i />
       <w:color w:val="4F81BD" w:themeColor="accent1" />
       <w:sz w:val="24" />
       <w:szCs w:val="24" />
@@ -389,10 +389,10 @@
         <w:jc w:val="left"/>
       </w:trPr>
       <w:tcPr>
-        <w:vAlign w:val="bottom"/>
         <w:tcBorders>
           <w:bottom w:val="single"/>
         </w:tcBorders>
+        <w:vAlign w:val="bottom"/>
       </w:tcPr>
     </w:tblStylePr>
   </w:style>
diff --git a/data/templates/default.html5 b/data/templates/default.html5
--- a/data/templates/default.html5
+++ b/data/templates/default.html5
@@ -32,9 +32,6 @@
 $endif$
   $math$
 $endif$
-  <!--[if lt IE 9]>
-    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
-  <![endif]-->
 </head>
 <body>
 $for(include-before)$
diff --git a/data/templates/default.opendocument b/data/templates/default.opendocument
--- a/data/templates/default.opendocument
+++ b/data/templates/default.opendocument
@@ -3,9 +3,6 @@
   <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>
-  <office:styles>
-    $highlighting-styles$
-  </office:styles>
   <office:automatic-styles>
     $automatic-styles$
   </office:automatic-styles>
diff --git a/pandoc.cabal b/pandoc.cabal
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,6 +1,6 @@
 cabal-version:   2.4
 name:            pandoc
-version:         3.1.11
+version:         3.1.11.1
 build-type:      Simple
 license:         GPL-2.0-or-later
 license-file:    COPYING.md
diff --git a/src/Text/Pandoc/Chunks.hs b/src/Text/Pandoc/Chunks.hs
--- a/src/Text/Pandoc/Chunks.hs
+++ b/src/Text/Pandoc/Chunks.hs
@@ -28,7 +28,8 @@
   ) where
 
 import Text.Pandoc.Definition
-import Text.Pandoc.Shared (makeSections, stringify, inlineListToIdentifier)
+import Text.Pandoc.Shared (makeSections, stringify, inlineListToIdentifier,
+                           tshow)
 import Text.Pandoc.Walk (Walkable(..))
 import Data.Aeson (FromJSON, ToJSON)
 import Data.Text (Text)
@@ -204,22 +205,26 @@
                         divid
                         (fromMaybe "" secnum)
   toChunk chunknum (Div ("",["preamble"],[]) bs) =
-    Chunk
+      Chunk
       { chunkHeading = docTitle meta
-      , chunkId = inlineListToIdentifier mempty $ docTitle meta
+      , chunkId = chunkid
       , chunkLevel = 0
       , chunkNumber = chunknum
       , chunkSectionNumber = Nothing
-      , chunkPath = resolvePathTemplate pathTemplate chunknum
-                        (stringify (docTitle meta))
-                        (inlineListToIdentifier mempty (docTitle meta))
-                        "0"
+      , chunkPath = chunkpath
       , chunkUp = Nothing
       , chunkPrev = Nothing
       , chunkNext = Nothing
       , chunkUnlisted = False
       , chunkContents = bs
       }
+    where
+      chunkpath = resolvePathTemplate pathTemplate chunknum
+                        (stringify (docTitle meta))
+                        chunkid
+                        "0"
+      chunkid = inlineListToIdentifier mempty (docTitle meta) <>
+                      "-" <> tshow chunknum
   toChunk _ b = error $ "toChunk called on inappropriate block " <> show b
   -- should not happen
 
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
@@ -425,18 +425,23 @@
      logContents <- if logExists
                        then readFileLazy logFile
                        else return mempty
-     needsRerun <- checkForRerun logContents
-     if needsRerun && runNumber < 3
-        then go file env'' programArgs (runNumber + 1)
+     let rerunWarnings = checkForRerun logContents
+     if not (null rerunWarnings) && runNumber < 3
+        then do
+          report $ MakePDFInfo "Rerun needed"
+                    (T.intercalate "\n"
+                      (map (UTF8.toText . BC.toStrict) rerunWarnings))
+          go file env'' programArgs (runNumber + 1)
        else do
           let pdfFile = replaceExtension file ".pdf"
           (log', pdf) <- getResultingPDF (Just logFile) pdfFile
           return (exit, fromMaybe out log', pdf)
 
-   checkForRerun log' = pure $ any isRerunWarning $ BC.lines log'
+   checkForRerun log' = filter isRerunWarning $ BC.lines log'
 
-   isRerunWarning ln = BC.isPrefixOf "LaTeX Warning:" ln &&
-                       BS.isInfixOf "Rerun to" (BL.toStrict ln)
+   isRerunWarning ln =
+     let ln' = BL.toStrict ln
+       in BS.isInfixOf "Warning:" ln' && BS.isInfixOf "Rerun" ln'
 
 generic2pdf :: (PandocMonad m, MonadIO m)
             => String
@@ -542,19 +547,95 @@
   report $ MakePDFInfo "Command line:"
            (T.pack program <> " " <> T.pack (unwords (map show programArgs)))
   -- we filter out irrelevant stuff to avoid leaking passwords and keys!
-  let isRelevant ("PATH",_) = True
-      isRelevant ("TMPDIR",_) = True
-      isRelevant ("PWD",_) = True
-      isRelevant ("LANG",_) = True
-      isRelevant ("HOME",_) = True
-      isRelevant ("LUA_PATH",_) = True
-      isRelevant ("LUA_CPATH",_) = True
-      isRelevant ("SHELL",_) = True
-      isRelevant ("TEXINPUTS",_) = True
-      isRelevant ("TEXMFOUTPUT",_) = True
-      isRelevant _ = False
+  let isRelevant e = (e `elem` [ "PKFONTS"
+                               , "AFMFONTS"
+                               , "BIBINPUTS"
+                               , "BLTXMLINPUTS"
+                               , "BSTINPUTS"
+                               , "CLUAINPUTS"
+                               , "CMAPFONTS"
+                               , "CWEBINPUTS"
+                               , "DVIPSHEADERS"
+                               , "ENCFONTS"
+                               , "FONTCIDMAPS"
+                               , "FONTFEATURES"
+                               , "GFFONTS"
+                               , "GLYPHFONTS"
+                               , "HOME"
+                               , "INDEXSTYLE"
+                               , "KPATHSEA_DEBUG"
+                               , "KPATHSEA_WARNING"
+                               , "LANG"
+                               , "LIGFONTS"
+                               , "LUAINPUTS"
+                               , "LUA_CPATH"
+                               , "LUA_PATH"
+                               , "MFBASES"
+                               , "MFINPUTS"
+                               , "MFPOOL"
+                               , "MFTINPUTS"
+                               , "MISCFONTS"
+                               , "MISSFONT_LOG"
+                               , "MLBIBINPUTS"
+                               , "MLBSTINPUTS"
+                               , "MPINPUTS"
+                               , "MPMEMS"
+                               , "MPPOOL"
+                               , "MPSUPPORT"
+                               , "OCPINPUTS"
+                               , "OFMFONTS"
+                               , "OPENTYPEFONTS"
+                               , "OPLFONTS"
+                               , "OTPINPUTS"
+                               , "OVFFONTS"
+                               , "OVPFONTS"
+                               , "PATH"
+                               , "PDFTEXCONFIG"
+                               , "PROGRAMFONTS"
+                               , "PSHEADERS"
+                               , "PWD"
+                               , "RISINPUTS"
+                               , "SELFAUTODIR"
+                               , "SELFAUTOLOC"
+                               , "SELFAUTOPARENT"
+                               , "SFDFONTS"
+                               , "SHELL"
+                               , "T1FONTS"
+                               , "T1INPUTS"
+                               , "T42FONTS"
+                               , "TEXBIB"
+                               , "TEXCONFIG"
+                               , "TEXDOCS"
+                               , "TEXFONTMAPS"
+                               , "TEXFONTS"
+                               , "TEXFORMATS"
+                               , "TEXINDEXSTYLE"
+                               , "TEXINPUTS"
+                               , "TEXMFCNF"
+                               , "TEXMFDBS"
+                               , "TEXMFINI"
+                               , "TEXMFSCRIPTS"
+                               , "TEXMFVAR"
+                               , "TEXPICTS"
+                               , "TEXPKS"
+                               , "TEXPOOL"
+                               , "TEXPSHEADERS"
+                               , "TEXSOURCES"
+                               , "TEX_HUSH"
+                               , "TFMFONTS"
+                               , "TMPDIR"
+                               , "TRFONTS"
+                               , "TTFONTS"
+                               , "USERPROFILE"
+                               , "USE_TEXMFVAR"
+                               , "USE_VARTEXFONTS"
+                               , "VARTEXFONTS"
+                               , "VFFONTS"
+                               , "WEB2C"
+                               , "WEBINPUTS"
+                               ]) || "TEXMF" `isPrefixOf` e
   report $ MakePDFInfo "Relevant environment variables:"
-             (T.intercalate "\n" $ map tshow $ filter isRelevant env)
+             (T.intercalate "\n" $ map tshow $ filter (isRelevant . fst) env)
   report $ MakePDFInfo "Source:" source
 
 handlePDFProgramNotFound :: String -> IE.IOError -> IO a
diff --git a/src/Text/Pandoc/Readers/Docx/Fields.hs b/src/Text/Pandoc/Readers/Docx/Fields.hs
--- a/src/Text/Pandoc/Readers/Docx/Fields.hs
+++ b/src/Text/Pandoc/Readers/Docx/Fields.hs
@@ -110,7 +110,7 @@
   many space
   string "HYPERLINK"
   spaces
-  farg <- fieldArgument
+  farg <- option "" $ notFollowedBy (char '\\') *> fieldArgument
   switches <- spaces *> many hyperlinkSwitch
   let url = case switches of
               ("\\l", s) : _ -> farg <> "#" <> s
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
@@ -56,6 +56,7 @@
                                       , constructBogusParStyleData
                                       , leftBiasedMergeRunStyle
                                       , rowsToRowspans
+                                      , extractTarget
                                       ) where
 import Text.Pandoc.Readers.Docx.Parse.Styles
 import Codec.Archive.Zip
@@ -537,6 +538,10 @@
            T.stripPrefix frontOfFp $ T.dropWhile (== '/') target
     return $ Relationship relType relId target'
 relElemToRelationship _ _ _ = Nothing
+
+extractTarget :: Element -> Maybe Target
+extractTarget element = do (Relationship _ _ target) <- relElemToRelationship "word/" InDocument element
+                           return target
 
 filePathToRelationships :: Archive -> FilePath -> FilePath ->  [Relationship]
 filePathToRelationships ar docXmlPath fp
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
@@ -502,8 +502,9 @@
 -- }}
 -- * next list item
 -- which seems to be valid mediawiki.
+-- Also multiline math: see #9293.
 listChunk :: PandocMonad m => MWParser m Text
-listChunk = template <|> countChar 1 anyChar
+listChunk = template <|> (snd <$> withRaw math) <|> countChar 1 anyChar
 
 listItem' :: PandocMonad m => Char -> MWParser m Blocks
 listItem' c = try $ do
diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs
--- a/src/Text/Pandoc/Readers/Org/Blocks.hs
+++ b/src/Text/Pandoc/Readers/Org/Blocks.hs
@@ -26,7 +26,7 @@
 import Text.Pandoc.Readers.Org.Shared (cleanLinkText, isImageFilename,
                                        originalLang, translateLang, exportsCode)
 
-import Text.Pandoc.Builder (Blocks, Inlines)
+import Text.Pandoc.Builder (Blocks, Inlines, Many(..))
 import Text.Pandoc.Class.PandocMonad (PandocMonad)
 import Text.Pandoc.Definition
 import Text.Pandoc.Options
@@ -41,6 +41,7 @@
 import Data.Text (Text)
 import Data.List.NonEmpty (nonEmpty)
 import System.FilePath
+import qualified Data.Foldable as F
 import qualified Data.Text as T
 import qualified Text.Pandoc.Builder as B
 import qualified Text.Pandoc.Walk as Walk
@@ -631,38 +632,46 @@
   }
 
 table :: PandocMonad m => OrgParser m (F Blocks)
-table = do
-  withTables <- getExportSetting exportWithTables
-  tbl <- gridTableWith blocks <|> orgTable
-  return $ if withTables then tbl else mempty
-
--- | A normal org table
-orgTable :: PandocMonad m => OrgParser m (F Blocks)
-orgTable = try $ do
+table = try $ do
   -- don't allow a table on the first line of a list item; org requires that
   -- tables start at first non-space character on the line
   let isFirstInListItem st = orgStateParserContext st == ListItemState &&
                              isNothing (orgStateLastPreCharPos st)
   guard . not . isFirstInListItem =<< getState
   blockAttrs <- blockAttributes
+  let identMb = blockAttrName blockAttrs
+  tbl <- gridTableWith blocks <|> orgTable
+  withTables <- getExportSetting exportWithTables
+  return $ if withTables
+              then do
+                xs <- unMany <$> tbl
+                case F.toList xs of
+                  [Table _ _ cs th tb tf] -> do
+                    capt <- case blockAttrCaption blockAttrs of
+                              Nothing -> pure $ Caption Nothing []
+                              Just ils -> do
+                                ils' <- ils
+                                pure $ B.simpleCaption . B.plain $ ils'
+                    let attr = (fromMaybe mempty identMb, [],
+                                 blockAttrKeyValues blockAttrs)
+                    pure $ B.tableWith attr capt cs th tb tf
+                  _ -> tbl   -- should not happen
+              else mempty
+
+-- | A normal org table
+orgTable :: PandocMonad m => OrgParser m (F Blocks)
+orgTable = do
   lookAhead tableStart
   rows <- tableRows
-
-  let caption = fromMaybe mempty (blockAttrCaption blockAttrs)
   let orgTbl = normalizeTable <$> rowsToTable rows
-  let identMb = blockAttrName blockAttrs
-  let attr = (fromMaybe mempty identMb, [], blockAttrKeyValues blockAttrs)
-  return $ orgToPandocTable attr <$> orgTbl <*> caption
+  return $ orgToPandocTable <$> orgTbl
 
-orgToPandocTable :: Attr
-                 -> OrgTable
-                 -> Inlines
-                 -> Blocks
-orgToPandocTable attr (OrgTable colProps heads lns) caption =
+orgToPandocTable :: OrgTable -> Blocks
+orgToPandocTable (OrgTable colProps heads lns) =
   let totalWidth = if any (isJust . columnRelWidth) colProps
                    then Just . sum $ map (fromMaybe 1 . columnRelWidth) colProps
                    else Nothing
-  in B.tableWith attr (B.simpleCaption $ B.plain caption)
+  in B.tableWith nullAttr (Caption Nothing mempty)
                  (map (convertColProp totalWidth) colProps)
                  (TableHead nullAttr $ toHeaderRow heads)
                  [TableBody nullAttr 0 [] $ map toRow lns]
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
@@ -28,7 +28,7 @@
       toEntry,
       Entry(eRelativePath) )
 import Control.Applicative ((<|>))
-import Control.Monad (MonadPlus(mplus), unless, when)
+import Control.Monad (MonadPlus(mplus), unless, when, foldM)
 import Control.Monad.Except (catchError, throwError)
 import Control.Monad.Reader
     ( asks, MonadReader(local), MonadTrans(lift), ReaderT(runReaderT) )
@@ -36,7 +36,8 @@
 import qualified Data.ByteString.Lazy as BL
 import Data.Containers.ListUtils (nubOrd)
 import Data.Char (isSpace, isLetter)
-import Data.List (intercalate, isPrefixOf, isSuffixOf)
+import Data.List (intercalate, isPrefixOf, isSuffixOf, sortBy)
+import Data.Ord (comparing)
 import Data.String (fromString)
 import qualified Data.Map as M
 import Data.Maybe (fromMaybe, isNothing, mapMaybe, maybeToList, isJust)
@@ -63,6 +64,7 @@
 import Text.Pandoc.Logging
 import Text.Pandoc.MIME (extensionFromMimeType, getMimeType, getMimeTypeDef)
 import Text.Pandoc.Options
+import Text.Pandoc.Readers.Docx.Parse (extractTarget)
 import Text.Pandoc.Writers.Docx.StyleMap
 import Text.Pandoc.Writers.Docx.Table as Table
 import Text.Pandoc.Writers.Docx.Types
@@ -77,9 +79,63 @@
 import Data.Generics (mkT, everywhere)
 import Text.Collate.Lang (renderLang, Lang(..))
 
+-- from wml.xsd EG_RPrBase
+rPrTagOrder :: M.Map Text Int
+rPrTagOrder =
+  M.fromList
+  (zip [ "rStyle"
+    , "rFonts"
+    , "b"
+    , "bCs"
+    , "i"
+    , "iCs"
+    , "caps"
+    , "smallCaps"
+    , "strike"
+    , "dstrike"
+    , "outline"
+    , "shadow"
+    , "emboss"
+    , "imprint"
+    , "noProof"
+    , "snapToGrid"
+    , "vanish"
+    , "webHidden"
+    , "color"
+    , "spacing"
+    , "w"
+    , "kern"
+    , "position"
+    , "sz"
+    , "szCs"
+    , "highlight"
+    , "u"
+    , "effect"
+    , "bdr"
+    , "shd"
+    , "fitText"
+    , "vertAlign"
+    , "rtl"
+    , "cs"
+    , "em"
+    , "lang"
+    , "eastAsianLayout"
+    , "specVanish"
+    , "oMath"
+    ] [0..])
+
+sortSquashed :: [Element] -> [Element]
+sortSquashed l =
+  sortBy (comparing tagIndex) l
+  where
+    tagIndex :: Element -> Int
+    tagIndex el =
+      fromMaybe 0 (M.lookup tag rPrTagOrder)
+      where tag = (qName . elName) el
+
 squashProps :: EnvProps -> [Element]
-squashProps (EnvProps Nothing es) = es
-squashProps (EnvProps (Just e) es) = e : es
+squashProps (EnvProps Nothing es) = sortSquashed es
+squashProps (EnvProps (Just e) es) = sortSquashed (e : es)
 
 renumIdMap :: Int -> [Element] -> M.Map Text Text
 renumIdMap _ [] = M.empty
@@ -255,8 +311,6 @@
   let headers = filterElements isHeaderNode parsedRels
   let footers = filterElements isFooterNode parsedRels
 
-  let extractTarget = findAttr (QName "Target" Nothing Nothing)
-
   -- we create [Content_Types].xml and word/_rels/document.xml.rels
   -- from scratch rather than reading from reference.docx,
   -- because Word sometimes changes these files when a reference.docx is modified,
@@ -508,30 +562,104 @@
   -- adds references to footnotes or endnotes we don't have...
   -- we do, however, copy some settings over from reference
   let settingsPath = "word/settings.xml"
-      settingsList = [ "zoom"
-                     , "mirrorMargins"
+
+  settingsEntry <- copyChildren refArchive distArchive settingsPath epochtime
+                      -- note: these must go in the following order:
+                     [ "writeProtection"
+                     , "view"
+                     , "zoom"
+                     , "removePersonalInformation"
+                     , "removeDateAndTime"
+                     , "doNotDisplayPageBoundaries"
+                     , "displayBackgroundShape"
+                     , "printPostScriptOverText"
+                     , "printFractionalCharacterWidth"
+                     , "printFormsData"
+                     , "embedTrueTypeFonts"
                      , "embedSystemFonts"
+                     , "saveSubsetFonts"
+                     , "saveFormsData"
+                     , "mirrorMargins"
+                     , "alignBordersAndEdges"
+                     , "bordersDoNotSurroundHeader"
+                     , "bordersDoNotSurroundFooter"
+                     , "gutterAtTop"
+                     , "hideSpellingErrors"
+                     , "hideGrammaticalErrors"
+                     , "activeWritingStyle"
+                     , "proofState"
+                     , "formsDesign"
+                     , "attachedTemplate"
+                     , "linkStyles"
+                     , "stylePaneFormatFilter"
+                     , "stylePaneSortMethod"
+                     , "documentType"
+                     , "mailMerge"
+                     , "revisionView"
+                     , "trackRevisions"
                      , "doNotTrackMoves"
+                     , "doNotTrackFormatting"
+                     , "documentProtection"
+                     , "autoFormatOverride"
+                     , "styleLockTheme"
+                     , "styleLockQFSet"
                      , "defaultTabStop"
+                     , "autoHyphenation"
+                     , "consecutiveHyphenLimit"
+                     , "hyphenationZone"
+                     , "doNotHyphenateCaps"
+                     , "showEnvelope"
+                     , "summaryLength"
+                     , "clickAndTypeStyle"
+                     , "defaultTableStyle"
+                     , "evenAndOddHeaders"
+                     , "bookFoldRevPrinting"
+                     , "bookFoldPrinting"
+                     , "bookFoldPrintingSheets"
                      , "drawingGridHorizontalSpacing"
                      , "drawingGridVerticalSpacing"
                      , "displayHorizontalDrawingGridEvery"
                      , "displayVerticalDrawingGridEvery"
+                     , "doNotUseMarginsForDrawingGridOrigin"
+                     , "drawingGridHorizontalOrigin"
+                     , "drawingGridVerticalOrigin"
+                     , "doNotShadeFormData"
+                     , "noPunctuationKerning"
                      , "characterSpacingControl"
+                     , "printTwoOnOne"
+                     , "strictFirstAndLastChars"
+                     , "noLineBreaksAfter"
+                     , "noLineBreaksBefore"
                      , "savePreviewPicture"
-                     , "mathPr"
+                     , "doNotValidateAgainstSchema"
+                     , "saveInvalidXml"
+                     , "ignoreMixedContent"
+                     , "alwaysShowPlaceholderText"
+                     , "doNotDemarcateInvalidXml"
+                     , "saveXmlDataOnly"
+                     , "useXSLTWhenSaving"
+                     , "saveThroughXslt"
+                     , "showXMLTags"
+                     , "alwaysMergeEmptyNamespace"
+                     , "updateFields"
+                     , "hdrShapeDefaults"
+                     , "footnotePr"
+                     , "compat"
+                     , "docVars"
+                     , "rsids"
+                     , "attachedSchema"
                      , "themeFontLang"
+                     , "clrSchemeMapping"
+                     , "doNotIncludeSubdocsInStats"
+                     , "doNotAutoCompressPictures"
+                     , "forceUpgrade"
+                     , "captions"
+                     , "readModeInkLockDown"
+                     , "smartTagType"
+                     , "shapeDefaults"
+                     , "doNotEmbedSmartTags"
                      , "decimalSymbol"
-                     , "listSeparator"
-                     , "autoHyphenation"
-                     , "consecutiveHyphenLimit"
-                     , "hyphenationZone"
-                     , "doNotHyphenateCap"
-                     , "evenAndOddHeaders"
-                     , "proofState"
-                     , "compat"
-                     ]
-  settingsEntry <- copyChildren refArchive distArchive settingsPath epochtime settingsList
+                     , "listSeparator" ]
 
   let entryFromArchive arch path =
          maybe (throwError $ PandocSomeError
@@ -604,14 +732,14 @@
                              [ mknode "w:name" [("w:val", tshow toktype)] ()
                              , mknode "w:basedOn" [("w:val","VerbatimChar")] ()
                              , mknode "w:rPr" [] $
+                               [ mknode "w:b" [] () | tokFeature tokenBold toktype ] ++
+                               [ mknode "w:i" [] () | tokFeature tokenItalic toktype ] ++
                                [ mknode "w:color" [("w:val", tokCol toktype)] ()
                                  | tokCol toktype /= "auto" ] ++
+                               [ mknode "w:u" [] () | tokFeature tokenUnderline toktype ] ++
                                [ mknode "w:shd" [("w:val","clear")
                                                 ,("w:fill",tokBg toktype)] ()
-                                 | tokBg toktype /= "auto" ] ++
-                               [ mknode "w:b" [] () | tokFeature tokenBold toktype ] ++
-                               [ mknode "w:i" [] () | tokFeature tokenItalic toktype ] ++
-                               [ mknode "w:u" [] () | tokFeature tokenUnderline toktype ]
+                                 | tokBg toktype /= "auto" ]
                              ]
         tokStyles = tokenStyles style
         tokFeature f toktype = maybe False f $ M.lookup toktype tokStyles
@@ -639,17 +767,17 @@
 copyChildren refArchive distArchive path timestamp elNames = do
   ref  <- parseXml refArchive distArchive path
   dist <- parseXml distArchive distArchive path
-  let elsToCopy =
-        map cleanElem $ filterChildrenName (\e -> qName e `elem` elNames) ref
-  let elsToKeep =
-        [e | Elem e <- elContent dist, not (any (hasSameNameAs e) elsToCopy)]
-  return $ toEntry path timestamp $ renderXml dist{
-      elContent = map Elem elsToKeep ++ map Elem elsToCopy
-    }
+  els <- foldM (addEl ref dist) [] (reverse elNames)
+  return $ toEntry path timestamp
+         $ renderXml dist{ elContent = map cleanElem els }
   where
-    hasSameNameAs (Element {elName = n1}) (Element {elName = n2}) =
-      qName n1 == qName n2
-    cleanElem el@Element{elName=name} = el{elName=name{qURI=Nothing}}
+    addEl ref dist els name =
+      case filterChildName (hasName name) ref `mplus`
+             filterChildName (hasName name) dist of
+        Just el -> pure (el : els)
+        Nothing -> pure els
+    hasName name = (== name) . qName
+    cleanElem el@Element{elName=name} = Elem el{elName=name{qURI=Nothing}}
 
 -- this is the lowest number used for a list numId
 baseListId :: Int
@@ -678,7 +806,7 @@
 mkAbstractNum :: ListMarker -> Element
 mkAbstractNum marker =
   mknode "w:abstractNum" [("w:abstractNumId",listMarkerToId marker)]
-    $ mknode "w:nsid" [("w:val", "A" <> listMarkerToId marker)] ()
+    $ mknode "w:nsid" [("w:val", T.justifyRight 8 '0' ("A" <> listMarkerToId marker))] ()
     : mknode "w:multiLevelType" [("w:val","multilevel")] ()
     : map (mkLvl marker)
       [0..maxListLevel]
@@ -810,8 +938,8 @@
               , mknode "w:r" []
                 [ mknode "w:rPr" []
                   [ mknode "w:rStyle" [("w:val", "CommentReference")] ()
-                  , mknode "w:annotationRef" [] ()
                   ]
+                  , mknode "w:annotationRef" [] ()
                 ]
               ] ++ annotation
             ]
@@ -1063,18 +1191,17 @@
              map blockToCell blks
   let tbl = mknode "w:tbl" []
         ( mknode "w:tblPr" []
-          ( mknode "w:tblStyle" [("w:val","FigureTable")] () :
-            mknode "w:tblW" [ ("w:type", "auto"), ("w:w", "0") ] () :
+          [ mknode "w:tblStyle" [("w:val","FigureTable")] (),
+            mknode "w:tblW" [ ("w:type", "auto"), ("w:w", "0") ] (),
+            mknode "w:jc" [("w:val","center")] (),
             mknode "w:tblLook" [ ("w:firstRow", "0")
                                , ("w:lastRow", "0")
                                , ("w:firstColumn", "0")
                                , ("w:lastColumn", "0")
-                               ] () :
-            mknode "w:jc" [("w:val","center")] () :
-            []
-          )
+                               ] ()
+          ]
           : mknode "w:tblGrid" [] gridCols
-          : [tblBody]
+          : maybeToList tblBody
         )
   modify $ \s -> s { stInTable = False }
   return $ Elem tbl
@@ -1171,7 +1298,7 @@
   let listPr = [mknode "w:numPr" []
                 [ mknode "w:ilvl" [("w:val",tshow listLevel)] ()
                 , mknode "w:numId" [("w:val",tshow numid')] () ] | listLevel >= 0 && not displayMathPara]
-  return $ case listPr ++ squashProps props of
+  return $ case squashProps (EnvProps Nothing listPr <> props) of
                 [] -> []
                 ps -> [mknode "w:pPr" [] ps]
 
@@ -1290,12 +1417,12 @@
               langmod $ inlinesToOpenXML opts ils
   wrapBookmark ident contents
 inlineToOpenXML' opts (Strong lst) =
-  withTextProp (mknode "w:b" [] ()) $
   withTextProp (mknode "w:bCs" [] ()) $ -- needed for LTR, #6911
+  withTextProp (mknode "w:b" [] ()) $
   inlinesToOpenXML opts lst
 inlineToOpenXML' opts (Emph lst) =
-  withTextProp (mknode "w:i" [] ()) $
   withTextProp (mknode "w:iCs" [] ()) $  -- needed for LTR, #6911
+  withTextProp (mknode "w:i" [] ()) $
   inlinesToOpenXML opts lst
 inlineToOpenXML' opts (Underline lst) =
   withTextProp (mknode "w:u" [("w:val","single")] ()) $
diff --git a/src/Text/Pandoc/Writers/Docx/Table.hs b/src/Text/Pandoc/Writers/Docx/Table.hs
--- a/src/Text/Pandoc/Writers/Docx/Table.hs
+++ b/src/Text/Pandoc/Writers/Docx/Table.hs
@@ -22,6 +22,7 @@
 import Control.Monad.Except ( throwError )
 import Data.Array ( elems, (!), assocs, indices )
 import Data.Text (Text)
+import Data.Maybe (catMaybes)
 import Text.Pandoc.Definition
     ( ColSpec,
       Caption(Caption),
@@ -112,20 +113,20 @@
   let hasWidths = not $ all ((== ColWidthDefault) . snd) colspecs
   let tbl = mknode "w:tbl" []
         ( mknode "w:tblPr" []
-          ( mknode "w:tblStyle" [("w:val","Table")] () :
-            mknode "w:tblW" tblWattr () :
-            mknode "w:tblLook" [("w:firstRow",if hasHeader then "1" else "0")
-                               ,("w:lastRow",if hasFooter then "1" else "0")
-                               ,("w:firstColumn","0")
-                               ,("w:lastColumn","0")
-                               ,("w:noHBand","0")
-                               ,("w:noVBand","0")
-                               ,("w:val", T.pack $ printf "%04x" tblLookVal)
-                               ] () :
-            mknode "w:jc" [("w:val","start")] ()
-            : [ mknode "w:tblInd" [("w:w", tshow indent),("w:type","dxa")] ()
+          ( [ mknode "w:tblStyle" [("w:val","Table")] (),
+              mknode "w:tblW" tblWattr (),
+              mknode "w:jc" [("w:val","left")] () ] ++
+            [ mknode "w:tblInd" [("w:w", tshow indent),("w:type","dxa")] ()
                 | indent > 0 ] ++
             [ mknode "w:tblLayout" [("w:type", "fixed")] () | hasWidths ] ++
+            [ mknode "w:tblLook" [("w:firstRow",if hasHeader then "1" else "0")
+                                 ,("w:lastRow",if hasFooter then "1" else "0")
+                                 ,("w:firstColumn","0")
+                                 ,("w:lastColumn","0")
+                                 ,("w:noHBand","0")
+                                 ,("w:noVBand","0")
+                                 ,("w:val", T.pack $ printf "%04x" tblLookVal)
+                                 ] () ] ++
             [ mknode "w:tblCaption" [("w:val", captionStr)] ()
             | not (T.null captionStr) ]
           )
@@ -189,7 +190,7 @@
   if null (elems cellArray)
   then return mempty
   else partToRows rowType aligns part >>=
-       mapM (rowToOpenXML blocksToOpenXML)
+       fmap catMaybes . mapM (rowToOpenXML blocksToOpenXML)
 
 data OOXMLCell
   = OOXMLCell Attr Alignment RowSpan ColSpan [Block]
@@ -228,15 +229,17 @@
 rowToOpenXML :: PandocMonad m
              => ([Block] -> WS m [Content])
              -> OOXMLRow
-             -> WS m Element
-rowToOpenXML blocksToOpenXML (OOXMLRow rowType _attr cells) = do
-  xmlcells <- mapM (ooxmlCellToOpenXML blocksToOpenXML) cells
-  let addTrPr = case rowType of
-        HeadRow -> (mknode "w:trPr" []
-                    [mknode "w:tblHeader" [("w:val", "true")] ()] :)
-        BodyRow -> id
-        FootRow -> id
-  return $ mknode "w:tr" [] (addTrPr xmlcells)
+             -> WS m (Maybe Element)
+rowToOpenXML blocksToOpenXML (OOXMLRow rowType _attr cells)
+  | null cells = return Nothing
+  | otherwise = do
+    xmlcells <- mapM (ooxmlCellToOpenXML blocksToOpenXML) cells
+    let addTrPr = case rowType of
+          HeadRow -> (mknode "w:trPr" []
+                      [mknode "w:tblHeader" [("w:val", "on")] ()] :)
+          BodyRow -> id
+          FootRow -> id
+    return $ Just $ mknode "w:tr" [] (addTrPr xmlcells)
 
 ooxmlCellToOpenXML :: PandocMonad m
                    => ([Block] -> WS m [Content])
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
@@ -127,6 +127,13 @@
   let colwidth = if writerWrapText options == WrapAuto
                     then Just $ writerColumns options
                     else Nothing
+  docLangs <- catMaybes <$>
+      mapM (toLang . Just) (nubOrd (query (extract "lang") blocks))
+  mblang <- toLang $ case getLang options meta of
+                          Just l -> Just l
+                          Nothing | null docLangs -> Nothing
+                                  | otherwise     -> Just "en"
+  modify $ \s -> s{ stLang = mblang }
   metadata <- metaToContext options
               blockListToLaTeX
               (fmap chomp . inlineListToLaTeX)
@@ -167,8 +174,8 @@
   st <- get
   titleMeta <- stringToLaTeX TextString $ stringify $ docTitle meta
   authorsMeta <- mapM (stringToLaTeX TextString . stringify) $ docAuthors meta
-  docLangs <- catMaybes <$>
-      mapM (toLang . Just) (nubOrd (query (extract "lang") blocks))
+  -- we need a default here since lang is used in template conditionals
+  let otherLangs = [l | l <- docLangs, mblang /= Just l]
   let hasStringValue x = isJust (getField x metadata :: Maybe (Doc Text))
   let geometryFromMargins = mconcat $ intersperse ("," :: Doc Text) $
                             mapMaybe (\(x,y) ->
@@ -178,12 +185,6 @@
                               ,("tmargin","margin-top")
                               ,("bmargin","margin-bottom")
                               ]
-  mblang <- toLang $ case getLang options meta of
-                          Just l -> Just l
-                          Nothing | null docLangs -> Nothing
-                                  | otherwise     -> Just "en"
-  -- we need a default here since lang is used in template conditionals
-  let otherLangs = [l | l <- docLangs, mblang /= Just l]
 
   let dirs = query (extract "dir") blocks
 
diff --git a/src/Text/Pandoc/Writers/LaTeX/Citation.hs b/src/Text/Pandoc/Writers/LaTeX/Citation.hs
--- a/src/Text/Pandoc/Writers/LaTeX/Citation.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Citation.hs
@@ -15,6 +15,8 @@
 
 import Data.Text (Text)
 import Data.Char (isPunctuation)
+import Control.Monad.State (gets)
+import Data.Maybe (fromMaybe)
 import qualified Data.Text as T
 import Text.Pandoc.Class.PandocMonad (PandocMonad)
 import Text.Pandoc.Definition
@@ -22,7 +24,11 @@
 import Text.DocLayout (Doc, brackets, empty, (<+>), text, isEmpty, literal,
                        braces)
 import Text.Pandoc.Walk
-import Text.Pandoc.Writers.LaTeX.Types ( LW )
+import Text.Pandoc.Writers.LaTeX.Types ( LW, WriterState(stLang) )
+import Text.Pandoc.Citeproc.Locator (parseLocator, LocatorInfo(..),
+                                     toLocatorMap)
+import Citeproc.Types (Lang(..))
+import Citeproc.Locale (getLocale)
 
 citationsToNatbib :: PandocMonad m
                   => ([Inline] -> LW m (Doc Text))
@@ -101,11 +107,9 @@
               -> LW m (Doc Text)
 citeArgumentsList _inlineListToLaTeX (CiteGroup _ _ []) = return empty
 citeArgumentsList inlineListToLaTeX (CiteGroup pfxs sfxs ids) = do
-      pdoc <- inlineListToLaTeX pfxs
-      sdoc <- inlineListToLaTeX sfxs'
-      return $ optargs pdoc sdoc <>
-              braces (literal (T.intercalate "," (reverse ids)))
-      where sfxs' = stripLocatorBraces $ case sfxs of
+      mblang <- gets stLang
+      let sfxs' = removePageLabel mblang $
+              stripLocatorBraces $ case sfxs of
                 (Str t : r) -> case T.uncons t of
                   Just (x, xs)
                     | T.null xs
@@ -113,10 +117,14 @@
                     | isPunctuation x -> Str xs : r
                   _ -> sfxs
                 _   -> sfxs
-            optargs pdoc sdoc = case (isEmpty pdoc, isEmpty sdoc) of
+          optargs pdoc sdoc = case (isEmpty pdoc, isEmpty sdoc) of
                  (True, True ) -> empty
                  (True, False) -> brackets sdoc
                  (_   , _    ) -> brackets pdoc <> brackets sdoc
+      pdoc <- inlineListToLaTeX pfxs
+      sdoc <- inlineListToLaTeX sfxs'
+      return $ optargs pdoc sdoc <>
+              braces (literal (T.intercalate "," (reverse ids)))
 
 citeArguments :: PandocMonad m
               => ([Inline] -> LW m (Doc Text))
@@ -180,3 +188,17 @@
                cid = citationId cit
 
 citationsToBiblatex _ _ = return empty
+
+-- | In natbib and biblatex, the label p. or pp. can be
+-- omitted; ranges will be treated as page ranges by default.
+-- See #9275.
+removePageLabel :: Maybe Lang -> [Inline] -> [Inline]
+removePageLabel mblang ils =
+  case mbLocinfo of
+    Just locinfo | locatorLabel locinfo == "page"
+      -> Str (locatorLoc locinfo) : ils'
+    _ -> ils
+ where
+   (mbLocinfo, ils') = parseLocator (toLocatorMap locale) ils
+   lang = fromMaybe (Lang "en" Nothing (Just "US") [] [] []) mblang
+   locale = either mempty id $ getLocale lang
diff --git a/src/Text/Pandoc/Writers/LaTeX/Types.hs b/src/Text/Pandoc/Writers/LaTeX/Types.hs
--- a/src/Text/Pandoc/Writers/LaTeX/Types.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Types.hs
@@ -11,6 +11,7 @@
   ( WriterOptions (writerIncremental, writerTopLevelDivision)
   , TopLevelDivision (..)
   )
+import Citeproc.Types (Lang)
 
 -- | LaTeX writer type. The type constructor @m@ will typically be an
 -- instance of PandocMonad.
@@ -50,6 +51,7 @@
   , stEmptyLine     :: Bool          -- ^ true if no content on line
   , stHasCslRefs    :: Bool          -- ^ has a Div with class refs
   , stIsFirstInDefinition :: Bool    -- ^ first block in a defn list
+  , stLang          :: Maybe Lang    -- ^ lang specified in metadata
   }
 
 startingState :: WriterOptions -> WriterState
@@ -88,4 +90,5 @@
   , stEmptyLine = True
   , stHasCslRefs = False
   , stIsFirstInDefinition = False
+  , stLang = Nothing
   }
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -590,16 +590,19 @@
         | otherwise            = "> "
   contents <- blockListToMarkdown opts blocks
   return $ prefixed leader contents <> blankline
-blockToMarkdown' opts t@(Table _ blkCapt specs thead tbody tfoot) = do
+blockToMarkdown' opts t@(Table (ident,_,_) blkCapt specs thead tbody tfoot) = do
   let (caption, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot
   let numcols = maximum (length aligns :| length widths :
                            map length (headers:rows))
   caption' <- inlineListToMarkdown opts caption
-  let caption''
+  let caption'' = if T.null ident
+                     then caption'
+                     else caption' <+> attrsToMarkdown opts (ident,[],[])
+  let caption'''
         | null caption = blankline
         | isEnabled Ext_table_captions opts
-        = blankline $$ (": " <> caption') $$ blankline
-        | otherwise = blankline $$ caption' $$ blankline
+        = blankline $$ (": " <> caption'') $$ blankline
+        | otherwise = blankline $$ caption'' $$ blankline
   let hasSimpleCells = onlySimpleTableCells $ headers : rows
   let isSimple = hasSimpleCells && all (==0) widths
   let isPlainBlock (Plain _) = True
@@ -652,7 +655,7 @@
                    literal . removeBlankLinesInHTML <$>
                    writeHtml5String opts{ writerTemplate = Nothing } (Pandoc nullMeta [t])
             | otherwise -> return (id, literal "[TABLE]")
-  return $ nst (tbl $$ caption'') $$ blankline
+  return $ nst (tbl $$ caption''') $$ blankline
 blockToMarkdown' opts (BulletList items) = do
   contents <- inList $ mapM (bulletListItemToMarkdown opts) items
   return $ (if isTightList items then vcat else vsep)
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -14,7 +14,8 @@
 module Text.Pandoc.Writers.ODT ( writeODT ) where
 import Codec.Archive.Zip
 import Control.Monad.Except (catchError, throwError)
-import Control.Monad.State.Strict
+import Control.Monad.State.Strict (StateT, evalStateT, gets, modify, lift)
+import Control.Monad (MonadPlus(mplus))
 import qualified Data.ByteString.Lazy as B
 import Data.Maybe (fromMaybe)
 import Data.Generics (everywhere', mkT)
@@ -48,6 +49,7 @@
 import Text.TeXMath
 import qualified Text.XML.Light as XL
 import Network.URI (parseRelativeReference, URI(uriPath))
+import Skylighting
 
 newtype ODTState = ODTState { stEntries :: [Entry]
                          }
@@ -187,29 +189,56 @@
   -- make sure mimetype is first
   let mimetypeEntry = toEntry "mimetype" epochtime
                       $ fromStringLazy "application/vnd.oasis.opendocument.text"
-  archive'' <- updateStyleWithLang lang
+  archive'' <- updateStyle opts lang
                   $ addEntryToArchive mimetypeEntry
                   $ addEntryToArchive metaEntry archive'
   return $ fromArchive archive''
 
-updateStyleWithLang :: PandocMonad m => Maybe Lang -> Archive -> O m Archive
-updateStyleWithLang Nothing arch = return arch
-updateStyleWithLang (Just lang) arch = do
+updateStyle :: forall m . PandocMonad m
+            => WriterOptions -> Maybe Lang -> Archive -> O m Archive
+updateStyle opts mbLang arch = do
   epochtime <- floor `fmap` lift P.getPOSIXTime
-  entries <- mapM (\e -> if eRelativePath e == "styles.xml"
-                            then case parseXMLElement
-                                    (toTextLazy (fromEntry e)) of
-                                    Left msg -> throwError $
-                                        PandocXMLError "styles.xml" msg
-                                    Right d -> return $
-                                      toEntry "styles.xml" epochtime
-                                      ( fromTextLazy
-                                      . TL.fromStrict
-                                      . ppTopElement
-                                      . addLang lang $ d )
-                            else return e) (zEntries arch)
+  let goEntry :: Entry -> O m Entry
+      goEntry e
+        | eRelativePath e == "styles.xml"
+          = case parseXMLElement (toTextLazy (fromEntry e)) of
+              Left msg -> throwError $ PandocXMLError "styles.xml" msg
+              Right d -> return $
+                toEntry "styles.xml" epochtime
+                ( fromTextLazy
+                . TL.fromStrict
+                . showTopElement
+                . maybe id addLang mbLang
+                . transformElement (\qn -> qName qn == "styles" &&
+                                      qPrefix qn == Just "office" )
+                     (maybe id addHlStyles (writerHighlightStyle opts))
+                $ d )
+        | otherwise = pure e
+  entries <- mapM goEntry (zEntries arch)
   return arch{ zEntries = entries }
 
+addHlStyles :: Style -> Element -> Element
+addHlStyles sty el =
+  el{ elContent = filter (not . isHlStyle) (elContent el) ++
+                styleToOpenDocument sty }
+ where
+   isHlStyle (Elem e) = "Tok" `T.isSuffixOf` (qName (elName e))
+   isHlStyle _ = False
+
+-- top-down search
+transformElement :: (QName -> Bool)
+                 -> (Element -> Element)
+                 -> Element
+                 -> Element
+transformElement g f el
+  | g (elName el)
+    = f el
+  | otherwise
+    = el{ elContent = map go (elContent el) }
+ where
+   go (Elem e) = Elem (transformElement g f e)
+   go x = x
+
 -- TODO FIXME avoid this generic traversal!
 addLang :: Lang -> Element -> Element
 addLang lang = everywhere' (mkT updateLangAttr)
@@ -304,3 +333,36 @@
            inTags False "config:config-item" [("config:name", "IsTextMode")
                                              ,("config:type", "boolean")] $
                                               text $ if isTextMode then "true" else "false")
+
+styleToOpenDocument :: Style -> [Content]
+styleToOpenDocument style = map (Elem . toStyle) alltoktypes
+  where alltoktypes = enumFromTo KeywordTok NormalTok
+        styleName x =
+          case T.break (== ':') x of
+            (b, a) | T.null a  -> QName x Nothing (Just "style")
+                   | otherwise -> QName (T.drop 1 a) Nothing (Just b)
+        styleAttr (x, y) = Attr (styleName x) y
+        styleAttrs = map styleAttr
+        styleElement x attrs cs =
+          Element (styleName x) (styleAttrs attrs) cs Nothing
+        toStyle toktype =
+          styleElement "style"
+            [("name", tshow toktype), ("family", "text")]
+            [Elem (styleElement "text-properties"
+                      (tokColor toktype ++ tokBgColor toktype ++
+                        [("fo:font-style", "italic") |
+                           tokFeature tokenItalic toktype ] ++
+                        [("fo:font-weight", "bold") |
+                           tokFeature tokenBold toktype ] ++
+                        [("style:text-underline-style", "solid") |
+                           tokFeature tokenUnderline toktype ])
+                        [])]
+        tokStyles = tokenStyles style
+        tokFeature f toktype = maybe False f $ Map.lookup toktype tokStyles
+        tokColor toktype =
+          maybe [] (\c -> [("fo:color", T.pack (fromColor c))])
+                        ((tokenColor =<< Map.lookup toktype tokStyles)
+                           `mplus` defaultColor style)
+        tokBgColor toktype =
+          maybe [] (\c -> [("fo:background-color", T.pack (fromColor c))])
+                    (tokenBackground =<< Map.lookup toktype tokStyles)
diff --git a/src/Text/Pandoc/Writers/OPML.hs b/src/Text/Pandoc/Writers/OPML.hs
--- a/src/Text/Pandoc/Writers/OPML.hs
+++ b/src/Text/Pandoc/Writers/OPML.hs
@@ -35,9 +35,9 @@
                     else Nothing
       meta' = B.setMeta "date" (B.str $ convertDate $ docDate meta) meta
   metadata <- metaToContext opts
-              (fmap literal . writeMarkdown def . Pandoc nullMeta)
+              (fmap literal . writeMarkdown' opts . Pandoc nullMeta)
               (\ils -> literal . T.stripEnd <$>
-                writeMarkdown def (Pandoc nullMeta [Plain ils]))
+                writeMarkdown' opts (Pandoc nullMeta [Plain ils]))
               meta'
   let blocks' = makeSections False (Just 1) blocks
   main <- render colwidth . vcat <$>
@@ -49,6 +49,11 @@
        Nothing  -> main
        Just tpl -> render colwidth $ renderTemplate tpl context
 
+writeMarkdown' :: PandocMonad m => WriterOptions -> Pandoc -> m Text
+writeMarkdown' opts = writeMarkdown def{ writerWrapText = writerWrapText opts
+                                       , writerColumns = writerColumns opts
+                                       , writerExtensions = pandocExtensions
+                                       }
 
 writeHtmlInlines :: PandocMonad m => [Inline] -> m Text
 writeHtmlInlines ils =
@@ -71,7 +76,7 @@
   htmlIls <- writeHtmlInlines title
   md <- if null blocks
         then return mempty
-        else writeMarkdown def $ Pandoc nullMeta blocks
+        else writeMarkdown' opts $ Pandoc nullMeta blocks
   let attrs = ("text", htmlIls) :
               [("_note", T.stripEnd md) | not (null blocks)]
   rest' <- vcat <$> mapM (blockToOPML opts) rest
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
@@ -15,7 +15,7 @@
 -}
 module Text.Pandoc.Writers.OpenDocument ( writeOpenDocument ) where
 import Control.Arrow ((***), (>>>))
-import Control.Monad (unless, liftM, MonadPlus(mplus))
+import Control.Monad (unless, liftM)
 import Control.Monad.State.Strict ( StateT(..), modify, gets, lift )
 import Data.Char (chr)
 import Data.Foldable (find)
@@ -44,8 +44,7 @@
 import Text.Pandoc.XML
 import Text.Printf (printf)
 import Text.Pandoc.Highlighting (highlight)
-import Skylighting
-import qualified Data.Map as M
+import Skylighting (FormatOptions(..), SourceLine, Token)
 
 -- | Auxiliary function to convert Plain block to Para.
 plainToPara :: Block -> Block
@@ -268,11 +267,9 @@
                           [("style:name", "L" <> tshow n)] (vcat l)
   let listStyles  = map listStyle (stListStyles s)
   let automaticStyles = vcat $ reverse $ styles ++ listStyles
-  let highlightingStyles = maybe mempty styleToOpenDocument (writerHighlightStyle opts)
   let context = defField "body" body
               . defField "toc" (writerTableOfContents opts)
               . defField "toc-depth" (tshow $ writerTOCDepth opts)
-              . defField "highlighting-styles" highlightingStyles
               . defField "automatic-styles" automaticStyles
               $ metadata
   return $ render colwidth $
@@ -922,24 +919,3 @@
               Left _ -> do
                 report $ InvalidLang l
                 action
-
-styleToOpenDocument :: Style -> Doc Text
-styleToOpenDocument style = vcat (map toStyle alltoktypes)
-  where alltoktypes = enumFromTo KeywordTok NormalTok
-        toStyle toktype = inTags True "style:style" [("style:name", tshow toktype),
-                                                     ("style:family", "text")] $
-                             selfClosingTag "style:text-properties"
-                               (tokColor toktype ++ tokBgColor toktype ++
-                                 [("fo:font-style", "italic") |
-                                    tokFeature tokenItalic toktype ] ++
-                                 [("fo:font-weight", "bold") |
-                                    tokFeature tokenBold toktype ] ++
-                                 [("style:text-underline-style", "solid") |
-                                    tokFeature tokenUnderline toktype ])
-        tokStyles = tokenStyles style
-        tokFeature f toktype = maybe False f $ M.lookup toktype tokStyles
-        tokColor toktype = maybe [] (\c -> [("fo:color", T.pack (fromColor c))])
-                         $ (tokenColor =<< M.lookup toktype tokStyles)
-                           `mplus` defaultColor style
-        tokBgColor toktype = maybe [] (\c -> [("fo:background-color", T.pack (fromColor c))])
-                         $ (tokenBackground =<< M.lookup toktype tokStyles)
diff --git a/test/Tests/Writers/OOXML.hs b/test/Tests/Writers/OOXML.hs
--- a/test/Tests/Writers/OOXML.hs
+++ b/test/Tests/Writers/OOXML.hs
@@ -45,6 +45,11 @@
      (Comparison { mine = sort (elAttribs myElem)
                  , good = sort (elAttribs goodElem)
                  })))
+  <|> (if length (elContent myElem) == length (elContent goodElem)
+   then Nothing
+   else Just
+    (ElemChildrenDiffer
+      (Comparison { mine = elContent myElem, good = elContent goodElem})))
   <|> asum (zipWith compareXML (elContent myElem) (elContent goodElem))
 compareXML (Text goodCData) (Text myCData) =
   (if cdVerbatim myCData == cdVerbatim goodCData
@@ -60,6 +65,7 @@
 data XMLDifference
   = ElemNamesDiffer (Comparison QName)
   | ElemAttributesDiffer (Comparison [Attr])
+  | ElemChildrenDiffer (Comparison [Content])
   | CDatasDiffer (Comparison CData)
   | CRefsDiffer (Comparison String)
   | OtherContentsDiffer (Comparison Content)
diff --git a/test/command/6792.md b/test/command/6792.md
--- a/test/command/6792.md
+++ b/test/command/6792.md
@@ -21,101 +21,6 @@
   <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>
-  <office:styles>
-    <style:style style:name="KeywordTok" style:family="text">
-      <style:text-properties fo:color="#007020" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="DataTypeTok" style:family="text">
-      <style:text-properties fo:color="#902000" />
-    </style:style>
-    <style:style style:name="DecValTok" style:family="text">
-      <style:text-properties fo:color="#40a070" />
-    </style:style>
-    <style:style style:name="BaseNTok" style:family="text">
-      <style:text-properties fo:color="#40a070" />
-    </style:style>
-    <style:style style:name="FloatTok" style:family="text">
-      <style:text-properties fo:color="#40a070" />
-    </style:style>
-    <style:style style:name="ConstantTok" style:family="text">
-      <style:text-properties fo:color="#880000" />
-    </style:style>
-    <style:style style:name="CharTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="SpecialCharTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="StringTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="VerbatimStringTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="SpecialStringTok" style:family="text">
-      <style:text-properties fo:color="#bb6688" />
-    </style:style>
-    <style:style style:name="ImportTok" style:family="text">
-      <style:text-properties fo:color="#008000" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="CommentTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" />
-    </style:style>
-    <style:style style:name="DocumentationTok" style:family="text">
-      <style:text-properties fo:color="#ba2121" fo:font-style="italic" />
-    </style:style>
-    <style:style style:name="AnnotationTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="CommentVarTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="OtherTok" style:family="text">
-      <style:text-properties fo:color="#007020" />
-    </style:style>
-    <style:style style:name="FunctionTok" style:family="text">
-      <style:text-properties fo:color="#06287e" />
-    </style:style>
-    <style:style style:name="VariableTok" style:family="text">
-      <style:text-properties fo:color="#19177c" />
-    </style:style>
-    <style:style style:name="ControlFlowTok" style:family="text">
-      <style:text-properties fo:color="#007020" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="OperatorTok" style:family="text">
-      <style:text-properties fo:color="#666666" />
-    </style:style>
-    <style:style style:name="BuiltInTok" style:family="text">
-      <style:text-properties fo:color="#008000" />
-    </style:style>
-    <style:style style:name="ExtensionTok" style:family="text">
-      <style:text-properties />
-    </style:style>
-    <style:style style:name="PreprocessorTok" style:family="text">
-      <style:text-properties fo:color="#bc7a00" />
-    </style:style>
-    <style:style style:name="AttributeTok" style:family="text">
-      <style:text-properties fo:color="#7d9029" />
-    </style:style>
-    <style:style style:name="RegionMarkerTok" style:family="text">
-      <style:text-properties />
-    </style:style>
-    <style:style style:name="InformationTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="WarningTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="AlertTok" style:family="text">
-      <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="ErrorTok" style:family="text">
-      <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="NormalTok" style:family="text">
-      <style:text-properties />
-    </style:style>
-  </office:styles>
   <office:automatic-styles>
     <style:style style:name="fr2" style:family="graphic" style:parent-style-name="Formula"><style:graphic-properties style:vertical-pos="middle" style:vertical-rel="text" style:horizontal-pos="center" style:horizontal-rel="paragraph-content" style:wrap="none" /></style:style>
     <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Formula"><style:graphic-properties style:vertical-pos="middle" style:vertical-rel="text" /></style:style>
diff --git a/test/command/8256.md b/test/command/8256.md
--- a/test/command/8256.md
+++ b/test/command/8256.md
@@ -15,101 +15,6 @@
   <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>
-  <office:styles>
-    <style:style style:name="KeywordTok" style:family="text">
-      <style:text-properties fo:color="#007020" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="DataTypeTok" style:family="text">
-      <style:text-properties fo:color="#902000" />
-    </style:style>
-    <style:style style:name="DecValTok" style:family="text">
-      <style:text-properties fo:color="#40a070" />
-    </style:style>
-    <style:style style:name="BaseNTok" style:family="text">
-      <style:text-properties fo:color="#40a070" />
-    </style:style>
-    <style:style style:name="FloatTok" style:family="text">
-      <style:text-properties fo:color="#40a070" />
-    </style:style>
-    <style:style style:name="ConstantTok" style:family="text">
-      <style:text-properties fo:color="#880000" />
-    </style:style>
-    <style:style style:name="CharTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="SpecialCharTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="StringTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="VerbatimStringTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="SpecialStringTok" style:family="text">
-      <style:text-properties fo:color="#bb6688" />
-    </style:style>
-    <style:style style:name="ImportTok" style:family="text">
-      <style:text-properties fo:color="#008000" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="CommentTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" />
-    </style:style>
-    <style:style style:name="DocumentationTok" style:family="text">
-      <style:text-properties fo:color="#ba2121" fo:font-style="italic" />
-    </style:style>
-    <style:style style:name="AnnotationTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="CommentVarTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="OtherTok" style:family="text">
-      <style:text-properties fo:color="#007020" />
-    </style:style>
-    <style:style style:name="FunctionTok" style:family="text">
-      <style:text-properties fo:color="#06287e" />
-    </style:style>
-    <style:style style:name="VariableTok" style:family="text">
-      <style:text-properties fo:color="#19177c" />
-    </style:style>
-    <style:style style:name="ControlFlowTok" style:family="text">
-      <style:text-properties fo:color="#007020" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="OperatorTok" style:family="text">
-      <style:text-properties fo:color="#666666" />
-    </style:style>
-    <style:style style:name="BuiltInTok" style:family="text">
-      <style:text-properties fo:color="#008000" />
-    </style:style>
-    <style:style style:name="ExtensionTok" style:family="text">
-      <style:text-properties />
-    </style:style>
-    <style:style style:name="PreprocessorTok" style:family="text">
-      <style:text-properties fo:color="#bc7a00" />
-    </style:style>
-    <style:style style:name="AttributeTok" style:family="text">
-      <style:text-properties fo:color="#7d9029" />
-    </style:style>
-    <style:style style:name="RegionMarkerTok" style:family="text">
-      <style:text-properties />
-    </style:style>
-    <style:style style:name="InformationTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="WarningTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="AlertTok" style:family="text">
-      <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="ErrorTok" style:family="text">
-      <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="NormalTok" style:family="text">
-      <style:text-properties />
-    </style:style>
-  </office:styles>
   <office:automatic-styles>
     <style:style style:name="T1" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
     <style:style style:name="fr2" style:family="graphic" style:parent-style-name="Formula"><style:graphic-properties style:vertical-pos="middle" style:vertical-rel="text" style:horizontal-pos="center" style:horizontal-rel="paragraph-content" style:wrap="none" /></style:style>
diff --git a/test/command/9275.md b/test/command/9275.md
new file mode 100644
--- /dev/null
+++ b/test/command/9275.md
@@ -0,0 +1,18 @@
+```
+% pandoc -t latex --biblatex
+[@scott2000, p. 33]
+[@scott2000, pp. 33-34 and elsewhere; @scott2001, ch. 4]
+^D
+\autocite[33]{scott2000} \autocites[33-34 and
+elsewhere]{scott2000}[ch.~4]{scott2001}
+
+```
+
+```
+% pandoc -t latex --biblatex -Mlang=de
+[@scott2000, p. 33]
+[@scott2000, S. 33]
+^D
+\autocite[p.~33]{scott2000} \autocite[33]{scott2000}
+
+```
diff --git a/test/command/9279.md b/test/command/9279.md
new file mode 100644
--- /dev/null
+++ b/test/command/9279.md
@@ -0,0 +1,131 @@
+```
+% pandoc -f org -t native
+#+LABEL: tbl:Cosasexample
+#+CAPTION: Cosas
++-------+-------+
+| cosas | cosas |
+| cosas | cosas |
++=======+=======+
+| cosas | cosas |
+| cosas | cosas |
++-------+-------+
+^D
+[ Table
+    ( "tbl:Cosasexample" , [] , [] )
+    (Caption Nothing [ Plain [ Str "Cosas" ] ])
+    [ ( AlignDefault , ColWidth 0.1111111111111111 )
+    , ( AlignDefault , ColWidth 0.1111111111111111 )
+    ]
+    (TableHead
+       ( "" , [] , [] )
+       [ Row
+           ( "" , [] , [] )
+           [ Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "cosas" , SoftBreak , Str "cosas" ] ]
+           , Cell
+               ( "" , [] , [] )
+               AlignDefault
+               (RowSpan 1)
+               (ColSpan 1)
+               [ Plain [ Str "cosas" , SoftBreak , Str "cosas" ] ]
+           ]
+       ])
+    [ TableBody
+        ( "" , [] , [] )
+        (RowHeadColumns 0)
+        []
+        [ Row
+            ( "" , [] , [] )
+            [ Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "cosas" , SoftBreak , Str "cosas" ] ]
+            , Cell
+                ( "" , [] , [] )
+                AlignDefault
+                (RowSpan 1)
+                (ColSpan 1)
+                [ Plain [ Str "cosas" , SoftBreak , Str "cosas" ] ]
+            ]
+        ]
+    ]
+    (TableFoot ( "" , [] , [] ) [])
+]
+```
+
+```
+% pandoc -f org -t markdown
+#+LABEL: tbl:Cosasexample
+#+CAPTION: Cosas
++-------+-------+
+| cosas | cosas |
+| cosas | cosas |
++=======+=======+
+| cosas | cosas |
+| cosas | cosas |
++-------+-------+
+^D
+  ---------------
+  cosas   cosas
+  cosas   cosas
+  ------- -------
+  cosas   cosas
+  cosas   cosas
+
+  ---------------
+
+  : Cosas {#tbl:Cosasexample}
+
+```
+
+```
+% pandoc -f org -t markdown
+#+LABEL: tbl:Cosasexample
++-------+-------+
+| cosas | cosas |
+| cosas | cosas |
++=======+=======+
+| cosas | cosas |
+| cosas | cosas |
++-------+-------+
+^D
+  ---------------
+  cosas   cosas
+  cosas   cosas
+  ------- -------
+  cosas   cosas
+  cosas   cosas
+
+  ---------------
+
+```
+
+```
+% pandoc -f org -t markdown
+#+CAPTION: Cosas
++-------+-------+
+| cosas | cosas |
+| cosas | cosas |
++=======+=======+
+| cosas | cosas |
+| cosas | cosas |
++-------+-------+
+^D
+  ---------------
+  cosas   cosas
+  cosas   cosas
+  ------- -------
+  cosas   cosas
+  cosas   cosas
+
+  ---------------
+
+  : Cosas
+
+```
diff --git a/test/command/9293.md b/test/command/9293.md
new file mode 100644
--- /dev/null
+++ b/test/command/9293.md
@@ -0,0 +1,29 @@
+```
+% pandoc -f mediawiki -t native
+* Linearity in the first argument:
+*:<math>\begin{align}
+\langle a \mathbf u, \mathbf v\rangle &= a \langle \mathbf u, \mathbf v\rangle. \\
+\langle \mathbf u + \mathbf v, \mathbf w\rangle &= \langle \mathbf u, \mathbf w\rangle+ \langle \mathbf v, \mathbf w\rangle.
+\end{align}</math>
+^D
+[ BulletList
+    [ [ Plain
+          [ Str "Linearity"
+          , Space
+          , Str "in"
+          , Space
+          , Str "the"
+          , Space
+          , Str "first"
+          , Space
+          , Str "argument:"
+          ]
+      , Para
+          [ Math
+              DisplayMath
+              "\\begin{align}\n\\langle a \\mathbf u, \\mathbf v\\rangle &= a \\langle \\mathbf u, \\mathbf v\\rangle. \\\\\n\\langle \\mathbf u + \\mathbf v, \\mathbf w\\rangle &= \\langle \\mathbf u, \\mathbf w\\rangle+ \\langle \\mathbf v, \\mathbf w\\rangle.\n\\end{align}"
+          ]
+      ]
+    ]
+]
+```
diff --git a/test/docx/golden/block_quotes.docx b/test/docx/golden/block_quotes.docx
Binary files a/test/docx/golden/block_quotes.docx and b/test/docx/golden/block_quotes.docx differ
diff --git a/test/docx/golden/codeblock.docx b/test/docx/golden/codeblock.docx
Binary files a/test/docx/golden/codeblock.docx and b/test/docx/golden/codeblock.docx differ
diff --git a/test/docx/golden/comments.docx b/test/docx/golden/comments.docx
Binary files a/test/docx/golden/comments.docx and b/test/docx/golden/comments.docx differ
diff --git a/test/docx/golden/custom_style_no_reference.docx b/test/docx/golden/custom_style_no_reference.docx
Binary files a/test/docx/golden/custom_style_no_reference.docx and b/test/docx/golden/custom_style_no_reference.docx differ
diff --git a/test/docx/golden/custom_style_preserve.docx b/test/docx/golden/custom_style_preserve.docx
Binary files a/test/docx/golden/custom_style_preserve.docx and b/test/docx/golden/custom_style_preserve.docx differ
diff --git a/test/docx/golden/custom_style_reference.docx b/test/docx/golden/custom_style_reference.docx
Binary files a/test/docx/golden/custom_style_reference.docx and b/test/docx/golden/custom_style_reference.docx differ
diff --git a/test/docx/golden/definition_list.docx b/test/docx/golden/definition_list.docx
Binary files a/test/docx/golden/definition_list.docx and b/test/docx/golden/definition_list.docx differ
diff --git a/test/docx/golden/document-properties-short-desc.docx b/test/docx/golden/document-properties-short-desc.docx
Binary files a/test/docx/golden/document-properties-short-desc.docx and b/test/docx/golden/document-properties-short-desc.docx differ
diff --git a/test/docx/golden/document-properties.docx b/test/docx/golden/document-properties.docx
Binary files a/test/docx/golden/document-properties.docx and b/test/docx/golden/document-properties.docx differ
diff --git a/test/docx/golden/headers.docx b/test/docx/golden/headers.docx
Binary files a/test/docx/golden/headers.docx and b/test/docx/golden/headers.docx differ
diff --git a/test/docx/golden/image.docx b/test/docx/golden/image.docx
Binary files a/test/docx/golden/image.docx and b/test/docx/golden/image.docx differ
diff --git a/test/docx/golden/inline_code.docx b/test/docx/golden/inline_code.docx
Binary files a/test/docx/golden/inline_code.docx and b/test/docx/golden/inline_code.docx differ
diff --git a/test/docx/golden/inline_formatting.docx b/test/docx/golden/inline_formatting.docx
Binary files a/test/docx/golden/inline_formatting.docx and b/test/docx/golden/inline_formatting.docx differ
diff --git a/test/docx/golden/inline_images.docx b/test/docx/golden/inline_images.docx
Binary files a/test/docx/golden/inline_images.docx and b/test/docx/golden/inline_images.docx differ
diff --git a/test/docx/golden/link_in_notes.docx b/test/docx/golden/link_in_notes.docx
Binary files a/test/docx/golden/link_in_notes.docx and b/test/docx/golden/link_in_notes.docx differ
diff --git a/test/docx/golden/links.docx b/test/docx/golden/links.docx
Binary files a/test/docx/golden/links.docx and b/test/docx/golden/links.docx differ
diff --git a/test/docx/golden/lists.docx b/test/docx/golden/lists.docx
Binary files a/test/docx/golden/lists.docx and b/test/docx/golden/lists.docx differ
diff --git a/test/docx/golden/lists_continuing.docx b/test/docx/golden/lists_continuing.docx
Binary files a/test/docx/golden/lists_continuing.docx and b/test/docx/golden/lists_continuing.docx differ
diff --git a/test/docx/golden/lists_div_bullets.docx b/test/docx/golden/lists_div_bullets.docx
Binary files a/test/docx/golden/lists_div_bullets.docx and b/test/docx/golden/lists_div_bullets.docx differ
diff --git a/test/docx/golden/lists_multiple_initial.docx b/test/docx/golden/lists_multiple_initial.docx
Binary files a/test/docx/golden/lists_multiple_initial.docx and b/test/docx/golden/lists_multiple_initial.docx differ
diff --git a/test/docx/golden/lists_restarting.docx b/test/docx/golden/lists_restarting.docx
Binary files a/test/docx/golden/lists_restarting.docx and b/test/docx/golden/lists_restarting.docx differ
diff --git a/test/docx/golden/nested_anchors_in_header.docx b/test/docx/golden/nested_anchors_in_header.docx
Binary files a/test/docx/golden/nested_anchors_in_header.docx and b/test/docx/golden/nested_anchors_in_header.docx differ
diff --git a/test/docx/golden/notes.docx b/test/docx/golden/notes.docx
Binary files a/test/docx/golden/notes.docx and b/test/docx/golden/notes.docx differ
diff --git a/test/docx/golden/raw-blocks.docx b/test/docx/golden/raw-blocks.docx
Binary files a/test/docx/golden/raw-blocks.docx and b/test/docx/golden/raw-blocks.docx differ
diff --git a/test/docx/golden/raw-bookmarks.docx b/test/docx/golden/raw-bookmarks.docx
Binary files a/test/docx/golden/raw-bookmarks.docx and b/test/docx/golden/raw-bookmarks.docx differ
diff --git a/test/docx/golden/table_one_row.docx b/test/docx/golden/table_one_row.docx
Binary files a/test/docx/golden/table_one_row.docx and b/test/docx/golden/table_one_row.docx differ
diff --git a/test/docx/golden/table_with_list_cell.docx b/test/docx/golden/table_with_list_cell.docx
Binary files a/test/docx/golden/table_with_list_cell.docx and b/test/docx/golden/table_with_list_cell.docx differ
diff --git a/test/docx/golden/tables-default-widths.docx b/test/docx/golden/tables-default-widths.docx
Binary files a/test/docx/golden/tables-default-widths.docx and b/test/docx/golden/tables-default-widths.docx differ
diff --git a/test/docx/golden/tables.docx b/test/docx/golden/tables.docx
Binary files a/test/docx/golden/tables.docx and b/test/docx/golden/tables.docx differ
diff --git a/test/docx/golden/tables_separated_with_rawblock.docx b/test/docx/golden/tables_separated_with_rawblock.docx
Binary files a/test/docx/golden/tables_separated_with_rawblock.docx and b/test/docx/golden/tables_separated_with_rawblock.docx differ
diff --git a/test/docx/golden/track_changes_deletion.docx b/test/docx/golden/track_changes_deletion.docx
Binary files a/test/docx/golden/track_changes_deletion.docx and b/test/docx/golden/track_changes_deletion.docx differ
diff --git a/test/docx/golden/track_changes_insertion.docx b/test/docx/golden/track_changes_insertion.docx
Binary files a/test/docx/golden/track_changes_insertion.docx and b/test/docx/golden/track_changes_insertion.docx differ
diff --git a/test/docx/golden/track_changes_move.docx b/test/docx/golden/track_changes_move.docx
Binary files a/test/docx/golden/track_changes_move.docx and b/test/docx/golden/track_changes_move.docx differ
diff --git a/test/docx/golden/track_changes_scrubbed_metadata.docx b/test/docx/golden/track_changes_scrubbed_metadata.docx
Binary files a/test/docx/golden/track_changes_scrubbed_metadata.docx and b/test/docx/golden/track_changes_scrubbed_metadata.docx differ
diff --git a/test/docx/golden/unicode.docx b/test/docx/golden/unicode.docx
Binary files a/test/docx/golden/unicode.docx and b/test/docx/golden/unicode.docx differ
diff --git a/test/docx/golden/verbatim_subsuper.docx b/test/docx/golden/verbatim_subsuper.docx
Binary files a/test/docx/golden/verbatim_subsuper.docx and b/test/docx/golden/verbatim_subsuper.docx differ
diff --git a/test/lhs-test.html b/test/lhs-test.html
--- a/test/lhs-test.html
+++ b/test/lhs-test.html
@@ -231,9 +231,6 @@
     code span.vs { color: #4070a0; } /* VerbatimString */
     code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
   </style>
-  <!--[if lt IE 9]>
-    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
-  <![endif]-->
 </head>
 <body>
 <h1 id="lhs-test">lhs test</h1>
diff --git a/test/lhs-test.html+lhs b/test/lhs-test.html+lhs
--- a/test/lhs-test.html+lhs
+++ b/test/lhs-test.html+lhs
@@ -231,9 +231,6 @@
     code span.vs { color: #4070a0; } /* VerbatimString */
     code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
   </style>
-  <!--[if lt IE 9]>
-    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
-  <![endif]-->
 </head>
 <body>
 <h1 id="lhs-test">lhs test</h1>
diff --git a/test/writer.html5 b/test/writer.html5
--- a/test/writer.html5
+++ b/test/writer.html5
@@ -170,9 +170,6 @@
     }
     .display.math{display: block; text-align: center; margin: 0.5rem auto;}
   </style>
-  <!--[if lt IE 9]>
-    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
-  <![endif]-->
 </head>
 <body>
 <header id="title-block-header">
diff --git a/test/writer.opendocument b/test/writer.opendocument
--- a/test/writer.opendocument
+++ b/test/writer.opendocument
@@ -3,101 +3,6 @@
   <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>
-  <office:styles>
-    <style:style style:name="KeywordTok" style:family="text">
-      <style:text-properties fo:color="#007020" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="DataTypeTok" style:family="text">
-      <style:text-properties fo:color="#902000" />
-    </style:style>
-    <style:style style:name="DecValTok" style:family="text">
-      <style:text-properties fo:color="#40a070" />
-    </style:style>
-    <style:style style:name="BaseNTok" style:family="text">
-      <style:text-properties fo:color="#40a070" />
-    </style:style>
-    <style:style style:name="FloatTok" style:family="text">
-      <style:text-properties fo:color="#40a070" />
-    </style:style>
-    <style:style style:name="ConstantTok" style:family="text">
-      <style:text-properties fo:color="#880000" />
-    </style:style>
-    <style:style style:name="CharTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="SpecialCharTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="StringTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="VerbatimStringTok" style:family="text">
-      <style:text-properties fo:color="#4070a0" />
-    </style:style>
-    <style:style style:name="SpecialStringTok" style:family="text">
-      <style:text-properties fo:color="#bb6688" />
-    </style:style>
-    <style:style style:name="ImportTok" style:family="text">
-      <style:text-properties fo:color="#008000" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="CommentTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" />
-    </style:style>
-    <style:style style:name="DocumentationTok" style:family="text">
-      <style:text-properties fo:color="#ba2121" fo:font-style="italic" />
-    </style:style>
-    <style:style style:name="AnnotationTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="CommentVarTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="OtherTok" style:family="text">
-      <style:text-properties fo:color="#007020" />
-    </style:style>
-    <style:style style:name="FunctionTok" style:family="text">
-      <style:text-properties fo:color="#06287e" />
-    </style:style>
-    <style:style style:name="VariableTok" style:family="text">
-      <style:text-properties fo:color="#19177c" />
-    </style:style>
-    <style:style style:name="ControlFlowTok" style:family="text">
-      <style:text-properties fo:color="#007020" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="OperatorTok" style:family="text">
-      <style:text-properties fo:color="#666666" />
-    </style:style>
-    <style:style style:name="BuiltInTok" style:family="text">
-      <style:text-properties fo:color="#008000" />
-    </style:style>
-    <style:style style:name="ExtensionTok" style:family="text">
-      <style:text-properties />
-    </style:style>
-    <style:style style:name="PreprocessorTok" style:family="text">
-      <style:text-properties fo:color="#bc7a00" />
-    </style:style>
-    <style:style style:name="AttributeTok" style:family="text">
-      <style:text-properties fo:color="#7d9029" />
-    </style:style>
-    <style:style style:name="RegionMarkerTok" style:family="text">
-      <style:text-properties />
-    </style:style>
-    <style:style style:name="InformationTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="WarningTok" style:family="text">
-      <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="AlertTok" style:family="text">
-      <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="ErrorTok" style:family="text">
-      <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />
-    </style:style>
-    <style:style style:name="NormalTok" style:family="text">
-      <style:text-properties />
-    </style:style>
-  </office:styles>
   <office:automatic-styles>
     <text:list-style style:name="L1">
       <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">
diff --git a/test/writer.opml b/test/writer.opml
--- a/test/writer.opml
+++ b/test/writer.opml
@@ -21,52 +21,52 @@
     <outline text="Level 3" _note="with no blank line">
     </outline>
   </outline>
-  <outline text="Level 2" _note="with no blank line&#10;&#10;------------------------------------------------------------------------">
+  <outline text="Level 2" _note="with no blank line&#10;&#10;--------------------------------------------------------------------------------">
   </outline>
 </outline>
-<outline text="Paragraphs" _note="Here’s a regular paragraph.&#10;&#10;In Markdown 1.0.0 and earlier. Version 8. This line turns into a list&#10;item. Because a hard-wrapped line in the middle of a paragraph looked&#10;like a list item.&#10;&#10;Here’s one with a bullet. \* criminey.&#10;&#10;There should be a hard line break  &#10;here.&#10;&#10;------------------------------------------------------------------------">
+<outline text="Paragraphs" _note="Here's a regular paragraph.&#10;&#10;In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.&#10;Because a hard-wrapped line in the middle of a paragraph looked like a list&#10;item.&#10;&#10;Here's one with a bullet. \* criminey.&#10;&#10;There should be a hard line break\&#10;here.&#10;&#10;--------------------------------------------------------------------------------">
 </outline>
-<outline text="Block Quotes" _note="E-mail style:&#10;&#10;&gt; This is a block quote. It is pretty short.&#10;&#10;&gt; Code in a block quote:&#10;&gt;&#10;&gt;     sub status {&#10;&gt;         print &quot;working&quot;;&#10;&gt;     }&#10;&gt;&#10;&gt; A list:&#10;&gt;&#10;&gt; 1.  item one&#10;&gt; 2.  item two&#10;&gt;&#10;&gt; Nested block quotes:&#10;&gt;&#10;&gt; &gt; nested&#10;&gt;&#10;&gt; &gt; nested&#10;&#10;This should not be a block quote: 2 &amp;gt; 1.&#10;&#10;And a following paragraph.&#10;&#10;------------------------------------------------------------------------">
+<outline text="Block Quotes" _note="E-mail style:&#10;&#10;&gt; This is a block quote. It is pretty short.&#10;&#10;&gt; Code in a block quote:&#10;&gt;&#10;&gt;     sub status {&#10;&gt;         print &quot;working&quot;;&#10;&gt;     }&#10;&gt;&#10;&gt; A list:&#10;&gt;&#10;&gt; 1.  item one&#10;&gt; 2.  item two&#10;&gt;&#10;&gt; Nested block quotes:&#10;&gt;&#10;&gt; &gt; nested&#10;&gt;&#10;&gt; &gt; nested&#10;&#10;This should not be a block quote: 2 \&gt; 1.&#10;&#10;And a following paragraph.&#10;&#10;--------------------------------------------------------------------------------">
 </outline>
-<outline text="Code Blocks" _note="Code:&#10;&#10;    ---- (should be four hyphens)&#10;&#10;    sub status {&#10;        print &quot;working&quot;;&#10;    }&#10;&#10;    this code block is indented by one tab&#10;&#10;And:&#10;&#10;        this code block is indented by two tabs&#10;&#10;    These should not be escaped:  \$ \\ \&gt; \[ \{&#10;&#10;------------------------------------------------------------------------">
+<outline text="Code Blocks" _note="Code:&#10;&#10;    ---- (should be four hyphens)&#10;&#10;    sub status {&#10;        print &quot;working&quot;;&#10;    }&#10;&#10;    this code block is indented by one tab&#10;&#10;And:&#10;&#10;        this code block is indented by two tabs&#10;&#10;    These should not be escaped:  \$ \\ \&gt; \[ \{&#10;&#10;--------------------------------------------------------------------------------">
 </outline>
 <outline text="Lists">
   <outline text="Unordered" _note="Asterisks tight:&#10;&#10;-   asterisk 1&#10;-   asterisk 2&#10;-   asterisk 3&#10;&#10;Asterisks loose:&#10;&#10;-   asterisk 1&#10;&#10;-   asterisk 2&#10;&#10;-   asterisk 3&#10;&#10;Pluses tight:&#10;&#10;-   Plus 1&#10;-   Plus 2&#10;-   Plus 3&#10;&#10;Pluses loose:&#10;&#10;-   Plus 1&#10;&#10;-   Plus 2&#10;&#10;-   Plus 3&#10;&#10;Minuses tight:&#10;&#10;-   Minus 1&#10;-   Minus 2&#10;-   Minus 3&#10;&#10;Minuses loose:&#10;&#10;-   Minus 1&#10;&#10;-   Minus 2&#10;&#10;-   Minus 3">
   </outline>
-  <outline text="Ordered" _note="Tight:&#10;&#10;1.  First&#10;2.  Second&#10;3.  Third&#10;&#10;and:&#10;&#10;1.  One&#10;2.  Two&#10;3.  Three&#10;&#10;Loose using tabs:&#10;&#10;1.  First&#10;&#10;2.  Second&#10;&#10;3.  Third&#10;&#10;and using spaces:&#10;&#10;1.  One&#10;&#10;2.  Two&#10;&#10;3.  Three&#10;&#10;Multiple paragraphs:&#10;&#10;1.  Item 1, graf one.&#10;&#10;    Item 1. graf two. The quick brown fox jumped over the lazy dog’s&#10;    back.&#10;&#10;2.  Item 2.&#10;&#10;3.  Item 3.">
+  <outline text="Ordered" _note="Tight:&#10;&#10;1.  First&#10;2.  Second&#10;3.  Third&#10;&#10;and:&#10;&#10;1.  One&#10;2.  Two&#10;3.  Three&#10;&#10;Loose using tabs:&#10;&#10;1.  First&#10;&#10;2.  Second&#10;&#10;3.  Third&#10;&#10;and using spaces:&#10;&#10;1.  One&#10;&#10;2.  Two&#10;&#10;3.  Three&#10;&#10;Multiple paragraphs:&#10;&#10;1.  Item 1, graf one.&#10;&#10;    Item 1. graf two. The quick brown fox jumped over the lazy dog's back.&#10;&#10;2.  Item 2.&#10;&#10;3.  Item 3.">
   </outline>
-  <outline text="Nested" _note="-   Tab&#10;    -   Tab&#10;        -   Tab&#10;&#10;Here’s another:&#10;&#10;1.  First&#10;2.  Second:&#10;    -   Fee&#10;    -   Fie&#10;    -   Foe&#10;3.  Third&#10;&#10;Same thing but with paragraphs:&#10;&#10;1.  First&#10;&#10;2.  Second:&#10;&#10;    -   Fee&#10;    -   Fie&#10;    -   Foe&#10;&#10;3.  Third">
+  <outline text="Nested" _note="-   Tab&#10;    -   Tab&#10;        -   Tab&#10;&#10;Here's another:&#10;&#10;1.  First&#10;2.  Second:&#10;    -   Fee&#10;    -   Fie&#10;    -   Foe&#10;3.  Third&#10;&#10;Same thing but with paragraphs:&#10;&#10;1.  First&#10;&#10;2.  Second:&#10;&#10;    -   Fee&#10;    -   Fie&#10;    -   Foe&#10;&#10;3.  Third">
   </outline>
   <outline text="Tabs and spaces" _note="-   this is a list item indented with tabs&#10;&#10;-   this is a list item indented with spaces&#10;&#10;    -   this is an example list item indented with tabs&#10;&#10;    -   this is an example list item indented with spaces">
   </outline>
-  <outline text="Fancy list markers" _note="1.  begins with 2&#10;&#10;2.  and now 3&#10;&#10;    with a continuation&#10;&#10;    1.  sublist with roman numerals, starting with 4&#10;    2.  more items&#10;        1.  a subsublist&#10;        2.  a subsublist&#10;&#10;Nesting:&#10;&#10;1.  Upper Alpha&#10;    1.  Upper Roman.&#10;        1.  Decimal start with 6&#10;            1.  Lower alpha with paren&#10;&#10;Autonumbering:&#10;&#10;1.  Autonumber.&#10;2.  More.&#10;    1.  Nested.&#10;&#10;Should not be a list item:&#10;&#10;M.A. 2007&#10;&#10;B. Williams&#10;&#10;------------------------------------------------------------------------">
+  <outline text="Fancy list markers" _note="(2) begins with 2&#10;&#10;(3) and now 3&#10;&#10;    with a continuation&#10;&#10;    iv. sublist with roman numerals, starting with 4&#10;    v.  more items&#10;        (A) a subsublist&#10;        (B) a subsublist&#10;&#10;Nesting:&#10;&#10;A.  Upper Alpha&#10;    I.  Upper Roman.&#10;        (6) Decimal start with 6&#10;            c)  Lower alpha with paren&#10;&#10;Autonumbering:&#10;&#10;1.  Autonumber.&#10;2.  More.&#10;    1.  Nested.&#10;&#10;Should not be a list item:&#10;&#10;M.A. 2007&#10;&#10;B. Williams&#10;&#10;--------------------------------------------------------------------------------">
   </outline>
 </outline>
-<outline text="Definition Lists" _note="Tight using spaces:&#10;&#10;apple  &#10;red fruit&#10;&#10;orange  &#10;orange fruit&#10;&#10;banana  &#10;yellow fruit&#10;&#10;Tight using tabs:&#10;&#10;apple  &#10;red fruit&#10;&#10;orange  &#10;orange fruit&#10;&#10;banana  &#10;yellow fruit&#10;&#10;Loose:&#10;&#10;apple  &#10;red fruit&#10;&#10;orange  &#10;orange fruit&#10;&#10;banana  &#10;yellow fruit&#10;&#10;Multiple blocks with italics:&#10;&#10;*apple*  &#10;red fruit&#10;&#10;contains seeds, crisp, pleasant to taste&#10;&#10;*orange*  &#10;orange fruit&#10;&#10;    { orange code block }&#10;&#10;&gt; orange block quote&#10;&#10;Multiple definitions, tight:&#10;&#10;apple  &#10;red fruit&#10;&#10;computer&#10;&#10;orange  &#10;orange fruit&#10;&#10;bank&#10;&#10;Multiple definitions, loose:&#10;&#10;apple  &#10;red fruit&#10;&#10;computer&#10;&#10;orange  &#10;orange fruit&#10;&#10;bank&#10;&#10;Blank line after term, indented marker, alternate markers:&#10;&#10;apple  &#10;red fruit&#10;&#10;computer&#10;&#10;orange  &#10;orange fruit&#10;&#10;1.  sublist&#10;2.  sublist">
+<outline text="Definition Lists" _note="Tight using spaces:&#10;&#10;apple&#10;:   red fruit&#10;&#10;orange&#10;:   orange fruit&#10;&#10;banana&#10;:   yellow fruit&#10;&#10;Tight using tabs:&#10;&#10;apple&#10;:   red fruit&#10;&#10;orange&#10;:   orange fruit&#10;&#10;banana&#10;:   yellow fruit&#10;&#10;Loose:&#10;&#10;apple&#10;&#10;:   red fruit&#10;&#10;orange&#10;&#10;:   orange fruit&#10;&#10;banana&#10;&#10;:   yellow fruit&#10;&#10;Multiple blocks with italics:&#10;&#10;*apple*&#10;&#10;:   red fruit&#10;&#10;    contains seeds, crisp, pleasant to taste&#10;&#10;*orange*&#10;&#10;:   orange fruit&#10;&#10;        { orange code block }&#10;&#10;    &gt; orange block quote&#10;&#10;Multiple definitions, tight:&#10;&#10;apple&#10;:   red fruit&#10;:   computer&#10;&#10;orange&#10;:   orange fruit&#10;:   bank&#10;&#10;Multiple definitions, loose:&#10;&#10;apple&#10;&#10;:   red fruit&#10;&#10;:   computer&#10;&#10;orange&#10;&#10;:   orange fruit&#10;&#10;:   bank&#10;&#10;Blank line after term, indented marker, alternate markers:&#10;&#10;apple&#10;&#10;:   red fruit&#10;&#10;:   computer&#10;&#10;orange&#10;&#10;:   orange fruit&#10;&#10;    1.  sublist&#10;    2.  sublist">
 </outline>
-<outline text="HTML Blocks" _note="Simple block on one line:&#10;&#10;foo&#10;&#10;And nested without indentation:&#10;&#10;foo&#10;&#10;bar&#10;&#10;Interpreted markdown in a table:&#10;&#10;This is *emphasized*&#10;And this is **strong**&#10;Here’s a simple block:&#10;&#10;foo&#10;&#10;This should be a code block, though:&#10;&#10;    &lt;div&gt;&#10;        foo&#10;    &lt;/div&gt;&#10;&#10;As should this:&#10;&#10;    &lt;div&gt;foo&lt;/div&gt;&#10;&#10;Now, nested:&#10;&#10;foo&#10;&#10;This should just be an HTML comment:&#10;&#10;Multiline:&#10;&#10;Code block:&#10;&#10;    &lt;!-- Comment --&gt;&#10;&#10;Just plain comment, with trailing spaces on the line:&#10;&#10;Code:&#10;&#10;    &lt;hr /&gt;&#10;&#10;Hr’s:&#10;&#10;------------------------------------------------------------------------">
+<outline text="HTML Blocks" _note="Simple block on one line:&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;And nested without indentation:&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;bar&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;Interpreted markdown in a table:&#10;&#10;```{=html}&#10;&lt;table&gt;&#10;```&#10;```{=html}&#10;&lt;tr&gt;&#10;```&#10;```{=html}&#10;&lt;td&gt;&#10;```&#10;This is *emphasized*&#10;```{=html}&#10;&lt;/td&gt;&#10;```&#10;```{=html}&#10;&lt;td&gt;&#10;```&#10;And this is **strong**&#10;```{=html}&#10;&lt;/td&gt;&#10;```&#10;```{=html}&#10;&lt;/tr&gt;&#10;```&#10;```{=html}&#10;&lt;/table&gt;&#10;```&#10;```{=html}&#10;&lt;script type=&quot;text/javascript&quot;&gt;document.write('This *should not* be interpreted as markdown');&lt;/script&gt;&#10;```&#10;Here's a simple block:&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;This should be a code block, though:&#10;&#10;    &lt;div&gt;&#10;        foo&#10;    &lt;/div&gt;&#10;&#10;As should this:&#10;&#10;    &lt;div&gt;foo&lt;/div&gt;&#10;&#10;Now, nested:&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;&lt;div&gt;&#10;&#10;foo&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;&lt;/div&gt;&#10;&#10;This should just be an HTML comment:&#10;&#10;```{=html}&#10;&lt;!-- Comment --&gt;&#10;```&#10;Multiline:&#10;&#10;```{=html}&#10;&lt;!--&#10;Blah&#10;Blah&#10;--&gt;&#10;```&#10;```{=html}&#10;&lt;!--&#10;    This is another comment.&#10;--&gt;&#10;```&#10;Code block:&#10;&#10;    &lt;!-- Comment --&gt;&#10;&#10;Just plain comment, with trailing spaces on the line:&#10;&#10;```{=html}&#10;&lt;!-- foo --&gt;&#10;```&#10;Code:&#10;&#10;    &lt;hr /&gt;&#10;&#10;Hr's:&#10;&#10;```{=html}&#10;&lt;hr&gt;&#10;```&#10;```{=html}&#10;&lt;hr /&gt;&#10;```&#10;```{=html}&#10;&lt;hr /&gt;&#10;```&#10;```{=html}&#10;&lt;hr&gt;&#10;```&#10;```{=html}&#10;&lt;hr /&gt;&#10;```&#10;```{=html}&#10;&lt;hr /&gt;&#10;```&#10;```{=html}&#10;&lt;hr class=&quot;foo&quot; id=&quot;bar&quot; /&gt;&#10;```&#10;```{=html}&#10;&lt;hr class=&quot;foo&quot; id=&quot;bar&quot; /&gt;&#10;```&#10;```{=html}&#10;&lt;hr class=&quot;foo&quot; id=&quot;bar&quot;&gt;&#10;```&#10;&#10;--------------------------------------------------------------------------------">
 </outline>
-<outline text="Inline Markup" _note="This is *emphasized*, and so *is this*.&#10;&#10;This is **strong**, and so **is this**.&#10;&#10;An *[emphasized link](/url)*.&#10;&#10;***This is strong and em.***&#10;&#10;So is ***this*** word.&#10;&#10;***This is strong and em.***&#10;&#10;So is ***this*** word.&#10;&#10;This is code: `&gt;`, `$`, `\`, `\$`, `&lt;html&gt;`.&#10;&#10;This is *strikeout*.&#10;&#10;Superscripts: a^(bc)d a^(*hello*) a^(hello there).&#10;&#10;Subscripts: H₂O, H₂₃O, H_(many of them)O.&#10;&#10;These should not be superscripts or subscripts, because of the unescaped&#10;spaces: a^b c^d, a~b c~d.&#10;&#10;------------------------------------------------------------------------">
+<outline text="Inline Markup" _note="This is *emphasized*, and so *is this*.&#10;&#10;This is **strong**, and so **is this**.&#10;&#10;An *[emphasized link](/url)*.&#10;&#10;***This is strong and em.***&#10;&#10;So is ***this*** word.&#10;&#10;***This is strong and em.***&#10;&#10;So is ***this*** word.&#10;&#10;This is code: `&gt;`, `$`, `\`, `\$`, `&lt;html&gt;`.&#10;&#10;~~This is *strikeout*.~~&#10;&#10;Superscripts: a^bc^d a^*hello*^ a^hello there^.&#10;&#10;Subscripts: H~2~O, H~23~O, H~many of them~O.&#10;&#10;These should not be superscripts or subscripts, because of the unescaped spaces:&#10;a\^b c\^d, a\~b c\~d.&#10;&#10;--------------------------------------------------------------------------------">
 </outline>
-<outline text="Smart quotes, ellipses, dashes" _note="“Hello,” said the spider. “‘Shelob’ is my name.”&#10;&#10;‘A’, ‘B’, and ‘C’ are letters.&#10;&#10;‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’&#10;&#10;‘He said, “I want to go.”’ Were you alive in the 70’s?&#10;&#10;Here is some quoted ‘`code`’ and a “[quoted&#10;link](http://example.com/?foo=1&amp;bar=2)”.&#10;&#10;Some dashes: one—two — three—four — five.&#10;&#10;Dashes between numbers: 5–7, 255–66, 1987–1999.&#10;&#10;Ellipses…and…and….&#10;&#10;------------------------------------------------------------------------">
+<outline text="Smart quotes, ellipses, dashes" _note="&quot;Hello,&quot; said the spider. &quot;'Shelob' is my name.&quot;&#10;&#10;'A', 'B', and 'C' are letters.&#10;&#10;'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'&#10;&#10;'He said, &quot;I want to go.&quot;' Were you alive in the 70's?&#10;&#10;Here is some quoted '`code`' and a &quot;[quoted&#10;link](http://example.com/?foo=1&amp;bar=2)&quot;.&#10;&#10;Some dashes: one---two --- three---four --- five.&#10;&#10;Dashes between numbers: 5--7, 255--66, 1987--1999.&#10;&#10;Ellipses...and...and....&#10;&#10;--------------------------------------------------------------------------------">
 </outline>
-<outline text="LaTeX" _note="-   &#10;-   2 + 2 = 4&#10;-   *x* ∈ *y*&#10;-   *α* ∧ *ω*&#10;-   223&#10;-   *p*-Tree&#10;-   Here’s some display math:&#10;    $$\frac{d}{dx}f(x)=\lim\_{h\to 0}\frac{f(x+h)-f(x)}{h}$$&#10;-   Here’s one that has a line break in it: *α* + *ω* × *x*².&#10;&#10;These shouldn’t be math:&#10;&#10;-   To get the famous equation, write `$e = mc^2$`.&#10;-   $22,000 is a *lot* of money. So is $34,000. (It worked if “lot” is&#10;    emphasized.)&#10;-   Shoes ($20) and socks ($5).&#10;-   Escaped `$`: $73 *this should be emphasized* 23$.&#10;&#10;Here’s a LaTeX table:&#10;&#10;------------------------------------------------------------------------">
+<outline text="LaTeX" _note="-   `\cite[22-23]{smith.1899}`{=tex}&#10;-   $2+2=4$&#10;-   $x \in y$&#10;-   $\alpha \wedge \omega$&#10;-   $223$&#10;-   $p$-Tree&#10;-   Here's some display math:&#10;    $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$&#10;-   Here's one that has a line break in it: $\alpha + \omega \times x^2$.&#10;&#10;These shouldn't be math:&#10;&#10;-   To get the famous equation, write `$e = mc^2$`.&#10;-   \$22,000 is a *lot* of money. So is \$34,000. (It worked if &quot;lot&quot; is&#10;    emphasized.)&#10;-   Shoes (\$20) and socks (\$5).&#10;-   Escaped `$`: \$73 *this should be emphasized* 23\$.&#10;&#10;Here's a LaTeX table:&#10;&#10;```{=tex}&#10;\begin{tabular}{|l|l|}\hline&#10;Animal &amp; Number \\ \hline&#10;Dog    &amp; 2      \\&#10;Cat    &amp; 1      \\ \hline&#10;\end{tabular}&#10;```&#10;&#10;--------------------------------------------------------------------------------">
 </outline>
-<outline text="Special Characters" _note="Here is some unicode:&#10;&#10;-   I hat: Î&#10;-   o umlaut: ö&#10;-   section: §&#10;-   set membership: ∈&#10;-   copyright: ©&#10;&#10;AT&amp;T has an ampersand in their name.&#10;&#10;AT&amp;T is another way to write it.&#10;&#10;This &amp; that.&#10;&#10;4 &amp;lt; 5.&#10;&#10;6 &amp;gt; 5.&#10;&#10;Backslash: \\&#10;&#10;Backtick: \`&#10;&#10;Asterisk: \*&#10;&#10;Underscore: \_&#10;&#10;Left brace: {&#10;&#10;Right brace: }&#10;&#10;Left bracket: \[&#10;&#10;Right bracket: \]&#10;&#10;Left paren: (&#10;&#10;Right paren: )&#10;&#10;Greater-than: &amp;gt;&#10;&#10;Hash: \#&#10;&#10;Period: .&#10;&#10;Bang: !&#10;&#10;Plus: +&#10;&#10;Minus: -&#10;&#10;------------------------------------------------------------------------">
+<outline text="Special Characters" _note="Here is some unicode:&#10;&#10;-   I hat: Î&#10;-   o umlaut: ö&#10;-   section: §&#10;-   set membership: ∈&#10;-   copyright: ©&#10;&#10;AT&amp;T has an ampersand in their name.&#10;&#10;AT&amp;T is another way to write it.&#10;&#10;This &amp; that.&#10;&#10;4 \&lt; 5.&#10;&#10;6 \&gt; 5.&#10;&#10;Backslash: \\&#10;&#10;Backtick: \`&#10;&#10;Asterisk: \*&#10;&#10;Underscore: \_&#10;&#10;Left brace: {&#10;&#10;Right brace: }&#10;&#10;Left bracket: \[&#10;&#10;Right bracket: \]&#10;&#10;Left paren: (&#10;&#10;Right paren: )&#10;&#10;Greater-than: \&gt;&#10;&#10;Hash: \#&#10;&#10;Period: .&#10;&#10;Bang: !&#10;&#10;Plus: +&#10;&#10;Minus: -&#10;&#10;--------------------------------------------------------------------------------">
 </outline>
 <outline text="Links">
-  <outline text="Explicit" _note="Just a [URL](/url/).&#10;&#10;[URL and title](/url/ &quot;title&quot;).&#10;&#10;[URL and title](/url/ &quot;title preceded by two spaces&quot;).&#10;&#10;[URL and title](/url/ &quot;title preceded by a tab&quot;).&#10;&#10;[URL and title](/url/ &quot;title with &quot;quotes&quot; in it&quot;)&#10;&#10;[URL and title](/url/ &quot;title with single quotes&quot;)&#10;&#10;[with\_underscore](/url/with_underscore)&#10;&#10;[Email link](mailto:nobody@nowhere.net)&#10;&#10;[Empty]().">
+  <outline text="Explicit" _note="Just a [URL](/url/).&#10;&#10;[URL and title](/url/ &quot;title&quot;).&#10;&#10;[URL and title](/url/ &quot;title preceded by two spaces&quot;).&#10;&#10;[URL and title](/url/ &quot;title preceded by a tab&quot;).&#10;&#10;[URL and title](/url/ &quot;title with &quot;quotes&quot; in it&quot;)&#10;&#10;[URL and title](/url/ &quot;title with single quotes&quot;)&#10;&#10;[with_underscore](/url/with_underscore)&#10;&#10;[Email link](mailto:nobody@nowhere.net)&#10;&#10;[Empty]().">
   </outline>
   <outline text="Reference" _note="Foo [bar](/url/).&#10;&#10;With [embedded \[brackets\]](/url/).&#10;&#10;[b](/url/) by itself should be a link.&#10;&#10;Indented [once](/url).&#10;&#10;Indented [twice](/url).&#10;&#10;Indented [thrice](/url).&#10;&#10;This should \[not\]\[\] be a link.&#10;&#10;    [not]: /url&#10;&#10;Foo [bar](/url/ &quot;Title with &quot;quotes&quot; inside&quot;).&#10;&#10;Foo [biz](/url/ &quot;Title with &quot;quote&quot; inside&quot;).">
   </outline>
-  <outline text="With ampersands" _note="Here’s a [link with an ampersand in the&#10;URL](http://example.com/?foo=1&amp;bar=2).&#10;&#10;Here’s a link with an amersand in the link text:&#10;[AT&amp;T](http://att.com/ &quot;AT&amp;T&quot;).&#10;&#10;Here’s an [inline link](/script?foo=1&amp;bar=2).&#10;&#10;Here’s an [inline link in pointy braces](/script?foo=1&amp;bar=2).">
+  <outline text="With ampersands" _note="Here's a [link with an ampersand in the URL](http://example.com/?foo=1&amp;bar=2).&#10;&#10;Here's a link with an amersand in the link text: [AT&amp;T](http://att.com/ &quot;AT&amp;T&quot;).&#10;&#10;Here's an [inline link](/script?foo=1&amp;bar=2).&#10;&#10;Here's an [inline link in pointy braces](/script?foo=1&amp;bar=2).">
   </outline>
-  <outline text="Autolinks" _note="With an ampersand: &lt;http://example.com/?foo=1&amp;bar=2&gt;&#10;&#10;-   In a list?&#10;-   &lt;http://example.com/&gt;&#10;-   It should.&#10;&#10;An e-mail address: &lt;nobody@nowhere.net&gt;&#10;&#10;&gt; Blockquoted: &lt;http://example.com/&gt;&#10;&#10;Auto-links should not occur here: `&lt;http://example.com/&gt;`&#10;&#10;    or here: &lt;http://example.com/&gt;&#10;&#10;------------------------------------------------------------------------">
+  <outline text="Autolinks" _note="With an ampersand: &lt;http://example.com/?foo=1&amp;bar=2&gt;&#10;&#10;-   In a list?&#10;-   &lt;http://example.com/&gt;&#10;-   It should.&#10;&#10;An e-mail address: &lt;nobody@nowhere.net&gt;&#10;&#10;&gt; Blockquoted: &lt;http://example.com/&gt;&#10;&#10;Auto-links should not occur here: `&lt;http://example.com/&gt;`&#10;&#10;    or here: &lt;http://example.com/&gt;&#10;&#10;--------------------------------------------------------------------------------">
   </outline>
 </outline>
-<outline text="Images" _note="From “Voyage dans la Lune” by Georges Melies (1902):&#10;&#10;![lalune](lalune.jpg &quot;Voyage dans la Lune&quot;)&#10;&#10;lalune&#10;&#10;Here is a movie ![movie](movie.jpg) icon.&#10;&#10;------------------------------------------------------------------------">
+<outline text="Images" _note="From &quot;Voyage dans la Lune&quot; by Georges Melies (1902):&#10;&#10;![lalune](lalune.jpg &quot;Voyage dans la Lune&quot;)&#10;&#10;Here is a movie ![movie](movie.jpg) icon.&#10;&#10;--------------------------------------------------------------------------------">
 </outline>
-<outline text="Footnotes" _note="Here is a footnote reference,[1] and another.[2] This should *not* be a&#10;footnote reference, because it contains a space.\[^my note\] Here is an&#10;inline note.[3]&#10;&#10;&gt; Notes can go in quotes.[4]&#10;&#10;1.  And in list items.[5]&#10;&#10;This paragraph should not be part of the note, as it is not indented.&#10;&#10;[1] Here is the footnote. It can go anywhere after the footnote&#10;reference. It need not be placed at the end of the document.&#10;&#10;[2] Here’s the long note. This one contains multiple blocks.&#10;&#10;Subsequent blocks are indented to show that they belong to the footnote&#10;(as with list items).&#10;&#10;      { &lt;code&gt; }&#10;&#10;If you want, you can indent every line, but you can also be lazy and&#10;just indent the first line of each block.&#10;&#10;[3] This is *easier* to type. Inline notes may contain&#10;[links](http://google.com) and `]` verbatim characters, as well as&#10;\[bracketed text\].&#10;&#10;[4] In quote.&#10;&#10;[5] In list.">
+<outline text="Footnotes" _note="Here is a footnote reference,[^1] and another.[^2] This should *not* be a&#10;footnote reference, because it contains a space.\[\^my note\] Here is an inline&#10;note.[^3]&#10;&#10;&gt; Notes can go in quotes.[^4]&#10;&#10;1.  And in list items.[^5]&#10;&#10;This paragraph should not be part of the note, as it is not indented.&#10;&#10;[^1]: Here is the footnote. It can go anywhere after the footnote reference. It&#10;    need not be placed at the end of the document.&#10;&#10;[^2]: Here's the long note. This one contains multiple blocks.&#10;&#10;    Subsequent blocks are indented to show that they belong to the footnote (as&#10;    with list items).&#10;&#10;          { &lt;code&gt; }&#10;&#10;    If you want, you can indent every line, but you can also be lazy and just&#10;    indent the first line of each block.&#10;&#10;[^3]: This is *easier* to type. Inline notes may contain&#10;    [links](http://google.com) and `]` verbatim characters, as well as&#10;    \[bracketed text\].&#10;&#10;[^4]: In quote.&#10;&#10;[^5]: In list.">
 </outline>
   </body>
 </opml>
