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
{{ message }}
Repository navigation
[feature request]: Support rendering LaTeX math expressions in documentation comments #4277
It would be useful if Dart documentation comments could render mathematical expressions written in LaTeX syntax.
Dart documentation comments already support Markdown, but currently there is no built-in way to render mathematical formulas in generated API documentation.
For example, it would be nice to write:
/// Computes the loss function:////// $$/// L(\theta) = \frac{1}{N}\sum_{i=1}^{N}/// (f_\theta(x_i) - y_i)^2/// $$////// The gradient is $\nabla_\theta L(\theta)$.doubleloss(...) {
...
}
and have dart doc render both the block and inline equations as formatted mathematics.
Reacted by Felipe Morschel, Sam Rawlins and Sigurd Meldgaard
This sentence uses $` and `$ delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
So if it were well-specified in GFM (which I do not think it is), we could add it easily. Otherwise it is sort of a product decision whether we depart from GFM, but align with what users will see on GitHub in their READMEs and other Markdown files.
Activity
srawlins commentedon Aug 12, 2026
GitHub supports a syntax that uses MathJax I believe. https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions
This sentence uses$` and `$ delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
So if it were well-specified in GFM (which I do not think it is), we could add it easily. Otherwise it is sort of a product decision whether we depart from GFM, but align with what users will see on GitHub in their READMEs and other Markdown files.
sigurdm commentedon Aug 13, 2026
I agree with aligning with github whatever they do