You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/0.index.md
+38-36Lines changed: 38 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,6 @@
2
2
title: Introduction
3
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.'
4
4
category: Getting started
5
-
items:
6
-
- Zero-configuration required
7
-
- Helps reduce hydration errors
8
-
- Detects common accessibility mistakes
9
5
10
6
---
11
7
@@ -14,76 +10,82 @@ items:
14
10
15
11
## Key features
16
12
17
-
<list:items="items"></list>
13
+
::list
14
+
- Zero-configuration required
15
+
- Helps reduce hydration errors
16
+
- Detects common accessibility mistakes
17
+
::
18
18
19
19
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.
20
20
21
21
## Quick start
22
22
23
23
### Install
24
24
25
-
<code-group>
26
-
<code-blocklabel="Yarn"active>
27
-
28
-
```bash
25
+
::code-group
26
+
```bash [pnpm]
27
+
pnpm i -D @nuxtjs/html-validator
28
+
```
29
+
```bash [Yarn]
29
30
yarn add @nuxtjs/html-validator --dev
30
31
```
31
-
32
-
</code-block>
33
-
<code-blocklabel="NPM">
34
-
35
-
```bash
32
+
```bash [npm]
36
33
npm install @nuxtjs/html-validator --save-dev
37
34
```
38
-
39
-
</code-block>
40
-
</code-group>
35
+
::
41
36
42
37
### nuxt.config.js
43
38
44
-
<code-group>
45
-
<code-blocklabel="Nuxt 2.9+"active>
46
-
47
-
```js{}[nuxt.config.js]
48
-
{
39
+
::code-group
40
+
```js [Nuxt 3]
41
+
defineNuxtConfig({
42
+
modules: ['@nuxtjs/html-validator']
43
+
})
44
+
```
45
+
```js {}[Nuxt 2.9+]
46
+
exportdefault {
49
47
buildModules: ['@nuxtjs/html-validator']
50
48
}
51
49
```
52
-
53
-
</code-block>
54
-
<code-blocklabel="Nuxt < 2.9">
55
-
56
-
```js{}[nuxt.config.js]
57
-
{
50
+
```js [Nuxt < 2.9">
51
+
exportdefault {
58
52
// Install @nuxtjs/html-validator as dependency instead of devDependency
59
53
modules: ['@nuxtjs/html-validator']
60
54
}
61
55
```
56
+
::
62
57
63
-
</code-block>
64
-
</code-group>
65
-
66
-
<alerttype="info">`html-validator` won't be added to your production bundle - it's just used in development and at build/generate time.</alert>
58
+
::alert{type="info"}
59
+
`html-validator` won't be added to your production bundle - it's just used in development and at build/generate time.
60
+
::
67
61
68
62
### Configuration (optional)
69
63
70
64
`@nuxtjs/html-validator` takes four options.
71
65
72
66
-`usePrettier` enables prettier printing of your source code to show errors in-context.
73
67
74
-
<alert>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.</alert>
68
+
::alert
69
+
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.
70
+
::
75
71
76
72
-`logLevel` sets the verbosity to one of `verbose`, `warning` or `error`. It defaults to `verbose` in dev, and `warning` when generating.
77
73
78
-
<alert>You can use this configuration option to turn off console logging for the `No HTML validation errors found for ...` message.</alert>
74
+
::alert
75
+
You can use this configuration option to turn off console logging for the `No HTML validation errors found for ...` message.
76
+
::
79
77
80
78
-`failOnError` will throw an error after running `nuxt generate` if there are any validation errors with the generated pages.
81
79
82
-
<alert>Useful in continuous integration.</alert>
80
+
::alert
81
+
Useful in continuous integration.
82
+
::
83
83
84
84
-`options` allows you to pass in `html-validate` options that will be merged with the default configuration
85
85
86
-
<alerttype="info">You can find more about configuring `html-validate`[here](https://html-validate.org/rules/index.html).</alert>
86
+
::alert{type="info"}
87
+
You can find more about configuring `html-validate`[here](https://html-validate.org/rules/index.html).
0 commit comments