<!-- prettier-ignore --> doesn't work

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
NiklasPorcommented, Jun 21, 2021

FYI prettier-plugin-go-template@0.0.11-beta.9 also already includes Go specific ignore syntax:

<div>
  {{/* prettier-ignore */}}
  <script>
    This
      is
        ignored
          .
  </script>
  <span> But this is not </span>
</div>

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.

0reactions
NiklasPorcommented, Jun 22, 2021

Accidentally only published to my local registry. Should be available now 😁

prettier-plugin-go-template@0.0.11-beta.9

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found