Commit Graph

33 Commits

Author SHA1 Message Date
Kevin Barabash
298b482c18 Bump master to v0.10.0-pre 2018-02-18 16:55:16 -05:00
Kevin Barabash
cf6743b2a8 Bump master to v0.10.0-pre 2018-01-28 23:41:01 -05:00
ylemkimon
5f32b71c85 Use webpack to build files and webpack-dev-server for testing (#1068)
* 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
2018-01-21 19:48:25 -05:00
ylemkimon
4a11c3166d Move auto-render-spec.js to ./test (#1071)
Fixed jest not running auto-render-spec.js
+ Changed `require` to `import`
2018-01-17 08:44:48 -08:00
Kevin Barabash
0599e09a2d Bump master to v0.10.0-pre 2018-01-14 17:39:59 -05:00
Erik Demaine
d6609f7319 Make a more working example in README. Fix #1049 (#1050)
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.
2017-12-31 17:01:30 -07:00
Kevin Barabash
2ca6c3c73b Bump master to v0.10.0-pre 2017-11-26 18:34:59 -05:00
Kevin Barabash
b4c5dfaf20 Bump master to v0.10.0-pre 2017-10-15 16:49:24 -04:00
Ryan Randall
141afa091a Fixing CJS modules and Globals (#920)
* Working CJS modules.

* Changing cjs imports to es6.
2017-10-08 10:56:07 -06:00
Kevin Barabash
2e27d4248b Bump master to v0.10.0-pre 2017-10-05 11:40:49 -06:00
Ryan Randall
fbffdc5fc7 Webpack dev server (#902)
* 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
2017-09-26 12:16:35 -06:00
Erik Demaine
e71c7d4b81 copy-tex contrib module (#813)
* 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
2017-09-04 21:17:46 -04:00
Kevin Barabash
96c1fe7ad8 Bump master to v0.8.4-pre 2017-08-27 18:01:07 -04:00
Kevin Barabash
2cd961dbe0 Bump master to v0.8.3-pre 2017-08-17 01:13:27 -04:00
Kevin Barabash
ef66f30912 Bump master to v0.8.2-pre 2017-08-11 22:14:52 -04:00
Kevin Barabash
107d5284b5 Bump master to v0.9.0-pre 2017-08-11 20:00:34 -04:00
Jörn Lenoch
2eb32a8775 Add configurable error callback (#658)
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
2017-07-30 11:27:29 -04:00
Kevin Barabash
361c500a7f Switch from jasmine to jest (#747)
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
2017-07-11 14:16:26 -04:00
Erik Demaine
a36709d239 Add documentation for how to run auto-render example (#740) 2017-06-25 17:47:46 -04:00
Alex Pearce
60b1969a01 Support all render options in auto-render.
Closes #690.
2017-06-14 10:50:14 -04:00
Martin von Gagern
079fecaf86 Update README files to 0.7.1 release 2017-01-22 14:48:00 +01:00
Martin von Gagern
bd9db332d2 Turn var into const or let 2017-01-13 22:37:17 -05:00
Martin von Gagern
9b565a6375 Include babelify step in browserify calls
This allows using ES6 syntax in our code, while maintaining backwards
compatibility for the generated file.
2017-01-13 22:37:17 -05:00
James Lee
549104c5a8 auto-renderer README.md - added integrity (#591)
Integrity generated from https://www.srihash.org/
Reference: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
2017-01-13 12:15:57 +01:00
Martin von Gagern
4ead46c4ab Describe using auto renderer in html head (#623)
Describe using auto renderer in html head

Motivated by #621.
2017-01-11 21:04:52 +01:00
Martin von Gagern
53e416e296 Revert "Remove trailing commas for IE 9 compatibility"
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.
2017-01-11 13:26:00 +01:00
Emily Eisenberg
4d2e46e7f6 Remove trailing commas for IE 9 compatibility
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
2017-01-06 19:06:01 -08:00
Viktor Qvarfordt
e4d2d933af Provide link to auto-render.min.js in usage example (#522) 2016-09-17 15:23:26 -07:00
Andrey Mikhaylov (lolmaus)
b120b1c3d8 Fixed indentation in auto-render readme (#481) 2016-05-26 10:10:54 -07:00
Kevin Barabash
14a58adb90 Migrate to eslint
Summary
We'd like contributors to use the same linter and lint rules that we use
internally.  This diff swaps out eslint for jshint and fixes all lint failures
except for the max-len failures in the test suites.

Test Plan:
- ka-lint src
- make lint
- make test

Reviewers: emily
2015-12-01 10:02:08 -08:00
Ben Alpert
b29b8c40ea [auto-render] Don't stop parsing when one expression fails
Summary: Fixes #223.

Test Plan: Opened http://127.0.0.1:7936/contrib/auto-render/, saw `$\unsupported$` in page and error in console, but other expressions rendered. Made test.

Reviewers: emily

Reviewed By: emily

Differential Revision: https://phabricator.khanacademy.org/D17543
2015-04-26 17:04:11 -07:00
Emily Eisenberg
af8c1307f7 Add better lint checking.
Summary:
Make the lint checker check more files. Also, make arc run the
linter.

Test Plan:
 - `arc lint`
 - `make lint`

Reviewers: kevinb, alpert

Reviewed By: alpert

Differential Revision: https://phabricator.khanacademy.org/D17509
2015-04-22 18:55:20 -07:00
Emily Eisenberg
cd9bca4a89 Add basic auto-render extension
Summary:
Add an auto-render extension to render math on a page. It
exposes a global function (maybe we should attach it to `katex`?) to
render math in an element. It comes with a README on how to use it.
Also, make `make build` build the minified file.

Fixes #26

Test Plan:
 - Visit http://localhost:7936/contrib/auto-render/
 - See that all of the math renders correctly
 - `make test`

Reviewers: alpert, kevinb

Reviewed By: kevinb

Differential Revision: https://phabricator.khanacademy.org/D16620
2015-04-01 15:57:10 -07:00