diff --git a/katex.js b/katex.js index 28a2298d..232d9dd1 100644 --- a/katex.js +++ b/katex.js @@ -18,6 +18,8 @@ import utils from "./src/utils"; import type {SettingsOptions} from "./src/Settings"; import type ParseNode from "./src/ParseNode"; +import { defineSymbol } from './src/symbols'; + /** * Parse and build an expression, and place that expression in the DOM node * given. @@ -68,7 +70,6 @@ const generateParseTree = function( return parseTree(expression, settings); }; - /** * Generates and returns the katex build tree. This is used for advanced * use cases (like rendering to custom output). @@ -137,4 +138,8 @@ export default { * to change. Use at your own risk. */ __renderToHTMLTree: renderToHTMLTree, + /** + * adds a new symbol to internal symbols table + */ + __defineSymbol: defineSymbol, }; diff --git a/package.json b/package.json index b858360c..4382b25c 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "test:lint": "eslint katex.js katex.webpack.js cli.js webpack.common.js webpack.config.js webpack.dev.js src static test contrib dockers && stylelint src/katex.less", "test:flow": "flow", "test:jest": "jest", + "test:jest:watch": "jest --watch", "test:jest:update": "jest --updateSnapshot", "test:jest:coverage": "jest --coverage", "test:screenshots": "npm run test:screenshots:update -- --verify", diff --git a/src/symbols.js b/src/symbols.js index 8c33b60a..58a2035a 100644 --- a/src/symbols.js +++ b/src/symbols.js @@ -19,7 +19,7 @@ import type {Mode} from "./types"; -type Font = "main" | "ams"; +type Font = "main" | "ams" type Group = "accent" | "bin" | "close" | "inner" | "mathord" | "op" | "open" | "punct" | "rel" | "spacing" | "textord"; @@ -32,7 +32,7 @@ const symbols: {[Mode]: CharInfoMap} = { export default symbols; /** `acceptUnicodeChar = true` is only applicable if `replace` is set. */ -function defineSymbol( +export function defineSymbol( mode: Mode, font: Font, group: Group,