aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/warpc/js/renderkatex.js
blob: 5e83beb91e4b118b63453eac393cacdb02aa8751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { readInput, writeOutput } from './common';
import katex from 'katex';

const render = function (input) {
	const data = input.data;
	const expression = data.expression;
	const options = data.options;
	const header = input.header;
	try {
		const output = katex.renderToString(expression, options);
		writeOutput({ header: header, data: { output: output } });
	} catch (e) {
		header.err = e.message;
		writeOutput({ header: header });
	}
};

readInput(render);