lib/kramdown/converter/base.rb in kramdown-1.6.0 vs lib/kramdown/converter/base.rb in kramdown-1.7.0

- old
+ new

@@ -180,20 +180,20 @@ [[level + @options[:header_offset], 6].min, 1].max end # Extract the code block/span language from the attributes. def extract_code_language(attr) - if attr['class'] && attr['class'] =~ /\blanguage-\w+\b/ - attr['class'].scan(/\blanguage-(\w+)\b/).first.first + if attr['class'] && attr['class'] =~ /\blanguage-\w[\w-]*\b/ + attr['class'].scan(/\blanguage-(\w[\w-]*)\b/).first.first end end # See #extract_code_language # # *Warning*: This version will modify the given attributes if a language is present. def extract_code_language!(attr) lang = extract_code_language(attr) - attr['class'] = attr['class'].sub(/\blanguage-\w+\b/, '').strip if lang + attr['class'] = attr['class'].sub(/\blanguage-\w[\w-]*\b/, '').strip if lang attr.delete('class') if lang && attr['class'].empty? lang end # Highlight the given +text+ in the language +lang+ with the syntax highlighter configured