git.iko.soy/typeable/pandoc
on master help sign in
Allow YAML title blocks to contain only comments.
commitd44d1664312f0d05ada61eb49a678ef8a04d90d0 authorJohn MacFarlane <fiddlosopher@gmail.com> dateWed 7 Aug 2013, 08:43 (13 years ago) parent7d18770
1 file changed+4−1
src/Text/Pandoc/Readers/Markdown.hs+4−1
src/Text/Pandoc/Readers/Markdown.hs+4−1
@@ -231,7 +231,9 @@ yamlTitleBlock = try $ do
231231 pos <- getPosition
232232 string "---"
233233 blankline
234− rawYaml <- unlines <$> manyTill anyLine stopLine
234+ rawYamlLines <- manyTill anyLine stopLine
235+ -- by including --- and ..., we allow yaml blocks with just comments:
236+ let rawYaml = unlines ("---" : (rawYamlLines ++ ["..."]))
235237 optional blanklines
236238 opts <- stateOptions <$> getState
237239 case Yaml.decodeEither' $ UTF8.fromString rawYaml of
@@ -241,6 +243,7 @@ yamlTitleBlock = try $ do
241243 then f
242244 else B.setMeta (T.unpack k) (yamlToMeta opts v) . f)
243245 id hashmap
246+ Right Yaml.Null -> return $ return id
244247 Right _ -> do
245248 addWarning (Just pos) "YAML header is not an object"
246249 return $ return id