@@ -227,20 +227,26 @@ pandocTitleBlock = try $ do
227227yamlTitleBlock :: MarkdownParser (F (Pandoc -> Pandoc))
228228yamlTitleBlock = try $ do
229229 guardEnabled Ext_yaml_title_block
230+ pos <- getPosition
230231 string "---"
231232 blankline
232233 rawYaml <- unlines <$> manyTill anyLine stopLine
233234 optional blanklines
234235 opts <- stateOptions <$> getState
235− return $ return $
236− case Yaml.decode $ UTF8.fromString rawYaml of
237− Just (Yaml.Object hashmap) ->
236+ case Yaml.decodeEither $ UTF8.fromString rawYaml of
237+ Right (Yaml.Object hashmap) -> return $ return $
238238 H.foldrWithKey (\k v f ->
239239 if ignorable k
240240 then f
241241 else B.setMeta (T.unpack k) (yamlToMeta opts v) . f)
242242 id hashmap
243− _ -> fail "Could not parse yaml object"
243+ Left errStr -> do
244+ addWarning (Just pos) $ "Could not parse YAML header: " ++
245+ errStr
246+ return $ return id
247+ Right _ -> do
248+ addWarning (Just pos) "YAML header is not an object"
249+ return $ return id
244250
245251-- ignore fields starting with _
246252ignorable :: Text -> Bool