0.0
The project is in a healthy, maintained state
Convert LaTeX math formulas to HTML using KaTeX in Rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 1.8.0
 Project Readme

KaTeX on Rails

Convert LaTeX math formulas to HTML using KaTeX in Rails.

KaTeX on Rails uses Nodo to call the KaTex Node.js package.

Installation

Add the KaTeX on Rails gem:

bundle add katex_on_rails

Or add this line to your Gemfile manually:

gem 'katex_on_rails'

Install the katex package with npm:

npm install katex

Or with yarn:

yarn add katex

To render any HTML generated by this gem, you will need to link the CSS file from the katex Node.js package, make the KaTeX font files available to the client, and use the HTML5 doctype. See browser usage. Note, however, that you do not need to include katex.js on the client.

Usage

katex = KatexOnRails.new

katex.render_to_string('x', { output: 'html' })
#=> "<span class=\"katex\">..."

The last argument to render_to_string can contain a variety of rendering options.

License

The KaTeX on Rails gem is is released under the MIT License.