-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Support math latex. #1275
Support math latex. #1275
Conversation
This seems like it would be better as a wrapper around marked. You could create a separate npm package that extends the lexer |
@UziTech
|
We are trying to slim marked down. By the 1.0 release we would like to deprecate most of the options. We are trying to focus on making marked spec compliant with CommonMark and GFM. For everything else we would like to create separate modules that extend marked. I can leave this PR open so we can revisit it in the future and possibly create a module ourselves but it will be a while before that happens. |
Is there a API for marked or is it code it from the ground if you wanna make extensions to it? |
You can check out the documentation here for extending marked. |
@UziTech Posible without node.js? Some web hotels don't support nodejs and would like to keep it working on so many server types as possible |
@BenjaminHoegh Is what possible without node? marked is written in js so it needs a js engine in order to run at all. If you use marked on the client side it will create a global variable |
@UziTech Is there documentation about how to add new rules to inline and block |
I don't believe there is a way to add new rules easily yet. All of our documentation is at marked.js.org |
@ahuigo |
markedjs/marked#1275 to make it work with katex
@yhcharles What you need is |
This is a bit late, but another solution would be to change the source code beginning at line 935 from var html = marked.defaults.latexRender(text);
if (block) {
out = '<div style="text-align:center">' + html + '</div>';
}else{
out = html;
} to if (block) {
out = marked.defaults.latexRender(text, {displayMode: true});
}else{
out = marked.defaults.latexRender(text);
} This assumes you're using KaTeX to render LaTeX; documentation here. I'm sure that MathJax has the same setting. Note I haven't tested this implementation yet. |
Marked version:
Release 0.4.0
Contributor
I don't know how to test this project exactly. Any advice?
The demo for this feature:
Committer
In most cases, this should be a different person than the contributor.