rust-ndarray / ndarray

ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations
https://docs.rs/ndarray/
Apache License 2.0
3.62k stars 307 forks source link

KaTeX for documentation #598

Open LukeMathWalker opened 5 years ago

LukeMathWalker commented 5 years ago

A new crate, hmmm, has just been released. It's a super cool project, dealing with Hidden Markov Model Models, but the relevant piece for ndarray is its documentation: @paulkernfeld managed to get KaTeX to work on doc.rs :heart:

Is this something we might be interested in doing? I'd personally love to have better rendered math than ASCII art :sweat_smile:

LukeMathWalker commented 5 years ago

The relevant HTML/JS snippet is here and this is how cargo gets told what to do with it (if I got it correctly).

jturner314 commented 5 years ago

The KaTeX docs are pretty. :) I found some docs on including KaTeX in Rust docs. There are a few disadvantages, though:

I wouldn't mind these issues as long as we can use the existing text-based math as a fallback. Maybe we could keep the text-based math, add KaTeX, and add some JavaScript that hides the the text-based version when KaTeX is working?

LukeMathWalker commented 5 years ago

We could use a JavaScript snippet to have a fallback option, but how do we make sure the snippet itself is included when running cargo doc if we can't set the --html-in-header attribute using Cargo.toml? :thinking:

jturner314 commented 5 years ago

What I mean is that the existing text-based math would be included in the document and would be visible without any JavaScript snippets (like it is now). The purpose of the JavaScript snippet would be to hide the text-based math when KaTeX is able to render the pretty math (so that the math isn't shown in both text-based and pretty forms). So, the snippet would only need to be included with --html-in-header when KaTeX is included with --html-in-header.