wrapper is dropped by
+ # _unwrap_lone_figures below.)
+ title = token.attrs.get("title")
+ caption = f"
wrapper around a lone titled image. + """Drop the
wrapper around a lone image.
markdown-it wraps inline content in a paragraph, but our image rule
- turns titled images into . Browsers hoist it out, leaving an empty paragraph whose
margins disturb the layout.
"""
@@ -88,7 +96,7 @@ def _unwrap_lone_figures(state) -> None:
if token.type != "inline" or not token.children:
continue
[child] = token.children if len(token.children) == 1 else [None]
- if child and child.type == "image" and child.attrs.get("title"):
+ if child and child.type == "image":
if (tokens[i - 1].type == "paragraph_open"
and tokens[i + 1].type == "paragraph_close"):
tokens[i - 1].hidden = True