executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
708 stars 189 forks source link

Equation label of math not work before `make clean` when math_numfig=True #886

Closed berlin2123 closed 4 months ago

berlin2123 commented 4 months ago

Here is the initial description of the phenomenon, but the bug is not really related to the Dollar math. Actual testing of directive math does the same issue. See comment 3.

I want to using math_numfig to show equation label like (m.n) instead of (n).

However, the dollar math shows a empty (), when:

math_numfig = True
numfig = True
numfig_secnum_depth = 2

but the directive {math} works fine.

here is the test.md

{math}`a^2 + b^2 = c^2`

```{math} e^{i\pi} + 1 = 0
:label: euler
```                                          #(just show this ``` inside github)
$$a^2 + b^2 = c^2$$(label: mymath3)

Error, when using numfig: empty ()

YX`SKBNGS2GQRY11Z8J5 7R

Fine, when disabled numfig: type as (n)

O%W0KEIC{6L1Q07F7SC%Y}V

However, that not what I wanted type (1.2).

welcome[bot] commented 4 months ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

berlin2123 commented 4 months ago

I've identified the real issue:

After add a new dollar math with a label, if only run make html or just only using sphinx-autobuild, it will be a empty () . However, after make clean; make html, all lable will be fine.

It may be a bug related to the build process.

berlin2123 commented 4 months ago

the same issue for directive math too. Regardless of whether the newly added formula is writen as directive or dollar, you have to run make clean before it works.

berlin2123 commented 4 months ago

So it could be a bug in sphix, not MyST ?

chrisjsewell commented 4 months ago

Yep it sounds like it. Perhaps you could try a math directive in a restructuredtext file

berlin2123 commented 4 months ago

the same issue for adding math in a rst file.

berlin2123 commented 4 months ago

fixed by https://github.com/sphinx-doc/sphinx/pull/11939