def self.is_delimited_block? line, return_match_data = false
return unless (line_len = line.length) > 1 && DELIMITED_BLOCK_HEADS.include?(line.slice 0, 2)
if line_len == 2
tip = line
tl = 2
else
if line_len <= 4
tip = line
tl = line_len
else
tip = line.slice 0, 4
tl = 4
end
fenced_code = false
if Compliance.markdown_syntax
tip_3 = (tl == 4 ? tip.chop : tip)
if tip_3 == '```'
if tl == 4 && tip.end_with?('`')
return
end
tip = tip_3
tl = 3
fenced_code = true
end
end
return if tl == 3 && !fenced_code
end
if DELIMITED_BLOCKS.key? tip
if tl < 4 || tl == line_len
if return_match_data
context, masq = DELIMITED_BLOCKS[tip]
BlockMatchData.new(context, masq, tip, tip)
else
true
end
elsif %(#{tip}#{tip[-1..-1] * (line_len - tl)}) == line
if return_match_data
context, masq = DELIMITED_BLOCKS[tip]
BlockMatchData.new(context, masq, tip, line)
else
true
end
else
nil
end
else
nil
end
end