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

Force svelte not to interpret some classes #677

Open
tobiasBora opened this issue Dec 13, 2024 · 0 comments
Open

Force svelte not to interpret some classes #677

tobiasBora opened this issue Dec 13, 2024 · 0 comments

Comments

@tobiasBora
Copy link

tobiasBora commented Dec 13, 2024

When using rehype-katex, it generates text like:

<div class="math math-inline">
 … some stuff involving {x} that is interpreted by svelte
</div>

and it produces error as {x} usually comes from a math expression like \sqrt{x} and is not meant to be replaced as a svelte variable. People created a rehype-katex-svelte (as recommended in #302) to solve this issue and this seems to work reasonably well, but I don't know how well maintained this is (e.g. it requires a quite old remark-math, but so do rehype-katex so it might be unrelated) and the author mention some potential security flows. As such, it seems not at battle-tested as rehype-katex.

As such, I was wondering if would instead directly allow users to add in MDsveX (via the options) a list of classes that should be wrapped around {@html } appropriately (with escaping etc) in order not to be interpreted by svelte later in the process. As rehype-katex does not want to do it on their side (see remarkjs/remark-math#104), I see not much other solution, and this might anyway be useful in other scenarios.

@github-project-automation github-project-automation bot moved this to Triage + Refine in mdsvex Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage + Refine
Development

No branches or pull requests

1 participant