Skip to content

Commit

Permalink
Fix newline not rendered in image alt attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
hukkinj1 committed Apr 15, 2021
1 parent 3740146 commit 272a470
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 272a470

Please sign in to comment.