-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Prettier not respecting prettier-ignore-start
and prettier-ignore-end
#5557
Comments
I can look into this |
This is occurring because the only time we check for prettier-ignore start and end is on the children of the root node (which in this case would be [List]) and not in any of the deeper nodes. I'll start figuring out how to fix it |
Seems like your evaluation is correct. If you’d like to add support for the comments in more places, feel free! |
I'll take a crack at it |
I'm not sure we want to support it in more places. Ignore comment is intended to be a escape hatch, not a feature we want to extend |
@anishmittal2020 It's already possible to ignore them, is this what you want? Prettier 1.15.3 --parser markdown
--prose-wrap never Input: - **Sequence of initialization**:
<!-- prettier-ignore -->
#. Firmware
#. Bootloader (GNU Grub)
#. Operating System Kernel
#. Service Manager (e.g. `systemd`)
__formatting still works here__
Output: - **Sequence of initialization**:
<!-- prettier-ignore -->
#. Firmware
#. Bootloader (GNU Grub)
#. Operating System Kernel
#. Service Manager (e.g. `systemd`)
**formatting still works here**
|
Summary:
Prettier 1.15.3 --parser markdown
--prose-wrap never Input: <!-- prettier-ignore -->
a) regular use
1. finish something worthy of a commit
2. commit
b) independent fixup
1. realize that something does not work
2. fix that
3. commit it Output: <!-- prettier-ignore -->
a) regular use 1. finish something worthy of a commit 2. commit b) independent fixup 1. realize that something does not work 2. fix that 3. commit it
Expected behavior: See Input NOTE: The following Prettier 1.15.3 --parser markdown
--prose-wrap never Input: - Workflow
<!-- prettier-ignore -->
a) regular use
<!-- prettier-ignore -->
1. finish something worthy of a commit
2. commit
<!-- prettier-ignore -->
b) independent fixup
<!-- prettier-ignore -->
1. realize that something does not work
2. fix that
3. commit it Output: - Workflow
<!-- prettier-ignore -->
a) regular use
<!-- prettier-ignore -->
1. finish something worthy of a commit
2. commit
<!-- prettier-ignore -->
b) independent fixup
<!-- prettier-ignore -->
1. realize that something does not work
1. fix that
1. commit it
Expected behavior: See Input |
It seems you'd like to use pandoc-specific syntax in some places but the rest of them are still valid CommonMark. I think it'd be better to find a remark plugin to support pandoc instead of using a lot of range ignore but I'm not sure if there's one. |
Yes, if we could do I understand from @duailibe comment that Prettier want's to enforce standard and weed out nonstandard things. IMHO: In the case of source code, people use prettier to standardize code that can be shared. But in the case of markdown usually, people share the generated HTML or PDF and not markdown. So, I think that this feature can be extended to markdown and limited only to Markdown and not to other language like Javascript etc. If people could use some non-standard markdown, it should be ok as they don't share the source or the markdown file itself. Also, sensible people won't misuse prettier-ignore as they would use it rarely because using this at all the places is as good as not using prettier at all. |
Life has gotten a little busy for me recently so I'm going to step off this issue and open it up for anyone else that wants to work on it |
I think @anishmittal2020 is onto a great suggestion here. Allowing an explicit range ignore anywhere in any prettier supported file would be very helpful. This kind of implementation is present in many other platform linters and formatters.
As mentioned above inserting
Would be much cleaner to be able to do the this...
Is this being worked on by anyone? |
It should actually work if you add a blank line before the end tag:
At least that's the behavior I get in this Prettier playground. |
See also the explanation in #7027 (comment) |
@jimmyhoran The request to support ranges in any language is here: #5287 |
Lifesaver. Thanks a bunch @pawamoy |
Prettier 1.15.2
Playground link
Input:
Output:
Expected behavior:
See Input
The text was updated successfully, but these errors were encountered: