Skip to content

feat(mdx/image): Add dead image detection#3275

Merged
SoonIter merged 2 commits intoweb-infra-dev:mainfrom
elliotcourant:feature/check-dead-images
Apr 7, 2026
Merged

feat(mdx/image): Add dead image detection#3275
SoonIter merged 2 commits intoweb-infra-dev:mainfrom
elliotcourant:feature/check-dead-images

Conversation

@elliotcourant
Copy link
Copy Markdown
Contributor

@elliotcourant elliotcourant commented Apr 4, 2026

Summary

I noticed during builds that if dead image links were used that they did not necessarily produce a warning. But dead links would. This copies the pattern used for dead link detection and basically applies it to images as well. But does not do anything for external images, only local ones.

Related Issue

N/A

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

I noticed during builds that if dead image links were used that they did
not necessarily produce a warning. But dead links would. This copies the
pattern used for dead link detection and basically applies it to images
as well. But does not do anything for external images, only local ones.
Copilot AI review requested due to automatic review settings April 4, 2026 22:30
@elliotcourant
Copy link
Copy Markdown
Contributor Author

Still need to update documentation, working on that now

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds dead local image detection to the MDX pipeline, mirroring the existing dead link detection behavior, with configurable options exposed via markdown.image.

Changes:

  • Introduces RemarkImageOptions (checkDeadImages with optional excludes) and wires it into MarkdownOptions.
  • Extends the remarkImage plugin to detect missing local images (absolute-from-public and relative-to-doc) and fail builds in production (or report via lint).
  • Adds unit tests covering existing/missing absolute & relative images and external image behavior; plumbs the new options through MDX options creation (disabled for isSsgMd).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/shared/src/types/index.ts Adds RemarkImageOptions and exposes markdown.image config.
packages/core/src/node/mdx/remarkPlugins/image.ts Implements dead local image detection and reporting/throwing logic.
packages/core/src/node/mdx/remarkPlugins/image.test.ts Adds tests for dead-image detection behavior.
packages/core/src/node/mdx/options.ts Passes docDirectory + markdown.image options into remarkImage (disabled for SSG-md).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@elliotcourant
Copy link
Copy Markdown
Contributor Author

I've updated part of the docs, but only the english version

Copy link
Copy Markdown
Member

@SoonIter SoonIter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks ❤️️

@SoonIter SoonIter changed the title feat(core): Add dead image detection feat(mdx/image): Add dead image detection Apr 7, 2026
@SoonIter SoonIter merged commit 4c5b91b into web-infra-dev:main Apr 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants