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
Nicer rendering of LaTeX formulas in docstrings on the REPL #41915
Comments
Those seem like good ideas. Another, perhaps more comprehensive approach: https://github.com/Kolaru/MathTeXEngine.jl looks like it's mostly targeting Makie, but I bet it could also be leveraged to do what you want (if it doesn't already). Maybe consider collaborating with them? If you need a couple of hooks in Base.Docs to get it integrated into the REPL help display, we could add that separately. |
So how would that work? Surely this shouldn't be a stdlib. So is implied the idea that my package would depend on I guess that breaks it down into (at least) the following tasks:
|
You've already thought about it more than me 😄 . But yes, that was generally the kind of thing I was imagining. Perhaps your package wouldn't have to depend on MathTeXEngine, it might be more of an "environment" thing (if the user has loaded MathTeXEngine then you get pretty-printed LaTeX at the REPL, otherwise you get raw LaTeX). I'll be curious to see what you come up with! |
A user implemented something in this direction, see https://discourse.julialang.org/t/97498 (there is also a thread on Slack). They posted their code on Slack, but not yet in a public Git repo. It currently uses Autom.jl, so if this should be integrated into Julia core that dependency would have to be replaced. But perhaps this could also be an external package? Then we'd have to add some hooks: Right now it works by overriding |
Right now, if a docstring contains LaTeX math, it renders nicely in HTML, but in the REPL help system, the raw TeX source is shown.
Couldn't the translation describe in
latex_symbols
fromstdlib/REPL/src/latex_symbols.jl
be applied to Markdown docstrings, too?This would require accessing that code from
stdlib/Markdown
, which then would have to accessREPL
, or else that translation code would have to be factored out into a separate place. I believe one would want to perform some more transformations, too (e.g. map\mathbb{Z}
to\bbZ
).It might also not look great in all cases, so perhaps an option for docstring authors to somehow opt-out of this translation for certain docstrings might be necessary?
The text was updated successfully, but these errors were encountered: