diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Extensions.hs | 1 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/CommonMark.hs | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs index 1db1a6545..e33a59e37 100644 --- a/src/Text/Pandoc/Extensions.hs +++ b/src/Text/Pandoc/Extensions.hs @@ -435,6 +435,7 @@ getAllExtensions f = universalExtensions <> getAll f extensionsFromList [ Ext_raw_html , Ext_raw_tex -- only supported in writer (for math) + , Ext_implicit_figures , Ext_hard_line_breaks , Ext_smart ] 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) = |