<!-- prettier-ignore --> doesn't work
See original GitHub issueI am using this plugin with hugo and my content pages are written in html NOT markdown
Problem is prettier is formatting my code when I don’t want it to. So I tried following to ignore code
Option1: doesn’t work
<!-- prettier-ignore -->
{{< highlight ts "linenos=table" >}}
import styles from './App.module.css';
function App() {
return (
<div className={styles.App}>
<header className={styles.AppHeader}>
{{< / highlight >}}
Option 2: doesn’t work
<!-- prettier-ignore-start -->
{{< highlight ts "linenos=table" >}}
import styles from './App.module.css';
function App() {
return (
<div className={styles.App}>
<header className={styles.AppHeader}>
{{< / highlight >}}
<!-- prettier-ignore-end -->
Option 3: doesn’t work
<!-- prettier-ignore -->
```ts
import styles from './App.module.css';
function App() {
return (
<div className={styles.App}>
<header className={styles.AppHeader}>
\```
Option 4: doesn’t work
<!-- prettier-ignore-start -->
```ts
import styles from './App.module.css';
function App() {
return (
<div className={styles.App}>
<header className={styles.AppHeader}>
\```
<!-- prettier-ignore-end -->
The following option does work but there is annoying prettier ignore comment
{{< highlight ts "linenos=table" >}}
<!-- prettier-ignore -->
import styles from './App.module.css';
function App() {
return (
<div className={styles.App}>
<header className={styles.AppHeader}>
{{< / highlight >}}
above code will generate following snippet that has annoying prettier ignore comment
<!-- prettier-ignore -->
import styles from './App.module.css';
function App() {
return (
<div className={styles.App}>
<header className={styles.AppHeader}>
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
prettierignore is not working · Issue #279 - GitHub
I have a simple .prettierignore config that is consumed and applied as ... Yeah, it appears that .prettierignore does not work at all...
Read more >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 make Prettier to ignore a block of code? - Stack Overflow
Another option is to move all the code you don't want to format (e.g., because it's generated) to a separate file excluded by...
Read more >Prettierignore is ignored for subfolders with package.json
json files in subfolders. It doesn't mean that the project is a Monorepo project with multiple npm packages in one repo. For example,...
Read more >how to disable prettier formatting for individual files or folders
To disable prettier formatting on a single file, open the .prettierignore file and ... so don't forget to connect with me on social...
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 Free
Top 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
FYI
prettier-plugin-go-template@0.0.11-beta.9also already includes Go specific ignore syntax:All the contents of the ignored tag won’t be formatted. Does this fulfill all of your needs? @jasikpark @apoorvmote
If something is not working with that syntax, please give me a specific example with input, output and expected sections. Also keep in mind that this plugin currently only supports HTML templates.
Accidentally only published to my local registry. Should be available now 😁
prettier-plugin-go-template@0.0.11-beta.9