Sha256: 32b0cf9af286ab2b52ffd3c1a4075418f5261db817e459d49258b2c55565c1e6
Contents?: true
Size: 531 Bytes
Versions: 3
Compression:
Stored size: 531 Bytes
Contents
module HtmlToProsemirror module Nodes class CodeBlock < Node def matching @node.name === 'code' && @node.parent.name === 'pre' end def data block = { type: "code_block" } lang = get_language block.merge({attrs: { language: lang } }) if lang block end def get_language lang = @node.attribute('class') if (lang && lang.value) return lang.value.gsub("/^language-/", "") end return nil end end end end
Version data entries
3 entries across 3 versions & 1 rubygems