-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Semantic line feed in bullets leading to panic with prettier
#4
Comments
Hi @jamesbraza, thanks for trying out I think a 3-space indent on a numbered list is either an intentional choice or a bug in prettier. I found one related issue that requested the behavior that Is the 3-space indent a standard and/or documented somewhere? Semi-relatedly, I have run into issues with prettier not properly supporting 4-space indents like prettier/prettier#5019, which is why I've used prettier and mdformat separately: https://github.com/KyleKing/calcipy_template/blob/8a67593aae13d2ea88d3981bd9c53479f1b65c16/.pre-commit-config.yaml#L51-L72 And TIL about https://github.com/sembr/specification |
The 3-space indent on a semantic line feed gets enforced by 1. Semantic line feed where the following line is
three spaces deep You'll see that second line gets corrected to 3 spaces. Check this comment for why. I think |
Oh okay, let me take a look at making that change |
So this change would break the rendering of one of my test cases Based on an issue reported to ### With proposed change
1. Here indent width is
three.
1. Here indent width is
three.
1. Here indent width is
five (three). It needs to be so, because
Otherwise this next paragraph doesn't belong in the same list item.
---
### With current behavior
1. Here indent width is
three (four).
1. Here indent width is
three (four).
1. Here indent width is
five (four). It needs to be so, because
Otherwise this next paragraph doesn't belong in the same list item. You can see that bullet 2 isn't rendered properly if we were to change the behavior: |
Fwiw, I am not able to repro that screenshot's rendering in PyCharm: Or in this, this, or this markdown renderer. What renderer are you using? Fwiw, semantic linefeeds with bulleted lists is pretty fundamental to Markdown. |
Looking at the linked issue, I don't know there was ever actually a conclusion, hukkin in his main response disagreed that it was actually a problem. I agree with his comment here:
Technically, What do you think? |
If you don't agree, perhaps |
I can reproduce the issue with vanilla Just to understand, are you using this plugin with mkdocs or are you looking for 4-space support in general? |
I hacked together a quick working version here: 815e977 and tested both wiht or without the configuration option here: 7fb0476
Edit: looks like it should be possible to add CLI options, but not possible to extend the configuration file: hukkin/mdformat#378 (and there is |
Published! https://pypi.org/project/mdformat_mkdocs/1.0.2rc2. Try with Let me know what you think and if it is behaving properly on your projects |
Oh wow that My use case is actually not using MkDocs, it's just vanilla Markdown. Long story short, we have After > mdformat --help
...
--align-semantic-breaks-in-numbered-lists
If specified, align semantic indents in numbered lists to the text And running, Thank you! I will use this in - repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
additional_dependencies:
- ... # Other plugins
- mdformat-mkdocs>=1.0.2rc2
args: [--align-semantic-breaks-in-numbered-lists] |
That is great to hear! I'll go ahead and make the official Let me know if you run into any additional issues |
I think that commit has |
The commit and my comment were incorrect, use |
I am using
mdformat==0.7.16
,mdformat-mkdocs==1.0.1
, andprettier==3.0.0-alpha.9-for-vscode
withtabWidth = 4
to match PEP 8.Here is the input, and this is fine for
mdformat
andprettier
:However, after adding
mdformat-mkdocs
, there is a panic about the "three spaces deep" part.mdformat-mkdocs
wants to add an extra space before "three" so it's 4-spaces deep:I think this is a bug with
mdformat-mkdocs
, imo it shouldn't touch the semantic line feed's spacing.The text was updated successfully, but these errors were encountered: