linjer / jekyll-katex

[DEPRECATED] Jekyll plugin for easy server-side math rendering via KaTeX
MIT License
96 stars 8 forks source link

Bug in configuration #20

Closed dthul closed 5 years ago

dthul commented 5 years ago

I believe this bug was first reported in issue #3, fixed by PR #4 and recently reintroduced again by PR #15.

I do not specify any katex configuration options in my _config.yml file, so jekyll-katex/configuration.rb will set JEKYLL_CONFIG to {}. But then it tries to do a double indexing:

JEKYLL_CONFIG['rendering_options']['throw_error']

The first indexing operation will return nil, so the second indexing operation will throw the following error:

vendor/bundle/ruby/2.5.0/gems/jekyll-katex-0.3.1/lib/jekyll-katex/configuration.rb:34:in `global_rendering_options': undefined method `[]' for nil:NilClass (NoMethodError)

Maybe that code could be expressed more robustly by Ruby's Hash#merge operation? I might try and create a PR for this later.