[GH-ISSUE #166] What's the LaTeX writing rule in MD files? #1990

Closed
opened 2026-03-07 20:03:27 +03:00 by kerem · 7 comments
Owner

Originally created by @Tiger3018 on GitHub (Feb 13, 2019).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/166

I write markdown file with LaTeX like this style:

## Hello World.

$$
\gcd(a, b) = \gcd(b, a \% b)
$$$$
\gcd(a, b) = \gcd(b, a \% b)
$$

And MDlint just scans no synatx warning with this file. When I add one or more lines after $$, the extension works again. So it's a bug or a real problem to write LaTeX with more than one line and using $$$$?

Originally created by @Tiger3018 on GitHub (Feb 13, 2019). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/166 I write markdown file with LaTeX like this style: ```md ## Hello World. $$ \gcd(a, b) = \gcd(b, a \% b) $$$$ \gcd(a, b) = \gcd(b, a \% b) $$ ``` And MDlint just scans no synatx warning with this file. When I add one or more lines after `$$`, the extension works again. So it's a **bug** or a real problem to write LaTeX with **more than one line and using `$$$$`**?
kerem 2026-03-07 20:03:27 +03:00
Author
Owner

@DavidAnson commented on GitHub (Feb 13, 2019):

What syntax errors are you expecting?

Also, please note that this project doesn’t recognize math blocks by default – though the VS Code markdownlint extension does.

<!-- gh-comment-id:463030739 --> @DavidAnson commented on GitHub (Feb 13, 2019): What syntax errors are you expecting? Also, please note that this project doesn’t recognize math blocks by default – though the VS Code markdownlint extension does.
Author
Owner

@Tiger3018 commented on GitHub (Feb 13, 2019):

Yeah... I'm using VS Code but I go to this repository, maybe because of the errors showing?

Let it to be a md file and there is no first heading. (002, 041, 026 for '.' punctuation) But they can't show with latex blocks and show without them or with more lines.

<!-- gh-comment-id:463190889 --> @Tiger3018 commented on GitHub (Feb 13, 2019): Yeah... I'm using VS Code but I go to this repository, maybe because of the errors showing? Let it to be a md file and there is no first heading. (002, 041, 026 for '.' punctuation) But they can't show with latex blocks and show without them or with more lines.
Author
Owner

@DavidAnson commented on GitHub (Feb 13, 2019):

I’m afraid I still don’t understand. Going back to your original example file above, what errors are you expecting to be reported on what lines? Or else what errors are you seeing reported that you do not think are correct?

<!-- gh-comment-id:463314503 --> @DavidAnson commented on GitHub (Feb 13, 2019): I’m afraid I still don’t understand. Going back to your original example file above, what errors are you expecting to be reported on what lines? Or else what errors are you seeing reported that you do not think are correct?
Author
Owner

@DavidAnson commented on GitHub (Feb 13, 2019):

[Accidental close, please see question above.]

<!-- gh-comment-id:463314663 --> @DavidAnson commented on GitHub (Feb 13, 2019): [Accidental close, please see question above.]
Author
Owner

@Tiger3018 commented on GitHub (Feb 14, 2019):

It should be reported as

[1,1] MD002/first-heading-h1/first-header-h1: First heading should be a top level heading [Expected: h1; Actual: h2]
[1,1] MD041/first-line-h1: First line in file should be a top level heading
[1,1] MD026/no-trailing-punctuation: Trailing punctuation in heading [Punctuation: '.']

But with latex block below and no more empty lines at EOF, it can't be shown.

$$
Some math expressions
$$$$
Some math expressions
$$

Screenshot:

screenshot_20190214_101316

screenshot_20190214_101351

<!-- gh-comment-id:463458125 --> @Tiger3018 commented on GitHub (Feb 14, 2019): It should be reported as ``` [1,1] MD002/first-heading-h1/first-header-h1: First heading should be a top level heading [Expected: h1; Actual: h2] [1,1] MD041/first-line-h1: First line in file should be a top level heading [1,1] MD026/no-trailing-punctuation: Trailing punctuation in heading [Punctuation: '.'] ``` But with latex block below and no more empty lines at EOF, **it can't be shown.** ``` $$ Some math expressions $$$$ Some math expressions $$ ``` Screenshot: ![screenshot_20190214_101316](https://user-images.githubusercontent.com/31267153/52757900-4c24d300-3041-11e9-8168-eb01304f0e6f.png) ![screenshot_20190214_101351](https://user-images.githubusercontent.com/31267153/52757901-4cbd6980-3041-11e9-9474-dadfbf2b6ada.png)
Author
Owner

@DavidAnson commented on GitHub (Feb 14, 2019):

Got it, thanks! I’ll have a look.

<!-- gh-comment-id:463458799 --> @DavidAnson commented on GitHub (Feb 14, 2019): Got it, thanks! I’ll have a look.
Author
Owner

@DavidAnson commented on GitHub (Feb 14, 2019):

It looks to be a bug in markdownlint related to the way the math block parser outputs tokens. I can't reproduce it otherwise. Good catch, thank you!

<!-- gh-comment-id:463474253 --> @DavidAnson commented on GitHub (Feb 14, 2019): It looks to be a bug in `markdownlint` related to the way the math block parser outputs tokens. I can't reproduce it otherwise. Good catch, thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#1990
No description provided.