From ac6ccd1eda8daf00e6c9722dda7755f31ed92bea Mon Sep 17 00:00:00 2001 From: Lorin Werthen Date: Thu, 18 Mar 2021 22:12:15 +0100 Subject: [PATCH] fix katex fonts --- Rules | 2 ++ content/assets/stylesheets/includes/general.scss | 1 - lib/data_sources/katex.rb | 13 ++++++------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Rules b/Rules index 17b3ea4..d5e8819 100644 --- a/Rules +++ b/Rules @@ -3,6 +3,8 @@ require 'json' require 'icalendar' +require 'kramdown' +require 'kramdown-math-katex' # Important!!! diff --git a/content/assets/stylesheets/includes/general.scss b/content/assets/stylesheets/includes/general.scss index 58cfdd6..b59cccd 100644 --- a/content/assets/stylesheets/includes/general.scss +++ b/content/assets/stylesheets/includes/general.scss @@ -15,7 +15,6 @@ pre .line-numbers { transition: all .15s ease; box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08); - } a.box:hover { diff --git a/lib/data_sources/katex.rb b/lib/data_sources/katex.rb index 31677b7..2b13cd5 100644 --- a/lib/data_sources/katex.rb +++ b/lib/data_sources/katex.rb @@ -5,13 +5,12 @@ class KatexDataSource < ::Nanoc::DataSource def items katex_css_path = File.join(Katex.gem_path, 'vendor', 'katex', 'stylesheets', 'katex.css') + katex_font_paths = Dir[File.join(Katex.gem_path, 'vendor', 'katex', 'fonts', '*')] - [ - new_item( - File.open(katex_css_path).read, - {}, - "/katex.css" - ) - ] + font_items = katex_font_paths.map do |e| + font_name = File.split(e)[-1] + new_item(File.open(e).read, {}, "/fonts/#{font_name}") + end + [new_item(File.open(katex_css_path).read, {}, "/katex.css")] + font_items end end