Skip to content

Markdownlint: Confusing or contradictory rule - expects empty line 1 vs MD041 requiring H1 #547

@konard

Description

@konard
Image

Description

I'm experiencing a contradictory markdown linting issue when using Codacy's markdownlint engine on a GitHub pull request.

The Problem

Codacy is reporting an issue on a markdown file:

  • File: FEATURE_COMPARISON.md
  • Line: 1
  • Error: "Expected: {None}; Actual: # Feature Comparison"
  • Category: Best practice

However, this contradicts standard markdown best practice:

  • MD041 (first-line-heading) requires files to start with an H1 heading
  • All other markdown files in the same repository start with H1 headings and pass Codacy checks

Expected Behavior

Either:

  1. Codacy should accept H1 headings on line 1 (consistent with MD041)
  2. Or provide clear documentation about why line 1 should be empty

Repository Context

All other .md files in the repository (README.md, README.ru.md, etc.) start with H1 headings on line 1 and pass Codacy checks without issues.

Request

Please clarify:

  1. Is this expected behavior?
  2. Why does this rule differ from standard markdownlint MD041?
  3. Should all markdown files have an empty first line, or is this a false positive?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions