diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..f05dc61 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,6 @@ +# v0.1.1 + +* Changes the default for `throw_on_error` to `true` to align with KaTeX native. +* Also catches KaTeX `ParseError` when `throw_on_error` is `false`. +* Fixes Rails assets resolution. +* Updates KaTeX to v0.7.1. diff --git a/README.md b/README.md index d9602bb..64daab4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ It uses [ExecJS] under the hood. Add this line to your application's Gemfile: ```ruby -gem 'katex', '~> 0.1.0' +gem 'katex', '~> 0.1.1' ``` And then execute: @@ -30,6 +30,18 @@ Katex.render 'c = \\pm\\sqrt{a^2 + b^2}' If you're on Rails, the result is marked as `html_safe`. +Any error in the markup is raised by default. To avoid this and render error +text instead, pass `throw_on_error: false`: + +```ruby +Katex.render '\\', throw_on_error: false +``` + +Note that this will catch even `ParseError`s (unlike native KaTeX). + +Learn more about all the available options in the +[documentation](http://www.rubydoc.info/gems/katex/Katex#render-class_method). + ### Assets For this rendered math to look nice, you will also need to include KaTeX CSS diff --git a/lib/katex/version.rb b/lib/katex/version.rb index b6b4c8b..8890f63 100644 --- a/lib/katex/version.rb +++ b/lib/katex/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Katex - VERSION = '0.1.0' + VERSION = '0.1.1' KATEX_VERSION = 'v0.7.1' end