Open embedded-kiddie opened 4 months ago
Hello!
I think you are right that rendering latex in <pre>
and <code>
tags makes no sense.
I will try to fix it but it will not be simple. Current implementation gets LaTeX expressions using regex. This is quick and simple but not very robust. I can see two solutions:
1) Parse rendered HTML to create AST object and check parent tags in hierarchy it self. This would be very clean and reliable solution but it will be very slow. I do not think that Jekyll currently has an API for getting AST from kramdown so the workflow would look like this:
Markdown file -> Parse to AST in inside kramdown -> Render to HTML -> Parse to AST from HTML -> Render LaTeX -> Render to HTML again
2) Edit current regex expressions to avoid rendering in mentioned tags. This can be probably easily done, but it can be uncomfortable in future to maintain. viz legendary SO post. I probably start experimenting with this option first.
Well, I promise that I will try to take a look at this soon as possible. At my university this time is beginning of exam season so it will be hard for me to find time for this issue.
Thank you for your kind words. :) This really motivates me to work on Open Source projects.
@yagarea , Thank you for your support.
I can understand the difficulty coordinating with kramdown. First and foremost, do your best for your university exams!
First of all, thank you for the awesome plugin.
Could you consider to avoid rendering the contents in pre or code tags? There are quite a few sites that explain how to express mathematical formulas in LaTeX using KaTeX scripts.
For example, the following code snippet
is rendered into like this:
This issue happens only with
\[...\]
and\(...\)
. The$$...$$
and\begin{}...\end{}
are OK.I think we don't need rendering in pre or code tags. I would appreciate it if you would consider compatibility for sites that already use KaTeX scripts, because it's great that the owners of these sites can just install your plugin and remove the KaTeX script tags.
Thanks again!
P.S. In my site, when I write some formulas with
\[...\]
or\(...\)
, I use the following to avoid kramdown do something: