Add code for generating HTML

Test Plan: Ran unit tests. Looked at `\blue{\displaystyle \left(\dfrac{a^\sigma}{\sin \theta}\right\Updownarrow \intop_{1/2}^{z^z} \sum_{i=0}^\infty x \,dx}` in Chrome and saw the future in my eyes.

Reviewers: emily

Reviewed By: emily

Subscribers: jessie

Differential Revision: http://phabricator.khanacademy.org/D13154
This commit is contained in:
Ben Alpert
2014-09-12 17:59:26 -07:00
parent 3e78a76a47
commit 7df5b4bba8
4 changed files with 146 additions and 9 deletions

View File

@@ -8,12 +8,18 @@ var process = function(toParse, baseNode) {
utils.clearNode(baseNode);
var tree = parseTree(toParse);
var node = buildTree(tree).toDOM();
var node = buildTree(tree).toNode();
baseNode.appendChild(node);
};
var renderToString = function(toParse) {
var tree = parseTree(toParse);
return buildTree(tree).toMarkup();
};
module.exports = {
process: process,
renderToString: renderToString,
ParseError: ParseError
};