Browse Source

Add position and size for code_block

pull/204/head
Samy Pessé 9 years ago
parent
commit
dfeba0a3bd
  1. 8
      lib/rules_block/code.js

8
lib/rules_block/code.js

@ -4,7 +4,9 @@
module.exports = function code(state, startLine, endLine/*, silent*/) {
var nextLine, last, token, emptyLines = 0;
var nextLine, last, token, emptyLines = 0,
pos = state.bMarks[startLine],
endPos;
if (state.sCount[startLine] - state.blkIndent < 4) { return false; }
@ -34,11 +36,15 @@ module.exports = function code(state, startLine, endLine/*, silent*/) {
break;
}
endPos = state.bMarks[last] + state.tShift[last];
state.line = last;
token = state.push('code_block', 'code', 0);
token.content = state.getLines(startLine, last, 4 + state.blkIndent, true);
token.map = [ startLine, state.line ];
token.position = pos;
token.size = endPos - pos;
return true;
};

Loading…
Cancel
Save