Katex render and vscode output improvements for md
1. Fix output of jupyter notebooks saved in VSCode VSCode uses the newer NBFormat Version 4.1 [1], which allows the output text entry to be a simple string. The function `rawCode` assumed NBFormat Version 3.2 [2], which requires the output.text object to be an array. This commit adds a special handling if the type of output.text is a string, then we don't need to use `join()` and can just return the string. Fixes: https://gitlab.com/gitlab-org/gitlab/-/issues/212837 [1] https://nbformat.readthedocs.io/en/latest/format_description.html [2] https://ipython.org/ipython-doc/3/notebook/nbformat.html 2. Handle katex render error in ipython markdown When a formula brings katex to its knees the whole cell is dropped. Instead of just dropping continue on and leave the unrendered formula in the cell. Partially fixes: https://gitlab.com/gitlab-org/gitlab/-/issues/216744 3. Render listitems with Katex in ipython markdown Add a renderer callback for list items. Not only paragraphs should have the honor to have math formulas rendered with Katex. Also listitems of bullet points and enumerations should have this honor. Fixes: https://gitlab.com/gitlab-org/gitlab/-/issues/216741 4. Get the tick `'` back to pass it to Katex When rendering IPython notebook markdown cells the formulas are passed to Katex. Before that the raw string is passed to marked.js to handle HTML forbidden characters. One of these characters is the `'`. This character is often used in math formulas and the replacement `'` is not well received by Katex. Fixes: https://gitlab.com/gitlab-org/gitlab/-/issues/216744
Showing
Please register or sign in to comment