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

Add mathjax support #165

Closed
wants to merge 6 commits into from
Closed

Add mathjax support #165

wants to merge 6 commits into from

Conversation

tani
Copy link

@tani tani commented Jun 6, 2020

Closes #164

@tani tani mentioned this pull request Jun 6, 2020
Copy link
Member

@yhatt yhatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are too much duplications so I'll work to refactor the math plugin in #166.

@@ -25,6 +26,7 @@ export interface MarpOptions extends Options {
| { [attr: string]: boolean | ((value: string) => string) }
}
markdown?: object
mathjax?: boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that interface of constructor option is not intuitive. math: 'mathjax' would be better than an individual option.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea. Let me confirm you.

math: 'katex' # enable katex as same as `true`
math: true # enable katex for backward compatibility
math: { ... } # enable katex with options
math: 'mathjax' # enable mathjax

Do you want to do like this?


try {
return `<p>${adaptor.outerHTML(
mathDocument.convert(content, genOpts(true))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By comparing to KaTeX rendering, the rendered math block is not centering.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solved, check it.

const { Marp } = require("./lib/marp.js")
const marp = new Marp({ math: true, mathjax: false})

const md = `
# Elementary Math

$$
1+1 = 2
$$
`
const r = marp.render(md)
console.log(r.html + `<style>${r.css}</style>`)

@tani
Copy link
Author

tani commented Jun 7, 2020

My updates have been done by #166 . Thus, I stop to update this branch.

@yhatt yhatt closed this Jun 7, 2020
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.

MathJaX v3 support
2 participants