Skip to content

Commit cc86aa4

Browse files
NyllREdanielroe
andauthored
docs: upgrade docus (#762)
Co-authored-by: Daniel Roe <daniel@roe.dev>
1 parent c23a8b5 commit cc86aa4

File tree

10 files changed

+5171
-2350
lines changed

10 files changed

+5171
-2350
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ node_modules
88
.DS_Store
99
coverage
1010
dist
11+
.data

docs/app.config.ts

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
11
export default defineAppConfig({
2-
docus: {
2+
header: {
33
title: '@nuxtjs/html-validator',
4-
url: 'https://html-validator.nuxtjs.org',
5-
description: 'The best place to start your documentation.',
6-
socials: {
7-
github: 'nuxt-modules/html-validator',
4+
logo: {
5+
light: '/logo-light.svg',
6+
dark: '/logo-dark.svg',
7+
alt: 'HTML Validator Logo',
88
},
9+
},
10+
socials: {
11+
github: 'https://github.com/nuxt-modules/html-validator',
12+
},
13+
seo: {
14+
url: 'https://html-validator.nuxtjs.org',
15+
description:
16+
'Automatically validate Nuxt server-rendered HTML (SSR and SSG) to detect common issues with HTML that can lead to hydration errors, as well as improve accessibility and best practice.',
917
image: 'https://html-validator.nuxtjs.org/preview.png',
10-
aside: {
11-
level: 0,
12-
exclude: [],
13-
},
14-
header: {
15-
logo: true,
18+
},
19+
ui: {
20+
colors: {
21+
primary: 'green',
1622
},
17-
footer: {
18-
iconLinks: [
23+
},
24+
toc: {
25+
bottom: {
26+
title: 'Community',
27+
links: [
1928
{
20-
href: 'https://nuxt.com',
21-
icon: 'simple-icons:nuxtdotjs',
29+
icon: 'i-lucide-book-open',
30+
label: 'Nuxt docs',
31+
to: 'https://nuxt.com',
32+
target: '_blank',
2233
},
2334
],
2435
},

docs/components/Logo.vue

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
<template>
22
<img
3-
class="dark-img"
4-
src="/logo-dark.svg"
3+
class="block dark:hidden"
4+
src="/logo-light.svg"
55
>
66
<img
7-
class="light-img"
8-
src="/logo-light.svg"
7+
class="hidden dark:block"
8+
src="/logo-dark.svg"
99
>
1010
</template>
11-
12-
<style lang="ts">
13-
css({
14-
'.light .dark-img': {
15-
display: 'none',
16-
},
17-
'.dark .light-img': {
18-
display: 'none',
19-
},
20-
})
21-
</style>
Lines changed: 57 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,107 @@
11
---
22
title: Introduction
3-
description: 'Automatically validate Nuxt server-rendered HTML (SSR and SSG) to detect common issues with HTML that can lead to hydration errors, as well as improve accessibility and best practice.'
3+
description: "Automatically validate Nuxt server-rendered HTML (SSR and SSG) to detect common issues with HTML that can lead to hydration errors, as well as improve accessibility and best practice."
44
category: Getting started
5-
65
---
76

8-
<img src="/preview.png" class="light-img" />
9-
<img src="/preview-dark.png" class="dark-img" />
7+
::u-container
8+
9+
![Light preview](/preview.png){class="block dark:hidden w-full rounded-xl shadow"}
10+
![Dark preview](/preview-dark.png){class="hidden dark:block w-full rounded-xl shadow"}
11+
12+
Validate your SSR/SSG HTML automatically to catch hydration and accessibility issues before they ship.
1013

1114
## Key features
1215

13-
::list
14-
- Zero-configuration required
15-
- Helps reduce hydration errors
16-
- Detects common accessibility mistakes
17-
::
16+
- Zero-configuration required
17+
- Helps reduce hydration errors
18+
- Detects common accessibility mistakes
1819

1920
This module configures [`html-validate`](https://html-validate.org/) to automatically validate Nuxt server-rendered HTML (SSR and SSG) to detect common issues with HTML that can lead to hydration errors, as well as improve accessibility and best practice.
2021

2122
## Quick start
2223

2324
### Install
24-
```bash
25+
26+
```bash [Terminal]
2527
npx nuxi@latest module add html-validator
2628
```
2729

28-
### nuxt.config.js
29-
30-
::code-group
31-
```js [Nuxt 3]
32-
defineNuxtConfig({
33-
modules: ['@nuxtjs/html-validator']
34-
})
35-
```
36-
```js {}[Nuxt 2.9+]
37-
export default {
38-
buildModules: ['@nuxtjs/html-validator']
39-
}
40-
```
41-
```js [Nuxt < 2.9">
42-
export default {
43-
// Install @nuxtjs/html-validator as dependency instead of devDependency
44-
modules: ['@nuxtjs/html-validator']
45-
}
46-
```
30+
### Configure Nuxt
31+
32+
::tabs
33+
:::tabs-item{label="Nuxt 3"}
34+
35+
```js
36+
defineNuxtConfig({
37+
modules: ["@nuxtjs/html-validator"],
38+
});
39+
```
40+
41+
:::
42+
:::tabs-item{label="Nuxt 2.9+"}
43+
44+
```js
45+
export default {
46+
buildModules: ["@nuxtjs/html-validator"],
47+
};
48+
```
49+
50+
:::
51+
:::tabs-item{label="Nuxt < 2.9"}
52+
53+
```js
54+
export default {
55+
// Install @nuxtjs/html-validator as a dependency instead of devDependency
56+
modules: ["@nuxtjs/html-validator"],
57+
};
58+
```
59+
60+
:::
4761
::
4862

49-
::alert{type="info"}
50-
`html-validator` won't be added to your production bundle - it's just used in development and at build/generate time.
63+
::note
64+
`html-validator` won't be added to your production bundle it's only used in development and at build/generate time.
5165
::
5266

53-
### Configuration (optional)
67+
## Configuration
5468

55-
`@nuxtjs/html-validator` takes four options.
69+
`@nuxtjs/html-validator` exposes four options:
5670

5771
- `usePrettier` enables prettier printing of your source code to show errors in-context.
5872

59-
::alert
73+
::tip
6074
Consider not enabling this if you are using TailwindCSS, as prettier will struggle to cope with parsing the size of your HTML in development mode.
6175
::
6276

6377
- `logLevel` sets the verbosity to one of `verbose`, `warning` or `error`. It defaults to `verbose` in dev, and `warning` when generating.
6478

65-
::alert
66-
You can use this configuration option to turn off console logging for the `No HTML validation errors found for ...` message.
79+
::note
80+
Use this option to turn off console logging for the `No HTML validation errors found for ...` message.
6781
::
6882

6983
- `failOnError` will throw an error after running `nuxt generate` if there are any validation errors with the generated pages.
7084

71-
::alert
85+
::tip
7286
Useful in continuous integration.
7387
::
7488

75-
- `options` allows you to pass in `html-validate` options that will be merged with the default configuration
89+
- `options` allows you to pass in `html-validate` options that will be merged with the default configuration.
7690

77-
::alert{type="info"}
91+
::note
7892
You can find more about configuring `html-validate` [here](https://html-validate.org/rules/index.html).
7993
::
8094

8195
**Defaults**
8296

83-
```js{}[nuxt.config.js]
97+
```js [nuxt.config.ts]
8498
{
8599
htmlValidator: {
86100
usePrettier: false,
87101
logLevel: 'verbose',
88102
failOnError: false,
89103
/** A list of routes to ignore (that is, not check validity for). */
90-
ignore: [/\.(xml|rss|json)$/],
104+
ignore: [/\\.(xml|rss|json)$/],
91105
options: {
92106
extends: [
93107
'html-validate:document',
@@ -115,3 +129,5 @@ npx nuxi@latest module add html-validator
115129
**You're good to go!**
116130

117131
Every time you hard-refresh (server-render) a page in Nuxt, you will see any HTML validation issues printed in your server console.
132+
133+
::

docs/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export default defineNuxtConfig({
2-
extends: '@nuxt-themes/docus',
2+
extends: ['docus'],
33
compatibilityDate: '2024-08-19',
44
})

docs/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"dev": "nuxi dev",
7-
"build": "nuxi build",
6+
"dev": "nuxt dev",
7+
"build": "nuxt build",
88
"generate": "nuxi generate",
99
"preview": "nuxi preview",
1010
"lint": "eslint ."
1111
},
1212
"dependencies": {
13-
"@nuxt-themes/docus": "1.15.1",
14-
"nuxt": "4.3.1",
15-
"pinceau": "^0.20.1"
13+
"docus": "^5.4.4",
14+
"nuxt": "4.3.1"
1615
}
1716
}

docs/tokens.config.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
]
7373
},
7474
"resolutions": {
75-
"@nuxt/content": "2.13.4",
75+
"@nuxt/content": "^3.11.0",
7676
"@nuxt/kit": "^4.0.0",
7777
"@nuxtjs/html-validator": "link:./"
7878
},

0 commit comments

Comments
 (0)