prettier / prettier

Prettier is an opinionated code formatter.

Home Page:https://prettier.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extra spacing added to single top level unordered list

SteveALee opened this issue · comments

I can't use the play ground as it does not support MD. At least I can find no way to sepcify the language.

In visuall studio code I am finding that prettier adds spaces aftet the - character starting a single top level list.
Even though PR #4893 indicates this should have been fixed. I coldn't easily see if that PR had been reelased bu dates would inidcate it should ahve.

# Top level

- aaa
- bbb

is converted to the following on save

# Top level

-   aaa
-   bbb

which is horrible and prettier lint extension moans with it's default rules - which I'm happy with

.prettierrc.json

{
	"trailingComma": "all",
	"semi": false,
	"singleQuote": true,
	"useTabs": true,
	"tabWidth": 4,
	"endOfLine": "lf"
}

.editorcong (haveduplication as the Svelte extension for code ignores .editorconfig :(

# editorconfig.org
root = true

[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
  • "prettier": "1.18.2",
  • "prettier-plugin-svelte": "0.7.0",
  • Prettier -extension for code esbenp.prettier-vscode 2.2.2

I guess the issue is I do not think the indent level should apply here. Indeed there is no indent separate from tab as far as I can see

Hi!

This is how Prettier formats your input code:

Prettier 1.18.2
Playground link

--parser markdown

Input:

# Top level

- aaa
- bbb

Output:

# Top level

- aaa
- bbb

In other words – the output is identical to the input.

aha so that's how I select language! Obvious now

So try this playground link which has the indent settings I am using

I guess it's a mute point if the items should follow tab stops for intital indent or not treat thuis as an indent so i'll close this issue..

My workaround was to use an override for md in my prettier config with tab spacing of 2. Hopefull I'll never actuall need tabs in the markdown or I'll be stuck.

Thanks