Skip to content

Commit

Permalink
docs: add docs for prefer-docusaurus-heading rule
Browse files Browse the repository at this point in the history
Signed-off-by: Devansu <devansuyadav@gmail.com>
  • Loading branch information
Devansu-Yadav committed Dec 31, 2022
1 parent 199da9c commit e351bf9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions website/docs/api/misc/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ For more fine-grained control, you can also enable the plugin manually and confi
| [`@docusaurus/no-untranslated-text`](./no-untranslated-text.md) | Enforce text labels in JSX to be wrapped by translate calls | |
| [`@docusaurus/string-literal-i18n-messages`](./string-literal-i18n-messages.md) | Enforce translate APIs to be called on plain text labels ||
| [`@docusaurus/no-html-links`](./no-html-links.md) | Ensures @docusaurus/Link is used instead of `<a>` tags ||
| [`@docusaurus/prefer-docusaurus-heading`](./prefer-docusaurus-heading.md) | Ensures @theme/Heading is used instead of `<hn>` tags for headings ||

✅ = recommended

Expand Down
31 changes: 31 additions & 0 deletions website/docs/api/misc/eslint-plugin/prefer-docusaurus-heading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
slug: /api/misc/@docusaurus/eslint-plugin/prefer-docusaurus-heading
---

# prefer-docusaurus-heading

Ensures that the `@theme/Heading` theme component provided by Docusaurus [`theme-classic`](../../themes/theme-classic.md) is used instead of `<hn>` tags for headings.

## Rule Details {#details}

Examples of **incorrect** code for this rule:

```html
<h1>This is heading 1</h1>

<h2>This is heading 2</h2>

<h3>This is heading 3</h3>
```

Examples of **correct** code for this rule:

```javascript
import Heading from '@theme/Heading'

<Heading as='h1'>This is heading 1</Heading>

<Heading as='h2'>This is heading 2</Heading>

<Heading as='h3'>This is heading 3</Heading>
```

0 comments on commit e351bf9

Please sign in to comment.