-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Equation identifier using pandoc-eqnos breaks syntax highlighting #346
Comments
The math syntax highlight is actually contributed by the community. This is a bit hard for me. On the other hand, it is not a normal Markdown syntax (and even not valid in LaTeX). |
Ok, I understand this is not normal Markdown Syntax, but it is actually a wide employed pattern in Pandoc to reference parts of a document (see pandoc-crossref, pandoc-fignos or pandoc-tablenos). I've actually used the same notation to reference images and tables and markdown syntax highlighting still works just fine. Could you give directions to which file should be modified to support this? Maybe I could take a look at it and see if I can help. |
Thanks. Here is the "entrance" I suspect you only need to remove the ending And some references for TextMate Grammars Finally, make sure no other syntax is broken Test code<!-- inline math -->
Let's say $x + y = z$, ...
$\alpha$$\$$$\\$$\ $
\\$\\$\$$\alpha$
$\gdef\bar#1{#1^2} \bar{y} + \bar{y}$
$$\$$$
$$
<!-- display math -->
$$ \tag{1} x + y = z $$
$$
\begin{array}{cc}
a & b \\
c & d
\end{array}
$$
$$
\alpha%comment
$$
$$
\gdef\bar#1{#1^2} \bar{y} + \bar{y}
$$
<!-- functions -->
$$ \alpha, \hat{x}, \frac{x}{y} $$
<!-- character -->
$$ x \, y \; z $$
<!-- non-valid math environment -->
$20,000
$ x + y = z $
$\ $ |
I just made a quick test by making your suggested fix and it did, indeed, solved my problem. Thanks! I will do some tests later with the test code you provided. |
Here's the how the test code is highlighted without removing the And here's the same code by changing the line to the following:
You can see that line 16 shows a different output. The image below shows that the math block in lines 13-16 is not correctly rendered by the markdown preview pane (although it seems to recognize everything until the ending Pandoc, however, does render it correctly: In my opinion, the syntax highlight showed in Image 2 should be the correct one, because the
|
Sorry, I find I cannot remember why there is the line 16. Feel free to remove that line when testing. And the math rendering of Markdown is provided by markdown-it-katex, which assumes the block math delimiter Could you please open a PR when you feel it is good enough? Thanks. |
The line 13 should be removed. The line 16 is just an ordinary test. The ending '$' just try to make the highlight behave the same as the rendering. 😂 |
This is an old issue, but has this been resolved yet? It still seems to be an issue. |
Hi, I'd like this issue to be solved, and I'd be happy to help. Is the test code you gave still up-to-date ? I can try and solve it and open a PR. |
I think so. (Just remove lines 13 and 16.) |
Okay then. So here is the updated test code, for the records: Test code
<!-- inline math -->
Let's say $x + y = z$, ...
$\alpha$$\$$$\\$$\ $
\\$\\$\$$\alpha$
$\gdef\bar#1{#1^2} \bar{y} + \bar{y}$
$$\$$$
<!-- display math -->
$$
\begin{array}{cc}
a & b \\
c & d
\end{array}
$$
$$
\alpha%comment
$$
$$
\gdef\bar#1{#1^2} \bar{y} + \bar{y}
$$
<!-- functions -->
$$ \alpha, \hat{x}, \frac{x}{y} $$
<!-- character -->
$$ x \, y \; z $$
<!-- non-valid math environment -->
$20,000
$ x + y = z $
$\ $ Just note line 11 ( And, this was the point, adding text after the final Tell me if there are other things you want me to test. |
Thanks. I've deleted the |
Great, thanks ! |
What is the problem?
Syntax highlighting stops working when using equation identifiers for Pandoc with pandoc-eqnos (https://github.com/tomduck/pandoc-eqnos) package. Example:
What I get:
Expected result:
How can I reproduce it?
Just write anything on the same line of a
$$
ending a math block.Is there any error message in the console?
No.
The text was updated successfully, but these errors were encountered: