-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autoformat markdown files #66235
base: trunk
Are you sure you want to change the base?
Autoformat markdown files #66235
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Great idea 👍🏻 |
Honestly not sure how I feel about it. I like the idea of standardized formatting for all the things. But I do worry that for markdown files this will make contributing even harder for non developers than it already is. A lot of the nice spelling fixes / documentation additions are coming from first time contributors / non code contributors. And it would be a shame to block all those PRs because some arbitrary formatting in MD files. Most contributions like that actually happen through the GitHub web UI where this formatting won't be auto applied. We already have this issue with the need for generating the manifest files after documentation changes. But I worry this will make it even harder. I would love to see us actually make that part of contributing easier by running those commands / auto formatting directly in CI if we can fix it automatically. |
That's a good concern. I don't think this will change anything, it really doesn't matter if things are not all formatted on a given commit. As folks works with files, they'll tend towards the expected formatting. I don't believe anything will block commits that aren't fully formatted, I've just pushed a change to test that so we'll see 🙂 |
Size Change: 0 B Total Size: 1.84 MB ℹ️ View Unchanged
|
Flaky tests detected in a8e225f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12379241680
|
Ok, there's a problem. A bunch of files are generated but are not formatted. Which causes CI to fail 😕 The generated files would need to be correctly formatted. Related to your point 😀
I agree with you in general, especially where these files are expected to have their contents be updated and committed. For formatting, it's not such a big deal if things aren't up to date. |
f7b5cc4
to
6ff5d29
Compare
@@ -34,7 +34,7 @@ jobs: | |||
|
|||
# Find any changelog file that contains the Gutenberg PR link | |||
gutenberg_pr_url="https://github\.com/WordPress/gutenberg/pull/${PR_NUMBER}" | |||
changelog_file=$(grep -rl "[-*] ${gutenberg_pr_url}" "${changelog_folder}" | head -n 1) | |||
changelog_file=$(grep -Erl "[-*] +${gutenberg_pr_url}" "${changelog_folder}" | head -n 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is important to review. The backport changelog has changed its format to adhere to the standard markdown formatting. The regex would not correctly recognized the autoformatted markdown.
I've extracted this change to #68049 so it can be landed separate from all the autoformatting work here.
I've addressed this by adding docs autoformatting in a new script Unfortunately… it's quite slow 😞 |
What?
Why?
Autoformatting is used for JavaScript in Gutenberg. Why not for markdown as well? The consistency is nice.
Testing Instructions
Confirm that the rendered markdown files are unchanged. The formatting only affects the source.
Try modifying some markdown and committing locally, the files should be formatted on save.