Browse Source

Set position and size for hr tokens

pull/204/head
Samy Pessé 9 years ago
parent
commit
ea17ef0e35
  1. 5
      lib/rules_block/hr.js

5
lib/rules_block/hr.js

@ -6,10 +6,11 @@ var isSpace = require('../common/utils').isSpace;
module.exports = function hr(state, startLine, endLine, silent) {
var marker, cnt, ch, token,
var marker, cnt, ch, token, originalPos,
pos = state.bMarks[startLine] + state.tShift[startLine],
max = state.eMarks[startLine];
originalPos = pos;
marker = state.src.charCodeAt(pos++);
// Check hr marker
@ -37,6 +38,8 @@ module.exports = function hr(state, startLine, endLine, silent) {
token = state.push('hr', 'hr', 0);
token.map = [ startLine, state.line ];
token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
token.position = originalPos;
token.size = pos - originalPos;
return true;
};

Loading…
Cancel
Save