From 111ab3afa2e67409fefada7f65c76a791b6e6126 Mon Sep 17 00:00:00 2001 From: Ibrahim Awwal Date: Thu, 21 Jun 2018 16:25:12 -0700 Subject: [PATCH] Allow passing arbitrary options to KaTeX This may be useful for things like the maxSize option. --- src/createMathComponent.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/createMathComponent.js b/src/createMathComponent.js index 9fc690b..f376489 100644 --- a/src/createMathComponent.js +++ b/src/createMathComponent.js @@ -40,7 +40,8 @@ const createMathComponent = (Component, { displayMode }) => { return KaTeX.renderToString(props[this.usedProp], { displayMode, errorColor, - throwOnError: !!renderError + throwOnError: !!renderError, + ...this.props.katexOptions }); } @@ -63,10 +64,15 @@ const createMathComponent = (Component, { displayMode }) => { MathComponent.propTypes = { children: PropTypes.string, errorColor: PropTypes.string, + katexOptions: PropTypes.object, math: PropTypes.string, renderError: PropTypes.func }; + MathComponent.defaultProps = { + katexOptions: {} + }; + return MathComponent; };