Generate ECMAScript module for contrib (#1624)

* Create separate entry point of copy-tex for webpack

* Update katex.webpack.js comment

* Generate ECMAScript for contrib

* Update dependencies

* Comment out documentations
This commit is contained in:
ylemkimon
2018-10-31 11:37:54 +09:00
committed by GitHub
parent 1d79483291
commit f628ca142b
10 changed files with 54 additions and 10 deletions

View File

@@ -35,6 +35,12 @@ If you want to build your own custom copy handler based on this one,
copy the `copy-tex.js` into your codebase and replace the `require`
statement with `require('katex/contrib/copy-tex/katex2tex.js')`.
<!-- TODO: uncomment when releasing a new version
ECMAScript module is also available:
```html
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/contrib/copy-tex.mjs" integrity="sha384-jLtlhlpasgCe2I4eVNEStxiWP4slZdWUk3E3FgbblMBxLs6YlA/rMNSeiGTRfAQ/" crossorigin="anonymous"></script>
```` -->
### Known Issues
This extension has been tested on Chrome, Firefox, Edge, and Safari.

View File

@@ -1,4 +1,3 @@
import './copy-tex.css';
import katexReplaceWithTex from './katex2tex';
// Global copy handler to modify behavior on .katex elements.

View File

@@ -0,0 +1,6 @@
/**
* This is the webpack entry point for KaTeX. As ECMAScript doesn't support
* CSS modules natively, a separate entry point is used.
*/
import './copy-tex.css';
import './copy-tex.js';

View File

@@ -14,8 +14,6 @@ This extension should be loaded *after* all `script type=math/tex` blocks that y
```html
<script src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/contrib/mathtex-script-type.min.js" integrity="sha384-zWYbd0NBwgTsgIdFKVprSfTh1mbMPe5Hz1X3yY4Sd1h/K1cQoUe36OGwAGz/PcDy"></script>
```
Note that if the URL above contains `...` in-place of a version string, then this script has not yet
been deployed to the CDN.
You can download the script and use it locally, or from a local KaTeX installation instead.
For example, in the following simple page, we first load KaTeX as usual.
@@ -34,3 +32,9 @@ After we're done writing `math/tex` scripts, we load this extension.
</body>
</html>
```
<!-- TODO: uncomment when releasing a new version
ECMAScript module is also available:
```html
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/contrib/mathtex-script-type.mjs" integrity="sha384-En8cse3uW4xErwYkF3uTpWEw4BdLEWrWT2u1BttQuilGrJjAKcpGeC2ihwJ/wRD4" crossorigin="anonymous"></script>
```` -->