Skip to content

Anchor links to headings with numbered prefixes (e.g. "2. Title") are incorrectly flagged as broken #3246

@wandergeek

Description

@wandergeek

Describe the bug

docs-builder reports cross-file anchor links as broken when the target heading starts with a number-dot prefix (e.g. ## 2. Create your Slack app). The links work correctly in GitHub, VS Code, and every other standard Markdown renderer — only docs-builder's link validator rejects them.

Error produced:

error::d.b.d.Log :: `2-create-your-slack-app` does not exist in getting-started.md. (docs/slack-apps.md:47)
error::d.b.d.Log :: `2-create-your-slack-app` does not exist in getting-started.md. (docs/slack-apps.md:58)

The issue is an anchor-slug mismatch. GitHub's spec strips the trailing period from 2. when generating the slug, producing 2-create-your-slack-app. docs-builder appears to generate a different slug for the same heading (possibly 2.-create-your-slack-app or similar), so its validator cannot find the anchor that writers naturally link to.

Expected behavior

docs-builder should generate (and resolve) anchor slugs using the same algorithm as GitHub Flavored Markdown:

  • Lowercase everything
  • Strip all characters except letters, digits, spaces, and hyphens
  • Replace spaces with hyphens

Under that algorithm ## 2. Create your Slack app2-create-your-slack-app, which is exactly what the links use.

Steps to reproduce

  1. Create getting-started.md with the following heading:
## 2. Create your Slack app

Some content here.
  1. Create slack-apps.md that links to it:
See [docs/getting-started.md](getting-started.md#2-create-your-slack-app).
  1. Run docs-builder — it reports the anchor as missing.
  2. Open the same link in GitHub or any standard Markdown preview — it resolves correctly.

Tooling

  • docs-builder
  • migration tooling
  • I'm not sure

Metadata

Metadata

Assignees

No one assigned

    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