Merge pull request #449 from ZeusWPI/fix-katex

Fix KaTeX (math mode) fonts
This commit is contained in:
lorin 2021-03-20 09:13:37 +01:00 committed by GitHub
commit 3a2b233f45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

2
Rules
View file

@ -3,6 +3,8 @@
require 'json'
require 'icalendar'
require 'kramdown'
require 'kramdown-math-katex'
# Important!!!

View file

@ -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 {

View file

@ -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