Skip to content

feat: add support for @astrojs/markdoc#1829

Merged
webpro merged 4 commits into
webpro-nl:mainfrom
trueberryless:feat/astro-markdoc
Jun 27, 2026
Merged

feat: add support for @astrojs/markdoc#1829
webpro merged 4 commits into
webpro-nl:mainfrom
trueberryless:feat/astro-markdoc

Conversation

@trueberryless

Copy link
Copy Markdown
Contributor

Description

This PR creates a new Knip plugin for the @astrojs/markdoc package.
Astro's Markdoc integration offers a configuration file, which references Astro components via the render property (in nodes and tags). The plugin resolves all those paths, so the Knip analysis graph can be constructed.

I decided to add the astro dep in the fixture as it is a peerDep from @astrojs/markdoc.
I added the config file as a default production entry, because of this tip:

image

However, I remember reading somewhere that config files should never be entries (not sure if I am misremembering), so I wanted to mention it here to hopefully make reviewing the PR easier.


This PR should also enable auto-detection for users of @astrojs/starlight-markdoc, as that package has @astrojs/markdoc as a peerDep, so they need to install it either way 🙌

@pkg-pr-new

pkg-pr-new Bot commented Jun 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/knip@1829
npm i https://pkg.pr.new/@knip/language-server@1829
npm i https://pkg.pr.new/@knip/mcp@1829

commit: a4126f3

@webpro webpro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for another plugin! 🥳 Just a few nits left.

Comment thread packages/knip/src/plugins/astro-markdoc/index.ts Outdated
Comment thread packages/knip/src/plugins/astro-markdoc/index.ts Outdated
Co-authored-by: Lars Kappert <[email protected]>
@trueberryless

Copy link
Copy Markdown
Contributor Author

I fixed our suggestions and also added a second parameter to the component method (alto mocked), because @astrojs/markdoc supports named exports.

@webpro
webpro merged commit 94e2863 into webpro-nl:main Jun 27, 2026
30 checks passed
@webpro

webpro commented Jun 27, 2026

Copy link
Copy Markdown
Member

Thanks! 🚀

@trueberryless
trueberryless deleted the feat/astro-markdoc branch June 27, 2026 20:56
@webpro

webpro commented Jun 28, 2026

Copy link
Copy Markdown
Member

🚀 This pull request is included in v6.23.0. See Release 6.23.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

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.

2 participants