diff --git a/katex.js b/katex.js index 3eda4e59..f513b3ab 100644 --- a/katex.js +++ b/katex.js @@ -28,7 +28,7 @@ let render = function( options: SettingsOptions, ) { utils.clearNode(baseNode); - const node = generateBuildTree(expression, options).toNode(); + const node = renderToDomTree(expression, options).toNode(); baseNode.appendChild(node); }; @@ -53,7 +53,7 @@ const renderToString = function( expression: string, options: SettingsOptions, ): string { - const markup = generateBuildTree(expression, options).toMarkup(); + const markup = renderToDomTree(expression, options).toMarkup(); return markup; }; @@ -73,7 +73,7 @@ const generateParseTree = function( * Generates and returns the katex build tree. This is used for advanced * use cases (like rendering to custom output). */ -const generateBuildTree = function( +const renderToDomTree = function( expression: string, options: SettingsOptions, ) { @@ -86,7 +86,7 @@ const generateBuildTree = function( * Generates and returns the katex build tree, with just HTML (no MathML). * This is used for advanced use cases (like rendering to custom output). */ -const generateBuildHTMLTree = function( +const renderToHTMLTree = function( expression: string, options: SettingsOptions, ) { @@ -96,25 +96,45 @@ const generateBuildHTMLTree = function( }; module.exports = { + /** + * Renders the given LaTeX into an HTML+MathML combination, and adds + * it as a child to the specified DOM node. + */ render, + /** + * Renders the given LaTeX into an HTML+MathML combination string, + * for sending to the client. + */ renderToString, + /** + * KaTeX error, usually during parsing. + */ ParseError, /** + * Parses the given LaTeX into KaTeX's internal parse tree structure, + * without rendering to HTML or MathML. + * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ __parse: generateParseTree, /** + * Renders the given LaTeX into an HTML+MathML internal DOM tree + * representation, without flattening that representation to a string. + * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ - __getBuildTree: generateBuildTree, + __renderToDomTree: renderToDomTree, /** + * Renders the given LaTeX into an HTML internal DOM tree representation, + * without MathML and without flattening that representation to a string. + * * NOTE: This method is not currently recommended for public use. * The internal tree representation is unstable and is very likely * to change. Use at your own risk. */ - __getBuildHTMLTree: generateBuildHTMLTree, + __renderToHTMLTree: renderToHTMLTree, };