Skip to content

Commit 2136ab7

Browse files
authored
🐛 FIX: Add content to image tokens (#113)
1 parent 16b8537 commit 2136ab7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

markdown_it/rules_inline/image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
def image(state: StateInline, silent: bool):
1212

13-
tokens: List[Token] = []
1413
label = None
1514
href = ""
1615
oldPos = state.pos
@@ -134,11 +133,13 @@ def image(state: StateInline, silent: bool):
134133
if not silent:
135134
content = state.src[labelStart:labelEnd]
136135

136+
tokens: List[Token] = []
137137
state.md.inline.parse(content, state.md, state.env, tokens)
138138

139139
token = state.push("image", "img", 0)
140140
token.attrs = [["src", href], ["alt", ""]]
141141
token.children = tokens or None
142+
token.content = content
142143

143144
if title:
144145
token.attrs.append(["title", title])

tests/test_port/test_references.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def test_store_labels():
279279
hidden=False,
280280
)
281281
],
282-
content="",
282+
content="a",
283283
markup="",
284284
info="",
285285
meta={"label": "A"},

0 commit comments

Comments
 (0)