Created
January 6, 2017 01:20
-
-
Save Vnthf/add63b2080c91e55bf0f974326d3c503 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code block (4 spaces padded) | |
'use strict'; | |
module.exports = function code(state, startLine, endLine/*, silent*/) { | |
var nextLine, last, token; | |
if (state.sCount[startLine] - state.blkIndent < 4) { return false; } | |
last = nextLine = startLine + 1; | |
while (nextLine < endLine) { | |
if (state.isEmpty(nextLine)) { | |
nextLine++; | |
continue; | |
} | |
if (state.sCount[nextLine] - state.blkIndent >= 4) { | |
nextLine++; | |
last = nextLine; | |
continue; | |
} | |
break; | |
} | |
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 ]; | |
return true; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment