slorber / docusaurus-mdx-checker

Report potential MDX v2 parsing errors found in your content
MIT License
13 stars 7 forks source link

Support for only processing files modified in a specified git range #5

Closed beveradb closed 2 months ago

beveradb commented 2 months ago

Hey @slorber, thanks for all your work on Docusaurus, it's wonderful! <3

I had a use case which needed the ability to validate modified docs files (in a PR) were valid before they are allowed to be merged, and I couldn't find any easy way to do that so I forked your validator and added functionality.

If that's of interest to you and you wish to re-integrate, feel free to take this and modify it as you wish.

Otherwise, feel free to close this and I'll keep using it from my fork :)

Cheers, Andrew

slorber commented 2 months ago

Hey thanks

To be honest I'm not sure to understand what this means.

I had a use case which needed the ability to validate modified docs files (in a PR) were valid before they are allowed to be merged, and I couldn't find any easy way to do that so I forked your validator and added functionality.

Can you explain? Show me an example PR or something?

What did the tool do in its current form and how this PR behave differently?

Since we have an (undocumented) node API, couldn't you implement your behavior "from the outside" using the include/exclude options?

The goal for me is to keep this CLI quite minimal and let you implement things on your side rather than trying to solve every problem every user might eventually encounter with the default CLI.

beveradb commented 2 months ago

That's fair, and it may be better for me to keep the thing I've built separate then - but I wanted to open the discussion with you just in case you wanted it tidied up into a PR for this repo instead ☺️

So basically I just needed a CI job to validate files modified in the current PR / changeset - and I couldn't find an easy existing way to do that without building something, so I built this.

I use it in our content repos GitHub actions workflow to prevent broken docs getting added to repos, like so:

npx docusaurus-mdx-checker-diff -r $SHA1..$SHA2

If that functionality is too niche for this repo and you're fine with me keeping it separate, no action required and we can close this PR 😊

slorber commented 2 months ago

Thanks for the explanation. The idea makes sense but I'd prefer to keep it separately because I doubt others will use it. I'm going to close but let me know if you are unable to implement it with the current node API and we'll look for a solution.