Skip to content

Commit f36fe57

Browse files
committed
Add code groups to docs
1 parent 3991f85 commit f36fe57

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

docs/guide/index.md

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,49 @@
44

55
Simply install `prettier` and `@prettier/plugin-pug` as your project’s npm `devDependencies`:
66

7-
```bash
7+
::: code-group
8+
9+
```shell [npm]
810
npm add --save-dev prettier @prettier/plugin-pug
9-
yarn add --dev prettier @prettier/plugin-pug
11+
```
12+
13+
```shell [pnpm]
1014
pnpm add --save-dev prettier @prettier/plugin-pug
1115
```
1216

17+
```shell [yarn]
18+
yarn add --dev prettier @prettier/plugin-pug
19+
```
20+
21+
:::
22+
1323
## Usage
1424

1525
Format all pug files in your project:
1626

17-
```bash
27+
::: code-group
28+
29+
```shell [npm]
1830
npx prettier --write "**/*.pug"
19-
yarn prettier --write "**/*.pug"
31+
```
32+
33+
```shell [pnpm]
2034
pnpm prettier --write "**/*.pug"
2135
```
2236

37+
```shell [yarn]
38+
yarn prettier --write "**/*.pug"
39+
```
40+
41+
:::
42+
2343
### Selectively ignoring automatic formatting
2444

2545
You can disable code formatting for a particular element by adding `//- prettier-ignore` comments in your pug templates:
2646

27-
```pug
47+
::: code-group
48+
49+
```pug [Input]
2850
div.text( color = "primary", disabled ="true" )
2951
//- prettier-ignore
3052
div.text( color = "primary", disabled ="true" )
@@ -33,9 +55,7 @@ div
3355
div.text( color = "primary", disabled ="true" )
3456
```
3557

36-
Prettified output:
37-
38-
```pug
58+
```pug [Output]
3959
.text(color="primary", disabled)
4060
//- prettier-ignore
4161
div.text( color = "primary", disabled ="true" )
@@ -44,6 +64,8 @@ div
4464
div.text( color = "primary", disabled ="true" )
4565
```
4666

67+
:::
68+
4769
You can also disable code formatting in Markdown for a particular ` ```pug ` block by adding`<!-- prettier-ignore -->` before the block:
4870

4971
````markdown

0 commit comments

Comments
 (0)