aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-05 16:34:47 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-05 16:34:47 +0100
commite20f55618f82eb93f9ad5968e8e90b57def0d5d7 (patch)
tree3faf7c0f2212ee785155ba04ae2f22acbb662f53 /src/Text/Pandoc/Readers
parentaeb11cea4eb1d0e6f68ad71cd178cd8636dcbf5f (diff)
downloadpandoc-e20f55618f82eb93f9ad5968e8e90b57def0d5d7.tar.gz
Markdown reader: fixed internal header links.
Closes #2397. This patch also adds `shortcut_reference_links` to the list of mmd extensions.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index abaa907e0..2cd1c0d83 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -567,9 +567,14 @@ setextHeaderEnd = try $ do
mmdHeaderIdentifier :: PandocMonad m => MarkdownParser m Attr
mmdHeaderIdentifier = do
- ident <- stripFirstAndLast . snd <$> reference
+ (_, raw) <- reference
+ let raw' = trim $ stripFirstAndLast raw
+ let ident = concat $ words $ map toLower raw'
+ let attr = (ident, [], [])
+ guardDisabled Ext_implicit_header_references
+ <|> registerImplicitHeader raw' attr
skipSpaces
- return (ident,[],[])
+ return attr
setextHeader :: PandocMonad m => MarkdownParser m (F Blocks)
setextHeader = try $ do