镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix: name the document a refused Markdown link was authored in - #94

Closed
glennmichael123 wants to merge 1 commit into
mainfrom
fix/name-the-document-a-refused-link-is-in
Closed

glennmichael123 wants to merge 1 commit into
mainfrom
fix/name-the-document-a-refused-link-is-in

Conversation

@glennmichael123

Copy link
Copy Markdown
Member

Closes #92.

What changed

Both link failures in resolveLink named the destination and nothing else:

error: Markdown link has no documentation source: ./missing-one.md

The destination is the half the reader already knows, because it is the part that is
missing. The file holding the link is what has to be edited, and it was not in the
message, so acting on it meant grepping the repository for the string.

The throw site already had the answer. resolveLink reads page.sourceFile on the line
above, to resolve the destination it then rejects, so nothing new is threaded through:

error: guides/start.md: Markdown link has no documentation source: ../adr/absent.md

Relative to the documentation root, because an absolute temporary path is noise in a
build log. The same applies to Markdown link has no rendered page, which had the same
shape.

Includes

Named file is the included one rather than its host. rewriteMarkdownSourceLinks hands
resolveLink the innermost origin on its include stack, so page.sourceFile is already
where the link was written. The two differ exactly when the message matters most, so
there is a test for it.

Tests

Two, in test/markdown-source-links.test.ts beside the existing coverage for this area.
Both were run against the unpatched source first and fail there:

Expected substring: "guides/start.md: Markdown link has no documentation source: ../adr/absent.md"
Received message: "Markdown link has no documentation source: ../adr/absent.md"

Full suite: 612 pass, 0 fail. Lint is unchanged at 3 pre-existing warnings in README.md
and serve.ts, identical before and after. tsc --noEmit is clean.

Not in this change

#93, the build stopping at the first unresolvable link so N of them cost N builds. That
one needs failures collected across the render and reported together, which is a larger
change than this message fix and is better judged on its own.

🤖 Generated with Claude Code

Both link failures named the destination and nothing else, which is the half
the reader already knows: the destination is what is missing, and the file
holding the link is what has to be edited. On a docs set of any size the only
way to act on the message was to grep for the string.

The throw site already had the answer. `resolveLink` reads `page.sourceFile`
on the line above, to resolve the destination it then rejects, so this is the
path relative to the documentation root rather than anything newly threaded
through.

Under an include it names the included file rather than its host, because
`rewriteMarkdownSourceLinks` hands `resolveLink` the innermost origin on its
stack. That is the file somebody has to open, and the two differ exactly when
the message matters most.

Closes #92.
@netlify

netlify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for bunpress ready!

Name Link
🔨 Latest commit 33ba918
🔍 Latest deploy log https://app.netlify.com/projects/bunpress/deploys/6adf487d7e46db0f40dbb3a8
😎 Deploy Preview https://deploy-preview-94--bunpress.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@glennmichael123

Copy link
Copy Markdown
Member Author

Folded into #95, which now targets main and carries both commits: this one unchanged, plus the collecting change for #93. Closing to leave a single PR to review rather than a stack.

@glennmichael123
glennmichael123 deleted the fix/name-the-document-a-refused-link-is-in branch October 26, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dead-link build failure does not name the file containing the link, and buries the message under minified bundle output

1 participant