File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 66 npm install
77 mkdir -p build
88
9- # watch the changes to js source code and update the target js code
9+ # Watch the changes to js source code and update the target js code
1010watch-js : pseudocode.js $(wildcard src/* .js)
11- ./node_modules/.bin/watchify $< --standalone pseudocode -o build/pseudocode.js
11+ ./node_modules/.bin/watchify $< --exclude katex -- standalone pseudocode -o build/pseudocode.js
1212
1313clean :
1414 rm -rf build/*
@@ -18,8 +18,11 @@ zip: build/pseudocode-js.tar.gz build/pseudocode-js.zip
1818lint : pseudocode.js $(wildcard src/* .js)
1919 ./node_modules/.bin/jshint $^
2020
21+ # although pseudocode.js depends on katex, pseudocode.js will not be
22+ # bundled with katex, as users are likely to have katex.js loade in a separate
23+ # file by browser
2124build/pseudocode.js : pseudocode.js $(wildcard src/* .js)
22- ./node_modules/.bin/browserify $< --standalone pseudocode -o $@
25+ ./node_modules/.bin/browserify $< --exclude katex -- standalone pseudocode -o $@
2326
2427build/pseudocode.min.js : build/pseudocode.js
2528 ./node_modules/.bin/uglifyjs --mangle --beautify beautify=false < $< > $@
Original file line number Diff line number Diff line change 11/*
22 * TODO: rename commentSymbol to commentDelimiters
33* */
4- var katex = require ( 'katex' ) ;
4+ /* katex package may either be defined in a separate js file loaded by browser
5+ * or imported by node.js.
6+ * */
57var utils = require ( './utils' ) ;
68
79/*
@@ -155,6 +157,7 @@ TextEnvironment.prototype.renderToHTML = function() {
155157 this . _html . putText ( text ) ;
156158 break ;
157159 case 'math' :
160+ if ( ! katex ) katex = require ( 'katex' ) ;
158161 var mathHTML = katex . renderToString ( text ) ;
159162 this . _html . putSpan ( mathHTML ) ;
160163 break ;
You can’t perform that action at this time.
0 commit comments