You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for this library, I have integrated it into Starboard Notebook (you can try it here). Before the NPM package was released I vendored all the code (read: copy pasted), but now that it's out I would love to get rid of my own version.
I was only able to remove about half of the code: in Starboard Notebook I load as much stuff asynchronously as possible to keep the initial load and render time fast, KaTeX included.
Basically the only change I made is this in NodeView:
katexLoader.then((katex)=>{if(!this._mathRenderElt)return;// render katex, but fail gracefullytry{katex.render(texString,this._mathRenderElt,this._katexOptions);this._mathRenderElt.classList.remove("parse-error");this.dom.setAttribute("title","");}catch(err){if(errinstanceofParseError){console.error(err);this._mathRenderElt.classList.add("parse-error");this.dom.setAttribute("title",err.toString());}else{throwerr;}}});
I don't know the best way to fit this into the library.
Perhaps instead of importing katex directly one could pass an object with this signature:
fyi I'm actively working on this (outside of my day job), trying to put some care into how options might be passed to/from NodeViews.
In addition to your async KaTeX use case, I want to support MathJax with the next release. Right now some of the KaTeX-specific design decisions are tangled up with the NodeView code. MathJax is a bit of a behemoth, so I'm trying to understand the various ways that MathJax (as well as KaTeX or other math renderers) might be included in an application.
Hi benrbray,
Thank you for this library, I have integrated it into Starboard Notebook (you can try it here). Before the NPM package was released I vendored all the code (read: copy pasted), but now that it's out I would love to get rid of my own version.
I was only able to remove about half of the code: in Starboard Notebook I load as much stuff asynchronously as possible to keep the initial load and render time fast, KaTeX included.
Basically the only change I made is this in NodeView:
I don't know the best way to fit this into the library.
Perhaps instead of importing katex directly one could pass an object with this signature:
I saw in another issue that you wanted to support Mathjax as well, this would be a step towards supporting that too.
The text was updated successfully, but these errors were encountered: