diff --git a/markdown_it/renderer.py b/markdown_it/renderer.py index f690b091..73dbde15 100644 --- a/markdown_it/renderer.py +++ b/markdown_it/renderer.py @@ -202,7 +202,9 @@ def renderInlineAsText( elif token.type == "image": if token.children: result += self.renderInlineAsText(token.children, options, env) - elif token.type == "softbreak": + elif token.type in ("html_inline", "html_block"): + result += token.content + elif token.type in ("softbreak", "hardbreak"): result += "\n" return result diff --git a/tests/test_port/fixtures/commonmark_extras.md b/tests/test_port/fixtures/commonmark_extras.md index f0b31dbd..2de75e5d 100644 --- a/tests/test_port/fixtures/commonmark_extras.md +++ b/tests/test_port/fixtures/commonmark_extras.md @@ -749,3 +749,19 @@ Issue #204. Combination of blockquotes, list and newlines causes an IndexError . + +Hardbreak in image description +. +![foo\ +bar](/url) +. +

foo
+bar

+. + +Inline HTML in image description +. +![ac](/url) +. +

a<b>c

+.