summaryrefslogtreecommitdiffstats
path: root/internal/warpc/js/renderkatex.js
blob: dc4cb402502a03cde25ee4ec478dc3df60fc5018 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { readInput, writeOutput } from './common';
import katex from 'katex';
import 'katex/contrib/mhchem/mhchem.js';

const render = function (input) {
	const data = input.data;
	const expression = data.expression;
	const options = data.options;
	const header = input.header;
	// Any error thrown here will be caught by the common.js readInput function.
	const output = katex.renderToString(expression, options);
	writeOutput({ header: header, data: { output: output } });
};

readInput(render);