Implement implicit_figures extension for commonmark reader.
Closes #6350.
This commit is contained in:
parent
e7ac57d04c
commit
8fc57664f8
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
]
|
||||
|
|
|
@ -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) =
|
||||
|
|
Loading…
Add table
Reference in a new issue