Browse Source

Merge pull request #775 from hukkinj1/fix-image-newline

Fix newline not rendered in image alt attribute
pull/779/head
Vitaly Puzrin 3 years ago
committed by GitHub
parent
commit
28d9ad8f0c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lib/renderer.js
  2. 9
      test/fixtures/markdown-it/commonmark_extras.txt

2
lib/renderer.js

@ -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';
}
}

9
test/fixtures/markdown-it/commonmark_extras.txt

@ -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>
.

Loading…
Cancel
Save