diff --git a/components/bin/build b/components/bin/build index e045ddd0a..d9a9d5836 100755 --- a/components/bin/build +++ b/components/bin/build @@ -30,7 +30,7 @@ const path = require('path'); /** * The amount of space for each level of indentation */ -const INDENT = ' '; +const INDENT = ' '; /** * The pattern to use when looking for explort commands to process @@ -51,17 +51,28 @@ const mjGlobal = path.join('..', mjPath, 'components', 'global.js'); */ const config = JSON.parse(fs.readFileSync(process.argv[2] || 'build.json')); +function getType() { + const component = config.component || 'part'; + if (component.match(/\/(svg|chtml|common)\/fonts\//)) return RegExp.$1 + '-font'; + if (component.match(/\/(mathml|tex)\/.+\//)) return RegExp.$1 + '-extension'; + if (component.match(/^(.+)\//)) return RegExp.$1; + return component; +} + /** * Extract the configuration values */ const COMPONENT = path.basename(config.component || 'part'); // name of the component +const ID = config.id || config.component || 'part'; // the ID of the component const TARGETS = config.targets || []; // the files to include in the component const EXCLUDE = new Map((config.exclude || []).map(name => [name, true])); // files to exclude from the component const EXCLUDESUBDIRS = config.excludeSubdirs === 'true'; // exclude subdirectories or not const JS = config.js || config.mathjax || mjPath; // path to the compiled .js files const LIB = config.lib || './lib'; // path to the lib directory to create -const GLOBAL = config.global || mjGlobal; // path to the global.js file const TS = config.ts || JS.replace(/js$/, 'ts'); // path to the .ts files +const GLOBAL = config.global || mjGlobal; // path to the global.js file +const VERSION = config.version || mjGlobal.replace(/global/, 'version'); // path to the version.js file +const TYPE = config.type || getType(); // the module type /** * The list of files that need to be added to the lib directory @@ -222,6 +233,7 @@ function processGlobal() { console.info(' ' + COMPONENT + '.ts'); const lines = [ `import {combineWithMathJax} from '${GLOBAL}';`, + `import {VERSION} from '${VERSION}';`, '', ]; const packages = []; @@ -230,9 +242,17 @@ function processGlobal() { const dir = path.dirname(PACKAGE[0]).split(path.sep)[0]; packages.push(processPackage(lines, INDENT, dir)); } - lines.push('', `combineWithMathJax({_: {`); - lines.push(INDENT + packages.join(',\n' + INDENT)); - lines.push('}});'); + const name = (ID.match(/[^a-zA-Z0-9_]/) ? `"${ID}"` : ID); + lines.push( + '', + 'if (MathJax.loader) {', + INDENT + `MathJax.loader.checkVersion('${ID}', VERSION, '${TYPE}');`, + '}', + '', + `combineWithMathJax({_: {`, + INDENT + packages.join(',\n' + INDENT), + '}});' + ); fs.writeFileSync(path.join(LIB, COMPONENT + '.js'), lines.join('\n') + '\n'); } diff --git a/components/src/input/mml/build.json b/components/src/input/mml/build.json index a41d8dfdd..d4864a0f5 100644 --- a/components/src/input/mml/build.json +++ b/components/src/input/mml/build.json @@ -1,5 +1,5 @@ { - "component": "inpu/mml", + "component": "input/mml", "targets": [ "input/mathml.ts", "input/mathml" diff --git a/components/src/input/mml/extensions/mml3/build.json b/components/src/input/mml/extensions/mml3/build.json index 1de76ca6f..6ae79ed71 100644 --- a/components/src/input/mml/extensions/mml3/build.json +++ b/components/src/input/mml/extensions/mml3/build.json @@ -1,4 +1,5 @@ { + "id": "[mml]/mml3", "component": "input/mml/extensions/mml3", "targets": ["input/mathml/mml3"] } diff --git a/components/src/input/tex/extensions/action/build.json b/components/src/input/tex/extensions/action/build.json index 5c2aa0f8d..a0b6af601 100644 --- a/components/src/input/tex/extensions/action/build.json +++ b/components/src/input/tex/extensions/action/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/action", "component": "input/tex/extensions/action", "targets": ["input/tex/action"] } diff --git a/components/src/input/tex/extensions/all-packages/build.json b/components/src/input/tex/extensions/all-packages/build.json index 098cf185e..216671f99 100644 --- a/components/src/input/tex/extensions/all-packages/build.json +++ b/components/src/input/tex/extensions/all-packages/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/all-packages", "component": "input/tex/extensions/all-packages", "targets": [ "input/tex/AllPackages.ts", diff --git a/components/src/input/tex/extensions/ams/build.json b/components/src/input/tex/extensions/ams/build.json index a2a1d4002..865acc303 100644 --- a/components/src/input/tex/extensions/ams/build.json +++ b/components/src/input/tex/extensions/ams/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/ams", "component": "input/tex/extensions/ams", "targets": ["input/tex/ams"] } diff --git a/components/src/input/tex/extensions/amscd/build.json b/components/src/input/tex/extensions/amscd/build.json index 477406992..6c3fc87ea 100644 --- a/components/src/input/tex/extensions/amscd/build.json +++ b/components/src/input/tex/extensions/amscd/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/amscd", "component": "input/tex/extensions/amscd", "targets": ["input/tex/amscd"] } diff --git a/components/src/input/tex/extensions/autoload/build.json b/components/src/input/tex/extensions/autoload/build.json index e19f7f6d5..d4f9b89e0 100644 --- a/components/src/input/tex/extensions/autoload/build.json +++ b/components/src/input/tex/extensions/autoload/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/autoload", "component": "input/tex/extensions/autoload", "targets": ["input/tex/autoload"] } diff --git a/components/src/input/tex/extensions/bbox/build.json b/components/src/input/tex/extensions/bbox/build.json index 3741b8738..c50918558 100644 --- a/components/src/input/tex/extensions/bbox/build.json +++ b/components/src/input/tex/extensions/bbox/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/bbox", "component": "input/tex/extensions/bbox", "targets": ["input/tex/bbox"] } diff --git a/components/src/input/tex/extensions/boldsymbol/build.json b/components/src/input/tex/extensions/boldsymbol/build.json index 7e5deedbd..3d59f0cb2 100644 --- a/components/src/input/tex/extensions/boldsymbol/build.json +++ b/components/src/input/tex/extensions/boldsymbol/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/boldsymbol", "component": "input/tex/extensions/boldsymbol", "targets": ["input/tex/boldsymbol"] } diff --git a/components/src/input/tex/extensions/braket/build.json b/components/src/input/tex/extensions/braket/build.json index 5e2924725..c0631d751 100644 --- a/components/src/input/tex/extensions/braket/build.json +++ b/components/src/input/tex/extensions/braket/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/braket", "component": "input/tex/extensions/braket", "targets": ["input/tex/braket"] } diff --git a/components/src/input/tex/extensions/bussproofs/build.json b/components/src/input/tex/extensions/bussproofs/build.json index 8cf99265b..242e91f16 100644 --- a/components/src/input/tex/extensions/bussproofs/build.json +++ b/components/src/input/tex/extensions/bussproofs/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/bussproofs", "component": "input/tex/extensions/bussproofs", "targets": ["input/tex/bussproofs"] } diff --git a/components/src/input/tex/extensions/cancel/build.json b/components/src/input/tex/extensions/cancel/build.json index f06e1e858..9577e4e95 100644 --- a/components/src/input/tex/extensions/cancel/build.json +++ b/components/src/input/tex/extensions/cancel/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/cancel", "component": "input/tex/extensions/cancel", "targets": ["input/tex/cancel"] } diff --git a/components/src/input/tex/extensions/cases/build.json b/components/src/input/tex/extensions/cases/build.json index b7549fde4..b4be43cbc 100644 --- a/components/src/input/tex/extensions/cases/build.json +++ b/components/src/input/tex/extensions/cases/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/cases", "component": "input/tex/extensions/cases", "targets": ["input/tex/cases"] } diff --git a/components/src/input/tex/extensions/centernot/build.json b/components/src/input/tex/extensions/centernot/build.json index e754ff18a..1ebcd76b6 100644 --- a/components/src/input/tex/extensions/centernot/build.json +++ b/components/src/input/tex/extensions/centernot/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/centernot", "component": "input/tex/extensions/centernot", "targets": ["input/tex/centernot"] } diff --git a/components/src/input/tex/extensions/color/build.json b/components/src/input/tex/extensions/color/build.json index 98e4923e3..3e8614c11 100644 --- a/components/src/input/tex/extensions/color/build.json +++ b/components/src/input/tex/extensions/color/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/color", "component": "input/tex/extensions/color", "targets": ["input/tex/color"] } diff --git a/components/src/input/tex/extensions/colortbl/build.json b/components/src/input/tex/extensions/colortbl/build.json index 5b2e25c68..cf70b9a7d 100644 --- a/components/src/input/tex/extensions/colortbl/build.json +++ b/components/src/input/tex/extensions/colortbl/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/colortbl", "component": "input/tex/extensions/colortbl", "targets": ["input/tex/colortbl"] } diff --git a/components/src/input/tex/extensions/colorv2/build.json b/components/src/input/tex/extensions/colorv2/build.json index 3923daa18..0710e56e4 100644 --- a/components/src/input/tex/extensions/colorv2/build.json +++ b/components/src/input/tex/extensions/colorv2/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/colorv2", "component": "input/tex/extensions/colorv2", "targets": ["input/tex/colorv2"] } diff --git a/components/src/input/tex/extensions/configmacros/build.json b/components/src/input/tex/extensions/configmacros/build.json index 0496ad45a..809b5d94c 100644 --- a/components/src/input/tex/extensions/configmacros/build.json +++ b/components/src/input/tex/extensions/configmacros/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/configmacros", "component": "input/tex/extensions/configmacros", "targets": ["input/tex/configmacros"] } diff --git a/components/src/input/tex/extensions/empheq/build.json b/components/src/input/tex/extensions/empheq/build.json index 681da096b..f0563a9b2 100644 --- a/components/src/input/tex/extensions/empheq/build.json +++ b/components/src/input/tex/extensions/empheq/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/empheq", "component": "input/tex/extensions/empheq", "targets": ["input/tex/empheq"] } diff --git a/components/src/input/tex/extensions/enclose/build.json b/components/src/input/tex/extensions/enclose/build.json index 07e3978e7..ebf489c82 100644 --- a/components/src/input/tex/extensions/enclose/build.json +++ b/components/src/input/tex/extensions/enclose/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/enclose", "component": "input/tex/extensions/enclose", "targets": ["input/tex/enclose"] } diff --git a/components/src/input/tex/extensions/extpfeil/build.json b/components/src/input/tex/extensions/extpfeil/build.json index 7f5fa8bd5..37378a525 100644 --- a/components/src/input/tex/extensions/extpfeil/build.json +++ b/components/src/input/tex/extensions/extpfeil/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/extpfeil", "component": "input/tex/extensions/extpfeil", "targets": ["input/tex/extpfeil"] } diff --git a/components/src/input/tex/extensions/gensymb/build.json b/components/src/input/tex/extensions/gensymb/build.json index 0d976916e..220fe879d 100644 --- a/components/src/input/tex/extensions/gensymb/build.json +++ b/components/src/input/tex/extensions/gensymb/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/gensymb", "component": "input/tex/extensions/gensymb", "targets": ["input/tex/gensymb"] } diff --git a/components/src/input/tex/extensions/html/build.json b/components/src/input/tex/extensions/html/build.json index 886436843..7ee5d20ac 100644 --- a/components/src/input/tex/extensions/html/build.json +++ b/components/src/input/tex/extensions/html/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/html", "component": "input/tex/extensions/html", "targets": ["input/tex/html"] } diff --git a/components/src/input/tex/extensions/mathtools/build.json b/components/src/input/tex/extensions/mathtools/build.json index 22021cfd5..b00ef3147 100644 --- a/components/src/input/tex/extensions/mathtools/build.json +++ b/components/src/input/tex/extensions/mathtools/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/mathtools", "component": "input/tex/extensions/mathtools", "targets": ["input/tex/mathtools"] } diff --git a/components/src/input/tex/extensions/mhchem/build.json b/components/src/input/tex/extensions/mhchem/build.json index e79f6127f..e7728bdad 100644 --- a/components/src/input/tex/extensions/mhchem/build.json +++ b/components/src/input/tex/extensions/mhchem/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/mhchem", "component": "input/tex/extensions/mhchem", "targets": ["input/tex/mhchem"], "exclude": ["input/tex/mhchem/mhchem_parser.d.ts"] diff --git a/components/src/input/tex/extensions/newcommand/build.json b/components/src/input/tex/extensions/newcommand/build.json index 9a3eb23a3..119063b2f 100644 --- a/components/src/input/tex/extensions/newcommand/build.json +++ b/components/src/input/tex/extensions/newcommand/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/newcommand", "component": "input/tex/extensions/newcommand", "targets": ["input/tex/newcommand"] } diff --git a/components/src/input/tex/extensions/noerrors/build.json b/components/src/input/tex/extensions/noerrors/build.json index c35696db6..dae2b51e0 100644 --- a/components/src/input/tex/extensions/noerrors/build.json +++ b/components/src/input/tex/extensions/noerrors/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/noerrors", "component": "input/tex/extensions/noerrors", "targets": ["input/tex/noerrors"] } diff --git a/components/src/input/tex/extensions/noundefined/build.json b/components/src/input/tex/extensions/noundefined/build.json index 177e0e78a..3ea2d344c 100644 --- a/components/src/input/tex/extensions/noundefined/build.json +++ b/components/src/input/tex/extensions/noundefined/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/noundefined", "component": "input/tex/extensions/noundefined", "targets": ["input/tex/noundefined"] } diff --git a/components/src/input/tex/extensions/physics/build.json b/components/src/input/tex/extensions/physics/build.json index 962363e25..b0ba5aaec 100644 --- a/components/src/input/tex/extensions/physics/build.json +++ b/components/src/input/tex/extensions/physics/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/physics", "component": "input/tex/extensions/physics", "targets": ["input/tex/physics"] } diff --git a/components/src/input/tex/extensions/require/build.json b/components/src/input/tex/extensions/require/build.json index a39792c56..594088cfc 100644 --- a/components/src/input/tex/extensions/require/build.json +++ b/components/src/input/tex/extensions/require/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/require", "component": "input/tex/extensions/require", "targets": ["input/tex/require"] } diff --git a/components/src/input/tex/extensions/setoptions/build.json b/components/src/input/tex/extensions/setoptions/build.json index d703672ac..f7171fd64 100644 --- a/components/src/input/tex/extensions/setoptions/build.json +++ b/components/src/input/tex/extensions/setoptions/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/setoptions", "component": "input/tex/extensions/setoptions", "targets": ["input/tex/setoptions"] } diff --git a/components/src/input/tex/extensions/tagformat/build.json b/components/src/input/tex/extensions/tagformat/build.json index 9562f5403..e56479448 100644 --- a/components/src/input/tex/extensions/tagformat/build.json +++ b/components/src/input/tex/extensions/tagformat/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/tagformat", "component": "input/tex/extensions/tagformat", "targets": ["input/tex/tagformat"] } diff --git a/components/src/input/tex/extensions/textcomp/build.json b/components/src/input/tex/extensions/textcomp/build.json index fe61189ae..dc88ae71c 100644 --- a/components/src/input/tex/extensions/textcomp/build.json +++ b/components/src/input/tex/extensions/textcomp/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/textcomp", "component": "input/tex/extensions/textcomp", "targets": ["input/tex/textcomp"] } diff --git a/components/src/input/tex/extensions/textmacros/build.json b/components/src/input/tex/extensions/textmacros/build.json index ecd01e28b..80b0e02d9 100644 --- a/components/src/input/tex/extensions/textmacros/build.json +++ b/components/src/input/tex/extensions/textmacros/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/textmacros", "component": "input/tex/extensions/textmacros", "targets": ["input/tex/textmacros"] } diff --git a/components/src/input/tex/extensions/unicode/build.json b/components/src/input/tex/extensions/unicode/build.json index 9340bb190..2e7604802 100644 --- a/components/src/input/tex/extensions/unicode/build.json +++ b/components/src/input/tex/extensions/unicode/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/unicode", "component": "input/tex/extensions/unicode", "targets": ["input/tex/unicode"] } diff --git a/components/src/input/tex/extensions/upgreek/build.json b/components/src/input/tex/extensions/upgreek/build.json index 2bda780bf..70c9812ea 100644 --- a/components/src/input/tex/extensions/upgreek/build.json +++ b/components/src/input/tex/extensions/upgreek/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/upgreek", "component": "input/tex/extensions/upgreek", "targets": ["input/tex/upgreek"] } diff --git a/components/src/input/tex/extensions/verb/build.json b/components/src/input/tex/extensions/verb/build.json index ad4d0e183..53f726931 100644 --- a/components/src/input/tex/extensions/verb/build.json +++ b/components/src/input/tex/extensions/verb/build.json @@ -1,4 +1,5 @@ { + "id": "[tex]/verb", "component": "input/tex/extensions/verb", "targets": ["input/tex/verb"] } diff --git a/components/webpack.common.js b/components/webpack.common.js index 8edfdd893..034b98810 100644 --- a/components/webpack.common.js +++ b/components/webpack.common.js @@ -46,11 +46,15 @@ function quoteRE(string) { const PLUGINS = function (js, dir) { const mjdir = path.resolve(__dirname, '..', 'js'); const jsdir = path.resolve(dir, js); + const package = path.resolve(__dirname, '..', 'package.json'); // // Record the js directory for the pack command // - return [new webpack.DefinePlugin({__JSDIR__: jsdir})]; + return [new webpack.DefinePlugin({ + __JSDIR__: jsdir, + PACKAGE_VERSION: `'${require(package).version}'` + })]; }; /** diff --git a/ts/components/global.ts b/ts/components/global.ts index e6fafd8ce..d0fee7690 100644 --- a/ts/components/global.ts +++ b/ts/components/global.ts @@ -22,6 +22,8 @@ * @author dpvc@mathjax.org (Davide Cervone) */ +import {VERSION} from './version.js'; + /** * The MathJax variable as a configuration object */ @@ -127,7 +129,7 @@ if (typeof global.MathJax === 'undefined') { */ if (!(global.MathJax as MathJaxObject).version) { global.MathJax = { - version: '3.2.0', + version: VERSION, _: {}, config: global.MathJax }; diff --git a/ts/components/loader.ts b/ts/components/loader.ts index fa5b2501e..bf4d1f19c 100644 --- a/ts/components/loader.ts +++ b/ts/components/loader.ts @@ -58,6 +58,7 @@ export interface MathJaxConfig extends MJConfig { failed?: PackageFailed; // A function to call when MathJax fails to load require?: (url: string) => any; // A function for loading URLs pathFilters?: PathFilterList; // List of path filters (and optional priorities) to add + versionWarnings?: boolean; // True means warn when extension version doesn't match MJ version [name: string]: any; // Other configuration blocks }; } @@ -74,6 +75,7 @@ export interface MathJaxObject extends MJObject { preLoad: (...names: string[]) => void; // Indicate that packages are already loaded by hand defaultReady: () => void; // The function performed when all packages are loaded getRoot: () => string; // Find the root URL for the MathJax files + checkVersion: (name: string, version: string) => boolean; // Check the version of an extension pathFilters: FunctionList; // the filters to use for looking for package paths }; startup?: any; @@ -127,6 +129,16 @@ export const PathFilters: {[name: string]: PathFilterFunction} = { */ export namespace Loader { + /** + * The version of MathJax that is running. + */ + const VERSION = MJGlobal.version; + + /** + * The versions of all the loaded extensions. + */ + export const versions: Map = new Map(); + /** * Get a promise that is resolved when all the named packages have been loaded. * @@ -163,7 +175,12 @@ export namespace Loader { extension.provides(CONFIG.provides[name]); } extension.checkNoLoad(); - promises.push(extension.promise); + promises.push(extension.promise.then(() => { + if (!CONFIG.versionWarnings) return; + if (extension.isLoaded && !versions.has(Package.resolvePath(name))) { + console.warn(`No version information available for component ${name}`); + } + }) as Promise); } Package.loadAll(); return Promise.all(promises); @@ -210,6 +227,23 @@ export namespace Loader { return root; } + /** + * Check the version of an extension and report an error if not correct + * + * @param {string} name The name of the extension being checked + * @param {string} version The version of the extension to check + * @param {string} type The type of extension (future code may use this to check ranges of versions) + * @return {boolean} True if there was a mismatch, false otherwise + */ + export function checkVersion(name: string, version: string, _type?: string): boolean { + versions.set(Package.resolvePath(name), VERSION); + if (CONFIG.versionWarnings && version !== VERSION) { + console.warn(`Component ${name} uses ${version} of MathJax; version in use is ${VERSION}`); + return true; + } + return false; + } + /** * The filters to use to modify the paths used to obtain the packages */ @@ -247,6 +281,7 @@ if (typeof MathJax.loader === 'undefined') { failed: (error: PackageError) => console.log(`MathJax(${error.package || '?'}): ${error.message}`), require: null, pathFilters: [], + versionWarnings: true }); combineWithMathJax({ loader: Loader diff --git a/ts/components/version.ts b/ts/components/version.ts new file mode 100644 index 000000000..a96fc8277 --- /dev/null +++ b/ts/components/version.ts @@ -0,0 +1,44 @@ +/************************************************************* + * + * Copyright (c) 2018-2021 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview The version of MathJax (used to tell what version a component + * was compiled against). + * + * @author dpvc@mathjax.org (Davide Cervone) + */ + +declare const PACKAGE_VERSION: string; // provided by webpack via DefinePlugin + +export const VERSION = ( + typeof PACKAGE_VERSION === 'undefined' ? + // + // This will not be included in the webpack version, so only runs in node + // + (function () { + // + // Look up the version from the package.json file + // + /* tslint:disable-next-line:no-eval */ + const load = eval('require'); + /* tslint:disable-next-line:no-eval */ + const dirname = eval('__dirname'); + const path = load('path'); + return load(path.resolve(dirname, '..', '..', 'package.json')).version; + })() : + PACKAGE_VERSION +); diff --git a/ts/mathjax.ts b/ts/mathjax.ts index 5273bc1b6..41c5b5337 100644 --- a/ts/mathjax.ts +++ b/ts/mathjax.ts @@ -21,6 +21,7 @@ * @author dpvc@mathjax.org (Davide Cervone) */ +import {VERSION} from './components/version.js'; import {HandlerList} from './core/HandlerList.js'; import {handleRetriesFor, retryAfter} from './util/Retries.js'; import {OptionList} from './util/Options.js'; @@ -34,7 +35,7 @@ export const mathjax = { /** * The MathJax version number */ - version: '3.2.0', + version: VERSION, /** * The list of registers document handlers diff --git a/ts/output/chtml/FontData.ts b/ts/output/chtml/FontData.ts index 1e45a48ff..23de02dde 100644 --- a/ts/output/chtml/FontData.ts +++ b/ts/output/chtml/FontData.ts @@ -73,6 +73,11 @@ export class CHTMLFontData extends FontData, D extends unknownFamily: 'serif' // Should use 'monospace' with LiteAdaptor }; + /** + * The name of the output jax this font data is for (used by extensions) + */ + public static JAX: string = 'common'; + + /** + * The name of the font that is being defined (used by extensions) + */ + public static NAME: string = ''; + /** * The standard variants to define */ diff --git a/ts/output/common/fonts/tex.ts b/ts/output/common/fonts/tex.ts index dc1496461..90e239b1e 100644 --- a/ts/output/common/fonts/tex.ts +++ b/ts/output/common/fonts/tex.ts @@ -40,6 +40,11 @@ export function CommonTeXFontMixin< return class extends Base { + /** + * @override + */ + public static NAME = 'TeX'; + /** * Add the extra variants for the TeX fonts */ diff --git a/ts/output/svg/FontData.ts b/ts/output/svg/FontData.ts index 9b4d3fcf5..8a67f4b14 100644 --- a/ts/output/svg/FontData.ts +++ b/ts/output/svg/FontData.ts @@ -61,6 +61,19 @@ export interface SVGDelimiterData extends DelimiterData { */ export class SVGFontData extends FontData { + /** + * @override + */ + public static OPTIONS = { + ...FontData.OPTIONS, + dynamicPrefix: './output/svg/fonts' + }; + + /** + * @override + */ + public static JAX = 'SVG'; + /** * @override */