https://github.com/bradhowes/remarkable-katex
A Remarkable plugin for converting $...$ and $$...$$ in Markdown text into math HTML using KaTeX.
https://github.com/bradhowes/remarkable-katex
katex latex math-html remarkable remarkable-plugin
Last synced: 15 days ago
JSON representation
A Remarkable plugin for converting $...$ and $$...$$ in Markdown text into math HTML using KaTeX.
- Host: GitHub
- URL: https://github.com/bradhowes/remarkable-katex
- Owner: bradhowes
- License: mit
- Created: 2017-06-11T23:55:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-04-24T19:54:28.000Z (over 1 year ago)
- Last Synced: 2024-05-02T02:56:56.276Z (over 1 year ago)
- Topics: katex, latex, math-html, remarkable, remarkable-plugin
- Language: JavaScript
- Homepage:
- Size: 44.9 KB
- Stars: 23
- Watchers: 3
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/bradhowes/remarkable-katex)
[](https://opensource.org/licenses/MIT)
# Overview
This is a [Remarkable](https://github.com/jonschlinkert/remarkable) plugin that converts
[LaTeX math expressions](http://web.ift.uib.no/Teori/KURS/WRK/TeX/symALL.html) between `$...$` (inline) or
`$$...$$` (block) delimiters into math HTML. It should not interfere with any other Markdown processing.
I use this to perform server-side math expression rendering for my blog, [Keystroke
Countdown](https://keystrokecountdown.com). The post
[Metalsmith Plugins for Server-side KaTeX Processing](https://keystrokecountdown.com/articles/metalsmith2/index.html)
talks about the implementation of this package as well as a Jupyter IPython notebook plugin that does
similar processing.
# To Use
Install this package using `npm`:
```bash
% npm install [-s] remarkable-katex
```
Assuming you already have `Remarkable` installed, one way to use would be like so:
**CommonJS**
```javascript
const { Remarkable, utils } = require('remarkable');
const plugin = require('remarkable-katex');
const md = new Remarkable();
md.use(plugin, {delimiter: ''});
```
**ES6**
```javascript
import { Remarkable, utils } from 'remarkable';
import { rkatex } from 'remarkable-katex';
const md = new Remarkable();
md.use(rkatex, {delimiter: ''});
```
# Configuration
Accepts a `delimiter` option that defines the 1-character delimiter to use when recognizing KaTeX spans. Default
is the `$` character.
```
{delimiter: '$'}
```
# Dependencies
* [KaTeX](https://github.com/Khan/KaTeX) -- performs the rendering of the LaTeX commands.
# Tests
There are a set of [Vows](http://vowsjs.org) in [index.test.js](index.test.js). To run:
```bash
% npm test
```
> **NOTE**: if this fails, there may be a path issue with `vows` executable. See [package.json](package.json).