workmux 0.1.72

An opinionated workflow tool that orchestrates git worktrees and tmux
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
# VitePress Documentation Reference

## What is VitePress?

VitePress is a Static Site Generator (SSG) designed for building fast,
content-centric websites. It transforms Markdown content into static HTML pages
deployable anywhere.

### Primary Use Cases

- **Documentation Sites**: Powers technical documentation for major projects
  including Vite, Rollup, Pinia, and Vue.js itself
- **Content Platforms**: Supports blogs, portfolios, and marketing websites
  through customizable themes

### Key Features

- **Vite Integration**: Rapid server startup with near-instantaneous hot reload
- **Markdown Extensions**: Frontmatter, tables, syntax highlighting, and
  advanced code block features
- **Vue Compatibility**: Each Markdown page functions as a Vue Single-File
  Component
- **Hybrid Rendering**: Pre-rendered static HTML for initial load, then SPA
  behavior for navigation

VitePress is the modernized successor to VuePress 1, leveraging Vue 3 and Vite
instead of Vue 2 and webpack.

---

## Getting Started

### Requirements

- **Node.js 18 or higher**
- ESM-only: Ensure `package.json` contains `"type": "module"` or use
  `.mjs`/`.mts` extensions

### Installation

```bash
npm add -D vitepress@next
```

### Setup Wizard

```bash
npx vitepress init
```

The wizard prompts for:

- Config location
- Site title and description
- Theme preference
- Whether to add npm scripts

### File Structure

A typical VitePress project scaffolded in `./docs`:

```
docs/
├── .vitepress/
│   ├── config.js          # Site configuration
│   └── theme/
│       └── index.js       # Custom theme (optional)
├── public/                # Static assets (favicon, robots.txt)
├── guide/
│   ├── index.md           # /guide/
│   └── getting-started.md # /guide/getting-started
├── api/
│   └── index.md           # /api/
└── index.md               # Home page
```

The `.vitepress` directory is reserved for config, cache, build output, and
theme customization.

### Running Locally

```bash
npm run docs:dev
```

Dev server runs at `http://localhost:5173` with hot module replacement.

### Building for Production

```bash
npm run docs:build
npm run docs:preview  # Preview at localhost:4173
```

---

## Site Configuration

Configuration is defined in `.vitepress/config.[ext]` (js, ts, mjs, mts).

### Complete Example

```javascript
import { defineConfig } from 'vitepress';

export default defineConfig({
  // Site metadata
  title: 'My Documentation',
  description: 'A VitePress powered documentation site',
  lang: 'en-US',

  // Deployment
  base: '/', // Use '/repo-name/' for GitHub Pages subdirectory

  // URL handling
  cleanUrls: true,

  // Source/output directories
  srcDir: './src', // Default: project root
  outDir: './.vitepress/dist',

  // Git-based timestamps
  lastUpdated: true,

  // Appearance
  appearance: true, // Enable dark mode toggle

  // Markdown configuration
  markdown: {
    lineNumbers: true,
    theme: {
      light: 'github-light',
      dark: 'github-dark',
    },
  },

  // Head tags
  head: [
    ['link', { rel: 'icon', href: '/favicon.ico' }],
    ['meta', { name: 'theme-color', content: '#3eaf7c' }],
  ],

  // Theme configuration
  themeConfig: {
    // ... see Theme Configuration section
  },
});
```

### Site Metadata

| Option        | Description                                |
| ------------- | ------------------------------------------ |
| `title`       | Site name displayed in nav bar             |
| `description` | Meta tag content for SEO                   |
| `lang`        | HTML language attribute (default: `en-US`) |
| `head`        | Additional HTML elements to inject         |
| `base`        | Deployment path for sub-directory hosting  |

### Routing Options

| Option      | Description                        |
| ----------- | ---------------------------------- |
| `cleanUrls` | Removes trailing `.html` from URLs |
| `rewrites`  | Custom directory-to-URL mappings   |

### Build Options

| Option            | Description                        |
| ----------------- | ---------------------------------- |
| `srcDir`          | Markdown source directory location |
| `outDir`          | Build output directory             |
| `assetsDir`       | Generated assets folder name       |
| `ignoreDeadLinks` | Dead link handling behavior        |

### Customization

| Option        | Description                       |
| ------------- | --------------------------------- |
| `markdown`    | Markdown-it parser configuration  |
| `vite`        | Raw Vite config options           |
| `vue`         | Plugin options for Vue files      |
| `appearance`  | Dark mode toggle control          |
| `lastUpdated` | Git-based page timestamp tracking |

### Build Hooks

- `transformPageData` - Modify page metadata during processing
- `transformHead` - Dynamically add head entries per page
- `postRender` - Handle content after SSG rendering
- `buildEnd` - Execute logic after build completion

---

## Default Theme Configuration

Theme options are set under `themeConfig` in your config file.

### Complete Theme Example

```javascript
export default defineConfig({
  themeConfig: {
    // Branding
    logo: '/logo.svg',
    siteTitle: 'My Docs',

    // Navigation
    nav: [
      { text: 'Guide', link: '/guide/' },
      { text: 'API', link: '/api/' },
      {
        text: 'Resources',
        items: [
          { text: 'Blog', link: '/blog/' },
          { text: 'Changelog', link: '/changelog' },
        ],
      },
    ],

    // Sidebar
    sidebar: {
      '/guide/': [
        {
          text: 'Introduction',
          items: [
            { text: 'What is This?', link: '/guide/' },
            { text: 'Getting Started', link: '/guide/getting-started' },
          ],
        },
        {
          text: 'Advanced',
          collapsed: true,
          items: [{ text: 'Configuration', link: '/guide/configuration' }],
        },
      ],
      '/api/': [
        {
          text: 'API Reference',
          items: [{ text: 'Overview', link: '/api/' }],
        },
      ],
    },

    // Social links
    socialLinks: [
      { icon: 'github', link: 'https://github.com/user/repo' },
      { icon: 'twitter', link: 'https://twitter.com/user' },
    ],

    // Footer
    footer: {
      message: 'Released under the MIT License.',
      copyright: 'Copyright © 2024',
    },

    // Edit link
    editLink: {
      pattern: 'https://github.com/user/repo/edit/main/docs/:path',
      text: 'Edit this page on GitHub',
    },

    // Search
    search: {
      provider: 'local',
    },

    // Outline/TOC
    outline: {
      level: [2, 3],
      label: 'On this page',
    },

    // Last updated
    lastUpdated: {
      text: 'Updated at',
      formatOptions: {
        dateStyle: 'medium',
      },
    },
  },
});
```

### Logo & Branding

```javascript
themeConfig: {
  logo: '/logo.svg',
  // Or with light/dark variants:
  logo: { light: '/light-logo.svg', dark: '/dark-logo.svg' },
  siteTitle: 'My Docs',  // Set to false to hide
}
```

### Navigation

```javascript
themeConfig: {
  nav: [
    // Simple link
    { text: 'Guide', link: '/guide/' },

    // Link with active match pattern
    { text: 'Config', link: '/config/', activeMatch: '/config/' },

    // Dropdown menu
    {
      text: 'Dropdown',
      items: [
        { text: 'Item A', link: '/item-a' },
        { text: 'Item B', link: '/item-b' },
        // Grouped items
        {
          items: [
            { text: 'Section', link: '/section' },
          ],
        },
      ],
    },
  ],
}
```

### Sidebar

**Simple sidebar (all pages):**

```javascript
themeConfig: {
  sidebar: [
    {
      text: 'Guide',
      items: [
        { text: 'Introduction', link: '/guide/' },
        { text: 'Getting Started', link: '/guide/getting-started' },
      ],
    },
  ],
}
```

**Multiple sidebars (by path):**

```javascript
themeConfig: {
  sidebar: {
    '/guide/': [
      {
        text: 'Guide',
        items: [
          { text: 'Introduction', link: '/guide/' },
        ],
      },
    ],
    '/api/': [
      {
        text: 'API',
        items: [
          { text: 'Reference', link: '/api/' },
        ],
      },
    ],
  },
}
```

**Collapsible groups:**

```javascript
{
  text: 'Advanced',
  collapsed: false,  // Open by default
  // collapsed: true,  // Closed by default
  items: [
    { text: 'Item', link: '/advanced/item' },
  ],
}
```

Supports up to 6 levels of nesting.

### Social Links

```javascript
themeConfig: {
  socialLinks: [
    { icon: 'github', link: 'https://github.com/...' },
    { icon: 'twitter', link: 'https://twitter.com/...' },
    { icon: 'discord', link: 'https://discord.gg/...' },
    // Custom SVG icon
    {
      icon: { svg: '<svg>...</svg>' },
      link: 'https://...',
    },
  ],
}
```

Available icons: `discord`, `facebook`, `github`, `instagram`, `linkedin`,
`mastodon`, `npm`, `slack`, `twitter`, `x`, `youtube`.

### Other Theme Options

| Option        | Description                                        |
| ------------- | -------------------------------------------------- |
| `aside`       | Aside panel position (`true`, `'left'`, `false`)   |
| `outline`     | Table of contents display and heading levels       |
| `footer`      | Message and copyright text (no-sidebar pages only) |
| `editLink`    | Links to edit pages on GitHub, etc.                |
| `socialLinks` | Social media icons in navbar                       |

---

## Search

### Local Search (Built-in)

```javascript
themeConfig: {
  search: {
    provider: 'local',
    options: {
      // Customize search
      translations: {
        button: {
          buttonText: 'Search',
          buttonAriaLabel: 'Search',
        },
        modal: {
          noResultsText: 'No results for',
          resetButtonTitle: 'Reset search',
          footer: {
            selectText: 'to select',
            navigateText: 'to navigate',
          },
        },
      },
    },
  },
}
```

### Algolia DocSearch

```javascript
themeConfig: {
  search: {
    provider: 'algolia',
    options: {
      appId: 'YOUR_APP_ID',
      apiKey: 'YOUR_SEARCH_API_KEY',
      indexName: 'YOUR_INDEX_NAME',
    },
  },
}
```

### Exclude Pages from Search

In frontmatter:

```yaml
---
search: false
---
```

---

## Home Page Layout

Set `layout: home` in frontmatter to use the home page layout.

### Complete Home Page Example

```markdown
---
layout: home

hero:
  name: My Project
  text: Build amazing things
  tagline: A powerful toolkit for developers
  image:
    src: /hero-image.png
    alt: Project Logo
  actions:
    - theme: brand
      text: Get Started
      link: /guide/
    - theme: alt
      text: View on GitHub
      link: https://github.com/user/repo

features:
  - icon: ⚡️
    title: Lightning Fast
    details: Built on Vite for instant server start and HMR
    link: /guide/performance
    linkText: Learn more
  - icon: 📝
    title: Markdown Focused
    details: Write content in Markdown with Vue components
  - icon: 🎨
    title: Customizable
    details: Extend with Vue components and custom CSS
---

## Additional Content

You can add markdown content below the frontmatter.
```

### Hero Options

| Option    | Description                                  |
| --------- | -------------------------------------------- |
| `name`    | Product name (displayed in brand color)      |
| `text`    | Main headline (rendered as h1)               |
| `tagline` | Subtitle text                                |
| `image`   | Logo/image with optional light/dark variants |
| `actions` | CTA buttons with `theme: 'brand'` or `'alt'` |

### Features Options

| Option     | Description                        |
| ---------- | ---------------------------------- |
| `icon`     | Emoji or image path (supports SVG) |
| `title`    | Feature title                      |
| `details`  | Feature description                |
| `link`     | Optional link URL                  |
| `linkText` | Link button text                   |

### Custom Hero Colors

```css
/* .vitepress/theme/custom.css */
:root {
  --vp-home-hero-name-color: transparent;
  --vp-home-hero-name-background: linear-gradient(120deg, #bd34fe, #41d1ff);
}
```

---

## Frontmatter Configuration

### Page-Level Options

```yaml
---
title: Page Title
titleTemplate: ':title - Custom Suffix'
description: Page description for SEO
head:
  - - meta
    - name: keywords
      content: vitepress, documentation

# Layout options
layout: doc # doc | home | page
navbar: true
sidebar: true
aside: true # true | false | 'left'
outline: [2, 3] # Heading levels in TOC
lastUpdated: true
editLink: true
footer: true
pageClass: custom-page-class
---
```

### Layout Types

| Layout | Description                                    |
| ------ | ---------------------------------------------- |
| `doc`  | Default documentation layout with all features |
| `home` | Special home page layout with hero/features    |
| `page` | Minimal layout for custom pages                |

### Disable Layout Elements

```yaml
---
navbar: false
sidebar: false
aside: false
footer: false
editLink: false
lastUpdated: false
---
```

---

## Routing

### File-Based Routing

Directory structure determines URL structure:

| File                       | URL                           |
| -------------------------- | ----------------------------- |
| `index.md`                 | `/`                           |
| `guide/index.md`           | `/guide/`                     |
| `guide/getting-started.md` | `/guide/getting-started.html` |

### Linking Between Pages

Use extension-less links:

```markdown
<!-- Good -->

[Link](./getting-started) [Link](/guide/getting-started)

<!-- Avoid -->

[Link](./getting-started.md)
```

### Clean URLs

Enable in config for extension-less URLs (`/path` instead of `/path.html`):

```javascript
export default {
  cleanUrls: true,
};
```

Requires hosting platform support (Netlify, Vercel, GitHub Pages).

### Dynamic Routes

Generate multiple pages from a single template using `[param].md` files paired
with `.paths.js` loader files:

```
docs/
├── posts/
│   ├── [slug].md        # Template
│   └── [slug].paths.js  # Data loader
```

**`[slug].paths.js`:**

```javascript
export default {
  paths() {
    return [
      { params: { slug: 'post-1' }, content: '# Post 1' },
      { params: { slug: 'post-2' }, content: '# Post 2' },
    ];
  },
};
```

**`[slug].md`:**

```markdown
---
title: { { $params.slug } }
---

Dynamic content here
```

---

## Asset Handling

### Public Directory

Place static files in `docs/public/`:

```
docs/
├── public/
│   ├── favicon.ico
│   ├── logo.png
│   ├── robots.txt
│   └── og-image.png
```

Reference with absolute paths (no `/public` prefix):

```markdown
![Logo](/logo.png)
```

### Relative Asset References

```markdown
![Image](./images/screenshot.png)
```

Assets are processed by Vite:

- Small images (<4kb) are base64 inlined
- Hashed filenames in production for cache busting

### Base URL for Assets

When deploying to a subdirectory, set `base` in config:

```javascript
export default {
  base: '/my-repo/',
};
```

For dynamic paths in Vue components, use `withBase`:

```vue
<script setup>
import { withBase } from 'vitepress';
</script>

<template>
  <img :src="withBase('/logo.png')" />
</template>
```

---

## Internationalization (i18n)

### Directory Structure

```
docs/
├── en/
│   ├── index.md
│   └── guide/
├── zh/
│   ├── index.md
│   └── guide/
├── index.md          # Default locale
```

### Configuration

```javascript
export default defineConfig({
  locales: {
    root: {
      label: 'English',
      lang: 'en',
    },
    zh: {
      label: '中文',
      lang: 'zh-CN',
      link: '/zh/',
      themeConfig: {
        nav: [{ text: '指南', link: '/zh/guide/' }],
        sidebar: {
          // Chinese sidebar
        },
      },
    },
  },
});
```

### Per-Locale Configuration

Each locale can override:

- `lang` - HTML lang attribute
- `dir` - Text direction (`'ltr'` or `'rtl'`)
- `title` / `titleTemplate`
- `description`
- `head`
- `themeConfig` - Theme-specific options

### RTL Support

```javascript
locales: {
  ar: {
    label: 'العربية',
    lang: 'ar',
    dir: 'rtl',
  },
}
```

---

## Extending the Default Theme

### Custom CSS

Create `.vitepress/theme/index.js`:

```javascript
import DefaultTheme from 'vitepress/theme';
import './custom.css';

export default DefaultTheme;
```

**`.vitepress/theme/custom.css`:**

```css
/* Override CSS variables */
:root {
  --vp-c-brand-1: #646cff;
  --vp-c-brand-2: #747bff;
}

/* Custom styles */
.vp-doc h1 {
  border-bottom: 2px solid var(--vp-c-brand-1);
}
```

### Register Global Components

```javascript
// .vitepress/theme/index.js
import DefaultTheme from 'vitepress/theme';
import MyComponent from './components/MyComponent.vue';

export default {
  extends: DefaultTheme,
  enhanceApp({ app }) {
    app.component('MyComponent', MyComponent);
  },
};
```

### Layout Slots

Inject content into the default layout:

```javascript
// .vitepress/theme/index.js
import DefaultTheme from 'vitepress/theme';
import MyLayout from './MyLayout.vue';

export default {
  extends: DefaultTheme,
  Layout: MyLayout,
};
```

**`MyLayout.vue`:**

```vue
<script setup>
import DefaultTheme from 'vitepress/theme';
const { Layout } = DefaultTheme;
</script>

<template>
  <Layout>
    <template #nav-bar-content-after>
      <CustomNavItem />
    </template>
    <template #doc-before>
      <ArticleMeta />
    </template>
    <template #doc-after>
      <Comments />
    </template>
  </Layout>
</template>
```

**Available slots:**

- `nav-bar-title-before/after`
- `nav-bar-content-before/after`
- `sidebar-nav-before/after`
- `doc-before/after`
- `doc-top/bottom`
- `doc-footer-before`
- `home-hero-before/after`
- `home-features-before/after`

### Custom Fonts

```javascript
// .vitepress/theme/index.js
import DefaultTheme from 'vitepress/theme-without-fonts';
import './fonts.css';

export default DefaultTheme;
```

**`fonts.css`:**

```css
@font-face {
  font-family: 'My Font';
  src: url('/fonts/my-font.woff2') format('woff2');
}

:root {
  --vp-font-family-base: 'My Font', sans-serif;
  --vp-font-family-mono: 'Fira Code', monospace;
}
```

---

## Using Vue in Markdown

### Inline Vue

```markdown
# Counter Example

{{ 1 + 1 }}

<script setup>
import { ref } from 'vue'
const count = ref(0)
</script>

<button @click="count++">Count: {{ count }}</button>
```

### Import Components

```markdown
<script setup>
import CustomComponent from './components/CustomComponent.vue'
</script>

# My Page

<CustomComponent :prop="value" />
```

### Access Page Data

```vue
<script setup>
import { useData } from 'vitepress';
const { page, frontmatter, theme } = useData();
</script>

<template>
  <div>
    <h1>{{ frontmatter.title }}</h1>
    <p>Last updated: {{ page.lastUpdated }}</p>
  </div>
</template>
```

### Component Naming

Components must use PascalCase or hyphenated names to avoid being wrapped in
`<p>` tags:

```markdown
<!-- Good -->
<CustomComponent />
<my-component />

<!-- Bad - will cause hydration errors -->
<customcomponent />
```

### SSR Compatibility

Components must be SSR-safe. For client-only components:

```vue
<script setup>
import { onMounted, ref } from 'vue';

const ClientOnlyComponent = ref(null);

onMounted(async () => {
  ClientOnlyComponent.value = (await import('./ClientOnly.vue')).default;
});
</script>

<template>
  <component :is="ClientOnlyComponent" v-if="ClientOnlyComponent" />
</template>
```

---

## Markdown Features

### Frontmatter

```yaml
---
title: Page Title
description: Page description
---
```

### Header Anchors

Custom anchors with `{#custom-id}` syntax:

```markdown
## My Heading {#custom-anchor}
```

### Table of Contents

Auto-generated with:

```markdown
[[toc]]
```

### Custom Containers

```markdown
::: info This is an info box. :::

::: tip This is a tip. :::

::: warning This is a warning. :::

::: danger This is a dangerous warning. :::

::: details Click to expand Hidden content here. :::
```

### GitHub-Flavored Alerts

```markdown
> [!NOTE] Highlights information.

> [!TIP] Optional information to help.

> [!IMPORTANT] Crucial information.

> [!WARNING] Critical content requiring attention.

> [!CAUTION] Negative potential consequences.
```

### Code Blocks

**Syntax highlighting:**

````markdown
```javascript
const hello = 'world';
```
````

**Line highlighting:**

````markdown
```javascript{4}
// line 4 highlighted
```

```javascript{4,7-13}
// line 4 and lines 7-13 highlighted
```
````

**Focus mode:**

```javascript
export default {
  data() {
    return {
      msg: 'Focused!', // [!code focus]
    };
  },
};
```

**Colored diffs:**

```javascript
export default {
  data() {
    return {
      msg: 'Removed', // [!code --]
      msg: 'Added', // [!code ++]
    };
  },
};
```

**Error/warning markers:**

```javascript
const error = 'This has error'; // [!code error]
const warning = 'This has warning'; // [!code warning]
```

**Line numbers:**

````markdown
```javascript:line-numbers
// line numbers enabled
```

```javascript:line-numbers=5
// starts at line 5
```
````

### Code Groups

````markdown
::: code-group

```javascript [config.js]
export default {};
```

```typescript [config.ts]
export default {};
```

:::
````

### File Imports

```markdown
<<< @/filepath <<< @/filepath{2-10} <<< @/filepath{2-10 javascript}
```

### Math Equations

Requires `markdown-it-mathjax3` plugin:

```markdown
$a^2 + b^2 = c^2$
```

---

## Deployment

### Build Scripts

Add to `package.json`:

```json
{
  "scripts": {
    "docs:dev": "vitepress dev docs",
    "docs:build": "vitepress build docs",
    "docs:preview": "vitepress preview docs"
  }
}
```

### GitHub Pages

**`.github/workflows/deploy.yml`:**

```yaml
name: Deploy VitePress site to Pages

on:
  push:
    branches: [main]

permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npm run docs:build
      - uses: actions/upload-pages-artifact@v3
        with:
          path: docs/.vitepress/dist

  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/deploy-pages@v4
        id: deployment
```

For project repos (`user.github.io/repo`), set base:

```javascript
export default {
  base: '/repo-name/',
};
```

### Netlify

- Build command: `npm run docs:build`
- Publish directory: `docs/.vitepress/dist`
- Node version: 20

### Vercel

- Framework Preset: VitePress
- Build command: `npm run docs:build`
- Output directory: `docs/.vitepress/dist`

### Cloudflare Pages

- Build command: `npm run docs:build`
- Build output directory: `docs/.vitepress/dist`

### Cache Headers

Configure for the `/assets/` directory:

```
Cache-Control: max-age=31536000, immutable
```

---

## Quick Reference: Minimal Docs Site

### 1. Initialize

```bash
npm add -D vitepress
npx vitepress init
```

### 2. Config (`docs/.vitepress/config.js`)

```javascript
import { defineConfig } from 'vitepress';

export default defineConfig({
  title: 'My Project',
  description: 'Project documentation',
  themeConfig: {
    nav: [
      { text: 'Home', link: '/' },
      { text: 'Guide', link: '/guide/' },
    ],
    sidebar: [
      {
        text: 'Guide',
        items: [
          { text: 'Introduction', link: '/guide/' },
          { text: 'Getting Started', link: '/guide/getting-started' },
        ],
      },
    ],
    socialLinks: [{ icon: 'github', link: 'https://github.com/...' }],
  },
});
```

### 3. Home Page (`docs/index.md`)

```markdown
---
layout: home

hero:
  name: My Project
  text: Tagline here
  actions:
    - theme: brand
      text: Get Started
      link: /guide/

features:
  - title: Feature One
    details: Description of feature one
  - title: Feature Two
    details: Description of feature two
---
```

### 4. Guide Pages

**`docs/guide/index.md`:**

```markdown
# Introduction

Welcome to the documentation.
```

**`docs/guide/getting-started.md`:**

```markdown
# Getting Started

## Installation

npm install my-project
```

### 5. Run

```bash
npm run docs:dev
```

---

## Links

- Official Documentation: https://vitepress.dev/
- GitHub: https://github.com/vuejs/vitepress
- Default Theme CSS Variables:
  https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css