Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion site/assets/mhchem.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion site/assets/temml.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions temml-default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* An entry point that only has the default export of Temml.
* This is used for the iife and CommonJS builds.
*/

import { default as Temml } from "./temml.js";
export default Temml;
32 changes: 22 additions & 10 deletions temml.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ export interface Options {
maxExpand?: number;
}

export function render(
expression: string,
baseNode: HTMLElement | MathMLElement,
options?: Options,
): void;
declare const version: string;

declare function render(expression: string, baseNode: HTMLElement | MathMLElement, options?: Options): void;

export function renderToString(expression: string, options?: Options): string;
declare function renderToString(expression: string, options?: Options): string;

export function renderMathInElement(block: any, options?: Options): void;
declare function renderMathInElement(block: any, options?: Options): void;

export function generateParseTree(expression: string, options?: Options): any;
declare function generateParseTree(expression: string, options?: Options): any;

export function definePreamble(expression: string, options?: Options): any;
declare function definePreamble(expression: string, options?: Options): any;

export function renderToMathMLTree(expression: string, options?: Options): any;
declare function renderToMathMLTree(expression: string, options?: Options): any;

declare function postProcess(block: any): void;
declare function defineMacro(name: string, body: any): void;
Expand All @@ -46,6 +44,20 @@ declare class ParseError {
);
}

export {
version,
render,
renderToString,
renderMathInElement,
postProcess,
ParseError,
definePreamble,
generateParseTree as __parse,
renderToMathMLTree as __renderToMathMLTree,
defineSymbol as __defineSymbol,
defineMacro as __defineMacro
}

declare const Temml: {
version: string;
render: typeof render;
Expand Down
24 changes: 21 additions & 3 deletions temml.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const renderToString = function(expression, options) {
};

/**
* @type {import('./temml').generateParseTree}
* @type {import('./temml').__parse}
* Parse an expression and return the parse tree.
*/
const generateParseTree = function(expression, options) {
Expand Down Expand Up @@ -111,7 +111,7 @@ const renderError = function(error, expression, options) {
};

/**
* @type {import('./temml').renderToMathMLTree}
* @type {import('./temml').__renderToMathMLTree}
* Generates and returns the Temml build tree. This is used for advanced
* use cases (like rendering to custom output).
*/
Expand All @@ -129,8 +129,24 @@ const renderToMathMLTree = function(expression, options) {
}
};

// ESM exports
export {
version,
render,
renderToString,
renderMathInElement,
postProcess,
ParseError,
definePreamble,
generateParseTree as __parse,
renderToMathMLTree as __renderToMathMLTree,
defineSymbol as __defineSymbol,
defineMacro as __defineMacro
};

// CJS exports and ESM default export
/** @type {import('./temml').default} */
export default {
const Temml = {
/**
* Current Temml version
*/
Expand Down Expand Up @@ -191,3 +207,5 @@ export default {
*/
__defineMacro: defineMacro
}

export default Temml;
14 changes: 10 additions & 4 deletions test/temml.js
Original file line number Diff line number Diff line change
Expand Up @@ -12646,7 +12646,7 @@ var temml = (function () {
};

/**
* @type {import('./temml').generateParseTree}
* @type {import('./temml').__parse}
* Parse an expression and return the parse tree.
*/
const generateParseTree = function(expression, options) {
Expand Down Expand Up @@ -12688,7 +12688,7 @@ var temml = (function () {
};

/**
* @type {import('./temml').renderToMathMLTree}
* @type {import('./temml').__renderToMathMLTree}
* Generates and returns the Temml build tree. This is used for advanced
* use cases (like rendering to custom output).
*/
Expand All @@ -12706,8 +12706,9 @@ var temml = (function () {
}
};

// CJS exports and ESM default export
/** @type {import('./temml').default} */
var temml$1 = {
const Temml = {
/**
* Current Temml version
*/
Expand Down Expand Up @@ -12769,6 +12770,11 @@ var temml = (function () {
__defineMacro: defineMacro
};

return temml$1;
/**
* An entry point that only has the default export of Temml.
* This is used for the iife and CommonJS builds.
*/

return Temml;

})();
6 changes: 3 additions & 3 deletions utils/rollupConfig.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export default [
{
input: "./temml.js",
input: "./temml-default.js",
output: { format: "iife", name: "temml", file: "./test/temml.js" }
},
{
input: "./temml.js",
output: { format: "cjs", name: "temml", exports: "auto", file: "./utils/temml.cjs" }
input: "./temml-default.js",
output: { format: "cjs", name: "temml", file: "./utils/temml.cjs" }
},
{
input: "./temml.js",
Expand Down
14 changes: 10 additions & 4 deletions utils/temml.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14559,7 +14559,7 @@ const renderToString = function(expression, options) {
};

/**
* @type {import('./temml').generateParseTree}
* @type {import('./temml').__parse}
* Parse an expression and return the parse tree.
*/
const generateParseTree = function(expression, options) {
Expand Down Expand Up @@ -14601,7 +14601,7 @@ const renderError = function(error, expression, options) {
};

/**
* @type {import('./temml').renderToMathMLTree}
* @type {import('./temml').__renderToMathMLTree}
* Generates and returns the Temml build tree. This is used for advanced
* use cases (like rendering to custom output).
*/
Expand All @@ -14619,8 +14619,9 @@ const renderToMathMLTree = function(expression, options) {
}
};

// CJS exports and ESM default export
/** @type {import('./temml').default} */
var temml$1 = {
const Temml = {
/**
* Current Temml version
*/
Expand Down Expand Up @@ -14682,4 +14683,9 @@ var temml$1 = {
__defineMacro: defineMacro
};

module.exports = temml$1;
/**
* An entry point that only has the default export of Temml.
* This is used for the iife and CommonJS builds.
*/

module.exports = Temml;
9 changes: 5 additions & 4 deletions utils/temml.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14557,7 +14557,7 @@ const renderToString = function(expression, options) {
};

/**
* @type {import('./temml').generateParseTree}
* @type {import('./temml').__parse}
* Parse an expression and return the parse tree.
*/
const generateParseTree = function(expression, options) {
Expand Down Expand Up @@ -14599,7 +14599,7 @@ const renderError = function(error, expression, options) {
};

/**
* @type {import('./temml').renderToMathMLTree}
* @type {import('./temml').__renderToMathMLTree}
* Generates and returns the Temml build tree. This is used for advanced
* use cases (like rendering to custom output).
*/
Expand All @@ -14617,8 +14617,9 @@ const renderToMathMLTree = function(expression, options) {
}
};

// CJS exports and ESM default export
/** @type {import('./temml').default} */
var temml$1 = {
const Temml = {
/**
* Current Temml version
*/
Expand Down Expand Up @@ -14680,4 +14681,4 @@ var temml$1 = {
__defineMacro: defineMacro
};

export { temml$1 as default };
export { ParseError, defineMacro as __defineMacro, defineSymbol as __defineSymbol, generateParseTree as __parse, renderToMathMLTree as __renderToMathMLTree, Temml as default, definePreamble, postProcess, render, renderMathInElement, renderToString, version };