Skip to content

Commit

Permalink
Merge pull request #775 from hukkinj1/fix-image-newline
Browse files Browse the repository at this point in the history
Fix newline not rendered in image alt attribute
  • Loading branch information
Vitaly Puzrin committed Apr 16, 2021
2 parents 3740146 + 272a470 commit 28d9ad8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/renderer.js
Expand Up @@ -300,6 +300,8 @@ Renderer.prototype.renderInlineAsText = function (tokens, options, env) {
result += tokens[i].content;
} else if (tokens[i].type === 'image') {
result += this.renderInlineAsText(tokens[i].children, options, env);
} else if (tokens[i].type === 'softbreak') {
result += '\n';
}
}

Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/markdown-it/commonmark_extras.txt
Expand Up @@ -653,3 +653,12 @@ Issue #772. Header rule should not interfere with html tags.
==
</pre>
.

Newline in image description
.
There is a newline in this image ![here
it is](https://github.com/executablebooks/)
.
<p>There is a newline in this image <img src="https://github.com/executablebooks/" alt="here
it is"></p>
.

0 comments on commit 28d9ad8

Please sign in to comment.