Markdown: respect useTabs for indented code blocks and footnote bodies#19352
Open
WhoamiI00 wants to merge 2 commits into
Open
Markdown: respect useTabs for indented code blocks and footnote bodies#19352WhoamiI00 wants to merge 2 commits into
WhoamiI00 wants to merge 2 commits into
Conversation
added 2 commits
June 13, 2026 22:56
In Markdown, an indented code block must be indented by 4 columns, and CommonMark explicitly treats a tab as advancing to the next 4-column stop. When `useTabs` is enabled, emitting four spaces ignores the user's indentation preference even though a single tab is a spec-equivalent substitute. Apply the same reasoning to the 4-column alignment used for subsequent blocks inside a footnote definition. Fixes prettier#8782 for the cases where the spec allows a tab without altering the document structure. List-item alignment is left unchanged because its prefix width is not a multiple of 4.
✅ Deploy Preview for prettier ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes a subset of #8782 — when
useTabsis enabled, Prettier was still emitting four literal spaces for indented code blocks and for the 4-column alignment used inside footnote definitions.CommonMark explicitly treats a tab as advancing to the next 4-column stop (spec §2.2), so a single
\tis structurally equivalent to four spaces for both of these cases — the document still parses as an indented code block / footnote continuation, andtabWidthdoesn't change that (the 4-column rule is fixed by the spec, not by Prettier's setting).List-item alignment is intentionally not changed in this PR: list prefixes (
-,1., …) are not multiples of 4 columns, so substituting a tab there would actually break the structure. That part of #8782 needs a separate, more involved fix.Before / after
Checklist
docs/directory).changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.