-
-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add mathjax support #165
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>`)
My updates have been done by #166 . Thus, I stop to update this branch. |
Closes #164