Open zcysxy opened 1 year ago
The use case is that I want to render some TeX commands at startup, e.g., defining some macros like \def\R{\mathbb{R}}
for every document.
If you read the source code of this plugin, you will find that it only receive tex
option and svg
option. So the answer is simply that the startup
option is not supported so far.
function plugin(md: MarkdownIt, options: any) {
// Default options
const documentOptions = {
InputJax: new TeX({ packages: AllPackages, ...options?.tex }),
OutputJax: new SVG({ fontCache: 'none', ...options?.svg })
}
const convertOptions = {
display: false
}
// set MathJax as the renderer for markdown-it-simplemath
md.inline.ruler.after("escape", "math_inline", math_inline);
md.block.ruler.after("blockquote", "math_block", math_block, {
alt: ["paragraph", "reference", "blockquote", "list"],
});
md.renderer.rules.math_inline = function (tokens: Token[], idx: number) {
convertOptions.display = false;
return renderMath(tokens[idx].content, documentOptions, convertOptions)
};
md.renderer.rules.math_block = function (tokens: Token[], idx: number) {
convertOptions.display = true;
return renderMath(tokens[idx].content, documentOptions, convertOptions)
};
};
Sorry I am not very familiar with web development. I want to configure MathJax following the official document like the following example
However, it requires to access MathJax within the configure. I tried the following code
But it does not seem to work. Thanks!