diff --git a/src/buildHTML.js b/src/buildHTML.js
index ddcbd19c..8149efd7 100644
--- a/src/buildHTML.js
+++ b/src/buildHTML.js
@@ -71,7 +71,7 @@ const spliceSpaces = function(children, i) {
* is a real group (no atoms will be added on either side), as opposed to
* a partial group (e.g. one created by \color).
*/
-const buildExpression = function(expression, options, isRealGroup) {
+export const buildExpression = function(expression, options, isRealGroup) {
// Parse expressions into `groups`.
const groups = [];
for (let i = 0; i < expression.length; i++) {
@@ -255,7 +255,7 @@ const makeNullDelimiter = function(options, classes) {
* This is a map of group types to the function used to handle that type.
* Simpler types come at the beginning, while complicated types come afterwards.
*/
-const groupTypes = {};
+export const groupTypes = {};
groupTypes.mathord = function(group, options) {
return buildCommon.makeOrd(group, options, "mathord");
@@ -1723,46 +1723,6 @@ groupTypes.xArrow = function(group, options) {
return makeSpan(["mrel", "x-arrow"], [vlist], options);
};
-groupTypes.phantom = function(group, options) {
- const elements = buildExpression(
- group.value.value,
- options.withPhantom(),
- false
- );
-
- // \phantom isn't supposed to affect the elements it contains.
- // See "color" for more details.
- return new buildCommon.makeFragment(elements);
-};
-
-groupTypes.hphantom = function(group, options) {
- let node = makeSpan(
- [], [buildGroup(group.value.body, options.withPhantom())]);
- node.height = 0;
- node.depth = 0;
- if (node.children) {
- for (let i = 0; i < node.children.length; i++) {
- node.children[i].height = 0;
- node.children[i].depth = 0;
- }
- }
-
- // See smash for comment re: use of makeVList
- node = buildCommon.makeVList([
- {type: "elem", elem: node},
- ], "firstBaseline", null, options);
-
- return node;
-};
-
-groupTypes.vphantom = function(group, options) {
- const inner = makeSpan(
- ["inner"], [buildGroup(group.value.body, options.withPhantom())]);
- const fix = makeSpan(["fix"], []);
- return makeSpan(
- ["mord", "rlap"], [inner, fix], options);
-};
-
groupTypes.mclass = function(group, options) {
const elements = buildExpression(group.value.value, options, true);
@@ -1774,7 +1734,7 @@ groupTypes.mclass = function(group, options) {
* function for it. It also handles the interaction of size and style changes
* between parents and children.
*/
-const buildGroup = function(group, options, baseOptions) {
+export const buildGroup = function(group, options, baseOptions) {
if (!group) {
return makeSpan();
}
@@ -1807,7 +1767,7 @@ const buildGroup = function(group, options, baseOptions) {
* Take an entire parse tree, and build it into an appropriate set of HTML
* nodes.
*/
-const buildHTML = function(tree, options) {
+export default function buildHTML(tree, options) {
// buildExpression is destructive, so we need to make a clone
// of the incoming tree so that it isn't accidentally changed
tree = JSON.parse(JSON.stringify(tree));
@@ -1835,6 +1795,4 @@ const buildHTML = function(tree, options) {
htmlNode.setAttribute("aria-hidden", "true");
return htmlNode;
-};
-
-module.exports = buildHTML;
+}
diff --git a/src/buildMathML.js b/src/buildMathML.js
index 79e4aa78..0205ad21 100644
--- a/src/buildMathML.js
+++ b/src/buildMathML.js
@@ -60,7 +60,7 @@ const getVariant = function(group, options) {
* Functions for handling the different types of groups found in the parse
* tree. Each function should take a parse group and return a MathML node.
*/
-const groupTypes = {};
+export const groupTypes = {};
const defaultVariant = {
"mi": "italic",
@@ -650,25 +650,6 @@ groupTypes.smash = function(group, options) {
return node;
};
-groupTypes.phantom = function(group, options) {
- const inner = buildExpression(group.value.value, options);
- return new mathMLTree.MathNode("mphantom", inner);
-};
-
-groupTypes.hphantom = function(group, options) {
- const inner = buildExpression(group.value.value, options);
- const node = new mathMLTree.MathNode("mphantom", inner);
- node.setAttribute("height", "0px");
- return node;
-};
-
-groupTypes.vphantom = function(group, options) {
- const inner = buildExpression(group.value.value, options);
- const node = new mathMLTree.MathNode("mphantom", inner);
- node.setAttribute("width", "0px");
- return node;
-};
-
groupTypes.mclass = function(group, options) {
const inner = buildExpression(group.value.value, options);
return new mathMLTree.MathNode("mstyle", inner);
@@ -679,7 +660,7 @@ groupTypes.mclass = function(group, options) {
* MathML nodes. A little simpler than the HTML version because we don't do any
* previous-node handling.
*/
-const buildExpression = function(expression, options) {
+export const buildExpression = function(expression, options) {
const groups = [];
for (let i = 0; i < expression.length; i++) {
const group = expression[i];
@@ -695,8 +676,9 @@ const buildExpression = function(expression, options) {
* Takes a group from the parser and calls the appropriate groupTypes function
* on it to produce a MathML node.
*/
-// TODO(kevinb): determine if removeUnnecessaryRow should always be true
-const buildGroup = function(group, options, removeUnnecessaryRow = false) {
+export const buildGroup = function(
+ group, options, removeUnnecessaryRow = false,
+) {
if (!group) {
return new mathMLTree.MathNode("mrow");
}
@@ -724,7 +706,7 @@ const buildGroup = function(group, options, removeUnnecessaryRow = false) {
* Note that we actually return a domTree element with a `