File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -281,7 +281,6 @@ Sub-figure with adaptive layouts
281281:class-grid: outline
282282
283283![ Figure A] ( _static/A.png )
284-
285284![ Figure B] ( _static/B.png )
286285
287286Sub-figure using myst-parser syntax: `  `
Original file line number Diff line number Diff line change @@ -65,13 +65,17 @@ def run(self) -> list[nodes.Element]:
6565 child ["subfigure_area" ] = string .ascii_uppercase [idx ]
6666 elif (
6767 isinstance (child , nodes .paragraph )
68- and len ( child .children ) == 1
68+ and child .children
6969 and isinstance (child [0 ], nodes .image )
7070 ):
71- number_of_images += 1
72- image = child [0 ]
73- image ["subfigure_area" ] = string .ascii_uppercase [idx ]
74- child .replace_self (image )
71+ images = []
72+ for sub in child :
73+ if not isinstance (sub , nodes .image ):
74+ continue
75+ number_of_images += 1
76+ images .append (sub )
77+ sub ["subfigure_area" ] = string .ascii_uppercase [idx ]
78+ child .replace_self (images )
7579 elif isinstance (child , nodes .paragraph ):
7680 if has_caption :
7781 raise self .error ("Invalid subfigure content (multiple captions)" )
You can’t perform that action at this time.
0 commit comments