class MarkdownIt::RulesBlock::Code
Public Class Methods
code(state, startLine, endLine, silent = true)
click to toggle source
# File lib/motion-markdown-it/rules_block/code.rb, line 8 def self.code(state, startLine, endLine, silent = true) return false if (state.sCount[startLine] - state.blkIndent < 4) last = nextLine = startLine + 1 while nextLine < endLine if state.isEmpty(nextLine) nextLine += 1 next end if (state.sCount[nextLine] - state.blkIndent >= 4) nextLine += 1 last = nextLine next end break end 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 end