diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 16141369a..985d1d0f2 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -317,6 +317,7 @@ rawLines = do noteBlock :: MarkdownParser (F Blocks) noteBlock = try $ do + pos <- getPosition skipNonindentSpaces ref <- noteMarker char ':' @@ -328,7 +329,11 @@ noteBlock = try $ do optional blanklines parsed <- parseFromString parseBlocks raw let newnote = (ref, parsed) - updateState $ \s -> s { stateNotes' = newnote : stateNotes' s } + oldnotes <- stateNotes' <$> getState + case lookup ref oldnotes of + Just _ -> addWarning (Just pos) $ "Duplicate note reference `" ++ ref ++ "'" + Nothing -> return () + updateState $ \s -> s { stateNotes' = newnote : oldnotes } return mempty -- |