Browse Source

Merge pull request #244 from cbreeden/master

Fixes #246, HTML Escaping alt-tag twice.
pull/251/head
Vitaly Puzrin 9 years ago
parent
commit
f58e5b16c4
  1. 5
      lib/renderer.js
  2. 14
      test/fixtures/markdown-it/commonmark_extras.txt

5
lib/renderer.js

@ -258,12 +258,11 @@ Renderer.prototype.renderInline = function (tokens, options, env) {
* instead of simple escaping. * instead of simple escaping.
**/ **/
Renderer.prototype.renderInlineAsText = function (tokens, options, env) { Renderer.prototype.renderInlineAsText = function (tokens, options, env) {
var result = '', var result = '';
rules = this.rules;
for (var i = 0, len = tokens.length; i < len; i++) { for (var i = 0, len = tokens.length; i < len; i++) {
if (tokens[i].type === 'text') { if (tokens[i].type === 'text') {
result += rules.text(tokens, i, options, env, this); result += tokens[i].content;
} else if (tokens[i].type === 'image') { } else if (tokens[i].type === 'image') {
result += this.renderInlineAsText(tokens[i].children, options, env); result += this.renderInlineAsText(tokens[i].children, options, env);
} }

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

@ -1,3 +1,17 @@
Issue #246. Double escaping in ALT
.
![&](#)
.
<p><img src="#" alt="&amp;"></p>
.
Strip markdown in ALT tags
.
![*strip* [markdown __in__ alt](#)](#)
.
<p><img src="#" alt="strip markdown in alt"></p>
.
Issue #55: Issue #55:
. .
![test] ![test]

Loading…
Cancel
Save