git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: don't parse footnote body unless extension enabled.
commit3982b23428f9ef8db82c7e360d9f2b896b531c86 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 13 Nov 2019, 21:18 (7 years ago) parentcbcaf19
1 file changed+20−18
src/Text/Pandoc/Readers/Markdown.hs+20−18
src/Text/Pandoc/Readers/Markdown.hs+20−18
@@ -460,24 +460,26 @@ rawLines = do
460460 return $ T.unlines (first:rest)
461461
462462noteBlock :: PandocMonad m => MarkdownParser m (F Blocks)
463−noteBlock = try $ do
464− pos <- getPosition
465− skipNonindentSpaces
466− ref <- noteMarker
467− char ':'
468− optional blankline
469− optional indentSpaces
470− first <- rawLines
471− rest <- many $ try $ blanklines >> indentSpaces >> rawLines
472− let raw = T.unlines (first:rest) <> "\n"
473− optional blanklines
474− parsed <- parseFromString' parseBlocks raw
475− oldnotes <- stateNotes' <$> getState
476− case M.lookup ref oldnotes of
477− Just _ -> logMessage $ DuplicateNoteReference ref pos
478− Nothing -> return ()
479− updateState $ \s -> s { stateNotes' = M.insert ref (pos, parsed) oldnotes }
480− return mempty
463+noteBlock = do
464+ guardEnabled Ext_footnotes
465+ do pos <- getPosition
466+ skipNonindentSpaces
467+ ref <- noteMarker
468+ char ':'
469+ optional blankline
470+ optional indentSpaces
471+ first <- rawLines
472+ rest <- many $ try $ blanklines >> indentSpaces >> rawLines
473+ let raw = T.unlines (first:rest) <> "\n"
474+ optional blanklines
475+ parsed <- parseFromString' parseBlocks raw
476+ oldnotes <- stateNotes' <$> getState
477+ case M.lookup ref oldnotes of
478+ Just _ -> logMessage $ DuplicateNoteReference ref pos
479+ Nothing -> return ()
480+ updateState $ \s -> s { stateNotes' =
481+ M.insert ref (pos, parsed) oldnotes }
482+ return mempty
481483
482484--
483485-- parsing blocks