Closed tchajed closed 1 month ago
The hope theme happened to set a handful of macros by default,
Yes I agree with that, but we are still not overriding any user options (the transformer
option is private always)
So everything should work find if you manually set the previous macros that vuepress-plugin-md-enhance
provides.
If you think that something is wrong, provide details with a minimal reproduction, or point out the code issue directly.
Hello @tchajed. Please provide a minimal reproduction using a GitHub repository or v2.vuepress.vuejs.org/new. Issues marked with need reproduction
will be closed if they have no activity within 7 days.
Oh, I think I get your point by reading through https://katex.org/docs/api.html#persistent-macros
So you think that a macros object should be default provided in anyway right?
Yes, that's exactly the fix I was looking for. Thanks!
Clear and concise description of the problem
By default, KaTeX's
\gdef
feature (which creates a definition that persists across math blocks) does not work.Suggested solution
The plugin should set the option
macros: {}
by default, and then override it from the katex config. This happens here: https://github.com/vuepress/ecosystem/blob/f976a5ca619f0e870e40f7ef87b0b83d199b3e20/plugins/markdown/plugin-markdown-math/src/node/markdownMathPlugin.ts#L108.Alternative
No response
Additional context
I am migrating from vuepress-hope-theme v2.0.0-rc.52 to v2.0.0-rc.56, which involves migrating from the hope theme's markdown math plugin to the official one here. The hope theme happened to set a handful of macros by default, and this enabled global definitions; switching to the official markdown math plugin broke this and it was pretty difficult to debug.