tobiasah / mkdocs-caption

MkDocs plugin to add captions and easy element numbering
MIT License
3 stars 2 forks source link

Support equation cross-referencing #22

Open sinaatalay opened 6 days ago

sinaatalay commented 6 days ago

This plugin is great; I think it can help a lot with technical writing using MkDocs.

I was wondering if we could leverage the available functionality for equations. I haven't looked at the source code yet, but it feels like it could work.

This would mean essentially this: Support cross-referencing and counting only based on element IDs. IDs could have defined prefixes, and counting could be based on IDs (instead of markdown_identifier, id_identifier). IDs like #eq-blabla, #eq-this, etc. could be used.

I don't know how counters work in mkdocs-caption, but KaTeX allows automatic equation numbering with CSS counters. Also, element IDs can be assigned to equations with attr_list extension.

$$
\begin{equation}
a=5
\end{equation}
$${#eq-test}

It would be great if [](#eq-test) rendered as Equation 1.

Do you think this is achievable?