https://kotlinlang.org logo
#dokka
Title
# dokka
x

Xuan

03/11/2024, 7:56 AM
Hello, is there a plan to support latex in KDoc Markdown, including render latex KDoc inside IntelliJ IDEA?
o

Oleg Yukhnevich

03/13/2024, 4:43 PM
Hey! There is no such plans at the moment Support for
latex
rendering inside Dokka is theoretically possible via Dokka Plugin, but it will only affect generated HTML, not the IDEA Just in case, what is your use case?
x

Xuan

03/13/2024, 6:29 PM
Hi, thanks for your reply! My project for teaching usually needs to document math related stuffs. I would like to document directly quick explanation and proof inside the code, but without latex it's so ugly. It makes sense to have a separate doc if it's long and complex. However, quick doc is useful, so that we open a big external reference for details only when needed.
o

Oleg Yukhnevich

03/15/2024, 7:29 PM
On additional note, AFAIK there is no native support for latex in IDEA Also, as latex is not only about math, so I would't expect this kind of out of the box support soon (or ever) mathjax is a better candidate here I believe - there is some kind of support for it in Dokka (via plugin) and there is an issue to track for IDEA: https://youtrack.jetbrains.com/issue/IDEA-213075/Add-math-support-to-the-markdown-plugin Apart from that, I can't help more 😞
👍 1
s

solonovamax

03/19/2024, 4:38 AM
yeah, there is already the mathjax dokka plugin which I use extensively for one of my own libraries. It produces really nice documentation when you're using the website, however it makes the in-ide experience sub-par, imo a couple of examples: • DamerauLevenshtein.ktCosine.ktJaccard.kt
The similarity is computed as
\(\frac{w_d \lvert X \rvert + w_i \lvert Y \rvert - distance(X, Y)}{2}\).
The Cosine similarity between strings \(X\) and \(Y\) is
the Cosine of the angle between the two strings as vectors. It is computed as:
\(\frac{\vec{v_1} \cdot \vec{v_2}}{\lVert\vec{v_1}\rVert \times \lVert\vec{v_2}\rVert}\).
Where, \(\vec{v_1}\) and \(\vec{v_2}\) are the vector representation of string
\(X\) and \(Y\), respectively.
Each input string is converted into a set of n-grams, the Jaccard index is
then computed as \(\frac{\lVert V_1 \cap V_2 \rVert}{\lVert V_1 \cup V_2 \rVert}\).
Like Q-Gram distance, the input strings \(X\) and \(Y\) are first converted into sets of
n-grams \(V_1\) and \(V_2\) (sequences of n characters, also called k-shingles), but this time
the cardinality of each n-gram is not taken into account.
having to read things like
\frac{\lVert V_1 \cap V_2 \rVert}{\lVert V_1 \cup V_2 \rVert}
for those who don't understand latex is not the best, and even for those who do understand it, and are experienced with it, it can be a tad confusing.
👍 2
x

Xuan

03/19/2024, 6:51 PM
it makes the in-ide experience sub-par
That's why I said from the beginning, it's ugly. It only make sense to use latex when it's supported also in IDE.
s

solonovamax

03/19/2024, 6:52 PM
yeah, I just wanted to highlight a specific example of where it would make it difficult to read the documentation, but then the online documentation looks really nice
👍 1