Skip to content

Conversation

@gdagosto
Copy link
Contributor

Adds another markdown-it plugin, markdown-it-texmath, which supports mathematical expressions via KaTeX.

@gdagosto
Copy link
Contributor Author

While it worked for some really basic expressions, the fact that both Svelte and KaTeX use curly braces is troublesome. Svelte tries to evaluate expressions like \sum_{i=1} and fails because of ReferenceError: i is not defined

@gdagosto
Copy link
Contributor Author

@mihar-22 The code is ready, but I still need to write docs for it, which I'll do if you decide that the PR is ok.

You can see it working within the demo app, via this link.

Lemme know if I can move forward and write the docs for it, thanks!

@gdagosto gdagosto marked this pull request as ready for review November 27, 2023 20:43
@gdagosto
Copy link
Contributor Author

I made the dependencies optional as to not bloat kit-docs with unecessary dependencies. This way, if an user needs math expressions, he can just install some optional dependencies and support is already there.

In order to use mathematical expressions, one would need to:

  • add markdown-it-texmath as a project dependency
  • add katex as a project dependency

To add styling, one would need to:

  • add css rules to katex. A simple way could be to add this css file to your html
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"
  integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV"
  crossorigin="anonymous"
/>

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant