mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
internal/warpc: Improve the JS plugin API
* Move the error handling into commons and make sure the error returned also returns message errors * Make the protocol version an int so it can be more easily compared
This commit is contained in:
@@ -6,13 +6,9 @@ const render = function (input) {
|
||||
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 });
|
||||
}
|
||||
// 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);
|
||||
|
Reference in New Issue
Block a user