diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index f07d0381f..25f3163c2 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -580,6 +580,7 @@ toAttrs kvs = do
return $ map (\(x,y) ->
customAttribute
(fromString (if not html5 || x `Set.member` html5Attributes
+ || "epub:" `isPrefixOf` x
|| "data-" `isPrefixOf` x
then x
else "data-" ++ x)) (toValue y)) kvs