Skip to content

Docs: formatting #1616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ npm-debug.log*
/test/**/*.html
/test/**/*.xml

# CHANGELOG.md will be generated by semantic-release
CHANGELOG.md
changelog.mdx

# Report created by test
report.html

# Miscellaneous
CODEOWNERS
*.mdx
*.txt

## Website
Expand Down
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"semi": false,
"singleQuote": true,
"bracketSpacing": true,
"embeddedLanguageFormatting": "off",
"trailingComma": "es5",
"useTabs": false,
"tabWidth": 2,
Expand Down
2 changes: 2 additions & 0 deletions website/.htmlhintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"attr-whitespace": false,
"doctype-first": false,
"doctype-html5": true,
"h1-require": true,
"head-script-disabled": false,
"href-abs-or-rel": false,
"html-lang-require": true,
Expand All @@ -20,6 +21,7 @@
"inline-script-disabled": false,
"inline-style-disabled": false,
"input-requires-label": false,
"main-require": true,
"script-disabled": false,
"space-tab-mixed-disabled": false,
"spec-char-escape": false,
Expand Down
1 change: 0 additions & 1 deletion website/src/content/docs/rules/alt-require.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ keywords:

import { Badge } from '@astrojs/starlight/components';


Alt of `img` must be present and alt of `area[href]` and `input[type=image]` must be set with a value.

Level: <Badge text="Warning" variant="caution" />
Expand Down
3 changes: 0 additions & 3 deletions website/src/content/docs/rules/attr-lowercase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ description: Enforces all attribute names in HTML to be lowercase for consistenc

import { Badge } from '@astrojs/starlight/components';


Attribute name must be lowercase.

Level: <Badge text="Error" variant="danger" />
Expand All @@ -27,7 +26,6 @@ Level: <Badge text="Error" variant="danger" />
}
```


### The following pattern is **not** considered a rule violation:

```html
Expand All @@ -37,7 +35,6 @@ Level: <Badge text="Error" variant="danger" />
<svg width="200" height="200" viewBox="0 0 200 200" />
```


### The following pattern is considered a rule violation:

```html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: attr-no-unnecessary-whitespace
title: attr-no-unnecessary-whitespace
description: Disallows unnecessary spaces between attribute names and values in HTML elements.
---

import { Badge } from '@astrojs/starlight/components';

No spaces between attribute names and values.
Expand Down
4 changes: 1 addition & 3 deletions website/src/content/docs/rules/attr-sorted.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: attr-sorted
title: attr-sorted
description: Enforces a specific order for attributes in HTML elements to improve readability and consistency.
---

import { Badge } from '@astrojs/starlight/components';

Attributes should be sorted in the following order:
Expand All @@ -26,15 +27,12 @@ Level: <Badge text="Error" variant="danger" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
<div img="image" meta="meta" font="font"></div>
```



### The following pattern is considered a rule violation:

```html
Expand Down
3 changes: 1 addition & 2 deletions website/src/content/docs/rules/attr-unsafe-chars.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: attr-unsafe-chars
title: attr-unsafe-chars
description: Disallows unsafe characters in attribute values to prevent rendering and security issues.
---

import { Badge } from '@astrojs/starlight/components';

Attribute value cannot use unsafe chars.
Expand All @@ -16,7 +17,6 @@ Level: <Badge text="Warning" variant="caution" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
Expand All @@ -25,7 +25,6 @@ Level: <Badge text="Warning" variant="caution" />
</li>
```


### The following pattern is considered a rule violation:

```html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: attr-value-double-quotes
title: attr-value-double-quotes
description: Requires attribute values in HTML to be enclosed in double quotes for consistency and standards compliance.
---

import { Badge } from '@astrojs/starlight/components';

Attribute value must closed by double quotes.
Expand All @@ -14,14 +15,12 @@ Level: <Badge text="Error" variant="danger" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
<a href="" title="abc"></a>
```


### The following pattern is considered a rule violation:

```html
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/rules/attr-value-not-empty.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: attr-value-not-empty
title: attr-value-not-empty
description: Ensures all attributes have non-empty values to prevent invalid or ambiguous HTML.
---

import { Badge } from '@astrojs/starlight/components';

Attribute must set value.
Expand All @@ -20,7 +21,6 @@ Level: <Badge text="Warning" variant="caution" />
<input type="button" disabled="disabled" />
```


### The following pattern is considered a rule violation:

```html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ id: attr-value-single-quotes
title: attr-value-single-quotes
description: Requires attribute values in HTML to be enclosed in single quotes for consistency.
---
import { Badge } from '@astrojs/starlight/components';

import { Badge } from '@astrojs/starlight/components';

Attribute value must closed by single quotes.

Expand All @@ -15,7 +15,6 @@ Level: <Badge text="Error" variant="danger" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/rules/attr-whitespace.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ id: attr-whitespace
title: attr-whitespace
description: Disallows leading or trailing spaces inside attribute values to ensure clean and valid HTML.
---
import { Badge } from '@astrojs/starlight/components';

import { Badge } from '@astrojs/starlight/components';

No leading or trailing spaces inside attribute values.

Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/rules/doctype-first.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: doctype-first
title: doctype-first
description: Ensures the doctype declaration appears before any non-comment content in HTML documents.
---

import { Badge } from '@astrojs/starlight/components';

Doctype must be declared before any non-comment content. Comments and whitespace are allowed before the DOCTYPE declaration.
Expand All @@ -14,7 +15,6 @@ Level: <Badge text="Error" variant="danger" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
Expand Down
1 change: 1 addition & 0 deletions website/src/content/docs/rules/doctype-html5.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: doctype-html5
title: doctype-html5
description: Ensures the doctype is HTML5.
---

import { Badge } from '@astrojs/starlight/components';

Doctype must be HTML5.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: empty-tag-not-self-closed
title: empty-tag-not-self-closed
description: Ensures empty HTML tags are not self-closed, following HTML standards for void elements.
---

import { Badge } from '@astrojs/starlight/components';

The empty tag should not be closed by self.
Expand All @@ -14,14 +15,12 @@ Level: <Badge text="Warning" variant="caution" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
<br>
```


### The following pattern is considered a rule violation:

```html
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/rules/h1-require.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description: Ensures that an HTML document contains at least one `<h1>` element
sidebar:
badge: New
---

import { Badge } from '@astrojs/starlight/components';

A H1 heading element is required in HTML documents. The heading can not be empty. This rule ensures that the document has a clear and accessible structure, which is important for both users and search engines.
Expand All @@ -16,7 +17,6 @@ Level: <Badge text="Warning" variant="caution" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
Expand Down
1 change: 0 additions & 1 deletion website/src/content/docs/rules/head-script-disabled.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Level: <Badge text="Warning" variant="caution" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
Expand Down
1 change: 1 addition & 0 deletions website/src/content/docs/rules/href-abs-or-rel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: href-abs-or-rel
title: href-abs-or-rel
description: Enforces href attributes to be either absolute or relative URLs as specified in the configuration.
---

import { Badge } from '@astrojs/starlight/components';

Href must be absolute or relative.
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/rules/html-lang-require.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ description: Requires the lang attribute on the <html> element to ensure proper
keywords:
- i18n
---
import { Badge } from '@astrojs/starlight/components';

import { Badge } from '@astrojs/starlight/components';

The lang attribute of an `<html>` element must be present and should be valid.

Expand Down
3 changes: 1 addition & 2 deletions website/src/content/docs/rules/id-class-ad-disabled.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: id-class-ad-disabled
title: id-class-ad-disabled
description: Prevents the use of 'ad' in id or class attributes to avoid issues with ad blockers.
---

import { Badge } from '@astrojs/starlight/components';

Id and class can not use ad keyword, it will blocked by adblock software.
Expand All @@ -14,14 +15,12 @@ Level: <Badge text="Warning" variant="caution" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
<div id="adcontainer"></div>
```


### The following pattern is considered a rule violation:

```html
Expand Down
3 changes: 1 addition & 2 deletions website/src/content/docs/rules/id-class-value.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ id: id-class-value
title: id-class-value
description: Enforces specific naming conventions for id and class attribute values in HTML elements.
---
import { Badge } from '@astrojs/starlight/components';

import { Badge } from '@astrojs/starlight/components';

Id and class value must meet some rules: underline, dash, hump.

Expand All @@ -17,7 +17,6 @@ Level: <Badge text="Warning" variant="caution" />
3. hump: enable rule ( aaaBbb )
4. false: disable rule


### The following patterns are **not** considered rule violations:

```html
Expand Down
4 changes: 1 addition & 3 deletions website/src/content/docs/rules/id-unique.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ id: id-unique
title: id-unique
description: Ensures all id attributes in an HTML document are unique to prevent conflicts and unexpected behavior.
---
import { Badge } from '@astrojs/starlight/components';

import { Badge } from '@astrojs/starlight/components'

ID attributes must be unique in the document.

Expand All @@ -15,14 +15,12 @@ Level: <Badge text="Error" variant="danger" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
<div id="id1"></div><div id="id2"></div>
```


### The following pattern is considered a rule violation:

```html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ id: inline-script-disabled
title: inline-script-disabled
description: Disallows the use of inline JavaScript in HTML elements for improved security and maintainability.
---
import { Badge } from '@astrojs/starlight/components';

import { Badge } from '@astrojs/starlight/components';

Inline script cannot be used.

Expand Down
1 change: 1 addition & 0 deletions website/src/content/docs/rules/inline-style-disabled.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ id: inline-style-disabled
title: inline-style-disabled
description: Disallows the use of inline style attributes to promote separation of content and presentation.
---

import { Badge } from '@astrojs/starlight/components';

Inline style cannot be used.
Expand Down
3 changes: 1 addition & 2 deletions website/src/content/docs/rules/input-requires-label.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ keywords:
- label
- accessibility
---
import { Badge } from '@astrojs/starlight/components';

import { Badge } from '@astrojs/starlight/components';

All `<input>` tags must have a corresponding `<label>` tag.

Expand All @@ -19,7 +19,6 @@ Level: <Badge text="Warning" variant="caution" />
1. true: enable rule
2. false: disable rule


### The following patterns are **not** considered rule violations:

```html
Expand Down
Loading