Browse Source

Syntax highlighting in Git docs

Jed Fox 5 năm trước cách đây
mục cha
commit
bad02f87ba
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      lib/docs/filters/git/clean_html.rb

+ 2 - 0
lib/docs/filters/git/clean_html.rb

@@ -42,6 +42,8 @@ module Docs
 
         css('pre').each do |node|
           node.content = node.content.gsub("\t", ' ' * 8)
+          node['data-language'] = 'shell' if node.content.starts_with?('git ')
+          node['data-language'] = 'shell-session' if node.content[0] == '$'
         end
       end
     end