Browse Source

Add `content` property to image token

close https://github.com/markdown-it/markdown-it/issues/184
pull/186/head
Alex Kocharin 9 years ago
parent
commit
f2344b5cbc
  1. 7
      lib/rules_inline/image.js

7
lib/rules_inline/image.js

@ -12,6 +12,7 @@ var isSpace = require('../common/utils').isSpace;
module.exports = function image(state, silent) {
var attrs,
code,
content,
label,
labelEnd,
labelStart,
@ -136,8 +137,10 @@ module.exports = function image(state, silent) {
// so all that's left to do is to call tokenizer.
//
if (!silent) {
content = state.src.slice(labelStart, labelEnd);
state.md.inline.parse(
state.src.slice(labelStart, labelEnd),
content,
state.md,
state.env,
tokens = []
@ -146,6 +149,8 @@ module.exports = function image(state, silent) {
token = state.push('image', 'img', 0);
token.attrs = attrs = [ [ 'src', href ], [ 'alt', '' ] ];
token.children = tokens;
token.content = content;
if (title) {
attrs.push([ 'title', title ]);
}

Loading…
Cancel
Save