diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index f3c3b9882..2e5473992 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -486,6 +486,7 @@ endOfDoc = try $ do
 parseHtml :: GenParser Char ParserState Pandoc
 parseHtml = do
   sepEndBy (choice [xmlDec, definition, htmlComment]) spaces
+  spaces
   skipHtmlTag "html"
   spaces
   meta <- option (Meta [] [] []) parseHead