From ea17ef0e35f35866d2b74eaa4efba014760fceed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Wed, 24 Feb 2016 10:41:58 +0100 Subject: [PATCH] Set position and size for hr tokens --- lib/rules_block/hr.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/rules_block/hr.js b/lib/rules_block/hr.js index 8638f04..8d9fb20 100644 --- a/lib/rules_block/hr.js +++ b/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; };