@@ -52,6 +52,7 @@ import Text.Pandoc.CSS (foldOrElse, pickStyleAttrProps)
5252import Text.Pandoc.Definition
5353import Text.Pandoc.Readers.LaTeX (rawLaTeXInline)
5454import Text.Pandoc.Readers.LaTeX.Types (Macro)
55+import Text.Pandoc.XML (html5Attributes, html4Attributes, rdfaAttributes)
5556import Text.Pandoc.Error
5657import Text.Pandoc.Logging
5758import Text.Pandoc.Options (
@@ -835,7 +836,14 @@ mathMLToTeXMath s = writeTeX <$> readMathML s
835836
836837toStringAttr :: [(Text, Text)] -> [(Text, Text)]
837838toStringAttr = map go
838− where go (x,y) = (fromMaybe x $ T.stripPrefix "data-" x, y)
839+ where
840+ go (x,y) =
841+ case T.stripPrefix "data-" x of
842+ Nothing -> (x,y)
843+ Just x' -> if x' `Set.member` (html5Attributes <>
844+ html4Attributes <> rdfaAttributes)
845+ then (x,y)
846+ else (x',y)
839847
840848pScriptMath :: PandocMonad m => TagParser m Inlines
841849pScriptMath = try $ do