Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] markdown-math-plugin should support katex globals by default #261

Closed
tchajed opened this issue Sep 23, 2024 · 5 comments
Closed

Comments

@tchajed
Copy link

tchajed commented Sep 23, 2024

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:

.

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.

@Mister-Hope
Copy link
Member

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.

@Mister-Hope
Copy link
Member

If you think that something is wrong, provide details with a minimal reproduction, or point out the code issue directly.

Copy link

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.

@Mister-Hope
Copy link
Member

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?

@tchajed
Copy link
Author

tchajed commented Sep 23, 2024

Yes, that's exactly the fix I was looking for. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants