diff --git a/markdown_it/rules_inline/image.py b/markdown_it/rules_inline/image.py index 4bba0bdf..fc23a69d 100644 --- a/markdown_it/rules_inline/image.py +++ b/markdown_it/rules_inline/image.py @@ -10,7 +10,6 @@ def image(state: StateInline, silent: bool): - tokens: List[Token] = [] label = None href = "" oldPos = state.pos @@ -134,11 +133,13 @@ def image(state: StateInline, silent: bool): if not silent: content = state.src[labelStart:labelEnd] + tokens: List[Token] = [] state.md.inline.parse(content, state.md, state.env, tokens) token = state.push("image", "img", 0) token.attrs = [["src", href], ["alt", ""]] token.children = tokens or None + token.content = content if title: token.attrs.append(["title", title]) diff --git a/tests/test_port/test_references.py b/tests/test_port/test_references.py index 95761368..1f1eba1a 100644 --- a/tests/test_port/test_references.py +++ b/tests/test_port/test_references.py @@ -279,7 +279,7 @@ def test_store_labels(): hidden=False, ) ], - content="", + content="a", markup="", info="", meta={"label": "A"},