Prettier not respecting `prettier-ignore-start` and `prettier-ignore-end`
See original GitHub issuePrettier 1.15.2 Playground link
--parser markdown
--prose-wrap never
Input:
- **Sequence of initialization**:
<!-- prettier-ignore-start -->
#. Firmware
#. Bootloader (GNU Grub)
#. Operating System Kernel
#. Service Manager (e.g. `systemd`)
<!-- prettier-ignore-end -->
Output:
- **Sequence of initialization**:
<!-- prettier-ignore-start -->
#. Firmware #. Bootloader (GNU Grub) #. Operating System Kernel #. Service Manager (e.g. `systemd`)
<!-- prettier-ignore-end -->
Expected behavior: See Input
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:15 (10 by maintainers)
Top Results From Across the Web
Ignoring Code - Prettier
Use .prettierignore to ignore (i.e. not reformat) certain files and folders completely. Use “prettier-ignore” comments to ignore parts of files.
Read more >How to prevent Prettier from breaking test code from 1 line to ...
as the desired following 1-liner: const render = shallow(result).find('UserNotice').find('p');. But prettier keeps reverting it. I tried ...
Read more >How to configure Prettier and VSCode - Gleb Bahmutov
Not every project uses the same code style, thus it is important to respect the style of whatever project you are currently working...
Read more >prettier-plugin-go-template - npm
prettier -plugin-go-template. TypeScript icon, indicating that this package has built-in type declarations · Readme · Explore BETA · 1 Dependency · 7 ...
Read more >@prettier/plugin-xml | Yarn - Package Manager
@prettier/plugin-xml is a prettier plugin for XML. prettier is an opinionated code formatter that supports multiple languages and integrates with most ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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. If you try this out in a prettier playground the range ignore is being ignored 🙈
As mentioned above inserting
<-- prettier-ignore -->
multiple times is not a very nice implementation. A common example would be partials in a HTML file where I would need to do the following…Would be much cleaner to be able to do the this…
Is this being worked on by anyone?
Yes, if we could do
prettier ignore for a range
at any place in the document, it will be great. I think many people would like that, as I think many people might use other standard (like pandoc) for certain things rarely, but mostly they follow commonmark.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.