Skip to content

no-bold-paragraph

✅ Recommended ⭐ CommonMark 🌟 GFM

🔗 Rule Source 🔗 Test Source

Disallow using fully bolded paragraphs as headings.

Rule Details

This rule disallows using fully bolded paragraphs as headings. The use of fully bolded paragraphs as headings is a common anti-pattern that reduces document semantics and accessibility. Instead, proper heading elements (#, ##, etc.) should be used.

Why This Is Important

Using proper headings instead of bolded paragraphs:

  • Improves document structure and semantics
  • Enhances accessibility for screen readers
  • Creates proper document outline
  • Makes navigation of the document easier

What This Rule Checks

This rule identifies paragraphs that:

  • Consist entirely of a bold element (**text** or __text__)
  • Are contained on a single line
  • Are not within list items
  • Have bold markup that spans the entire paragraph content

Examples

❌ Incorrect

Examples of incorrect code for this rule:

md
<!-- eslint mark/no-bold-paragraph: "error" -->

# Book

**First Chapter**

Content of the first chapter

__Second Chapter__

Content of the second chapter

✅ Correct

Examples of correct code for this rule:

md
<!-- eslint mark/no-bold-paragraph: "error" -->

# Book

## First Chapter

Content of the first chapter

## Second Chapter

Content of the second chapter

---

**Bold text** with normal text in the paragraph.

Text with **bold parts** is fine.

- **Bold text in a list item** is allowed.

Options

No options are available for this rule.

AST

This rule applies to the Strong, Paragraph, and ListItem nodes.

Prior Art