Skip to content
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

Add a formatting step using mdformat as part of generate_mkdocs.py #10484

Merged
merged 4 commits into from
Mar 21, 2024

Conversation

augustelalande
Copy link
Contributor

Summary

The purpose of this change is mainly to address one of the issues outlined in #10427. Namely, some lists in the docs were not rendering properly when preceded by a text block without a newline character. This PR adds mdformat as a final step to the rule documentation script, so that any missing newlines will be added.

NB: The default behavior of mdformat is to escape markdown special characters found in text such as <. This resulted in some misformatted docs. To address this I implemented an ad-hoc mdformat plugin to override the behavior. This may be considered a bit 'hacky', but I think it's a good solution. Nevertheless, if someone has a better idea, let me know.

Test Plan

This change is hard to test systematically, however, I tried my best to look at the before and after diffs to ensure no unwanted changes were made to the docs.

@zanieb zanieb self-assigned this Mar 20, 2024
@zanieb zanieb added the documentation Improvements or additions to documentation label Mar 20, 2024
Copy link
Contributor

github-actions bot commented Mar 20, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Thanks

@charliermarsh charliermarsh enabled auto-merge (squash) March 21, 2024 00:30
@charliermarsh charliermarsh merged commit a5f41e8 into astral-sh:main Mar 21, 2024
17 checks passed
@augustelalande augustelalande deleted the mdformat-rule-docs branch March 21, 2024 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants