mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
Add looots of comments
Summary: Add comments everywhere! Also fix some small bugs like using Style.id instead of Style.size, and rename some variables to be more descriptive. Fixes #22 Test Plan: - Make sure the huxley screenshots didn't change - Make sure the tests still pass Reviewers: alpert Reviewed By: alpert Differential Revision: http://phabricator.khanacademy.org/D13158
This commit is contained in:
15
katex.js
15
katex.js
@@ -1,9 +1,21 @@
|
||||
/**
|
||||
* This is the main entry point for KaTeX. Here, we expose functions for
|
||||
* rendering expressions either to DOM nodes or to markup strings.
|
||||
*
|
||||
* We also expose the ParseError class to check if errors thrown from KaTeX are
|
||||
* errors in the expression, or errors in javascript handling.
|
||||
*/
|
||||
|
||||
var ParseError = require("./ParseError");
|
||||
|
||||
var buildTree = require("./buildTree");
|
||||
var parseTree = require("./parseTree");
|
||||
var utils = require("./utils");
|
||||
|
||||
/**
|
||||
* Parse and build an expression, and place that expression in the DOM node
|
||||
* given.
|
||||
*/
|
||||
var process = function(toParse, baseNode) {
|
||||
utils.clearNode(baseNode);
|
||||
|
||||
@@ -13,6 +25,9 @@ var process = function(toParse, baseNode) {
|
||||
baseNode.appendChild(node);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse and build an expression, and return the markup for that.
|
||||
*/
|
||||
var renderToString = function(toParse) {
|
||||
var tree = parseTree(toParse);
|
||||
return buildTree(tree).toMarkup();
|
||||
|
Reference in New Issue
Block a user