aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-05-08 07:56:39 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-05-08 07:56:54 -0700
commit8fc57664f88c2f8cc006d19f662b1f40927b83ec (patch)
tree2a36e46bec13a422ea73d2448522986945dbe772 /src/Text/Pandoc/Readers
parente7ac57d04cfddb58f3f9cf243f5e0e75eeb05747 (diff)
downloadpandoc-8fc57664f88c2f8cc006d19f662b1f40927b83ec.tar.gz
Implement implicit_figures extension for commonmark reader.
Closes #6350.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/CommonMark.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/CommonMark.hs b/src/Text/Pandoc/Readers/CommonMark.hs
index d1f732bf1..c63ea6392 100644
--- a/src/Text/Pandoc/Readers/CommonMark.hs
+++ b/src/Text/Pandoc/Readers/CommonMark.hs
@@ -76,7 +76,12 @@ addBlocks opts = foldr (addBlock opts) []
addBlock :: ReaderOptions -> Node -> [Block] -> [Block]
addBlock opts (Node _ PARAGRAPH nodes) =
- (Para (addInlines opts nodes) :)
+ case addInlines opts nodes of
+ [Image attr alt (src,tit)]
+ | isEnabled Ext_implicit_figures opts
+ -- the "fig:" prefix indicates an implicit figure
+ -> (Para [Image attr alt (src, "fig:" <> tit)] :)
+ ils -> (Para ils :)
addBlock _ (Node _ THEMATIC_BREAK _) =
(HorizontalRule :)
addBlock opts (Node _ BLOCK_QUOTE nodes) =