Skip to content

fix(markdown): list prefix: no unnecessary trailing spaces#4042

Merged
ikatyang merged 2 commits intoprettier:masterfrom
ikatyang:fix/markdown-list-prefix-no-trailing-spaces
Feb 26, 2018
Merged

fix(markdown): list prefix: no unnecessary trailing spaces#4042
ikatyang merged 2 commits intoprettier:masterfrom
ikatyang:fix/markdown-list-prefix-no-trailing-spaces

Conversation

@ikatyang
Copy link
Copy Markdown
Member

No description provided.

const alignFunc = listItem.children.length
? alignListPrefix
: identity; // do not print trailing spaces for empty list item since it might be treated as `break` node by [doc-printer](https://github.com/prettier/prettier/blob/master/src/doc/doc-printer.js#L470-L480), we don't want to preserve unnecessary trailing spaces.
const prefix = alignFunc(
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.

Would it make sense to refactor this into:

let prefix = ...
if (listItem.children.length) {
  prefix = alignListPrefix(prefix)
}

?

@ikatyang ikatyang merged commit ca81bef into prettier:master Feb 26, 2018
@ikatyang ikatyang deleted the fix/markdown-list-prefix-no-trailing-spaces branch February 26, 2018 00:52
@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.

4 participants