I'm playing with Roc code where a lot of the functions are based on mathematical formulas, so it'd be useful to be able to write LaTeX style maths in the docs. At the moment I'm using unicode symbols to write equations like
z = √x² + y²
but it's pretty limited and not a very good user experience.
In terms of technical limitations, CommonMark doesn't support maths notation and the pulldown_cmark crate which is used to generate the docs doesn't seem to have an extension to add it.
In terms of frontend, you don't need JS or custom CSS anymore because MathML is very well supported in modern browsers.
I've just checked the issues for pulldown_cmark and it seems like there's some movement in adding maths notation support, but it's a way off in the future.
Not sure if you've completed the idea thought above? But this gave me another idea (hope I don't derail this thread). We have talked about having different code blocks supported in markdown. At the moment docs just assumes all code is roc for the purpose of syntax highlighting. I was looking at potentially adding support for other languages, but haven't got that far. It will be easy enough for us to update to '''roc etc for syntax highlighting Roc code, and then we can have additional fenced block types, one fore the REPL '''repl which renders the code in an interactive window.
Wouldn't it be cool if we added an '''mathml fenced block, and then you can write a mathematical expression using types, maybe an AST or recursively somehow..., it can then be fed into a plugin generate MathML or whichever format we need to render.
Yeah, it's a pretty barebones idea in terms of details, I just dumped some thoughts and quick googling into Zulip to see if it's something other people would find useful. Feel free to expand the idea however you like :)
A plugin system sounds cool, I was thinking about suggesting the ability to add raw HTML into the docs which is what a lot of markdown implementations do, but a custom Roc function to transform code blocks sounds more interesting and useful
mathml is a good first step, but it is very verbose, it would be good to eventually support inline latex and asciimath as well.
Hannes said:
I was thinking about suggesting the ability to add raw HTML into the docs which is what a lot of markdown implementations do
yeah I actively want to avoid this because:
script tags and such)roc edit will need to ship with an entire browser in order to render Roc docs, and I never want it to have to do that :big_smile:Last updated: Jun 16 2026 at 16:19 UTC