-
Notifications
You must be signed in to change notification settings - Fork 88
Add the Markdown-It KaTeX plugin #266
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
Conversation
|
Can you please all code formatting changes in another commit (I cannot review what actually was changed) and add yourself as author of the script? @milan-rusev, @bessw, are you ok with those changes? |
|
And can you please mention the plugin and what it does in the description? Could be interesting for #253. |
I'm a little confused by what you mean. Do you want me to separate the actual addition of the plugin and the preview rendering? The diff is quite clear. |
Do you want me to do that here or in the description of the script? If here, this is the plugin I used: https://github.com/mdit-plugins/mdit-plugins/tree/main/packages/katex. The plugin does the same thing as KaTeX and is therefore unrelated to #253 (as KaTeX renders to html while the plugin used in #253 renders an image and displays it). I just bundled it as a UMD with rollup (resolve, commonjs, and typescript plugins), changed the prelude slightly to use |
| "default": null | ||
| }, | ||
| ] | ||
| property variant settingsVariables: [{ |
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.
You changed a lot of whitespaces in this and the following lines. That's what I meant with code formatting changes.
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.
Oh, I see. The diff looks cleaner in VSCode. That section all I did was add a boolean option titled LaTeX Support that would enable or disable KaTeX.
Yes, you could mention the KaTeX feature. |
Also if you're still waiting on this, I don't think I can separate it into multiple commits now that there are commits after it, and if I can, I don't know how to. |
|
|
||
| return mdHtml; | ||
| } | ||
|
|
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.
Did you add that on purpose?
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.
No, that was the QML formatter's doing, though I don't imagine it's a problem.
Sure. I'm not using this anymore and didn't test it, but it looks like a great addition. |
|
That last commit should hopefully resolve #77 |
|
Okay. In my opinion this PR is ready for merge, though it may need more testing. It should hopefully resolve #77, it might resolve #253 if they are willing to use a different script and export to HTML when they are finished. |
I wanted LaTeX rendering so I added it myself. Code addition quality may not be the greatest quality considering this is the first real work I've done with JS or QML, but it works.
This adds the markdown-it-katex plugin with the MathML output mode (it is a baseline feature now, and it is simpler than HTML and CSS). Of course the preview cannot display this so it displays the formula in italics and colors it red if there are errors.