Do not render math inside code blocks.

This commit is contained in:
Danila Fedorin 2020-04-07 22:33:36 -07:00
parent 2fb5691596
commit 1b175b739b

View File

@ -26,7 +26,7 @@ files = ARGV[0..-1]
files.each do |file| files.each do |file|
puts "Rendering file: #{file}" puts "Rendering file: #{file}"
document = Nokogiri::HTML.parse(File.open(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)) t.replace(perform_katex_sub(t.content))
end end
File.write(file, document.to_html) File.write(file, document.to_html)