11//
22// Load the packages needed for MathJax
33//
4- const { mathjax } = require ( 'mathjax-full/js/mathjax.js' ) ;
5- const { TeX } = require ( 'mathjax-full/js/input/tex.js' ) ;
6- const { SVG } = require ( 'mathjax-full/js/output/svg.js' ) ;
7- const { LiteAdaptor } = require ( 'mathjax-full/js/adaptors/liteAdaptor.js' ) ;
8- const { RegisterHTMLHandler } = require ( 'mathjax-full/js/handlers/html.js' ) ;
9-
10- let { AllPackages } = require ( 'mathjax-full/js/input/tex/AllPackages.js' ) ;
4+ const { mathjax } = require ( '@mathjax/src/js/mathjax.js' ) ;
5+ const { TeX } = require ( '@mathjax/src/js/input/tex.js' ) ;
6+ const { SVG } = require ( '@mathjax/src/js/output/svg.js' ) ;
7+ const { LiteAdaptor } = require ( '@mathjax/src/js/adaptors/liteAdaptor.js' ) ;
8+ const { RegisterHTMLHandler } = require ( '@mathjax/src/js/handlers/html.js' ) ;
119
1210module . exports = function ( config ) {
1311
@@ -20,22 +18,23 @@ module.exports = function(config) {
2018 unknownCharWidth : config . normal_width
2119 } ) ;
2220 RegisterHTMLHandler ( adaptor ) ;
21+ const texConfig = {
22+ tags : config . tags ,
23+ inlineMath : config . single_dollars ? {
24+ '[+]' : [ [ '$' , '$' ] ]
25+ } : { } ,
26+ } ;
27+ if ( Array . isArray ( config . packages ) ) {
28+ texConfig . packages = config . packages ;
29+ }
30+ Object . assign ( texConfig , config . extension_options ) ;
2331
2432 return function ( content ) {
2533
2634 //
2735 // Create input and output jax and a document using them on the content from the HTML file
2836 //
29- if ( Array . isArray ( config . packages ) ) {
30- AllPackages = AllPackages . concat ( config . packages ) ;
31- }
32- const tex = new TeX ( Object . assign ( {
33- packages : AllPackages ,
34- tags : config . tags ,
35- inlineMath : config . single_dollars ? {
36- '[+]' : [ [ '$' , '$' ] ]
37- } : { }
38- } , config . extension_options ) ) ;
37+ const tex = new TeX ( texConfig ) ;
3938 const svg = new SVG ( {
4039 fontCache : 'none'
4140 } ) ;
0 commit comments