Gleb Minaev
06/11/2022, 7:13 PM@usesMathJax
in the begining and in the end of it. In both cases documentation on the page of documented symbol renders great, but not in short description of the symbol: either all documentation or formulas are not rendered respectively. (See images in the thread for details.) Is it feature, bug, or me doing something wrong?Gleb Minaev
06/11/2022, 7:14 PMGrégory Lureau
06/12/2022, 5:46 AMGleb Minaev
06/12/2022, 12:40 PM<script>
tag that downloads MathJax.js).Ignat Beresnev
06/13/2022, 3:16 PM@author
, @return
, @otherstring
. Doctags usually have some text associated with it - the text that follows the tag.
So if you put @usesMathJax
doctag in the beginning of the docstring, the whole docstring will be considered to be its content (until it sees another doctag at least).
If you put usesMathJax
at the very end with no text following it, no content will be associated with it.
_
For briefs (short description) the first paragraph is usually taken. In your case, your whole docstring is the first paragraph, that's why you can see it in the brief description by default (without @usesMathJax
). Try breaking it a little in order to make brief description really brief.
If @usesMathJax
tag with some content is found in brief description, it's not rendered, it's probably too long and has too many details for briefs. But that only concerns text that is put after the tag.
_
Mathjax plugin adds mathjax.js
script to the page if it sees that any of the page's direct children use the @usesMathJax
tag.
As long as the script is present on the page, all formulas will be rendered, regardless of where you put the doctag.
For brief descriptions, this tag is not in the direct children, but it's a child of another child, so the script is not added by default, that's why some formulas don't render.
_
If you put it all together, you can explain the behaviour you're seeing 🙂Ignat Beresnev
06/13/2022, 3:18 PMGleb Minaev
06/13/2022, 3:36 PMVadim Mishenev
06/13/2022, 9:12 PM@usesMathJax
is a custom block tag, but it is just a marker to add mathjax.js
script to the page. It does not matter where the tag is present on the page and what is a tag body.
Thus
1. Using @usesMathJax
at the end of KDoc is preferred.
2. Workaround: To display formulas in brief descriptions, @usesMathJax
should be applied in the parent declaration that contains documented declaration with the brief description.
In your case usesMathJax
should be used in the KDoc of the property coefficients
and the class that has the property.
I hope we will make more convenient using of the mathjax
plugin in the future to avoid the non obvious configuration .
/**
* Some text
* @usesMathJax
*/
class Math() {
/**
* Some text: \(a^2 = b^2 + c^2\)
*
* Some text
* @usesMathJax
*/
val coefficients: List<Double> = emptyList()
}