prettier
prettier copied to clipboard
Removed excessive spaces after line prefixes for unordered lists in Markdown
Description
This change fixes excessive spaces after line prefixes for unordered lists in Markdown. Closes #5019.
Checklist
- [x] I’ve added tests to confirm my change works.
- [x] (If changing the API or CLI) I’ve documented the changes I’ve made (in the
docs/
directory). - [x] (If the change is user-facing) I’ve added my changes to
changelog_unreleased/*/XXXX.md
file followingchangelog_unreleased/TEMPLATE.md
. - [x] I’ve read the contributing guidelines.
Hello @fisker, what can I do to push this PR forward?
Hi, this seems like a really important fix. What has to be done to push this forward?
Any progress on this? I would really like to see this feature!
@TomasLudvik @fisker what's the status on this PR? This is the one problem preventing Prettier adoption at our org.
@glenn-jocher It is waiting for review from @fisker or @sosukesuzuki as I am not a maintainer of this repo.
Hi @fisker, @sosukesuzuki Any news regarding this issue?
Hi @fisker, @sosukesuzuki, I really hate to pester, but this is causing some immense grief with having to manually remove the extra spaces after the markers, is there anything anyone can do to push this forward?
The deviation fights with basically every example and other linting tool out there as shown in a comment in #5019 which makes it a near impossible sell to match the other way round.
@fisker @sosukesuzuki please merge this PR as soon as you can without further delay.
@fisker @sosukesuzuki another bump for getting this PR merged 🙏
I'm not familiar with the markdown spec, but will this break CommonMark?
@kachkaev mentioning you since you are involved in #3990
I'm not sure about this change TBH. If I understand it correctly, it essentially ignores tabWidth: 4
and renders lists as tabWidth: 2
. Shouldn’t folks do this instead?
{
"tabWidth": 4, // prerequisite
"overrides": [
{
"files": "*.md",
"options": {
"tabWidth": 2
}
}
]
}
That said, I’m not certain enough to say that this PR is wrong. I’m just confused about it’s best to ignore tabWidth
value rather than configure it to work as expected.
@fisker @kachkaev guys the https://github.com/prettier/prettier/issues/5019 bug that this PR fixes has 130 upvotes in https://github.com/prettier/prettier/issues/5019#issue-354096115, many many users are facing problems that this PR fixes.
The basic problem is that prettier --tab-width=4
is strangely creating spaces after dashes in lists, which no one is expecting and leaves all of us unable to use prettier for formatting markdown in our projects. This PR resolves this problem correctly per my testing and operates correctly in about 300 markdown pages for Ultralytics docs.
@fisker @sosukesuzuki @kachkaev friendly bump to please merge this. Our 80k-star organization is pending this PR to apply prettier to all our 300 MkDocs pages, it would really help us a lot. Currently we are considering installing prettier directly from @TomasLudvik fork instead, but this is much slower, i.e. npm install --global TomasLudvik/prettier
I'm not familiar with the markdown spec, but will this break CommonMark?
@fisker Actually, this PR makes prettier closer to what Commonmark shows in its tutorials: see https://github.com/prettier/prettier/issues/5019#issuecomment-1751818175 . @kachkaev , this PR in facts works together with tabwidth instead of a replacement. The indent is handled by tabwidth, but the spaces behind the marker should be handled independent of this as that is not an indentation (see comment above by @glenn-jocher ).
@fisker friendly nudge here to please merge this PR when you can, thank you!
@sosukesuzuki Looks like it’s awaiting your approval as well. Any updates / thoughts?
Really looking forward to this update! I have been banging my head against the wall why my markdown lists were being formatted so wonky and this appears to be the reason. Thanks in advance!
Is there any update on this PR? It would come in really handy if it could be merged :)