From dfeba0a3bde190941250ed419fb86de5fc7ca4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Wed, 24 Feb 2016 11:02:31 +0100 Subject: [PATCH] Add position and size for code_block --- lib/rules_block/code.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/rules_block/code.js b/lib/rules_block/code.js index 470cb01..ed2e304 100644 --- a/lib/rules_block/code.js +++ b/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; };