Skip to content

fix(markdown): list prefix alignment: count spaces from correct place#4041

Merged
ikatyang merged 3 commits intoprettier:masterfrom
ikatyang:fix/markdown-list-prefix-max-spaces
Feb 26, 2018
Merged

fix(markdown): list prefix alignment: count spaces from correct place#4041
ikatyang merged 3 commits intoprettier:masterfrom
ikatyang:fix/markdown-list-prefix-max-spaces

Conversation

@ikatyang
Copy link
Copy Markdown
Member

4+ spaces will cause indented codeblock but I mis-count its range in #3990, it was over-strict.

before

1.···123 <---- (count: 3) paragraph 
  ^^^
1.····123 <--- (count: 4) paragraph
  ^^^^
1.·····123 <-- (count: 5) indented codeblock
  ^^^^^

after

1.····123 <---- (count: 3) paragraph
   ^^^
1.·····123 <--- (count: 4) indented codeblock
   ^^^^
1.······123 <-- (count: 5) indented codeblock
   ^^^^^

prefix +
" ".repeat(
prefixTrailingSpaces + additionalSpaces >= 4 ? 0 : additionalSpaces // 4+ will cause indented code block
additionalSpaces >= 4 ? 0 : additionalSpaces // 4+ will cause indented codeblock
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code block feels more correct here to me.

@ikatyang ikatyang merged commit b6c2789 into prettier:master Feb 26, 2018
@ikatyang ikatyang deleted the fix/markdown-list-prefix-max-spaces branch February 26, 2018 00:53
@lock lock Bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 18, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants