aboutsummaryrefslogtreecommitdiff
path: root/articles/2023/prettier-when-it-works.html
blob: 8e0c19663afc70e68b4addb2d8f7236992b70bcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!doctype html>
<html lang="EN">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="/style.css" />
    <title>Bloggings</title>
  </head>
  <body>
    <header>
      <h1>Bloggings</h1>
      <a href="/index.php">Back</a>
      <hr />
    </header>
    
    <main>
<article>
<h2>Prettier when it works</h2>
    <h3>24-08-2023</h3>
    <img src="/images/prettier.jpg" />
    <p>Prettier is a great code beautifier for PHP, once you get it to work.</p>

    <h3>Update 14 may 2025</h3>
    <p>For Archlinux:</p>
    <code>pacman -S prettier
yay -S prettier-plugin-php</code>
    <p>edit ~/.prettierrc</p>
    <pre>
{ 
   "plugins": ["/usr/lib/node_modules/@prettier/plugin-php/src/index.mjs"]
}
    </pre>
    <p>In order to use it in the Micro text editor, download micro-prettier:</p>
    <pre>
    git clone https://github.com/claromes/micro-prettier.git
    cd micro-prettier
    make
    </pre>
    <p>If you would rather not have it running on every save, in micro:<br> 
    Ctrl+e > set prettier.onsave false</p>
    </article>
</main>
<footer>

    <p>&nbsp;</p>
    <hr />
    <p>§</p>
  </footer>
</body>
</html>