tani / markdown-it-mathjax3

Add Math to your Markdown with a MathJax plugin for Markdown-it
MIT License
59 stars 9 forks source link

How to use in browser? #65

Open lfmunoz opened 1 year ago

lfmunoz commented 1 year ago

How to use in browser?

Can you please compile and have a bin file where js can be downloaded and used in browser?

markg85 commented 1 month ago

A little late but i just made the KaTeX variant of this project (it forks from that version) 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.