prettier icon indicating copy to clipboard operation
prettier copied to clipboard

Removed excessive spaces after line prefixes for unordered lists in Markdown

Open TomasLudvik opened this issue 1 year ago • 19 comments

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 following changelog_unreleased/TEMPLATE.md.
  • [x] I’ve read the contributing guidelines.

Try the playground for this PR

TomasLudvik avatar Oct 20 '23 13:10 TomasLudvik

Hello @fisker, what can I do to push this PR forward?

TomasLudvik avatar Oct 25 '23 08:10 TomasLudvik

Hi, this seems like a really important fix. What has to be done to push this forward?

grossmannmartin avatar Nov 08 '23 09:11 grossmannmartin

Any progress on this? I would really like to see this feature!

LucasOe avatar Jan 08 '24 21:01 LucasOe

@TomasLudvik @fisker what's the status on this PR? This is the one problem preventing Prettier adoption at our org.

glenn-jocher avatar Jan 28 '24 19:01 glenn-jocher

@glenn-jocher It is waiting for review from @fisker or @sosukesuzuki as I am not a maintainer of this repo.

TomasLudvik avatar Jan 31 '24 08:01 TomasLudvik

Hi @fisker, @sosukesuzuki Any news regarding this issue?

grossmannmartin avatar Feb 26 '24 10:02 grossmannmartin

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.

Lixquid avatar Apr 04 '24 21:04 Lixquid

@fisker @sosukesuzuki please merge this PR as soon as you can without further delay.

glenn-jocher avatar May 03 '24 17:05 glenn-jocher

@fisker @sosukesuzuki another bump for getting this PR merged 🙏

beefchimi avatar Jun 13 '24 13:06 beefchimi

I'm not familiar with the markdown spec, but will this break CommonMark?

fisker avatar Jun 13 '24 14:06 fisker

@kachkaev mentioning you since you are involved in #3990

fisker avatar Jun 13 '24 14:06 fisker

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.

kachkaev avatar Jun 14 '24 09:06 kachkaev

@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.

Screenshot 2024-06-16 at 15 24 30

glenn-jocher avatar Jun 16 '24 13:06 glenn-jocher

@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

glenn-jocher avatar Jun 20 '24 11:06 glenn-jocher

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 ).

MartenBE avatar Jun 23 '24 11:06 MartenBE

@fisker friendly nudge here to please merge this PR when you can, thank you!

glenn-jocher avatar Jul 04 '24 14:07 glenn-jocher

@sosukesuzuki Looks like it’s awaiting your approval as well. Any updates / thoughts?

aarongustafson avatar Jul 26 '24 19:07 aarongustafson

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!

GitMurf avatar Aug 02 '24 00:08 GitMurf

Is there any update on this PR? It would come in really handy if it could be merged :)

MartenBE avatar Aug 11 '24 18:08 MartenBE