Allow YAML title blocks to contain only comments.
This commit is contained in:
parent
7d18770b00
commit
d44d166431
1 changed files with 4 additions and 1 deletions
|
@ -231,7 +231,9 @@ yamlTitleBlock = try $ do
|
|||
pos <- getPosition
|
||||
string "---"
|
||||
blankline
|
||||
rawYaml <- unlines <$> manyTill anyLine stopLine
|
||||
rawYamlLines <- manyTill anyLine stopLine
|
||||
-- by including --- and ..., we allow yaml blocks with just comments:
|
||||
let rawYaml = unlines ("---" : (rawYamlLines ++ ["..."]))
|
||||
optional blanklines
|
||||
opts <- stateOptions <$> getState
|
||||
case Yaml.decodeEither' $ UTF8.fromString rawYaml of
|
||||
|
@ -241,6 +243,7 @@ yamlTitleBlock = try $ do
|
|||
then f
|
||||
else B.setMeta (T.unpack k) (yamlToMeta opts v) . f)
|
||||
id hashmap
|
||||
Right Yaml.Null -> return $ return id
|
||||
Right _ -> do
|
||||
addWarning (Just pos) "YAML header is not an object"
|
||||
return $ return id
|
||||
|
|
Loading…
Add table
Reference in a new issue