[GH-ISSUE #331] Rule for unclosed unclosed code blocks using non-indented style #284

Open
opened 2026-03-03 01:25:24 +03:00 by kerem · 1 comment
Owner

Originally created by @nschonni on GitHub (Sep 20, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/331

When code fences are using backticks or other explicit styles, I think Markdownlint should add a warning when the block isn't closed.
I believe this would fit in the existing MD046/MD048, maybe by counting the opening vs closing blocks, but I can see this might not be straightforward to implement

Saw this was being picked up by the MicrosoftDocs build tooling and thought it would be good here too.

Here are some PRs where this is being fixed in an existing document https://github.com/dotnet/docs/pull/20716

Originally created by @nschonni on GitHub (Sep 20, 2020). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/331 When code fences are using backticks or other explicit styles, I think Markdownlint should add a warning when the block isn't closed. I believe this would fit in the existing MD046/MD048, maybe by counting the opening vs closing blocks, but I can see this might not be straightforward to implement Saw this was being picked up by the MicrosoftDocs build tooling and thought it would be good here too. Here are some PRs where this is being fixed in an existing document https://github.com/dotnet/docs/pull/20716
Author
Owner

@nschonni commented on GitHub (Oct 1, 2022):

Came to post a new issue around single backtick sections, but I think it might fall under this too.

In the spec it flags that some don't continue
https://spec.commonmark.org/0.30/#blocks-and-inlines

EX:

- `one
- two`

Here is another one on their code playground https://spec.commonmark.org/dingus/?text=Somethign%20%60foo%0Aleads%20to%20bar%60%0A%0ASomethign%20%60foo%0A%0Aleads%20to%20bar%60

A backtick continuing to the next line is ok, but not if there is a hard break before the next

Also some examples of the unbalanced cases https://spec.commonmark.org/0.30/#example-347

<!-- gh-comment-id:1264442053 --> @nschonni commented on GitHub (Oct 1, 2022): Came to post a new issue around single backtick sections, but I think it might fall under this too. In the spec it flags that some don't continue https://spec.commonmark.org/0.30/#blocks-and-inlines EX: ```md - `one - two` ``` Here is another one on their code playground https://spec.commonmark.org/dingus/?text=Somethign%20%60foo%0Aleads%20to%20bar%60%0A%0ASomethign%20%60foo%0A%0Aleads%20to%20bar%60 A backtick continuing to the next line is ok, but not if there is a hard break before the next Also some examples of the unbalanced cases https://spec.commonmark.org/0.30/#example-347
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#284
No description provided.