Skip to content

Commit 9401d25

Browse files
committed
Merge branch 'fix/windows-path' into fix/windows-tests
2 parents cc4d60e + 4c23062 commit 9401d25

File tree

173 files changed

+10381
-7073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+10381
-7073
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [published]
66

77
jobs:
8-
setup:
8+
publish:
99
runs-on: ubuntu-latest
1010
name: Build and publish MathJax
1111
permissions:

.github/workflows/test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- develop
1010

1111
jobs:
12-
setup:
12+
testing:
1313
runs-on: ubuntu-latest
1414
name: Compile and test MathJax
1515
steps:
@@ -22,6 +22,12 @@ jobs:
2222
version: 10
2323
run_install: false
2424

25+
- name: Install Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 24
29+
cache: 'pnpm'
30+
2531
- name: Install packages
2632
run: |
2733
pnpm -r i

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ coverage
88
/bundle
99
/bundle-cjs
1010
/testsuite/js
11+
/testsuite/lib/localstorage
1112
/lab/sre.js

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,35 @@ npm run --silent build-all
168168
```
169169

170170
in order to compile the JavaScript files from the TypeScript source,
171-
and build the component files from the JavaScript files.
171+
and build the component files from the JavaScript files. Windows
172+
users will need to use the command
173+
174+
``` bash
175+
npm config set script-shell "C:\\Program Files\\Git\\bin\\bash.exe"
176+
```
177+
178+
first in order to tell `pnpm` to use the `bash` shell for scripts that
179+
it runs, as that is required by the build scripts that MathJax defines
180+
in the `package.json` file. You may also need to use
181+
182+
``` bash
183+
Set-ExecutionPolicy Unrestricted
184+
```
185+
186+
to allow the scripts to run, if you receive errors about not being
187+
able to run the scripts.
188+
189+
The build process requires MathJax to set up a symbolic link, and in
190+
Windows, that requires permission, so you may receive an error message
191+
to that effect. If so, you may need to run
192+
193+
``` bash
194+
pnpm link:src
195+
```
196+
197+
from a shell with administrator privileges. Once that is done, you
198+
can run the build process from a non-administrator shell.
199+
172200

173201
## Code Contributions
174202

components/bin/build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ function processParts(parts) {
193193
function processLines(file, objects) {
194194
if (objects.length === 0) return [];
195195
const base = path.dirname(file).replace(/^\.$/, '');
196-
const dir = (PREFIX ? path.join(PREFIX, base) : base);
196+
const dir = (PREFIX ? normalize(path.join(PREFIX, base)) : base);
197197
const dots = dir.replace(/[^\/]+/g, '..') || '.';
198-
const relative = path.join(dots, '..', JS, dir, path.basename(file)).replace(/\.ts$/, '.js');
198+
const relative = normalize(path.join(dots, '..', JS, dir, path.basename(file))).replace(/\.ts$/, '.js');
199199
const name = path.parse(file).name;
200200
const lines = (target === 'mjs' ? [] : [
201201
'"use strict";',
@@ -264,7 +264,7 @@ function getExtraDirectories() {
264264
let prefix = '';
265265
let indent = INDENT;
266266
let postfix = '';
267-
for (let name of PREFIX.split(/\//)) {
267+
for (let name of PREFIX.split('/')) {
268268
if (name.match(/[^a-zA-Z0-9]/)) {
269269
name = `"${name}"`;
270270
}
@@ -293,7 +293,7 @@ function processGlobal() {
293293
const packages = [];
294294
PACKAGE = PACKAGE.sort(sortDir);
295295
while (PACKAGE.length) {
296-
const dir = path.dirname(PACKAGE[0]).split(path.sep)[0];
296+
const dir = path.dirname(PACKAGE[0]).split('/')[0];
297297
packages.push(processPackage(lines, indent, dir));
298298
}
299299
const name = (ID.match(/[^a-zA-Z0-9_]/) ? `"${ID}"` : ID);

components/mjs/a11y/util.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ Loader.preLoaded(
99
'a11y/sre',
1010
'a11y/semantic-enrich',
1111
'a11y/speech',
12-
'a11y/explorer'
12+
'a11y/explorer',
13+
'input/mml',
1314
);

components/mjs/core/config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"targets": [
55
"mathjax.ts",
66
"core", "util", "handlers",
7+
"ui/dialog/DraggableDialog.ts",
8+
"ui/dialog/InfoDialog.ts",
79
"adaptors/HTMLAdaptor.ts",
810
"adaptors/browserAdaptor.ts",
911
"components/global.ts"

components/mjs/input/tex/extension.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {combineDefaults} from '#js/components/global.js';
2-
import {hasWindow} from '#js/util/context.js';
32

4-
export function fontExtension(id, name, pkg = `@mathjax/${name}`) {
3+
export function fontExtension(id, name, pkg = `[fonts]/${name}`) {
54
if (MathJax.loader) {
6-
const FONTPATH = hasWindow ? `https://cdn.jsdelivr.net/npm/${pkg}` : pkg;
75
const path = name.replace(/-font-extension$/, '-extension');
86
const jax = (MathJax.config?.startup?.output || 'chtml');
9-
combineDefaults(MathJax.config.loader, 'paths', {[path]: FONTPATH});
10-
combineDefaults(MathJax.config.loader, 'dependencies', {[`[${path}]/${jax}`]: [`output/${jax}`]});
7+
combineDefaults(MathJax.config.loader, 'paths', {[path]: pkg});
8+
if (!MathJax._.output?.[jax]) {
9+
combineDefaults(MathJax.config.loader, 'dependencies', {[`[${path}]/${jax}`]: [`output/${jax}`]});
10+
}
1111
MathJax.loader.addPackageData(id, {
1212
extraLoads: [`[${path}]/${jax}`],
1313
rendererExtensions: [path]

components/mjs/node-main/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"copy": [
66
"node-main.mjs",
77
"node-main.cjs",
8-
"node-main-setup.mjs"
8+
"node-main-setup.cjs"
99
]
1010
},
1111
"webpack": {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
global.require = require;
2+
const path = require("path");
3+
4+
if (!global.MathJax) global.MathJax = {};
5+
global.MathJax.__dirname = __dirname;

0 commit comments

Comments
 (0)