diff --git a/docs/rules/attribute-hyphenation.md b/docs/rules/attribute-hyphenation.md
index 53feb9c8a..803baab0a 100644
--- a/docs/rules/attribute-hyphenation.md
+++ b/docs/rules/attribute-hyphenation.md
@@ -15,7 +15,8 @@ description: enforce attribute naming style on custom components in template
This rule enforces using hyphenated attribute names on custom components in Vue templates.
-```
+
+```vue
@@ -24,6 +25,7 @@ This rule enforces using hyphenated attribute names on custom components in Vue
```
+
## :wrench: Options
@@ -46,7 +48,8 @@ Default casing is set to `always` with `['data-', 'aria-', 'slot-scope']` set to
It errors on upper case letters.
-```
+
+```vue
@@ -55,13 +58,15 @@ It errors on upper case letters.
```
+
### `"never"`
It errors on hyphens except `data-`, `aria-` and `slot-scope`.
-```
+
+```vue
@@ -73,13 +78,15 @@ It errors on hyphens except `data-`, `aria-` and `slot-scope`.
```
+
### `"never", { "ignore": ["custom-prop"] }`
Don't use hyphenated name but allow custom attributes
-```
+
+```vue
@@ -92,6 +99,7 @@ Don't use hyphenated name but allow custom attributes
```
+
## :mag: Implementation
diff --git a/docs/rules/attributes-order.md b/docs/rules/attributes-order.md
index d703d7f58..cbd38eee0 100644
--- a/docs/rules/attributes-order.md
+++ b/docs/rules/attributes-order.md
@@ -40,7 +40,8 @@ This rule aims to enforce ordering of component attributes. The default order is
### the default order
-```
+
+```vue
```
+
## :wrench: Options
@@ -113,7 +115,8 @@ This rule aims to enforce ordering of component attributes. The default order is
#### `['LIST_RENDERING', 'CONDITIONALS', 'RENDER_MODIFIERS', 'GLOBAL', 'UNIQUE', 'TWO_WAY_BINDING', 'DEFINITION', 'OTHER_DIRECTIVES', 'OTHER_ATTR', 'EVENTS', 'CONTENT']`
-```
+
+```vue
```
+
## :books: Further reading
diff --git a/docs/rules/comment-directive.md b/docs/rules/comment-directive.md
index 7be264cec..9db00825f 100644
--- a/docs/rules/comment-directive.md
+++ b/docs/rules/comment-directive.md
@@ -30,6 +30,7 @@ ESLint doesn't provide any API to enhance `eslint-disable` functionality and ESL
This rule sends all `eslint-disable`-like comments as errors to the post-process of the `.vue` file processor, then the post-process removes all `vue/comment-directive` errors and the reported errors in disabled areas.
+
```vue
@@ -37,6 +38,7 @@ This rule sends all `eslint-disable`-like comments as errors to the post-process
```
+
## :books: Further reading
diff --git a/docs/rules/component-name-in-template-casing.md b/docs/rules/component-name-in-template-casing.md
index c7ea7ea84..c2bd52900 100644
--- a/docs/rules/component-name-in-template-casing.md
+++ b/docs/rules/component-name-in-template-casing.md
@@ -33,7 +33,8 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
### `"PascalCase"`
-```
+
+```vue
@@ -44,12 +45,14 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
```
+
### `"kebab-case"`
-```
+
+```vue
@@ -61,13 +64,15 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
```
+
### `"PascalCase", { ignores: ["custom-element"] }`
-```
+
+```vue
@@ -77,6 +82,7 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
```
+
## :books: Further reading
diff --git a/docs/rules/html-closing-bracket-newline.md b/docs/rules/html-closing-bracket-newline.md
index 056905fea..d91987052 100644
--- a/docs/rules/html-closing-bracket-newline.md
+++ b/docs/rules/html-closing-bracket-newline.md
@@ -31,7 +31,8 @@ This rule enforces a line break (or no line break) before tag's closing brackets
This rule aims to warn the right angle brackets which are at the location other than the configured location.
-```
+
+```vue
@@ -48,6 +49,7 @@ This rule aims to warn the right angle brackets which are at the location other
class="bar">
```
+
## :wrench: Options
@@ -73,7 +75,8 @@ Plus, you can use [`vue/html-indent`](./html-indent.md) rule to enforce indent-l
### `"multiline": "never"`
-```
+
+```vue
```
+
## :mag: Implementation
diff --git a/docs/rules/html-closing-bracket-spacing.md b/docs/rules/html-closing-bracket-spacing.md
index 20292810c..e77b9d7ec 100644
--- a/docs/rules/html-closing-bracket-spacing.md
+++ b/docs/rules/html-closing-bracket-spacing.md
@@ -15,7 +15,8 @@ description: require or disallow a space before tag's closing brackets
This rule aims to enforce consistent spacing style before closing brackets `>` of tags.
-```
+
+```vue
@@ -36,6 +37,7 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
```
+
## :wrench: Options
@@ -63,7 +65,8 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
### `"startTag": "always", "endTag": "always", "selfClosingTag": "always"`
-```
+
+```vue
@@ -75,6 +78,7 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
```
+
## :couple: Related rules
diff --git a/docs/rules/html-end-tags.md b/docs/rules/html-end-tags.md
index fe8b704bb..9cf5c1105 100644
--- a/docs/rules/html-end-tags.md
+++ b/docs/rules/html-end-tags.md
@@ -15,7 +15,8 @@ description: enforce end tag style
This rule aims to disallow lacking end tags.
-```
+
+```vue
@@ -29,6 +30,7 @@ This rule aims to disallow lacking end tags.
```
+
## :wrench: Options
diff --git a/docs/rules/html-indent.md b/docs/rules/html-indent.md
index fb5aab263..4c366451c 100644
--- a/docs/rules/html-indent.md
+++ b/docs/rules/html-indent.md
@@ -18,7 +18,8 @@ This rule enforces a consistent indentation style in ``. The default s
- In the expressions, this rule supports ECMAScript 2017 syntaxes. It ignores unknown AST nodes, but it might be confused by non-standard syntaxes.
-```
+
+```vue
@@ -55,6 +56,7 @@ This rule enforces a consistent indentation style in ``. The default s
```
+
## :wrench: Options
@@ -81,7 +83,8 @@ This rule enforces a consistent indentation style in ``. The default s
### `2, {"attribute": 1, "closeBracket": 1}`
-```
+
+```vue
`. The default s
/>
```
+
### `2, {"alignAttributesVertically": false}`
-```
+
+```vue
`. The default s
/>
```
+
### `2, {"baseIndent": 0}`
-```
+
+```vue
@@ -172,6 +183,7 @@ This rule enforces a consistent indentation style in ``. The default s
```
+
## :mag: Implementation
diff --git a/docs/rules/html-quotes.md b/docs/rules/html-quotes.md
index c63dcbd0d..aa0180de9 100644
--- a/docs/rules/html-quotes.md
+++ b/docs/rules/html-quotes.md
@@ -23,7 +23,8 @@ This rule enforces the quotes style of HTML attributes.
This rule reports the quotes of attributes if it is different to configured quotes.
-```
+
+```vue
@@ -33,6 +34,7 @@ This rule reports the quotes of attributes if it is different to configured quot
```
+
## :wrench: Options
@@ -51,7 +53,8 @@ Default is set to `double`.
### `"single"`
-```
+
+```vue
@@ -61,6 +64,7 @@ Default is set to `double`.
```
+
## :books: Further reading
diff --git a/docs/rules/html-self-closing.md b/docs/rules/html-self-closing.md
index bf818a016..da83e5b73 100644
--- a/docs/rules/html-self-closing.md
+++ b/docs/rules/html-self-closing.md
@@ -22,7 +22,8 @@ In Vue.js template, we can use either two styles for elements which don't have t
Self-closing is simple and shorter, but it's not supported in the HTML spec.
-```
+
+```vue
@@ -37,6 +38,7 @@ Self-closing is simple and shorter, but it's not supported in the HTML spec.
```
+
## :wrench: Options
@@ -70,7 +72,8 @@ Every option can be set to one of the following values:
### `html: {normal: "never", void: "always"}`
-```
+
+```vue
@@ -85,6 +88,7 @@ Every option can be set to one of the following values:
```
+
## :books: Further reading
diff --git a/docs/rules/max-attributes-per-line.md b/docs/rules/max-attributes-per-line.md
index d7c3e2d55..97e0402ed 100644
--- a/docs/rules/max-attributes-per-line.md
+++ b/docs/rules/max-attributes-per-line.md
@@ -21,7 +21,8 @@ An attribute is considered to be in a new line when there is a line break betwee
There is a configurable number of attributes that are acceptable in one-line case (default 1), as well as how many attributes are acceptable per line in multi-line case (default 1).
-```
+
+```vue
@@ -46,6 +47,7 @@ There is a configurable number of attributes that are acceptable in one-line cas
/>
```
+
## :wrench: Options
@@ -69,7 +71,8 @@ There is a configurable number of attributes that are acceptable in one-line cas
### `"singleline": 3`
-```
+
+```vue
@@ -78,12 +81,14 @@ There is a configurable number of attributes that are acceptable in one-line cas
```
+
### `"multiline": 2`
-```
+
+```vue
```
+
### `"multiline": 1, "allowFirstLine": true`
-```
+
+```vue
```
+
## :books: Further reading
diff --git a/docs/rules/multiline-html-element-content-newline.md b/docs/rules/multiline-html-element-content-newline.md
index 1e9357a78..9fe8d45af 100644
--- a/docs/rules/multiline-html-element-content-newline.md
+++ b/docs/rules/multiline-html-element-content-newline.md
@@ -15,6 +15,7 @@ description: require a line break before and after the contents of a multiline e
This rule enforces a line break before and after the contents of a multiline element.
+
```vue
@@ -68,6 +69,7 @@ This rule enforces a line break before and after the contents of a multiline ele
>
```
+
## :wrench: Options
@@ -89,6 +91,7 @@ This rule enforces a line break before and after the contents of a multiline ele
### `"ignores": ["VueComponent", "pre", "textarea"]`
+
```vue
@@ -103,6 +106,7 @@ This rule enforces a line break before and after the contents of a multiline ele
Defines the Vue component that accepts preformatted text.
```
+
## :mag: Implementation
diff --git a/docs/rules/mustache-interpolation-spacing.md b/docs/rules/mustache-interpolation-spacing.md
index f9bea9956..05db8ed48 100644
--- a/docs/rules/mustache-interpolation-spacing.md
+++ b/docs/rules/mustache-interpolation-spacing.md
@@ -15,7 +15,8 @@ description: enforce unified spacing in mustache interpolations
This rule aims at enforcing unified spacing in mustache interpolations.
-```
+
+```vue
{{ text }}
@@ -25,6 +26,7 @@ This rule aims at enforcing unified spacing in mustache interpolations.
{{text}}
```
+
## :wrench: Options
@@ -41,7 +43,8 @@ This rule aims at enforcing unified spacing in mustache interpolations.
### `"never"`
-```
+
+```vue
{{text}}
@@ -51,6 +54,7 @@ This rule aims at enforcing unified spacing in mustache interpolations.
{{ text }}
```
+
## :mag: Implementation
diff --git a/docs/rules/name-property-casing.md b/docs/rules/name-property-casing.md
index b5d307b5b..98aa4a26c 100644
--- a/docs/rules/name-property-casing.md
+++ b/docs/rules/name-property-casing.md
@@ -15,7 +15,8 @@ description: enforce specific casing for the name property in Vue components
This rule aims at enforcing the style for the `name` property casing for consistency purposes.
-```
+
+```vue
```
+
-```
+
+```vue
```
+
## :wrench: Options
@@ -50,7 +54,8 @@ This rule aims at enforcing the style for the `name` property casing for consist
### `"kebab-case"`
-```
+
+```vue
```
+
-```
+
+```vue
```
+
## :books: Further reading
diff --git a/docs/rules/no-async-in-computed-properties.md b/docs/rules/no-async-in-computed-properties.md
index 92205af86..7e2a39629 100644
--- a/docs/rules/no-async-in-computed-properties.md
+++ b/docs/rules/no-async-in-computed-properties.md
@@ -17,7 +17,8 @@ If you need async computed properties you might want to consider using additiona
This rule is aimed at preventing asynchronous methods from being called in computed properties.
-```
+
+```vue
```
+
## :wrench: Options
diff --git a/docs/rules/no-confusing-v-for-v-if.md b/docs/rules/no-confusing-v-for-v-if.md
index 9e76e8cd1..4e8fccbd7 100644
--- a/docs/rules/no-confusing-v-for-v-if.md
+++ b/docs/rules/no-confusing-v-for-v-if.md
@@ -18,7 +18,8 @@ This rule reports the elements which have both `v-for` and `v-if` directives in
In that case, the `v-if` should be written on the wrapper element.
-```
+
+```vue
```
+
::: warning Note
diff --git a/docs/rules/no-dupe-keys.md b/docs/rules/no-dupe-keys.md
index 70bbf88b2..2cbed8ebb 100644
--- a/docs/rules/no-dupe-keys.md
+++ b/docs/rules/no-dupe-keys.md
@@ -16,7 +16,8 @@ This rule prevents to use duplicated names.
This rule is aimed at preventing duplicated property names.
-```
+
+```vue
```
+
## :wrench: Options
@@ -54,7 +56,8 @@ export default {
### `"groups": ["firebase"]`
-```
+
+```vue
```
+
## :mag: Implementation
diff --git a/docs/rules/no-duplicate-attributes.md b/docs/rules/no-duplicate-attributes.md
index 5658370fa..bdccf50bd 100644
--- a/docs/rules/no-duplicate-attributes.md
+++ b/docs/rules/no-duplicate-attributes.md
@@ -18,7 +18,8 @@ This rule reports duplicate attributes.
`v-bind:foo` directives are handled as the attributes `foo`.
-```
+
+```vue
@@ -33,6 +34,7 @@ This rule reports duplicate attributes.
```
+
## :wrench: Options
@@ -55,13 +57,15 @@ This rule reports duplicate attributes.
### `"allowCoexistClass": false, "allowCoexistStyle": false`
-```
+
+```vue
```
+
## :mag: Implementation
diff --git a/docs/rules/no-multi-spaces.md b/docs/rules/no-multi-spaces.md
index bc21e0a63..72655e99e 100644
--- a/docs/rules/no-multi-spaces.md
+++ b/docs/rules/no-multi-spaces.md
@@ -15,7 +15,8 @@ description: disallow multiple spaces
This rule aims at removing multiple spaces in tags, which are not used for indentation.
-```
+
+```vue
```
+
## :wrench: Options
@@ -56,6 +58,7 @@ This rule aims at removing multiple spaces in tags, which are not used for inden
### `"ignoreProperties": true`
+
```vue
@@ -67,6 +70,7 @@ This rule aims at removing multiple spaces in tags, which are not used for inden
/>
```
+
## :mag: Implementation
diff --git a/docs/rules/no-parsing-error.md b/docs/rules/no-parsing-error.md
index b9dd2ee4a..502104724 100644
--- a/docs/rules/no-parsing-error.md
+++ b/docs/rules/no-parsing-error.md
@@ -25,7 +25,8 @@ This rule tries to parse directives/mustaches in `` by the parser whic
Then reports syntax errors if exist.
-```
+
+```vue
{{ . }}
@@ -35,6 +36,7 @@ Then reports syntax errors if exist.
```
+
## :wrench: Options
diff --git a/docs/rules/no-reserved-keys.md b/docs/rules/no-reserved-keys.md
index ec2d99206..f16da3e25 100644
--- a/docs/rules/no-reserved-keys.md
+++ b/docs/rules/no-reserved-keys.md
@@ -14,7 +14,8 @@ description: disallow overwriting reserved keys
This rule prevents to use [reserved names](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/utils/vue-reserved.json) to avoid conflicts and unexpected behavior.
-```
+
+```vue
```
+
## :wrench: Options
@@ -54,7 +56,8 @@ export default {
### `"reserved": ["foo", "foo2"], "groups": ["firebase"]`
-```
+
+```vue
```
+
## :books: Further reading
diff --git a/docs/rules/no-shared-component-data.md b/docs/rules/no-shared-component-data.md
index 5c6d15f3e..cfa87ede8 100644
--- a/docs/rules/no-shared-component-data.md
+++ b/docs/rules/no-shared-component-data.md
@@ -17,7 +17,8 @@ When using the data property on a component (i.e. anywhere except on `new Vue`),
When the value of `data` is an object, it’s shared across all instances of a component.
-```
+
+```vue
```
+
-```
+
+```vue
```
+
## :wrench: Options
diff --git a/docs/rules/no-side-effects-in-computed-properties.md b/docs/rules/no-side-effects-in-computed-properties.md
index 485e63663..8e3e694b6 100644
--- a/docs/rules/no-side-effects-in-computed-properties.md
+++ b/docs/rules/no-side-effects-in-computed-properties.md
@@ -16,7 +16,8 @@ This rule is aimed at preventing the code which makes side effects in computed p
It is considered a very bad practice to introduce side effects inside computed properties. It makes the code not predictable and hard to understand.
-```
+
+```vue
```
+
-```
+
+```vue
```
+
## :wrench: Options
diff --git a/docs/rules/no-spaces-around-equal-signs-in-attribute.md b/docs/rules/no-spaces-around-equal-signs-in-attribute.md
index 9cf5ea386..8498e3cc3 100644
--- a/docs/rules/no-spaces-around-equal-signs-in-attribute.md
+++ b/docs/rules/no-spaces-around-equal-signs-in-attribute.md
@@ -15,7 +15,8 @@ description: disallow spaces around equal signs in attribute
This rule disallow spaces around equal signs in attribute.
-```
+
+```vue
@@ -23,6 +24,7 @@ This rule disallow spaces around equal signs in attribute.
```
+
::: tip Info
diff --git a/docs/rules/no-template-key.md b/docs/rules/no-template-key.md
index 1b67596a1..e62f754b2 100644
--- a/docs/rules/no-template-key.md
+++ b/docs/rules/no-template-key.md
@@ -16,7 +16,8 @@ Vue.js disallows `key` attribute on `` elements.
This rule reports the `` elements which have `key` attribute.
-```
+
+```vue
...
@@ -28,6 +29,7 @@ This rule reports the `` elements which have `key` attribute.
...
```
+
## :wrench: Options
diff --git a/docs/rules/no-template-shadow.md b/docs/rules/no-template-shadow.md
index b6e65593e..3c3238813 100644
--- a/docs/rules/no-template-shadow.md
+++ b/docs/rules/no-template-shadow.md
@@ -16,6 +16,7 @@ description: disallow variable declarations from shadowing variables declared in
This rule aims to eliminate shadowed variable declarations of v-for directives or scope attributes.
+
```vue
@@ -42,6 +43,7 @@ This rule aims to eliminate shadowed variable declarations of v-for directives o
}
```
+
## :wrench: Options
diff --git a/docs/rules/no-textarea-mustache.md b/docs/rules/no-textarea-mustache.md
index 9cfef08bc..b5e1230e1 100644
--- a/docs/rules/no-textarea-mustache.md
+++ b/docs/rules/no-textarea-mustache.md
@@ -14,7 +14,8 @@ description: disallow mustaches in `
```
+
::: warning Note
diff --git a/docs/rules/valid-v-on.md b/docs/rules/valid-v-on.md
index e9eaa5a86..1c77664f8 100644
--- a/docs/rules/valid-v-on.md
+++ b/docs/rules/valid-v-on.md
@@ -20,6 +20,7 @@ This rule reports `v-on` directives in the following cases:
- The directive does not have that attribute value and any verb modifiers. E.g. ``
+
```vue
@@ -37,6 +38,7 @@ This rule reports `v-on` directives in the following cases:
```
+
::: warning Note
@@ -60,12 +62,14 @@ This rule has an object option:
### `"modifiers": ["foo"]`
+
```vue
```
+
## :couple: Related rules
diff --git a/docs/rules/valid-v-once.md b/docs/rules/valid-v-once.md
index fbeeb09e4..db786fafa 100644
--- a/docs/rules/valid-v-once.md
+++ b/docs/rules/valid-v-once.md
@@ -20,6 +20,7 @@ This rule reports `v-once` directives in the following cases:
- The directive has that attribute value. E.g. ``
+
```vue
@@ -31,6 +32,7 @@ This rule reports `v-once` directives in the following cases:
```
+
## :wrench: Options
diff --git a/docs/rules/valid-v-pre.md b/docs/rules/valid-v-pre.md
index 75a21c896..82c366f74 100644
--- a/docs/rules/valid-v-pre.md
+++ b/docs/rules/valid-v-pre.md
@@ -20,6 +20,7 @@ This rule reports `v-pre` directives in the following cases:
- The directive has that attribute value. E.g. ``
+
```vue
@@ -31,6 +32,7 @@ This rule reports `v-pre` directives in the following cases:
```
+
## :wrench: Options
diff --git a/docs/rules/valid-v-show.md b/docs/rules/valid-v-show.md
index fe4d09093..ce962c369 100644
--- a/docs/rules/valid-v-show.md
+++ b/docs/rules/valid-v-show.md
@@ -20,6 +20,7 @@ This rule reports `v-show` directives in the following cases:
- The directive does not have that attribute value. E.g. ``
+
```vue
@@ -31,6 +32,7 @@ This rule reports `v-show` directives in the following cases:
```
+
::: warning Note
diff --git a/docs/rules/valid-v-text.md b/docs/rules/valid-v-text.md
index 759677c06..5c2d9901f 100644
--- a/docs/rules/valid-v-text.md
+++ b/docs/rules/valid-v-text.md
@@ -20,6 +20,7 @@ This rule reports `v-text` directives in the following cases:
- The directive does not have that attribute value. E.g. ``
+
```vue
@@ -31,6 +32,7 @@ This rule reports `v-text` directives in the following cases:
```
+
::: warning Note
diff --git a/tools/update-docs.js b/tools/update-docs.js
index eecebec6e..78aac8c1f 100644
--- a/tools/update-docs.js
+++ b/tools/update-docs.js
@@ -117,6 +117,19 @@ class DocFile {
return this
}
+ adjustCodeBlocks () {
+ // Adjust the necessary blank lines before and after the code block so that GitHub can recognize `.md`.
+ this.content = this.content.replace(
+ /()\n+```/gm,
+ '$1\n\n```'
+ )
+ this.content = this.content.replace(
+ /```\n+<\/eslint-code-block>/gm,
+ '```\n\n'
+ )
+ return this
+ }
+
updateFooter () {
const { name } = this.rule
const footerPattern = /## :mag: Implementation.+$/s
@@ -142,5 +155,6 @@ for (const rule of rules) {
.updateFooter()
.updateCodeBlocks()
.updateFileIntro()
+ .adjustCodeBlocks()
.write()
}