Skip to content

Commit 196e9f4

Browse files
authored
Add 'Why this rule is important' sections to rule docs (#1733)
Add 'Why this rule is important' sections to rule docs Added explanations to multiple rule documentation files describing the importance of each rule, along with further reading links where relevant. Also updated some headings for consistency. Update further reading links to use markdown format Replaced plain angle-bracketed URLs with markdown link syntax in the 'Further reading' sections of doctype-html5, frame-title-require, and main-require rule documentation for improved readability. Update spec-char-escape.mdx Update id-class-ad-disabled.mdx
1 parent 38d090c commit 196e9f4

9 files changed

+41
-2
lines changed

website/src/content/docs/rules/doctype-html5.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ Level: <Badge text="Warning" variant="caution" />
2828
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "https://www.w3.org/TR/html4/strict.dtd">
2929
<html></html>
3030
```
31+
32+
## Why this rule is important
33+
34+
The DOCTYPE declaration is required for HTML5 compliance and to ensure that the document is parsed correctly.
35+
36+
Further reading: [MDN Web Docs - Doctype](https://developer.mozilla.org/en-US/docs/Glossary/Doctype)

website/src/content/docs/rules/frame-title-require.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ Level: <Badge text="Warning" variant="caution" />
3535
<iframe src="content.html" title=""></iframe>
3636
<frame src="content.html">
3737
```
38+
39+
## Why this rule is important
40+
41+
The `<frame>` or `<iframe>` element must have an accessible name to help screen readers and assistive technologies understand the content of the frame or iframe.
42+
43+
Further reading: [Axe Rules - frame-title](https://dequeuniversity.com/rules/axe/4.8/frame-title)

website/src/content/docs/rules/id-class-ad-disabled.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ Level: <Badge text="Warning" variant="caution" />
2727
<div id="ad-container"></div>
2828
<div id="ad_container"></div>
2929
```
30+
31+
## Why this rule is important
32+
33+
Using `ad` in `id` or `class` attributes can cause elements to be hidden by ad-blocking software, which may break the layout or hide important content.

website/src/content/docs/rules/inline-style-disabled.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ Level: <Badge text="Warning" variant="caution" />
2020
```html
2121
<div style="color:red"></div>
2222
```
23+
24+
## Why this rule is important
25+
26+
Inline styles can make the code harder to read and maintain. They also make it harder to override styles with CSS.

website/src/content/docs/rules/link-rel-canonical-require.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Level: <Badge text="Error" variant="danger" />
1717
- `true`: enable rule
1818
- `false`: disable rule
1919

20-
## The following patterns are **not** considered rule violations
20+
### The following patterns are **not** considered rule violations
2121

2222
```html
2323
<!-- Valid canonical link with absolute URL -->
@@ -33,7 +33,7 @@ Level: <Badge text="Error" variant="danger" />
3333
<html><head><link rel="canonical" href="https://example.com/dresses/green-dresses#section1"></head></html>
3434
```
3535

36-
## The following patterns are considered rule violations
36+
### The following patterns are considered rule violations
3737

3838
```html
3939
<!-- Missing canonical link -->

website/src/content/docs/rules/main-require.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ Level: <Badge text="Warning" variant="caution" />
3838
### Why this rule is important
3939

4040
This rule ensures that the document has a clear and accessible structure, which is important for both users and screen readers.
41+
42+
Further reading: [Axe Rules - landmark-one-main](https://dequeuniversity.com/rules/axe/4.9/landmark-one-main)

website/src/content/docs/rules/meta-description-require.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,12 @@ Level: <Badge text="Error" variant="danger" />
3838
<!-- Meta description outside head tag -->
3939
<html><meta name="description" content="A description"><head></head></html>
4040
```
41+
42+
## Why this rule is important
43+
44+
The `<meta name="description">` tag is used to provide a description of the page, which helps with SEO.
45+
46+
Further reading:
47+
48+
- [MDN Web Docs - Setting a document meta description](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/content#setting_a_document_meta_description)
49+
- [Google Search Central - Meta descriptions](https://developers.google.com/search/docs/appearance/snippet#meta-descriptions)

website/src/content/docs/rules/meta-viewport-require.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ Level: <Badge text="Error" variant="danger" />
3535
<!-- Whitespace-only meta viewport content -->
3636
<html><head><meta name="viewport" content=" "></head></html>
3737
```
38+
39+
## Why this rule is important
40+
41+
The `<meta name="viewport">` tag is used to control the viewport of the page, which helps with responsive design.

website/src/content/docs/rules/spec-char-escape.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ Level: <Badge text="Error" variant="danger" />
2828
```html
2929
<span>aaa>bbb<ccc</span>
3030
```
31+
32+
## Why this rule is important
33+
34+
Special HTML characters like `<`, `>`, and `&` must be escaped to prevent them from being interpreted as HTML tags or entities. This avoids rendering issues and potential cross-site scripting (XSS) vulnerabilities.

0 commit comments

Comments
 (0)