From c39f1a138b5056c6c43bc1972be8b0fa0ce80e38 Mon Sep 17 00:00:00 2001 From: Antoine Pietri Date: Sun, 24 May 2020 14:29:08 +0200 Subject: [PATCH] ocaml: enable highlighting of caml-example code fragments --- lib/docs/filters/ocaml/clean_html.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/docs/filters/ocaml/clean_html.rb b/lib/docs/filters/ocaml/clean_html.rb index 44f3fb5a..dea7a59a 100644 --- a/lib/docs/filters/ocaml/clean_html.rb +++ b/lib/docs/filters/ocaml/clean_html.rb @@ -6,6 +6,17 @@ module Docs node['data-language'] = 'ocaml' end + css('.caml-input').each do |node| + node.content = '# ' + node.content.strip + end + + css('.caml-example').each do |node| + node.name = 'pre' + node.traverse { |n| n.remove if n.text? && n.text !~ /\S/ } + + node['data-language'] = 'ocaml' + end + doc end end