mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
build(deps): update dependencies (#2301)
* Bump flow version * Bump jest version * Bump eslint version * Bump rollup version * Bump webpack version * Bump misc dependencies and update lockfile * Update lockfile * Bump commander version * Bump misc dependencies * Bump istanbul version * Bump docusaurus version * Update lockfile * Explicitly declare dependencies * Bump caniuse-lite version * Update lockfile * Bump commander version * Bump webpack and css-loader version * Bump flow version
This commit is contained in:
10
.eslintrc
10
.eslintrc
@@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
"parser": "babel-eslint",
|
"parser": "babel-eslint",
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"flowtype",
|
"flowtype"
|
||||||
"transform-runtime-aliasing"
|
|
||||||
],
|
],
|
||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
@@ -37,6 +36,7 @@
|
|||||||
"no-new": 2,
|
"no-new": 2,
|
||||||
"no-new-func": 2,
|
"no-new-func": 2,
|
||||||
"no-new-object": 2,
|
"no-new-object": 2,
|
||||||
|
"no-prototype-builtins": 0,
|
||||||
"no-spaced-func": 2,
|
"no-spaced-func": 2,
|
||||||
"no-this-before-super": 2,
|
"no-this-before-super": 2,
|
||||||
"no-throw-literal": 2,
|
"no-throw-literal": 2,
|
||||||
@@ -87,11 +87,7 @@
|
|||||||
"files": ["katex.js", "src/**/*.js", "contrib/**/*.js"],
|
"files": ["katex.js", "src/**/*.js", "contrib/**/*.js"],
|
||||||
"excludedFiles": ["*-spec.js", "unicodeAccents.js", "unicodeSymbols.js"],
|
"excludedFiles": ["*-spec.js", "unicodeAccents.js", "unicodeSymbols.js"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-restricted-syntax": [2, "ForOfStatement", "ClassDeclaration[superClass]", "ClassExpression[superClass]"],
|
"no-restricted-syntax": [2, "ForOfStatement", "ClassDeclaration[superClass]", "ClassExpression[superClass]"]
|
||||||
"transform-runtime-aliasing/no-transform-runtime-aliasing": [2, {
|
|
||||||
"transformEnabled": false,
|
|
||||||
"ignore": ["parseInt", "parseFloat", "JSON.stringify"]
|
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"node": false,
|
"node": false,
|
||||||
|
19
.flowconfig
19
.flowconfig
@@ -1,5 +1,5 @@
|
|||||||
[version]
|
[version]
|
||||||
0.102.0
|
0.130.0
|
||||||
|
|
||||||
[ignore]
|
[ignore]
|
||||||
<PROJECT_ROOT>/dist
|
<PROJECT_ROOT>/dist
|
||||||
@@ -11,20 +11,3 @@
|
|||||||
[lints]
|
[lints]
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
# $FlowFixMe
|
|
||||||
# This suppression hould be used to suppress an issue that requires additional
|
|
||||||
# effort to be resolved. That effort should be recorded in our issue tracking
|
|
||||||
# system for follow-up. Usually, this suppression is added by tooling during
|
|
||||||
# flow upgrades and should not be used directly by developers. If it is
|
|
||||||
# necessary, make sure to raise the corresponding issue and add the issue
|
|
||||||
# number to a TODO comment associated with the suppression.
|
|
||||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
|
|
||||||
|
|
||||||
# $FlowIgnore
|
|
||||||
# Every now and then, flow cannot understand our code the way we can. We just
|
|
||||||
# know better and we have to tell flow to trust us. Since this isn't something
|
|
||||||
# we expect to "fix", we can annotate them to just have flow ignore them.
|
|
||||||
# Using this suppression makes it clear that we know there's an error but it's
|
|
||||||
# ok to ignore it. Make sure the suppression has associated commentary to state
|
|
||||||
# why it's okay to ignore the flow error.
|
|
||||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIgnore
|
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -21,7 +21,6 @@ lib/core/metadata.js
|
|||||||
lib/core/MetadataBlog.js
|
lib/core/MetadataBlog.js
|
||||||
website/translated_docs
|
website/translated_docs
|
||||||
website/build/
|
website/build/
|
||||||
website/yarn.lock
|
|
||||||
website/node_modules
|
website/node_modules
|
||||||
website/i18n/*
|
website/i18n/*
|
||||||
website/static/static/katex.*
|
website/static/static/katex.*
|
||||||
|
@@ -1,8 +1,3 @@
|
|||||||
/* global beforeEach: false */
|
|
||||||
/* global expect: false */
|
|
||||||
/* global it: false */
|
|
||||||
/* global describe: false */
|
|
||||||
|
|
||||||
import splitAtDelimiters from "../splitAtDelimiters";
|
import splitAtDelimiters from "../splitAtDelimiters";
|
||||||
import renderMathInElement from "../auto-render";
|
import renderMathInElement from "../auto-render";
|
||||||
|
|
||||||
|
@@ -188,7 +188,8 @@ const buildString = (
|
|||||||
a11yStrings.length > 0 &&
|
a11yStrings.length > 0 &&
|
||||||
// TODO(kevinb): check that the last item in a11yStrings is a string
|
// TODO(kevinb): check that the last item in a11yStrings is a string
|
||||||
// I think we might be able to drop the nested arrays, which would make
|
// I think we might be able to drop the nested arrays, which would make
|
||||||
// this easier to type - $FlowFixMe
|
// this easier to type
|
||||||
|
// $FlowFixMe
|
||||||
/^\d+$/.test(a11yStrings[a11yStrings.length - 1])
|
/^\d+$/.test(a11yStrings[a11yStrings.length - 1])
|
||||||
) {
|
) {
|
||||||
a11yStrings[a11yStrings.length - 1] += ret;
|
a11yStrings[a11yStrings.length - 1] += ret;
|
||||||
|
@@ -11,8 +11,9 @@ const path = require("path");
|
|||||||
const selenium = require("selenium-webdriver");
|
const selenium = require("selenium-webdriver");
|
||||||
const firefox = require("selenium-webdriver/firefox");
|
const firefox = require("selenium-webdriver/firefox");
|
||||||
|
|
||||||
const istanbulApi = require('istanbul-api');
|
|
||||||
const istanbulLibCoverage = require('istanbul-lib-coverage');
|
const istanbulLibCoverage = require('istanbul-lib-coverage');
|
||||||
|
const istanbulLibReport = require('istanbul-lib-report');
|
||||||
|
const istanbulReports = require('istanbul-reports');
|
||||||
|
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const WebpackDevServer = require("webpack-dev-server");
|
const WebpackDevServer = require("webpack-dev-server");
|
||||||
@@ -529,9 +530,11 @@ function takeScreenshot(key) {
|
|||||||
}
|
}
|
||||||
if (opts.coverage) {
|
if (opts.coverage) {
|
||||||
collectCoverage().then(function() {
|
collectCoverage().then(function() {
|
||||||
const reporter = istanbulApi.createReporter();
|
const context = istanbulLibReport.createContext({coverageMap});
|
||||||
reporter.addAll(['json', 'text', 'lcov']);
|
['json', 'text', 'lcov'].forEach(fmt => {
|
||||||
reporter.write(coverageMap);
|
const report = istanbulReports.create(fmt);
|
||||||
|
report.execute(context);
|
||||||
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
83
package.json
83
package.json
@@ -17,59 +17,62 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.3.3",
|
"@babel/core": "^7.10.4",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.3.3",
|
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||||
"@babel/plugin-transform-runtime": "^7.2.0",
|
"@babel/plugin-transform-runtime": "^7.10.4",
|
||||||
"@babel/preset-env": "^7.3.1",
|
"@babel/preset-env": "^7.10.4",
|
||||||
"@babel/preset-flow": "^7.0.0",
|
"@babel/preset-flow": "^7.10.4",
|
||||||
"@babel/register": "^7.0.0",
|
"@babel/register": "^7.10.4",
|
||||||
"@babel/runtime": "^7.3.1",
|
"@babel/runtime": "^7.10.4",
|
||||||
"babel-eslint": "^10.0.1",
|
"@rollup/plugin-alias": "^3.1.1",
|
||||||
"babel-jest": "^24.1.0",
|
"@rollup/plugin-babel": "^5.0.4",
|
||||||
|
"babel-eslint": "^10.1.0",
|
||||||
|
"babel-jest": "^26.1.0",
|
||||||
"babel-loader": "^8.0.5",
|
"babel-loader": "^8.0.5",
|
||||||
"babel-plugin-istanbul": "^5.1.1",
|
"babel-plugin-istanbul": "^6.0.0",
|
||||||
"babel-plugin-preval": "^3.0.1",
|
"babel-plugin-preval": "^5.0.0",
|
||||||
"babel-plugin-version-inline": "^1.0.0",
|
"babel-plugin-version-inline": "^1.0.0",
|
||||||
"benchmark": "^2.1.4",
|
"benchmark": "^2.1.4",
|
||||||
"browserslist": "^4.7.1",
|
"browserslist": "^4.13.0",
|
||||||
"caniuse-lite": "^1.0.30001002",
|
"caniuse-lite": "^1.0.30001102",
|
||||||
"codecov": "^3.7.1",
|
"codecov": "^3.7.1",
|
||||||
"css-loader": "^3.0.0",
|
"css-loader": "^4.0.0",
|
||||||
"cssnano": "^4.1.10",
|
"cssnano": "^4.1.10",
|
||||||
"eslint": "^5.14.1",
|
"eslint": "^7.4.0",
|
||||||
"eslint-plugin-flowtype": "^3.4.2",
|
"eslint-plugin-flowtype": "^5.2.0",
|
||||||
"eslint-plugin-react": "^7.12.4",
|
"eslint-plugin-react": "^7.20.3",
|
||||||
"eslint-plugin-transform-runtime-aliasing": "^2.0.0",
|
"file-loader": "^6.0.0",
|
||||||
"file-loader": "^3.0.1",
|
"flow-bin": "^0.130.0",
|
||||||
"flow-bin": "^0.102.0",
|
"fs-extra": "^9.0.1",
|
||||||
"fs-extra": "^7.0.1",
|
"husky": "^4.2.5",
|
||||||
"husky": "^1.3.1",
|
"istanbul-lib-coverage": "^3.0.0",
|
||||||
"istanbul-api": "^2.1.1",
|
"istanbul-lib-report": "^3.0.0",
|
||||||
"istanbul-lib-coverage": "^2.0.3",
|
"istanbul-reports": "^3.0.2",
|
||||||
"jest": "^24.1.0",
|
"jest": "^26.1.0",
|
||||||
"jest-serializer-html": "^6.0.0",
|
"jest-diff": "^26.1.0",
|
||||||
|
"jest-matcher-utils": "^26.1.0",
|
||||||
|
"jest-message-util": "^26.1.0",
|
||||||
|
"jest-serializer-html": "^7.0.0",
|
||||||
"js-yaml": "^3.12.1",
|
"js-yaml": "^3.12.1",
|
||||||
"json-stable-stringify": "^1.0.1",
|
"json-stable-stringify": "^1.0.1",
|
||||||
"jspngopt": "^0.2.0",
|
"jspngopt": "^0.2.0",
|
||||||
"less": "^3.9.0",
|
"less": "^3.9.0",
|
||||||
"less-loader": "^4.1.0",
|
"less-loader": "^6.2.0",
|
||||||
"mini-css-extract-plugin": "^0.5.0",
|
"mini-css-extract-plugin": "^0.9.0",
|
||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^1.0.4",
|
||||||
"pako": "^1.0.8",
|
"pako": "^1.0.8",
|
||||||
"postcss-loader": "^3.0.0",
|
"postcss-loader": "^3.0.0",
|
||||||
"prettier": "^1.18.2",
|
"prettier": "^2.0.5",
|
||||||
"query-string": "^6.2.0",
|
"query-string": "^6.2.0",
|
||||||
"rimraf": "^2.6.3",
|
"rimraf": "^3.0.2",
|
||||||
"rollup": "^1.2.2",
|
"rollup": "^2.21.0",
|
||||||
"rollup-plugin-alias": "^1.5.1",
|
|
||||||
"rollup-plugin-babel": "^4.3.2",
|
|
||||||
"selenium-webdriver": "^3.6.0",
|
"selenium-webdriver": "^3.6.0",
|
||||||
"sri-toolbox": "^0.2.0",
|
"sri-toolbox": "^0.2.0",
|
||||||
"style-loader": "^0.23.1",
|
"style-loader": "^1.2.1",
|
||||||
"stylelint": "^9.10.1",
|
"stylelint": "^13.6.1",
|
||||||
"stylelint-config-standard": "^18.2.0",
|
"stylelint-config-standard": "^20.0.0",
|
||||||
"terser-webpack-plugin": "^1.2.2",
|
"terser-webpack-plugin": "^3.0.6",
|
||||||
"webpack": "^4.29.5",
|
"webpack": "^4.44.0",
|
||||||
"webpack-bundle-analyzer": "^3.0.4",
|
"webpack-bundle-analyzer": "^3.0.4",
|
||||||
"webpack-cli": "^3.2.3",
|
"webpack-cli": "^3.2.3",
|
||||||
"webpack-dev-server": "^3.2.0"
|
"webpack-dev-server": "^3.2.0"
|
||||||
@@ -98,7 +101,7 @@
|
|||||||
"dist:zip": "rimraf katex/ katex.tar.gz katex.zip && cp -R dist katex && tar czf katex.tar.gz katex && zip -rq katex.zip katex && rimraf katex/"
|
"dist:zip": "rimraf katex/ katex.tar.gz katex.zip && cp -R dist katex && tar czf katex.tar.gz katex && zip -rq katex.zip katex && rimraf katex/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"commander": "^2.19.0"
|
"commander": "^6.0.0"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import babel from 'rollup-plugin-babel';
|
import babel from '@rollup/plugin-babel';
|
||||||
import alias from 'rollup-plugin-alias';
|
import alias from '@rollup/plugin-alias';
|
||||||
|
|
||||||
const {targets} = require('./webpack.common');
|
const {targets} = require('./webpack.common');
|
||||||
|
|
||||||
@@ -12,9 +12,11 @@ export default targets.map(({name, entry}) => ({
|
|||||||
format: 'es',
|
format: 'es',
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
babel({runtimeHelpers: true}),
|
babel({babelHelpers: 'runtime'}),
|
||||||
alias({
|
alias({
|
||||||
katex: '../katex.mjs',
|
entries: [
|
||||||
|
{find: 'katex', replacement: '../katex.mjs'},
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
external: '../katex.mjs',
|
external: '../katex.mjs',
|
||||||
|
@@ -975,6 +975,7 @@ export default class Parser {
|
|||||||
text,
|
text,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// $FlowFixMe
|
||||||
symbol = s;
|
symbol = s;
|
||||||
} else if (text.charCodeAt(0) >= 0x80) { // no symbol for e.g. ^
|
} else if (text.charCodeAt(0) >= 0x80) { // no symbol for e.g. ^
|
||||||
if (this.settings.strict) {
|
if (this.settings.strict) {
|
||||||
@@ -1025,10 +1026,12 @@ export default class Parser {
|
|||||||
label: command,
|
label: command,
|
||||||
isStretchy: false,
|
isStretchy: false,
|
||||||
isShifty: true,
|
isShifty: true,
|
||||||
|
// $FlowFixMe
|
||||||
base: symbol,
|
base: symbol,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// $FlowFixMe
|
||||||
return symbol;
|
return symbol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -219,6 +219,7 @@ export const buildGroup = function(
|
|||||||
// Call the groupBuilders function
|
// Call the groupBuilders function
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
const result: MathDomNode = groupBuilders[group.type](group, options);
|
const result: MathDomNode = groupBuilders[group.type](group, options);
|
||||||
|
// $FlowFixMe
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
throw new ParseError(
|
throw new ParseError(
|
||||||
|
@@ -108,7 +108,6 @@ export default function defineEnvironment<NODETYPE: NodeType>({
|
|||||||
// TODO: The value type of _environments should be a type union of all
|
// TODO: The value type of _environments should be a type union of all
|
||||||
// possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is
|
// possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is
|
||||||
// an existential type.
|
// an existential type.
|
||||||
// $FlowFixMe
|
|
||||||
_environments[names[i]] = data;
|
_environments[names[i]] = data;
|
||||||
}
|
}
|
||||||
if (htmlBuilder) {
|
if (htmlBuilder) {
|
||||||
|
@@ -6,7 +6,6 @@ import environments from "../environments";
|
|||||||
|
|
||||||
// Environment delimiters. HTML/MathML rendering is defined in the corresponding
|
// Environment delimiters. HTML/MathML rendering is defined in the corresponding
|
||||||
// defineEnvironment definitions.
|
// defineEnvironment definitions.
|
||||||
// $FlowFixMe, "environment" handler returns an environment ParseNode
|
|
||||||
defineFunction({
|
defineFunction({
|
||||||
type: "environment",
|
type: "environment",
|
||||||
names: ["\\begin", "\\end"],
|
names: ["\\begin", "\\end"],
|
||||||
@@ -14,6 +13,7 @@ defineFunction({
|
|||||||
numArgs: 1,
|
numArgs: 1,
|
||||||
argTypes: ["text"],
|
argTypes: ["text"],
|
||||||
},
|
},
|
||||||
|
// $FlowFixMe, "environment" handler returns an environment ParseNode
|
||||||
handler({parser, funcName}, args) {
|
handler({parser, funcName}, args) {
|
||||||
const nameGroup = args[0];
|
const nameGroup = args[0];
|
||||||
if (nameGroup.type !== "ordgroup") {
|
if (nameGroup.type !== "ordgroup") {
|
||||||
|
@@ -61,7 +61,6 @@ export const htmlBuilder: HtmlBuilderSupSub<"op"> = (grp, options) => {
|
|||||||
// No font glyphs yet, so use a glyph w/o the oval.
|
// No font glyphs yet, so use a glyph w/o the oval.
|
||||||
// TODO: When font glyphs are available, delete this code.
|
// TODO: When font glyphs are available, delete this code.
|
||||||
stash = group.name.substr(1);
|
stash = group.name.substr(1);
|
||||||
// $FlowFixMe
|
|
||||||
group.name = stash === "oiint" ? "\\iint" : "\\iiint";
|
group.name = stash === "oiint" ? "\\iint" : "\\iiint";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +81,6 @@ export const htmlBuilder: HtmlBuilderSupSub<"op"> = (grp, options) => {
|
|||||||
{type: "elem", elem: oval, shift: large ? 0.08 : 0},
|
{type: "elem", elem: oval, shift: large ? 0.08 : 0},
|
||||||
],
|
],
|
||||||
}, options);
|
}, options);
|
||||||
// $FlowFixMe
|
|
||||||
group.name = "\\" + stash;
|
group.name = "\\" + stash;
|
||||||
base.classes.unshift("mop");
|
base.classes.unshift("mop");
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
|
@@ -458,6 +458,7 @@ export function assertNodeType<NODETYPE: NodeType>(
|
|||||||
`Expected node of type ${type}, but got ` +
|
`Expected node of type ${type}, but got ` +
|
||||||
(node ? `node of type ${node.type}` : String(node)));
|
(node ? `node of type ${node.type}` : String(node)));
|
||||||
}
|
}
|
||||||
|
// $FlowFixMe, >=0.125
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -650,14 +650,12 @@ exports[`A parser that does not throw on unsupported commands should build katex
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A parser that does not throw on unsupported commands should properly escape LaTeX in errors 1`] = `
|
exports[`A parser that does not throw on unsupported commands should properly escape LaTeX in errors 1`] = `
|
||||||
|
|
||||||
<span class="katex-error"
|
<span class="katex-error"
|
||||||
title="ParseError: KaTeX parse error: Expected group after '^' at position 2: 2^̲&"<>"
|
title="ParseError: KaTeX parse error: Expected group after '^' at position 2: 2^̲&"<>"
|
||||||
style="color:#933"
|
style="color:#933"
|
||||||
>
|
>
|
||||||
2^&"<>
|
2^&"<>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`An HTML extension builder should not affect spacing 1`] = `
|
exports[`An HTML extension builder should not affect spacing 1`] = `
|
||||||
@@ -1093,7 +1091,6 @@ exports[`An includegraphics builder should render with trust setting 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`Extending katex by new fonts and symbols Add new font class to new extended symbols 1`] = `
|
exports[`Extending katex by new fonts and symbols Add new font class to new extended symbols 1`] = `
|
||||||
|
|
||||||
<span class="katex">
|
<span class="katex">
|
||||||
<span class="katex-mathml">
|
<span class="katex-mathml">
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
@@ -1167,11 +1164,9 @@ exports[`Extending katex by new fonts and symbols Add new font class to new exte
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`Newlines via \\\\ and \\newline \\\\ causes newline, even after mrel and mop 1`] = `
|
exports[`Newlines via \\\\ and \\newline \\\\ causes newline, even after mrel and mop 1`] = `
|
||||||
|
|
||||||
<span class="katex">
|
<span class="katex">
|
||||||
<span class="katex-mathml">
|
<span class="katex-mathml">
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
@@ -1271,7 +1266,6 @@ exports[`Newlines via \\\\ and \\newline \\\\ causes newline, even after mrel an
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`href and url commands should allow all protocols when trust option is true 1`] = `
|
exports[`href and url commands should allow all protocols when trust option is true 1`] = `
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`A MathML builder \\html@mathml makes clean symbols 1`] = `
|
exports[`A MathML builder \\html@mathml makes clean symbols 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -26,11 +25,9 @@ exports[`A MathML builder \\html@mathml makes clean symbols 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder \\text fonts become mathvariant 1`] = `
|
exports[`A MathML builder \\text fonts become mathvariant 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -110,11 +107,9 @@ exports[`A MathML builder \\text fonts become mathvariant 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder accents turn into <mover accent="true"> in MathML 1`] = `
|
exports[`A MathML builder accents turn into <mover accent="true"> in MathML 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -167,11 +162,9 @@ exports[`A MathML builder accents turn into <mover accent="true"> in MathML 1`]
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder ligatures render properly 1`] = `
|
exports[`A MathML builder ligatures render properly 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -193,11 +186,9 @@ exports[`A MathML builder ligatures render properly 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder normal spaces render normally 1`] = `
|
exports[`A MathML builder normal spaces render normally 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -211,11 +202,9 @@ exports[`A MathML builder normal spaces render normally 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should concatenate digits into single <mn> 1`] = `
|
exports[`A MathML builder should concatenate digits into single <mn> 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -240,11 +229,9 @@ exports[`A MathML builder should concatenate digits into single <mn> 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should generate <mphantom> nodes for \\phantom 1`] = `
|
exports[`A MathML builder should generate <mphantom> nodes for \\phantom 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -259,11 +246,9 @@ exports[`A MathML builder should generate <mphantom> nodes for \\phantom 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should generate the right types of nodes 1`] = `
|
exports[`A MathML builder should generate the right types of nodes 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -294,11 +279,9 @@ exports[`A MathML builder should generate the right types of nodes 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should make prime operators into <mo> nodes 1`] = `
|
exports[`A MathML builder should make prime operators into <mo> nodes 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -319,11 +302,9 @@ exports[`A MathML builder should make prime operators into <mo> nodes 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} correctly in \\textstyle 1`] = `
|
exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} correctly in \\textstyle 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -354,11 +335,9 @@ exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} correc
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} in displaymode correctly 1`] = `
|
exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} in displaymode correctly 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML"
|
<math xmlns="http://www.w3.org/1998/Math/MathML"
|
||||||
display="block"
|
display="block"
|
||||||
>
|
>
|
||||||
@@ -391,11 +370,9 @@ exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} in dis
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should render boldsymbol with the correct mathvariants 1`] = `
|
exports[`A MathML builder should render boldsymbol with the correct mathvariants 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -433,11 +410,9 @@ exports[`A MathML builder should render boldsymbol with the correct mathvariants
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should render mathchoice as if there was nothing 1`] = `
|
exports[`A MathML builder should render mathchoice as if there was nothing 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -480,11 +455,9 @@ exports[`A MathML builder should render mathchoice as if there was nothing 1`] =
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should render mathchoice as if there was nothing 2`] = `
|
exports[`A MathML builder should render mathchoice as if there was nothing 2`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -521,11 +494,9 @@ exports[`A MathML builder should render mathchoice as if there was nothing 2`] =
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should render mathchoice as if there was nothing 3`] = `
|
exports[`A MathML builder should render mathchoice as if there was nothing 3`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -543,11 +514,9 @@ exports[`A MathML builder should render mathchoice as if there was nothing 3`] =
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should render mathchoice as if there was nothing 4`] = `
|
exports[`A MathML builder should render mathchoice as if there was nothing 4`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -570,11 +539,9 @@ exports[`A MathML builder should render mathchoice as if there was nothing 4`] =
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should set href attribute for href appropriately 1`] = `
|
exports[`A MathML builder should set href attribute for href appropriately 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -587,11 +554,9 @@ exports[`A MathML builder should set href attribute for href appropriately 1`] =
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should use <menclose> for colorbox 1`] = `
|
exports[`A MathML builder should use <menclose> for colorbox 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -611,11 +576,9 @@ exports[`A MathML builder should use <menclose> for colorbox 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should use <mpadded> for raisebox 1`] = `
|
exports[`A MathML builder should use <mpadded> for raisebox 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -634,11 +597,9 @@ exports[`A MathML builder should use <mpadded> for raisebox 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should use <msupsub> for regular operators 1`] = `
|
exports[`A MathML builder should use <msupsub> for regular operators 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -663,11 +624,9 @@ exports[`A MathML builder should use <msupsub> for regular operators 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder should use <munderover> for large operators 1`] = `
|
exports[`A MathML builder should use <munderover> for large operators 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -692,11 +651,9 @@ exports[`A MathML builder should use <munderover> for large operators 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder special spaces render specially 1`] = `
|
exports[`A MathML builder special spaces render specially 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||||
<semantics>
|
<semantics>
|
||||||
<mrow>
|
<mrow>
|
||||||
@@ -763,11 +720,9 @@ exports[`A MathML builder special spaces render specially 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`A MathML builder tags use <mlabeledtr> 1`] = `
|
exports[`A MathML builder tags use <mlabeledtr> 1`] = `
|
||||||
|
|
||||||
<math xmlns="http://www.w3.org/1998/Math/MathML"
|
<math xmlns="http://www.w3.org/1998/Math/MathML"
|
||||||
display="block"
|
display="block"
|
||||||
>
|
>
|
||||||
@@ -808,5 +763,4 @@ exports[`A MathML builder tags use <mlabeledtr> 1`] = `
|
|||||||
</annotation>
|
</annotation>
|
||||||
</semantics>
|
</semantics>
|
||||||
</math>
|
</math>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
@@ -1,7 +1,3 @@
|
|||||||
/* global expect: false */
|
|
||||||
/* global it: false */
|
|
||||||
/* global describe: false */
|
|
||||||
|
|
||||||
import symbols from '../src/symbols.js';
|
import symbols from '../src/symbols.js';
|
||||||
import macros from '../src/macros.js';
|
import macros from '../src/macros.js';
|
||||||
|
|
||||||
|
@@ -1,7 +1,3 @@
|
|||||||
/* global expect: false */
|
|
||||||
/* global it: false */
|
|
||||||
/* global describe: false */
|
|
||||||
|
|
||||||
describe("Parser:", function() {
|
describe("Parser:", function() {
|
||||||
|
|
||||||
describe("#handleInfixNodes", function() {
|
describe("#handleInfixNodes", function() {
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
/* eslint max-len:0 */
|
/* eslint max-len:0 */
|
||||||
/* global expect: false */
|
|
||||||
/* global it: false */
|
|
||||||
/* global describe: false */
|
|
||||||
/* global beforeAll: false */
|
|
||||||
|
|
||||||
import buildMathML from "../src/buildMathML";
|
import buildMathML from "../src/buildMathML";
|
||||||
import buildTree from "../src/buildTree";
|
import buildTree from "../src/buildTree";
|
||||||
|
@@ -1,7 +1,3 @@
|
|||||||
/* global expect: false */
|
|
||||||
/* global it: false */
|
|
||||||
/* global describe: false */
|
|
||||||
|
|
||||||
import buildMathML from "../src/buildMathML";
|
import buildMathML from "../src/buildMathML";
|
||||||
import parseTree from "../src/parseTree";
|
import parseTree from "../src/parseTree";
|
||||||
import Options from "../src/Options";
|
import Options from "../src/Options";
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* global expect: false */
|
|
||||||
|
|
||||||
import stringify from 'json-stable-stringify';
|
import stringify from 'json-stable-stringify';
|
||||||
import Lexer from "../src/Lexer";
|
import Lexer from "../src/Lexer";
|
||||||
import ParseError from "../src/ParseError";
|
import ParseError from "../src/ParseError";
|
||||||
|
@@ -1,7 +1,4 @@
|
|||||||
/* eslint max-len:0 */
|
/* eslint max-len:0 */
|
||||||
/* global expect: false */
|
|
||||||
/* global it: false */
|
|
||||||
/* global describe: false */
|
|
||||||
import Settings from "../src/Settings";
|
import Settings from "../src/Settings";
|
||||||
import {scriptFromCodepoint, supportedCodepoint} from "../src/unicodeScripts";
|
import {scriptFromCodepoint, supportedCodepoint} from "../src/unicodeScripts";
|
||||||
import {strictSettings, nonstrictSettings} from "./helpers";
|
import {strictSettings, nonstrictSettings} from "./helpers";
|
||||||
@@ -116,6 +113,7 @@ describe("unicode", function() {
|
|||||||
|
|
||||||
describe("unicodeScripts", () => {
|
describe("unicodeScripts", () => {
|
||||||
const scriptRegExps = {
|
const scriptRegExps = {
|
||||||
|
// eslint-disable-next-line no-misleading-character-class
|
||||||
latin: /[\u0100-\u024f\u0300-\u036f]/,
|
latin: /[\u0100-\u024f\u0300-\u036f]/,
|
||||||
cyrillic: /[\u0400-\u04ff]/,
|
cyrillic: /[\u0400-\u04ff]/,
|
||||||
brahmic: /[\u0900-\u109F]/,
|
brahmic: /[\u0900-\u109F]/,
|
||||||
|
@@ -121,7 +121,7 @@ function createConfig(target /*: Target */, dev /*: boolean */,
|
|||||||
...cssLoaders,
|
...cssLoaders,
|
||||||
{
|
{
|
||||||
loader: 'less-loader',
|
loader: 'less-loader',
|
||||||
options: lessOptions,
|
options: {lessOptions},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@@ -7,8 +7,9 @@
|
|||||||
"rename-version": "docusaurus-rename-version"
|
"rename-version": "docusaurus-rename-version"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"docusaurus": "^1.5.0",
|
"docusaurus": "^1.14.4",
|
||||||
"fs-extra": "^7.0.0"
|
"fs-extra": "^9.0.1",
|
||||||
|
"react": "^16.8.4"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
@@ -157,6 +157,7 @@ const siteConfig = {
|
|||||||
favicon: '../favicon.ico',
|
favicon: '../favicon.ico',
|
||||||
|
|
||||||
disableHeaderTitle: true,
|
disableHeaderTitle: true,
|
||||||
|
scrollToTop: true,
|
||||||
|
|
||||||
/* colors for website */
|
/* colors for website */
|
||||||
colors: {
|
colors: {
|
||||||
@@ -182,7 +183,6 @@ const siteConfig = {
|
|||||||
|
|
||||||
scripts: [
|
scripts: [
|
||||||
'https://buttons.github.io/buttons.js',
|
'https://buttons.github.io/buttons.js',
|
||||||
'/js/scrollspy.js',
|
|
||||||
],
|
],
|
||||||
|
|
||||||
separateCss: ['static/static', 'static\\static'],
|
separateCss: ['static/static', 'static\\static'],
|
||||||
|
@@ -1,52 +0,0 @@
|
|||||||
/* eslint-disable no-var */
|
|
||||||
// Inspired by ScrollSpy as in e.g. Bootstrap
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
var OFFSET = 10;
|
|
||||||
var timer;
|
|
||||||
|
|
||||||
var headingsCache;
|
|
||||||
function findHeadings() {
|
|
||||||
return headingsCache ? headingsCache :
|
|
||||||
document.querySelectorAll('.toc-headings > li > a');
|
|
||||||
}
|
|
||||||
|
|
||||||
function onScroll() {
|
|
||||||
if (timer) { // throttle
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
timer = setTimeout(function() {
|
|
||||||
timer = null;
|
|
||||||
var found = false;
|
|
||||||
var headings = findHeadings();
|
|
||||||
for (var i = 0; i < headings.length; i++) {
|
|
||||||
// if !found and i is the last element, highlight the last
|
|
||||||
var current = !found;
|
|
||||||
if (!found && i < headings.length - 1) {
|
|
||||||
var next = headings[i + 1].href.split('#')[1];
|
|
||||||
var nextHeader = document.getElementById(next);
|
|
||||||
var top = nextHeader.getBoundingClientRect().top;
|
|
||||||
// The following tests whether top + scrollTop
|
|
||||||
// (the top of the header) is greater than scrollTop
|
|
||||||
// (where scrollTop = window.pageYOffset, the top of
|
|
||||||
// the window), with OFFSET pixels of slop.
|
|
||||||
current = top > OFFSET;
|
|
||||||
}
|
|
||||||
if (current) {
|
|
||||||
found = true;
|
|
||||||
headings[i].className = "active";
|
|
||||||
} else {
|
|
||||||
headings[i].className = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('scroll', onScroll);
|
|
||||||
document.addEventListener('resize', onScroll);
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
// Cache the headings once the page has fully loaded.
|
|
||||||
headingsCache = findHeadings();
|
|
||||||
onScroll();
|
|
||||||
});
|
|
||||||
})();
|
|
6645
website/yarn.lock
Normal file
6645
website/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user