Skip to content

[ENH] Add --diff option to show diff when running with --check - #381

Open
tdgroot wants to merge 5 commits into
hukkin:masterfrom
tdgroot:check_diff
Open

[ENH] Add --diff option to show diff when running with --check#381
tdgroot wants to merge 5 commits into
hukkin:masterfrom
tdgroot:check_diff

Conversation

@tdgroot

@tdgroot tdgroot commented Jan 26, 2023

Copy link
Copy Markdown

We use mdformat to validate Markdown formatting in a documentation project we're running. Most users are contributing to the documentation by creating changes, commits and pull requests from the Github UI, so they won't be running any linting/validation on commit. In this case, it would be very useful for those users to see what mdformat is marking as "unformatted" and knowing what should be done to fix that.

This was highly inspired by the implementation that Black uses, as it seems to doing just what we need.

Looking forward to your thoughts and review :).

@welcome

welcome Bot commented Jan 26, 2023

Copy link
Copy Markdown

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.

Welcome to the EBP community! 🎉

@AlexanderGrooff

Copy link
Copy Markdown

Would be great to have this feature! 🚀

@tdgroot tdgroot changed the title Add --diff option to show diff when running with --check [ENH] Add --diff option to show diff when running with --check Oct 6, 2023
@tdgroot

tdgroot commented Oct 6, 2023

Copy link
Copy Markdown
Author

@hukkin any chance to get a review for this PR? :)

@hukkin

hukkin commented Oct 15, 2024

Copy link
Copy Markdown
Owner

Hi @tdgroot, thanks for contributing and sorry for the long wait!

Most users are contributing to the documentation by creating changes, commits and pull requests from the Github UI, so they won't be running any linting/validation on commit. In this case, it would be very useful for those users to see what mdformat is marking as "unformatted" and knowing what should be done to fix that.

I think you may find setting mdformat up with https://pre-commit.ci/ and pre-commit even more useful than this feature. The fixes would be automatically applied to PRs -> the contributor doesn't have to care about failures or bad formatting at all.

Regardless, I've decided to accept this feature. Do you still want to work on this or should I continue from where you left?

We should make --diff work also without --check, returning 0 also in the case there is a diff. Also mypy compains, and test coverage is not 100%.

@hukkin

hukkin commented Oct 15, 2024

Copy link
Copy Markdown
Owner

Closes #268

@tdgroot

tdgroot commented Oct 15, 2024

Copy link
Copy Markdown
Author

Hi @hukkin,

That's amazing! I'm not available to work on it this week, but I can update this PR next week I think. If that's taking too long for you, feel free to take my work and finish it :).

@Kristinita

Copy link
Copy Markdown

@tdgroot, @hukkin, is there any chances that the --diff will still be added to Mdformat?

Thanks.

@tdgroot

tdgroot commented Mar 2, 2026

Copy link
Copy Markdown
Author

@hukkin @Kristinita I finally updated the PR 😅

What do you think?

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.

4 participants