diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Options.hs | 1 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 26 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index f64926f67..8ebbef0be 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -169,6 +169,7 @@ multimarkdownExtensions :: Set Extension multimarkdownExtensions = Set.fromList [ Ext_pipe_tables , Ext_raw_html + , Ext_markdown_attribute , Ext_raw_tex , Ext_tex_math_double_backslash , Ext_intraword_underscores diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 8141187e7..05f6b084e 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -396,12 +396,30 @@ atxHeader = try $ do attr' <- addToHeaderList attr text return $ B.headerWith attr' level <$> text -atxClosing :: Parser [Char] st Attr -atxClosing = - try $ skipMany (char '#') >> skipSpaces >> option nullAttr attributes <* blanklines +atxClosing :: MarkdownParser Attr +atxClosing = try $ do + attr' <- option nullAttr + (guardEnabled Ext_mmd_header_identifiers >> mmdHeaderIdentifier) + skipMany (char '#') + skipSpaces + attr <- option attr' + (guardEnabled Ext_header_attributes >> attributes) + blanklines + return attr setextHeaderEnd :: MarkdownParser Attr -setextHeaderEnd = try $ option nullAttr attributes <* blankline +setextHeaderEnd = try $ do + attr <- option nullAttr + $ (guardEnabled Ext_mmd_header_identifiers >> mmdHeaderIdentifier) + <|> (guardEnabled Ext_header_attributes >> attributes) + blanklines + return attr + +mmdHeaderIdentifier :: MarkdownParser Attr +mmdHeaderIdentifier = do + ident <- stripFirstAndLast . snd <$> reference + skipSpaces + return (ident,[],[]) setextHeader :: MarkdownParser (F Blocks) setextHeader = try $ do |