-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add LaTeX support for documentation generation #1070
base: main
Are you sure you want to change the base?
Conversation
crates/aiken-project/src/docs.rs
Outdated
fn inject_math_library(html: String) -> String { | ||
let mathjax_script = r#" | ||
<script type="text/javascript" id="MathJax-script" async | ||
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"> | ||
</script> | ||
<script> | ||
MathJax.typeset(); | ||
</script> | ||
"#; | ||
|
||
html.replace("</head>", &format!("{}\n</head>", mathjax_script)) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, we probably don't need to inject this from the rust side, but can directly add it to the doc template: https://github.com/aiken-lang/aiken/blob/main/crates/aiken-project/templates/_layout.html#L3-L12
Ho, nice! I was looking into it actually the other day after seeing your message in #1062, mostly to see if the underlying markdown generation tool we use would support it out of the box. And, turns out they do actually have something! --> pulldown-cmark/pulldown-cmark#734 Though the feature is pretty minimalist, in the sense that it justs isolate the formula in between So it sounds like perhaps a good mix to include with the PR (enable the math feature, and use their detection as boundary for the MathJax lib ?) |
Also, someone (@mpizenberg) has been bringing Katex (instead of MathJax) --> https://katex.org/ as a better Math renderer? |
I have switched to Katex and used cmark-pulldown delimiters in a new commit. |
This PR addresses the request for LaTeX support mentioned in #1062. It introduces the following enhancements:
Example Usage
This documentation from aiken:
will show:
I'm open to any suggestions about the delimiters or the approach for rendering the formulas. 🚀