From c752ffacead3336c220a2b2d358713efeb0f5e09 Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Thu, 28 Jul 2022 17:21:05 +0800 Subject: [PATCH] Add support for extra packages --- README.md | 1 + lib/filter.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ff750ad..a804fe3 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ mathjax: normal_width: 0.6 # relative normal (monospace) width append_css: true # add CSS to pages rendered by MathJax every_page: false # if true, every page will be rendered by MathJax regardless the `mathjax` setting in Front-matter + packages: # extra packages to load extension_options: {} # you can put your extension options here # see http://docs.mathjax.org/en/latest/options/input/tex.html#tex-extension-options for more detail diff --git a/lib/filter.js b/lib/filter.js index 4b12129..155874e 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -7,7 +7,7 @@ const { SVG } = require('mathjax-full/js/output/svg.js'); const { LiteAdaptor } = require('mathjax-full/js/adaptors/liteAdaptor.js'); const { RegisterHTMLHandler } = require('mathjax-full/js/handlers/html.js'); -const { AllPackages } = require('mathjax-full/js/input/tex/AllPackages.js'); +let { AllPackages } = require('mathjax-full/js/input/tex/AllPackages.js'); module.exports = function(config) { @@ -26,6 +26,9 @@ module.exports = function(config) { // // Create input and output jax and a document using them on the content from the HTML file // + if (Array.isArray(config.packages)) { + AllPackages = AllPackages.concat(config.packages); + } const tex = new TeX(Object.assign({ packages : AllPackages, tags : config.tags,