diff --git a/AUTHORS.md b/AUTHORS.md
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -89,6 +89,7 @@
 - Gwern Branwen
 - Hamish Mackenzie
 - Hans-Peter Deifel
+- Heiko Schlittermann
 - Henrik Tramberend
 - Henry de Valence
 - Hubert Plociniczak
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 21, 2019
+date: January 5, 2020
 ---
 
 # Synopsis
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,51 @@
 # Revision history for pandoc
 
+## pandoc 2.9.1.1 (2020-01-05)
+
+  * Markdown reader:
+
+    + Fix parsing bug affected indented code after raw HTML (#6009, #5360).
+
+  * LaTeX writer:
+
+    + Fix regression in beamer slide structure with certain slide levels
+      (#6030).
+    + Allow framebreaks for beamer's TOC (Heiko Schlittermann, #6012)
+    + Properly handle unnumbered headings level 4+ (#6018).
+      Previously the `\paragraph` command was used instead of
+      `\paragraph*` for unnumbered level 4 headings.
+
+  * HTML writer:
+
+    + Fix revealjs slide structure regression with certain slide levels
+      (#6030).
+    + Add newlines to make slide show output more readable.
+
+  * Org writer:
+
+    + Remove extra spaces from table cells (Albert Krewinkel, #6024).
+
+  * JATS template: Update JATS dtd (Arfon Smith, #6020).  Use the archiving
+    and interchange DTD rather than the more restrictive journal publishing
+    DTD (which doesn't permit ext-link as a valid child).
+
+  * Text.Pandoc.PDF: Fix `runTeXProgram` so that the input source is always
+    overwritten (#6027).  Previously it wasn't overridden if the file already
+    existed, which led to bad results on subsequent runs when
+    `pdf-engine-opt=-output-directory=` was used to specify an explicit temp
+    dir.
+
+  * Text.Pandoc.BCP47: Change `getLang` to handle block-level contents
+    (#6008).  Some readers (e.g. RST) will populate the `lang` metadata field
+    with block-level content.  `getLang` has been modified to handle this.
+    Previously in these cases the LaTeX writer would not properly set the
+    "main language" of the document.
+
+  * Fix `test/tables.org` (Albert Krewinkel).
+
+  * Use HTTPS in copyright message (Felix Yan, #6010)
+
+
 ## pandoc 2.9.1 (2019-12-23)
 
   * Add Jira reader (Albert Krewinkel, #5556).
diff --git a/data/templates/default.jats b/data/templates/default.jats
--- a/data/templates/default.jats
+++ b/data/templates/default.jats
@@ -2,12 +2,12 @@
 $if(xml-stylesheet)$
 <?xml-stylesheet type="text/xsl" href="$xml-stylesheet$"?>
 $endif$
-<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.1 20151215//EN"
-                  "JATS-journalpublishing1.dtd">
+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"
+                  "JATS-archivearticle1.dtd">
 $if(article.type)$
-<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.1" article-type="$article.type$">
+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="$article.type$">
 $else$
-<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.1" article-type="other">
+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">
 $endif$
 <front>
 <journal-meta>
diff --git a/data/templates/default.latex b/data/templates/default.latex
--- a/data/templates/default.latex
+++ b/data/templates/default.latex
@@ -423,7 +423,7 @@
 \renewcommand*\contentsname{$toc-title$}
 $endif$
 $if(beamer)$
-\begin{frame}
+\begin{frame}[allowframebreaks]
 $if(toc-title)$
   \frametitle{$toc-title$}
 $endif$
diff --git a/man/pandoc.1 b/man/pandoc.1
--- a/man/pandoc.1
+++ b/man/pandoc.1
@@ -1,5 +1,8 @@
 .\"t
-.TH PANDOC 1 "December 21, 2019" "pandoc 2.9.1"
+.\" Automatically generated by Pandoc 2.9.1
+.\"
+.TH "Pandoc User\[aq]s Guide" "" "January 5, 2020" "pandoc 2.9.1.1" ""
+.hy
 .SH NAME
 pandoc - general markup converter
 .SH SYNOPSIS
diff --git a/pandoc.cabal b/pandoc.cabal
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,5 +1,5 @@
 name:            pandoc
-version:         2.9.1
+version:         2.9.1.1
 cabal-version:   2.0
 build-type:      Simple
 license:         GPL-2
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -933,7 +933,7 @@
 copyrightMessage :: String
 copyrightMessage = intercalate "\n" [
   "Copyright (C) 2006-2019 John MacFarlane",
-  "Web:  http://pandoc.org",
+  "Web:  https://pandoc.org",
   "This is free software; see the source for copying conditions.",
   "There is no warranty, not even for merchantability or fitness",
   "for a particular purpose." ]
diff --git a/src/Text/Pandoc/BCP47.hs b/src/Text/Pandoc/BCP47.hs
--- a/src/Text/Pandoc/BCP47.hs
+++ b/src/Text/Pandoc/BCP47.hs
@@ -46,9 +46,11 @@
         Just s -> Just s
         _      ->
           case lookupMeta "lang" meta of
-               Just (MetaInlines [Str s]) -> Just s
-               Just (MetaString s)        -> Just s
-               _                          -> Nothing
+               Just (MetaBlocks [Para [Str s]])  -> Just s
+               Just (MetaBlocks [Plain [Str s]]) -> Just s
+               Just (MetaInlines [Str s])        -> Just s
+               Just (MetaString s)               -> Just s
+               _                                 -> Nothing
 
 -- | Parse a BCP 47 string as a Lang.  Currently we parse
 -- extensions and private-use fields as "variants," even
diff --git a/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs b/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs
--- a/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs
@@ -1,6 +1,7 @@
 {-# LANGUAGE NoImplicitPrelude    #-}
 {-# LANGUAGE FlexibleInstances    #-}
 {-# LANGUAGE ScopedTypeVariables  #-}
+{-# LANGUAGE OverloadedStrings    #-}
 {-# LANGUAGE LambdaCase           #-}
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 {- |
@@ -67,7 +68,8 @@
         indexReaderOptions _tbl (AnyValue key) = do
           Lua.ltype key >>= \case
             Lua.TypeString -> Lua.peek key >>= \case
-              "defaultImageExtension" -> Lua.push defaultImageExtension
+              ("defaultImageExtension" :: Text.Text)
+                                    -> Lua.push defaultImageExtension
               "indentedCodeClasses" -> Lua.push indentedCodeClasses
               "stripComments" -> Lua.push stripComments
               "tabStop" -> Lua.push tabStop
diff --git a/src/Text/Pandoc/Lua/Marshaling/Version.hs b/src/Text/Pandoc/Lua/Marshaling/Version.hs
--- a/src/Text/Pandoc/Lua/Marshaling/Version.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/Version.hs
@@ -1,6 +1,8 @@
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 {-# LANGUAGE LambdaCase           #-}
 {-# LANGUAGE NoImplicitPrelude    #-}
+{-# LANGUAGE OverloadedStrings    #-}
+{-# LANGUAGE ScopedTypeVariables  #-}
 {- |
    Module      : Text.Pandoc.Lua.Marshaling.Version
    Copyright   : © 2019 Albert Krewinkel
@@ -19,6 +21,7 @@
   where
 
 import Prelude
+import Data.Text (Text)
 import Data.Maybe (fromMaybe)
 import Data.Version (Version (..), makeVersion, parseVersion, showVersion)
 import Foreign.Lua (Lua, Optional (..), NumResults,
@@ -103,7 +106,7 @@
       Lua.push (Lua.Optional versionPart)
       return 1
     Lua.TypeString -> do
-      str <- Lua.peek k
+      (str :: Text) <- Lua.peek k
       if str == "must_be_at_least"
         then 1 <$ Lua.pushHaskellFunction must_be_at_least
         else 1 <$ Lua.pushnil
diff --git a/src/Text/Pandoc/Lua/Module/MediaBag.hs b/src/Text/Pandoc/Lua/Module/MediaBag.hs
--- a/src/Text/Pandoc/Lua/Module/MediaBag.hs
+++ b/src/Text/Pandoc/Lua/Module/MediaBag.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE OverloadedStrings #-}
 {- |
    Module      : Text.Pandoc.Lua.Module.MediaBag
    Copyright   : Copyright © 2017-2019 Albert Krewinkel
@@ -108,9 +109,9 @@
   addEntry :: Lua.Integer -> (FilePath, MimeType, Int) -> Lua ()
   addEntry idx (fp, mimeType, contentLength) = do
     Lua.newtable
-    Lua.push "path" *> Lua.push fp *> Lua.rawset (-3)
-    Lua.push "type" *> Lua.push mimeType *> Lua.rawset (-3)
-    Lua.push "length" *> Lua.push contentLength *> Lua.rawset (-3)
+    Lua.push ("path" :: T.Text) *> Lua.push fp *> Lua.rawset (-3)
+    Lua.push ("type" :: T.Text) *> Lua.push mimeType *> Lua.rawset (-3)
+    Lua.push ("length" :: T.Text) *> Lua.push contentLength *> Lua.rawset (-3)
     Lua.rawseti (-2) idx
 
 fetch :: T.Text
diff --git a/src/Text/Pandoc/Lua/Util.hs b/src/Text/Pandoc/Lua/Util.hs
--- a/src/Text/Pandoc/Lua/Util.hs
+++ b/src/Text/Pandoc/Lua/Util.hs
@@ -1,6 +1,7 @@
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE OverloadedStrings #-}
 {- |
    Module      : Text.Pandoc.Lua.Util
    Copyright   : © 2012–2019 John MacFarlane,
@@ -31,9 +32,9 @@
 import Foreign.Lua ( Lua, NumArgs, NumResults, Peekable, Pushable, StackIndex
                    , Status, ToHaskellFunction )
 import Text.Pandoc.Class (readDataFile, runIOorExplode, setUserDataDir)
-
 import qualified Foreign.Lua as Lua
 import qualified Text.Pandoc.UTF8 as UTF8
+import Data.Text (Text)
 
 -- | Get value behind key from table at given index.
 rawField :: Peekable a => StackIndex -> String -> Lua a
@@ -104,7 +105,7 @@
 getTag idx = do
   -- push metatable or just the table
   Lua.getmetatable idx >>= \hasMT -> unless hasMT (Lua.pushvalue idx)
-  Lua.push "tag"
+  Lua.push ("tag" :: Text)
   Lua.rawget (Lua.nthFromTop 2)
   Lua.tostring Lua.stackTop <* Lua.pop 2 >>= \case
     Nothing -> Lua.throwException "untagged value"
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
@@ -18,7 +18,7 @@
 import Prelude
 import qualified Codec.Picture as JP
 import qualified Control.Exception as E
-import Control.Monad (unless, when)
+import Control.Monad (when)
 import Control.Monad.Trans (MonadIO (..))
 import qualified Data.ByteString as BS
 import Data.ByteString.Lazy (ByteString)
@@ -241,7 +241,7 @@
   let numruns | takeBaseName program == "latexmk"        = 1
               | "\\tableofcontents" `T.isInfixOf` source = 3  -- to get page numbers
               | otherwise                                = 2  -- 1 run won't give you PDF bookmarks
-  (exit, log', mbPdf) <- runTeXProgram verbosity program args 1 numruns
+  (exit, log', mbPdf) <- runTeXProgram verbosity program args numruns
                           tmpDir source
   case (exit, mbPdf) of
        (ExitFailure _, _)      -> do
@@ -348,9 +348,9 @@
 -- Run a TeX program on an input bytestring and return (exit code,
 -- contents of stdout, contents of produced PDF if any).  Rerun
 -- a fixed number of times to resolve references.
-runTeXProgram :: Verbosity -> String -> [String] -> Int -> Int -> FilePath
+runTeXProgram :: Verbosity -> String -> [String] -> Int -> FilePath
               -> Text -> PandocIO (ExitCode, ByteString, Maybe ByteString)
-runTeXProgram verbosity program args runNumber numRuns tmpDir' source = do
+runTeXProgram verbosity program args numRuns tmpDir' source = do
     let isOutdirArg x = "-outdir=" `isPrefixOf` x ||
                         "-output-directory=" `isPrefixOf` x
     let tmpDir =
@@ -359,8 +359,7 @@
             Nothing -> tmpDir'
     liftIO $ createDirectoryIfMissing True tmpDir
     let file = tmpDir ++ "/input.tex"  -- note: tmpDir has / path separators
-    exists <- liftIO $ doesFileExist file
-    unless exists $ liftIO $ BS.writeFile file $ UTF8.fromText source
+    liftIO $ BS.writeFile file $ UTF8.fromText source
     let isLatexMk = takeBaseName program == "latexmk"
         programArgs | isLatexMk = ["-interaction=batchmode", "-halt-on-error", "-pdf",
                                    "-quiet", "-outdir=" ++ tmpDir] ++ args ++ [file]
@@ -374,23 +373,25 @@
                 ("TEXMFOUTPUT", tmpDir) :
                   [(k,v) | (k,v) <- env'
                          , k /= "TEXINPUTS" && k /= "TEXMFOUTPUT"]
-    when (runNumber == 1 && verbosity >= INFO) $ liftIO $
-      UTF8.readFile file >>=
-       showVerboseInfo (Just tmpDir) program programArgs env''
-    (exit, out) <- liftIO $ E.catch
-      (pipeProcess (Just env'') program programArgs BL.empty)
-      (handlePDFProgramNotFound program)
-    when (verbosity >= INFO) $ liftIO $ do
-      putStrLn $ "[makePDF] Run #" ++ show runNumber
-      BL.hPutStr stdout out
-      putStr "\n"
-    if runNumber < numRuns
-       then runTeXProgram verbosity program args (runNumber + 1) numRuns tmpDir source
-       else do
-         let logFile = replaceExtension file ".log"
-         let pdfFile = replaceExtension file ".pdf"
-         (log', pdf) <- getResultingPDF (Just logFile) pdfFile
-         return (exit, fromMaybe out log', pdf)
+    when (verbosity >= INFO) $ liftIO $
+        UTF8.readFile file >>=
+         showVerboseInfo (Just tmpDir) program programArgs env''
+    let runTeX runNumber = do
+          (exit, out) <- liftIO $ E.catch
+            (pipeProcess (Just env'') program programArgs BL.empty)
+            (handlePDFProgramNotFound program)
+          when (verbosity >= INFO) $ liftIO $ do
+            putStrLn $ "[makePDF] Run #" ++ show runNumber
+            BL.hPutStr stdout out
+            putStr "\n"
+          if runNumber < numRuns
+             then runTeX (runNumber + 1)
+             else do
+               let logFile = replaceExtension file ".log"
+               let pdfFile = replaceExtension file ".pdf"
+               (log', pdf) <- getResultingPDF (Just logFile) pdfFile
+               return (exit, fromMaybe out log', pdf)
+    runTeX 1
 
 generic2pdf :: Verbosity
             -> String
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -618,7 +618,7 @@
   char '{'
   skipMany spaceChar
   char '='
-  format <- many1Char $ satisfy (\c -> isAlphaNum c || c `elem` ['-', '_']) 
+  format <- many1Char $ satisfy (\c -> isAlphaNum c || c `elem` ['-', '_'])
   skipMany spaceChar
   char '}'
   return format
@@ -1094,17 +1094,20 @@
   -- inline will not be parsed as inline tags
   oldInHtmlBlock <- stateInHtmlBlock <$> getState
   updateState $ \st -> st{ stateInHtmlBlock = Just tagtype }
-  let closer = htmlTag (\x -> x ~== TagClose tagtype)
-  let block' = do notFollowedBy' closer
-                  gobbleAtMostSpaces indentlevel
-                  block
+  let closer = htmlTag (~== TagClose tagtype)
+  let block' = try $ do
+                 gobbleAtMostSpaces indentlevel
+                 notFollowedBy' closer
+                 block
   contents <- mconcat <$> many block'
   result <-
-    (closer >>= \(_, rawcloser) -> return (
-                return (B.rawBlock "html" $ stripMarkdownAttribute raw) <>
+    try
+    (do gobbleAtMostSpaces indentlevel
+        (_, rawcloser) <- closer
+        return (return (B.rawBlock "html" $ stripMarkdownAttribute raw) <>
                 contents <>
                 return (B.rawBlock "html" rawcloser)))
-      <|> return (return (B.rawBlock "html" raw) <> contents)
+      <|> (return (return (B.rawBlock "html" raw) <> contents))
   updateState $ \st -> st{ stateInHtmlBlock = oldInHtmlBlock }
   return result
 
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -676,15 +676,18 @@
   let attr = (ident, classes', dkvs)
   if titleSlide
      then do
-       t <- addAttrs opts attr $ secttag $ header' <> titleContents
+       t <- addAttrs opts attr $
+             secttag $ nl opts <> header' <> nl opts <> titleContents <> nl opts
        return $
-         (if slideVariant == RevealJsSlides && not (null innerSecs)
-             -- revealjs doesn't like more than one level of section nesting:
-               {- REMOVED && isNothing mbparentlevel -}
-                then H5.section
-                else id) $ t <> if null innerSecs
-                                   then mempty
-                                   else nl opts <> innerContents
+         -- ensure 2D nesting for revealjs, but only for one level;
+         -- revealjs doesn't like more than one level of nseting
+         (if slideVariant == RevealJsSlides && not (null innerSecs) &&
+             level == slideLevel - 1
+                then \z -> H5.section (nl opts <> z)
+                else id) $ t <> nl opts <>
+                           if null innerSecs
+                              then mempty
+                              else innerContents <> nl opts
      else if writerSectionDivs opts || slide ||
               (hident /= ident && not (T.null hident || T.null ident)) ||
               (hclasses /= dclasses) || (hkvs /= dkvs)
@@ -696,9 +699,10 @@
                     else innerContents <> nl opts
           else do
             t <- addAttrs opts attr header'
-            return $ t <> if null innerSecs
-                             then mempty
-                             else nl opts <> innerContents
+            return $ t <>
+                     if null innerSecs
+                        then mempty
+                        else nl opts <> innerContents
 blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do
   html5 <- gets stHtml5
   slideVariant <- gets stSlideVariant
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
@@ -53,7 +53,7 @@
               , stInQuote       :: Bool          -- true if in a blockquote
               , stExternalNotes :: Bool          -- true if in context where
                                                  -- we need to store footnotes
-              , stInMinipage    :: Bool          -- true if in minipage 
+              , stInMinipage    :: Bool          -- true if in minipage
               , stInHeading     :: Bool          -- true if in a section heading
               , stInItem        :: Bool          -- true if in \item[..]
               , stNotes         :: [Doc Text]    -- notes in a minipage
@@ -455,11 +455,21 @@
 
 -- this creates section slides and marks slides with class "slide","block"
 elementToBeamer :: PandocMonad m => Int -> Block -> LW m Block
-elementToBeamer slideLevel d@(Div (ident,dclasses,dkvs)
-                              xs@(Header lvl _ _ : _))
-  | lvl >  slideLevel = return $ Div (ident,"block":dclasses,dkvs) xs
-  | lvl <  slideLevel = return d
-  | otherwise = return $ Div (ident,"slide":dclasses,dkvs) xs
+elementToBeamer slideLevel (Div (ident,"section":dclasses,dkvs)
+                              xs@(h@(Header lvl _ _) : ys))
+  | lvl >  slideLevel
+    = return $ Div (ident,"block":dclasses,dkvs) xs
+  | lvl <  slideLevel
+    = do let isDiv (Div{})      = True
+             isDiv _            = False
+         let (titleBs, slideBs) = break isDiv ys
+         return $
+           if null titleBs
+              then Div (ident,dclasses,dkvs) xs
+              else Div (ident,dclasses,dkvs)
+                    (h : Div ("","slide":dclasses,dkvs) (h:titleBs) : slideBs)
+  | otherwise
+    = return $ Div (ident,"slide":dclasses,dkvs) xs
 elementToBeamer _ x = return x
 
 isListBlock :: Block -> Bool
@@ -516,8 +526,7 @@
                             braces (literal ref) <> braces empty
   contents <- blockListToLaTeX bs >>= wrapDiv (identifier,classes,kvs)
   return $ ("\\begin{frame}" <> options <> slideTitle <> slideAnchor) $$
-           contents $$
-           "\\end{frame}"
+             contents $$ "\\end{frame}"
 blockToLaTeX (Div (identifier@(T.uncons -> Just (_,_)),dclasses,dkvs)
                (Header lvl ("",hclasses,hkvs) ils : bs)) =
   -- move identifier from div to header
@@ -1010,7 +1019,7 @@
                   -- see http://tex.stackexchange.com/questions/169830/
                   else empty
   lab <- labelFor ident
-  let star = if unnumbered && level' < 4 then text "*" else empty
+  let star = if unnumbered then text "*" else empty
   let stuffing = star <> optional <> contents
   stuffing' <- hypertarget True ident $
                   text ('\\':sectionType) <> stuffing <> lab
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -195,7 +195,7 @@
   let numChars = maximum . map offset
   -- FIXME: width is not being used.
   let widthsInChars =
-       map ((+2) . numChars) $ transpose (headers' : rawRows)
+       map numChars $ transpose (headers' : rawRows)
   -- FIXME: Org doesn't allow blocks with height more than 1.
   let hpipeBlocks blocks = hcat [beg, middle, end]
         where sep'   = vfill " | "
diff --git a/test/Tests/Writers/LaTeX.hs b/test/Tests/Writers/LaTeX.hs
--- a/test/Tests/Writers/LaTeX.hs
+++ b/test/Tests/Writers/LaTeX.hs
@@ -170,7 +170,7 @@
                       , "\\addcontentsline{toc}{subsection}{header4}\n"
                       , "\\subsubsection*{header5}"
                       , "\\addcontentsline{toc}{subsubsection}{header5}\n"
-                      , "\\paragraph{header6}"
+                      , "\\paragraph*{header6}"
                       , "\\addcontentsline{toc}{paragraph}{header6}"
                       ]
             ]
diff --git a/test/command/5360.md b/test/command/5360.md
new file mode 100644
--- /dev/null
+++ b/test/command/5360.md
@@ -0,0 +1,19 @@
+```
+% pandoc -t native
+::: {.foo}
+<table>
+ <tr>
+  <td>hi</td>
+ </tr>
+</table>
+:::
+^D
+[Div ("",["foo"],[])
+ [RawBlock (Format "html") "<table>"
+ ,RawBlock (Format "html") "<tr>"
+ ,RawBlock (Format "html") "<td>"
+ ,Plain [Str "hi"]
+ ,RawBlock (Format "html") "</td>"
+ ,RawBlock (Format "html") "</tr>"
+ ,RawBlock (Format "html") "</table>"]]
+```
diff --git a/test/command/6009.md b/test/command/6009.md
new file mode 100644
--- /dev/null
+++ b/test/command/6009.md
@@ -0,0 +1,18 @@
+```
+% pandoc -t native
+  <tr>
+   <td>
+   </td>
+  </tr>
+
+x
+
+    y
+^D
+[RawBlock (Format "html") "<tr>"
+,RawBlock (Format "html") "<td>"
+,RawBlock (Format "html") "</td>"
+,RawBlock (Format "html") "</tr>"
+,Para [Str "x"]
+,CodeBlock ("",[],[]) "y"]
+```
diff --git a/test/command/6030.md b/test/command/6030.md
new file mode 100644
--- /dev/null
+++ b/test/command/6030.md
@@ -0,0 +1,78 @@
+```
+% pandoc -t revealjs --slide-level=3
+# One
+
+One
+
+## Two
+
+Two
+
+### Three
+
+Three
+
+#### Four
+
+Four
+^D
+<section id="one" class="title-slide slide level1">
+<h1>One</h1>
+<p>One</p>
+</section>
+<section>
+<section id="two" class="title-slide slide level2">
+<h2>Two</h2>
+<p>Two</p>
+</section>
+<section id="three" class="slide level3">
+<h3>Three</h3>
+<p>Three</p>
+<h4 id="four">Four</h4>
+<p>Four</p>
+</section>
+</section>
+```
+
+```
+% pandoc -t beamer --slide-level=3
+# One
+
+One
+
+## Two
+
+Two
+
+### Three
+
+Three
+
+#### Four
+
+Four
+^D
+\hypertarget{one}{%
+\section{One}\label{one}}
+
+\begin{frame}{One}
+One
+\end{frame}
+
+\hypertarget{two}{%
+\subsection{Two}\label{two}}
+
+\begin{frame}{Two}
+Two
+\end{frame}
+
+\begin{frame}{Three}
+\protect\hypertarget{three}{}
+Three
+
+\begin{block}{Four}
+\protect\hypertarget{four}{}
+Four
+\end{block}
+\end{frame}
+```
diff --git a/test/jats-reader.xml b/test/jats-reader.xml
--- a/test/jats-reader.xml
+++ b/test/jats-reader.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.0 20120330//EN"
-                  "JATS-journalpublishing1.dtd">
-<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.0" article-type="other">
+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"
+                  "JATS-archivearticle1.dtd">
+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">
 <front>
 <journal-meta>
 <journal-title-group>
diff --git a/test/tables.org b/test/tables.org
--- a/test/tables.org
+++ b/test/tables.org
@@ -1,51 +1,51 @@
 Simple table with caption:
 
-| Right   | Left   | Center   | Default   |
-|---------+--------+----------+-----------|
-| 12      | 12     | 12       | 12        |
-| 123     | 123    | 123      | 123       |
-| 1       | 1      | 1        | 1         |
+| Right | Left | Center | Default |
+|-------+------+--------+---------|
+| 12    | 12   | 12     | 12      |
+| 123   | 123  | 123    | 123     |
+| 1     | 1    | 1      | 1       |
 #+CAPTION: Demonstration of simple table syntax.
 
 Simple table without caption:
 
-| Right   | Left   | Center   | Default   |
-|---------+--------+----------+-----------|
-| 12      | 12     | 12       | 12        |
-| 123     | 123    | 123      | 123       |
-| 1       | 1      | 1        | 1         |
+| Right | Left | Center | Default |
+|-------+------+--------+---------|
+| 12    | 12   | 12     | 12      |
+| 123   | 123  | 123    | 123     |
+| 1     | 1    | 1      | 1       |
 
 Simple table indented two spaces:
 
-| Right   | Left   | Center   | Default   |
-|---------+--------+----------+-----------|
-| 12      | 12     | 12       | 12        |
-| 123     | 123    | 123      | 123       |
-| 1       | 1      | 1        | 1         |
+| Right | Left | Center | Default |
+|-------+------+--------+---------|
+| 12    | 12   | 12     | 12      |
+| 123   | 123  | 123    | 123     |
+| 1     | 1    | 1      | 1       |
 #+CAPTION: Demonstration of simple table syntax.
 
 Multiline table with caption:
 
-| Centered Header   | Left Aligned   | Right Aligned   | Default aligned                                         |
-|-------------------+----------------+-----------------+---------------------------------------------------------|
-| First             | row            | 12.0            | Example of a row that spans multiple lines.             |
-| Second            | row            | 5.0             | Here's another one. Note the blank line between rows.   |
+| Centered Header | Left Aligned | Right Aligned | Default aligned                                       |
+|-----------------+--------------+---------------+-------------------------------------------------------|
+| First           | row          | 12.0          | Example of a row that spans multiple lines.           |
+| Second          | row          | 5.0           | Here's another one. Note the blank line between rows. |
 #+CAPTION: Here's the caption. It may span multiple lines.
 
 Multiline table without caption:
 
-| Centered Header   | Left Aligned   | Right Aligned   | Default aligned                                         |
-|-------------------+----------------+-----------------+---------------------------------------------------------|
-| First             | row            | 12.0            | Example of a row that spans multiple lines.             |
-| Second            | row            | 5.0             | Here's another one. Note the blank line between rows.   |
+| Centered Header | Left Aligned | Right Aligned | Default aligned                                       |
+|-----------------+--------------+---------------+-------------------------------------------------------|
+| First           | row          | 12.0          | Example of a row that spans multiple lines.           |
+| Second          | row          | 5.0           | Here's another one. Note the blank line between rows. |
 
 Table without column headers:
 
-| 12    | 12    | 12    | 12    |
-| 123   | 123   | 123   | 123   |
-| 1     | 1     | 1     | 1     |
+| 12  | 12  | 12  | 12  |
+| 123 | 123 | 123 | 123 |
+| 1   | 1   | 1   | 1   |
 
 Multiline table without column headers:
 
-| First    | row   | 12.0   | Example of a row that spans multiple lines.             |
-| Second   | row   | 5.0    | Here's another one. Note the blank line between rows.   |
+| First  | row | 12.0 | Example of a row that spans multiple lines.           |
+| Second | row | 5.0  | Here's another one. Note the blank line between rows. |
diff --git a/test/writer.jats b/test/writer.jats
--- a/test/writer.jats
+++ b/test/writer.jats
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.1 20151215//EN"
-                  "JATS-journalpublishing1.dtd">
-<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.1" article-type="other">
+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"
+                  "JATS-archivearticle1.dtd">
+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">
 <front>
 <journal-meta>
 <journal-title-group>
