-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
First markdown parser tests #97
base: master
Are you sure you want to change the base?
Conversation
|
Adding the normalization of GFM on the output HTML the results for JupyterLab is 293 failed, 378 passed The artifact to compare the outputs is available at: https://github.com/jupyterlab/benchmarks/actions/runs/2200787289 |
So a more in-depth analysis shows the following group of discrepancies:
|
Actually marked is running the commonmark and gfm tests in its CI. The results as of Jan 4th 2022 are reported there: markedjs/marked#1202 (comment) |
Interestingly, Github just added math rendering, so now there is another opinion about exactly what syntax is used to create math: https://github.blog/changelog/2022-05-19-render-mathematical-expressions-in-markdown/ Math is also rendering in github's notebook preview (see https://github.com/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Lorenz%20Differential%20Equations.ipynb, for example). It appears to use MathJax 3.2.0. |
@williamstein pointing me out to some concerns about the GitHub implementation: https://nschloe.github.io/2022/05/20/math-on-github.html; they bring interesting points to have in mind for our parser. |
Let's list the wanted feature for an ideal markdown parser for JupyterLab:
Reference: Notebook documentation |
WIP Candidates / features matrix
Some comments:
What other are using? Footnotes
|
@fcollonval a few days ago I rewrote the upstream markdown-it plugin I'm using for parsing out math, so in cocalc we fully parse math via a plugin, rather than some sort of hack involving parsing before or after markdown is used (like github and jupyter both do, I think). Here's the code: https://github.com/sagemathinc/cocalc/blob/master/src/packages/frontend/markdown/math-plugin.ts It's MIT licensed. My goal with that code is to align with upstream Jupyter in fidelity in terms of what is parsed as math. *In cases where there is a reasonable difference, I would lobby for Jupyter to change. As an example, my plugin parses this properly as inline math: consider \begin{math}x^3\end{math} and ... JupyterLab doesn't detect it as math at all. I think it's reasonable to detect. |
It seems that https://github.github.com/gfm/ has not been updated for math support. Edit: which is what @fcollonval was saying above |
@williamstein - can you give a comprehensive description of what your plugin parses as math to typeset? |
New Markdown parsers should also address existing Markdown bugs and feature requests, such as:
|
It's by definition exactly what this file parses: https://github.com/sagemathinc/cocalc/blob/master/src/packages/frontend/markdown/math-plugin.ts when run as the first plugin in markdown-it. It would be a lot of (very valuable) work for that to get converted to an official spec. My goal with writing and iterating on math-plugin.ts has been to get fidelity with what I think JupyterLab does or should do, and I've incorporated significant feedback from my users. I would not be at all surprised if there are significant bad surprises related to the above linked code though. In fact, I can't wait to test it on the bugs @jweill-aws just listed, and see if my code isn't all broken or not on those... |
I wrote up some thoughts in a README here along with a notebook testing the issues mentioned above: |
There's a related discussion about math + markdown here: https://chat.zulip.org/#narrow/stream/2-general/topic/LaTeX.20math/near/1382932 |
Discussion about Markdown parsing is a long standing issue. This PR lays out a structure to test nbconvert and web frontend parser based on the GitHub flavored Commonmark tests.
Xref: jupyterlab/jupyterlab#272