Skip to content

graph: wikilinks inside code spans/fences are counted as links (graph.js doesn't reuse extractBodyLinks) #6

Description

@eivanovski-lab

Summary

mdbase graph broken reports wikilink-looking literals inside inline code spans and fenced code blocks as broken links.

Repro

A note containing a literal example in backticks:

Escaped-pipe table links `[[x\|alias]]` don't cascade; bare `[[example]]` is shown here as a literal.

mdbase graph broken reports targets x\|alias / example as broken links, although they are documentation examples, not links.

Root cause

dist/commands/graph.js implements its own extractWikilinks() — a bare wikilink regex over raw file text, with no code-span/fence exclusion.

Meanwhile the mdbase library already handles this correctly: @callumalpass/mdbase dist/links/parser.jsextractBodyLinks() skips fenced code blocks, indented code, and inline code spans (removeInlineCode()). I verified: on the same lines extractBodyLinks() returns no links, while graph broken counts them.

This also means the rename cascade (which uses the library parser and correctly ignores code spans) and graph disagree about what counts as a link.

Suggestion

Reuse the library's extractBodyLinks() in graph.js for body links instead of the local regex, so graph analysis and link cascading share one definition of a link.

Impact

False positives make graph broken noisy as a post-rename health check in collections whose docs contain wikilink syntax examples.

Version: mdbase-cli 0.1.0 (Homebrew-installed via npm, macOS).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions