* fix(auto-render): concatenate text nodes
Concatenate successive text nodes to prevent auto-render from skipping
math input when browsers split text nodes with long textContent.
* Remove siblings only when math found
Only remove siblings when math expressions were found to prevent removal
of nodes that do not contain math.
* Skip siblings if they do not contain math
* Fixed typo in comments
* Added first tests for large test nodes
* Expanded testing to compare renderMathInElement with renderMathInText
* Simplified text node test
* Change description of test
* Update contrib/auto-render/auto-render.js
Co-authored-by: marcoesters <marco.esters@duke.edu>
Co-authored-by: ylemkimon <y@ylem.kim>
* chore(deps): update jest monorepo to v27 [skip netlify]
* test: use jsdom environment for auto-render test
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Ylemkimon <y@ylem.kim>
* rewrite of splitAtDelimiters.js -- new fix for #2523
* fix splitAtDelimiters test
* minor changes to splitAtDelimiters
* tweak the indentation a bit
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
Co-authored-by: Kevin Barabash <kevinb7@gmail.com>
* 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
* Add optional pre-process callback to the auto-renderer.
* Rewrite `preProcess` callback signature.
* Add test.
* Make test future-proof.
* Add root folder to the node module paths.
* Remove Object.assign() in auto-render which requires expensive polyfill
* Remove underscore.js from LICENSE
* Rename to LICENSE and update year
* Lint `contrib` codes
* Add ignore option for class names
This change adds another option for ignoring nodes for rendering similar to `ignoreTags`.
The new option `ignoreClasses` can hold an array of strings representing class names that should be ignored if they are in a node's class list. This can be desirable in dynamic environments.
* Adhere to CI rules for styling
* Add documentation for new option
* Exchange classList property with IE9 compatible code
* Harmonize variable names
* Add default for ignoredClasses
Within a single call to `renderMathInElement`, default `macros` to a shared
empty object (same as if you specified an object) so that global macros
defined via `\gdef` can be defined and shared.
Fixes issue #1075.
Currently, a row separator such as `\[0.3em]` will cause the auto-render extension to fail if the row separator is placed between `\(…\)` math delimiters.
This PR re-orders the array of left delimiters that get searched for, putting `\[` last in the list. This, `\\[0.3em]` is no longer mistaken for a math delimiter.
This is particularly important as update-sri.js only updates jsdelivr links.
I was able to get update-sri.js to do the heavy lifting (computing checksums)
after updating the links in general, and downloading v0.10.0-alpha from CDN.
* Create a separate entry point for webpack
Created a webpack entry point for KaTeX, which imports katex.less. As
flow[1] and jest[2] doesn't support CSS modules natively, a separate
entry point is used and it is not flowtyped.
[1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef
[2] https://facebook.github.io/jest/docs/en/webpack.html
* Use webpack to build files
* Made webpack.config.js export valid webpack configuration
* Use:
browserify -> webpack
babelify -> babel-loader
UglifyJS CLI -> UglifyJsPlugin
Less CLI -> less-loader
cleancss -> cssnano in css-loader
build/fonts -> file-loader
* Inline CSS(Less) using style-loader and export them using
ExtractTextPlugin
* Add `watch` npm script calling `webpack --watch`
* Improve local testing(webpack-dev-server)
* Made webpackDevServer export a valid webpack configuration
* Compile Less and inline CSS using less-loader and style-loader
* Instead of copying files serve files from /static and use file-loader
* Remove old server.js and its dependencies
* Use webpack-dev-server in Screenshotter
* Include contrib in webpack-dev-server
+ Moved common configurations to webpack.common.js
* Rename webpackDevServer.js to webpack.dev...
to be consistent, avoid confusion with webpack-dev-server and follow
webpack configuration naming convention.
* Remove unnecessary conditional output.path
* Use map instead of reduce
+ Add comments regarding function arguments
* Remove unnecessary mkdir and clean build/* before build
* Use katex as external dependency instead of global variable in contrib
Fixes#692.
* Unblock codes as they are built as a module
* Update package-lock.json
* Add comments regarding devServer option
* Lint renamed webpack.dev.js
a0d8b33
* Export ES6 module and expose its default export
* Revert "Browserify hotfix (#1057)"
This reverts commit f6b509123b.
* Enables colors on the console when running the dev server in Screenshotter
* Add context to webpack configuration
Allows webpack to be run from other directories
* Move `rm -rf build/*` to npm scripts
* Check dependencies before build
* Move UglifyJsPlugin into config creation
* Let webpack handle ES6 modules
Do not transform modules to commonjs in Babel. However Jest doesn't not
support ES6 modules, so transfrom modules to commonjs when NODE_ENV is
`test`.
* Add documentation on testing in IE 9 and 10 using webpack-dev-server
Changed version range to include IE-compatible version
This is an attempt to flesh out the required <head> tags needed to make a full
working example of autorender, including KaTeX itself, to help people get
started with KaTeX.
* Initial webpack config. Moving to ES6 modules. Some module cleanup.
* WIP
* WIP
* Removing commented out code.
* Removing old deps.
* Removing the build script (used for testing).
* Working tests.
* Switching to node api over cli.
* Updating per comments. Still need to fix server.js to properly run the selenium tests.
* Cleaning up the config.
* More cleanup.
* Bringing back server.js for selenium tests.
* Bringing back old dependencies.
* Adding back eslint rules for webpack config. Final cleanup for webpack config.
* Pointing to correct pre-existing module versions. Adding some extra logic to server.js to ensure it gets transpiled properly.
* Getting make build to work again. Updating package.json with some shortcut scripts.
* Resolving conflict.
* Reverting back to commonjs modules.
* Removing extra spaces in babelrc
* copy-tex contrib module
* Factor out replacement code
* Fix lint
* Support for more browsers, in particular Firefox
* Use for loop instead of Array.forEach
* Use replaceChild if replaceWith is unavailable
* Browserify to remove let etc.
* Fix HTML handling, in particular for Edge
* Convert DocumentFragment to HTML directly (via children' outerHTML)
* Set HTML content *before* text content; Edge takes the last only
* Handle .katex-html and .katex-mathml separately
* Implement option 2: CSS user-select: all
Also fix auto-render.js build location
* Revise documentation according to @kevinbarabash's comments
* Split copy-tex.js into it + katex2tex.js
This supports re-use of code in a custom copy handler.
* Document custom copy handler
* Add missing file
Replace console.error with a configurable option. This mimcs the current
default behaviour to guaranteee compatibility with previous versions.
Update errorCallback to the README.md
Summary:
The reasons for switching to jest:
- easy snapshot testing so that we can easily verify the structure of the parse tree and MathML tree
- easy compilation of ES6 features for tests as we continue to expand our use of ES6
Test Plan:
- npm test
This reverts commit 4d2e46e7f6.
Having trailing commans makes diffs easier to read as it avoids modifying a
line just to add a trailing comma if there is another item to add at the end
of a list. There are plans to switch to ES6 notation and to translate that
to ES5 as part of the build process. Since that translation would remove
trailing commas, the IE9 problems that originally motivated the commit
should vanish soon.
Summary: IE 9 doesn't like trailing commas. When we introduced eslint, we added
a bunch of trailing commas, which makes IE 9 sad.
Test Plan:
- `make lint`
- Visit http://localhost:7936/ using IE 9 on browserstack.
- See that the math loads, and there are no errors in the F12 developer tools.
@kevinb