Skip to content

Commit

Permalink
Make sure katex styles are shipped under root of
Browse files Browse the repository at this point in the history
Also copies of just the katex css we need instead of bundling the entire module
  • Loading branch information
mjbvz committed Mar 17, 2021
1 parent 581a659 commit fc8d768
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Thumbs.db
node_modules/
.build/
extensions/**/dist/
extensions/notebook-markdown-extensions/notebook-out/**
/out*/
/extensions/**/out/
src/vs/server
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion extensions/notebook-markdown-extensions/notebook/katex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ declare const extendMarkdownIt: undefined | (
(f: (md: markdownIt.MarkdownIt) => void) => void
);

const styleHref = (document.currentScript as any).src.replace('notebook-out/katex.js', 'node_modules/katex/dist/katex.min.css');
const styleHref = (document.currentScript as any).src.replace(/katex.js$/, 'katex.min.css');

const link = document.createElement('link');
link.rel = 'stylesheet';
Expand Down
11 changes: 5 additions & 6 deletions extensions/notebook-markdown-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@
"scripts": {
"compile": "npm run build-notebook",
"watch": "npm run build-notebook",
"build-notebook": "npx webpack-cli --config webpack.notebook.js --mode production"
},
"dependencies": {
"@iktakahiro/markdown-it-katex": "^4.0.1",
"markdown-it-emoji": "^2.0.0"
"build-notebook": "npx webpack-cli --config webpack.notebook.js --mode production",
"postinstall": "npm run build-notebook"
},
"devDependencies": {
"@iktakahiro/markdown-it-katex": "^4.0.1",
"@types/markdown-it": "^0.0.0",
"markdown-it": "^12.0.4"
"markdown-it": "^12.0.4",
"markdown-it-emoji": "^2.0.0"
},
"repository": {
"type": "git",
Expand Down
18 changes: 17 additions & 1 deletion extensions/notebook-markdown-extensions/webpack.notebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');

module.exports = {
entry: {
Expand All @@ -23,5 +24,20 @@ module.exports = {
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'notebook-out')
}
},
plugins: [
// @ts-ignore
new CopyPlugin({
patterns: [
{
from: './node_modules/katex/dist/katex.min.css',
to: 'katex.min.css'
},
{
from: './node_modules/katex/dist/fonts',
to: 'fonts/'
},
],
}),
]
};

0 comments on commit fc8d768

Please sign in to comment.