class MarkdownIt::RulesInline::Escape
Constants
- ESCAPED
Public Class Methods
escape(state, silent)
click to toggle source
# File lib/motion-markdown-it/rules_inline/escape.rb, line 16 def self.escape(state, silent) pos = state.pos max = state.posMax return false if charCodeAt(state.src, pos) != 0x5C # \ pos += 1 if pos < max ch = charCodeAt(state.src, pos) if ch < 256 && ESCAPED[ch] != 0 state.pending += state.src[pos] if !silent state.pos += 2 return true end if ch == 0x0A if !silent state.push('hardbreak', 'br', 0) end pos += 1 # skip leading whitespaces from next line while pos < max ch = charCodeAt(state.src, pos) break if !isSpace(ch) pos += 1 end state.pos = pos return true end end state.pending += '\\' if !silent state.pos += 1 return true end