Przeglądaj źródła

Add nix syntax highlighting

Thomas Dy 3 lat temu
rodzic
commit
c4cb1940f4

Plik diff jest za duży
+ 21 - 6
assets/javascripts/vendor/prism.js


+ 8 - 0
lib/docs/filters/nix/clean_html.rb

@@ -60,6 +60,8 @@ module Docs
           end
           new_root.add_child(image_sections)
 
+          new_root.css('pre.programlisting').attr('data-language', 'nix')
+
           new_root
         elsif subpath == 'nix/stable/expressions/builtins.html'
           @doc = doc.at_css('main dl')
@@ -83,6 +85,12 @@ module Docs
             description.name = 'div'
           end
 
+          doc.css('pre > code').each do |code|
+            code.parent['data-language'] = 'nix' if code['class'] == 'language-nix'
+            code.parent['data-language'] = 'xml' if code['class'] == 'language-xml'
+            unwrap(code)
+          end
+
           doc
         else
           doc

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików