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

How to use it in native JS? #42

Open
qnmlgbd250 opened this issue Sep 22, 2023 · 2 comments
Open

How to use it in native JS? #42

qnmlgbd250 opened this issue Sep 22, 2023 · 2 comments

Comments

@qnmlgbd250
Copy link

markdown-it-katex How to use it in native JS?

@markg85
Copy link

markg85 commented Oct 3, 2024

A little late but i just made this in my own project. It's part of a markdown project but fairly contained so it might be useful to you.

Clone this repo https://github.com/markg85/static-hedgedoc and pull out the js/marks-plugins folder in your own project.
Fix the paths if needed.

Then it's just as simple as:

import markdownIt from 'markdown-it'
import {  KaTeX } from 'marks-plugins'

const md = markdownIt().use(KaTeX)

Do look at my demo html code to get these paths and js in order.

What this does is essentially the latest KaTeX version wrapped in this markdown-it-katex plugin but tweaked to be modern javascript. It's just a quick couple hour hack to get it working. If there's bugs, let me know! But it should be enough to get you started.

@markg85
Copy link

markg85 commented Oct 3, 2024

@waylonflinn Would you be open to a PR that is modernizing this code (just uses ESM) and embeds katex in it's repository to make it usable in a stand-alone manner?

If you're not planning on maintaining this anymore then i'd be fine in taking over this repo. I don't really plan to maintain it other then to keep it working. To me it's just one of many plugins that i'd like to keep working in my own static markdown parser project :)

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

No branches or pull requests

2 participants