From 1b175b739b04e2e528cf1e1eb08c4863b9bfde86 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 7 Apr 2020 22:33:36 -0700 Subject: [PATCH] Do not render math inside code blocks. --- blog/convert.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blog/convert.rb b/blog/convert.rb index 86d660b..4962ee2 100644 --- a/blog/convert.rb +++ b/blog/convert.rb @@ -26,7 +26,7 @@ files = ARGV[0..-1] files.each do |file| puts "Rendering file: #{file}" document = Nokogiri::HTML.parse(File.open(file)) - document.search('//text()').each do |t| + document.search('//*[not(self::code)]/text()').each do |t| t.replace(perform_katex_sub(t.content)) end File.write(file, document.to_html)