[GH-ISSUE #416] Update MD010/hard-tabs to allow configuring the number of spaces in a code block/fence #346

Closed
opened 2026-03-03 01:25:55 +03:00 by kerem · 6 comments
Owner

Originally created by @Stanzilla on GitHub (Aug 3, 2021).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/416

My .markdownlint.json config is as follows:

{
    "default": true,
    "MD004": false,
    "MD013": false,
    "MD024": false,
    "MD025": { "level": 1, "front_matter_title": ""},
    "MD029": { "style": "ordered" },
    "MD007": { "indent": 4 },
    "MD046": false,
    "no-alt-text": true,
    "no-inline-html": false,
    "no-space-in-code": false,
    "code-block-style": false,
    "no-blanks-blockquote": false
}

Yet when I use quick fix to replace a hard-tab, it replaces it with 2 spaces instead of 4.

https://user-images.githubusercontent.com/75278/128001971-55a907c6-66ee-42ee-94eb-518d570763f3.mp4

Originally created by @Stanzilla on GitHub (Aug 3, 2021). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/416 My `.markdownlint.json` config is as follows: ```json { "default": true, "MD004": false, "MD013": false, "MD024": false, "MD025": { "level": 1, "front_matter_title": ""}, "MD029": { "style": "ordered" }, "MD007": { "indent": 4 }, "MD046": false, "no-alt-text": true, "no-inline-html": false, "no-space-in-code": false, "code-block-style": false, "no-blanks-blockquote": false } ``` Yet when I use quick fix to replace a hard-tab, it replaces it with 2 spaces instead of 4. https://user-images.githubusercontent.com/75278/128001971-55a907c6-66ee-42ee-94eb-518d570763f3.mp4
kerem 2026-03-03 01:25:55 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Aug 3, 2021):

MD010 replaces each hard tab character with a single space because that's how it renders in normal text. Inside code blocks, the number of spaces is still 1 and this is not currently configurable. Is seems you would like to see that ability added to the library?

<!-- gh-comment-id:891905218 --> @DavidAnson commented on GitHub (Aug 3, 2021): MD010 replaces each hard tab character with a single space because that's how it renders in normal text. Inside code blocks, the number of spaces is still 1 and this is not currently configurable. Is seems you would like to see that ability added to the library?
Author
Owner

@Stanzilla commented on GitHub (Aug 3, 2021):

MD010 replaces each hard tab character with a single space because that's how it renders in normal text. Inside code blocks, the number of spaces is still 1 and this is not currently configurable. Is seems you would like to see that ability added to the library?

Oh I did not know that, yeah I assumed it would replace a hard-tab with my configured tab width equivalent in spaces.

<!-- gh-comment-id:891938228 --> @Stanzilla commented on GitHub (Aug 3, 2021): > MD010 replaces each hard tab character with a single space because that's how it renders in normal text. Inside code blocks, the number of spaces is still 1 and this is not currently configurable. Is seems you would like to see that ability added to the library? Oh I did not know that, yeah I assumed it would replace a hard-tab with my configured tab width equivalent in spaces.
Author
Owner

@DavidAnson commented on GitHub (May 1, 2022):

I think the spaces_per_tab parameter may already do what you want: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md010

<!-- gh-comment-id:1114098992 --> @DavidAnson commented on GitHub (May 1, 2022): I think the `spaces_per_tab` parameter may already do what you want: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md010
Author
Owner

@Stanzilla commented on GitHub (May 1, 2022):

Oh interesting, thank you!

<!-- gh-comment-id:1114238863 --> @Stanzilla commented on GitHub (May 1, 2022): Oh interesting, thank you!
Author
Owner

@nschonni commented on GitHub (Sep 9, 2022):

I was thinking of opening a new issue, but I think it's still related to this one.
Usually inside a code fence a more sensible default would be 2 or 4 (the GitHub rendering default of 8 is too much). Maybe that requires a separate option than the current spaces_per_tab like spaces_per_tab_in_code (awkward name) or allowing the current code_blocks to use an integer for those spaces instead of the current boolean

<!-- gh-comment-id:1241483381 --> @nschonni commented on GitHub (Sep 9, 2022): I was thinking of opening a new issue, but I think it's still related to this one. Usually inside a code fence a more sensible default would be 2 or 4 (the GitHub rendering default of 8 is too much). Maybe that requires a separate option than the current `spaces_per_tab` like `spaces_per_tab_in_code` (awkward name) or allowing the current `code_blocks` to use an integer for those spaces instead of the current boolean
Author
Owner

@DavidAnson commented on GitHub (Sep 9, 2022):

As this is closed, a new issue would be helpful!

<!-- gh-comment-id:1241493216 --> @DavidAnson commented on GitHub (Sep 9, 2022): As this is closed, a new issue would be helpful!
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#346
No description provided.