Skip to content

Support Docusaurus content roots and static MDX heading IDs in repository-wide scans #37

Open

Description

@JAORMX

Problem

We are enabling matlatl for the stable user-docs/ corpus in stacklok/mecatl. The repository-wide check . --strict currently cannot model two Docusaurus conventions, so removing the corpus exclusion fails on valid site links and produces misleading graph findings.

Reproduced with matlatl v0.0.8 against Mecatl baseline 32535bf8e after removing user-docs/ from .matlatlignore.

1. Content-root-relative Markdown links

Mecatl's Docusaurus docs plugin uses path: '../user-docs' and routeBasePath: '/docs'. Inside that content tree, /building/deployment/mecated.md refers to user-docs/building/deployment/mecated.md, not building/deployment/mecated.md at the Git root.

Matlatl correctly applies its existing scan-root semantics, but offers no content-root mapping for this use case. The repository-wide scan reports 372 unresolved content-root-relative links. Scanning user-docs/ separately does not provide one graph containing both contributor docs and public docs, and leaves the MDX-anchor problem below.

2. Static Docusaurus MDX heading IDs

The generated SDK references import Heading from @theme/Heading and emit static IDs:

import Heading from '@theme/Heading';

[Widget](#api-widget-class)

<Heading as="h3" id="api-widget-class"><code>Widget</code></Heading>

Matlatl reports that the anchor does not exist. This accounts for 377 broken-anchor findings across user-docs/reference/typescript-sdk-api/{core,node,deno}.md (339 / 27 / 11). These are .md files processed as MDX by Docusaurus. No JavaScript evaluation is necessary to recognize these literal heading IDs.

3. Consequent graph findings

The missing root-relative edges also create apparent orphans, unreachable pages, and dead ends. Those findings should be recalculated after resolution is supported, rather than suppressed with blanket roots or exclusions. Some independent navigation issues may remain; we have not classified every structural finding as a tool bug.

Minimal reproduction

Create this tree:

README.md
user-docs/intro.md
user-docs/guide.md
user-docs/sdk.md

README.md:

# Repository

[Site overview](user-docs/intro.md)

user-docs/intro.md:

# Site overview

[Guide](/guide.md)
[SDK reference](sdk.md#api-widget-class)

user-docs/guide.md:

# Guide

[Overview](/intro.md)

user-docs/sdk.md:

import Heading from '@theme/Heading';

# SDK reference

[Widget](#api-widget-class)

<Heading as="h3" id="api-widget-class"><code>Widget</code></Heading>

[Overview](intro.md)

Run from the fixture root:

go run github.com/stacklok/matlatl/cmd/[email protected] check . --strict

Verified output:

matlatl check: 4 documents, 6 references — 2 broken link(s), 2 broken anchor(s), 0 ambiguous, 1 orphan(s), 1 unreachable

Desired behavior

  • Provide an explicit, scoped way to declare a documentation content root, without changing /... resolution for other repository documents or requiring a second disconnected scan.
  • Resolve both relative and content-root-relative paths into the same repository graph, including links entering the content tree from contributor docs.
  • Recognize literal IDs on supported Docusaurus/MDX heading elements for local and cross-document anchor checks; do not execute MDX or configuration JavaScript.
  • Continue reporting genuinely missing files and IDs, including negative regression controls.
  • Preserve scan-root containment and existing default behavior when no content root is configured.
  • Document the supported syntax and configuration. Ideally cover Docusaurus explicit Markdown heading IDs too if that syntax is supported; that additional syntax was not part of this reproduction.

Not upstream bugs

The Mecatl scan also found links to its excluded website/AGENTS.md, and converting external URLs to local links exposed two stale fragments (#the-toolhive-llm-gateway-no-api-key-needed and #watching-a-session-durably). Those are local corpus/link repairs, not requests to relax matlatl's checks.

This blocks removing the user-docs/ exclusion without either weakening the gate or changing stable site/link conventions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions