Skip to content

Preserve MkDocs syntax during Markdown formatting - #176

Merged
s2t2 merged 5 commits into
google:copybara_pushfrom
hugosmoreira:agent/preserve-mkdocs-markdown
Aug 21, 2026
Merged

s2t2 merged 5 commits into
google:copybara_pushfrom
hugosmoreira:agent/preserve-mkdocs-markdown

Conversation

@hugosmoreira

Copy link
Copy Markdown
Contributor

Fixes #103

Summary

  • Upgrade to mdformat 1.0.0 and add mdformat-mkdocs 5.3.0 in Poetry and pre-commit.
  • Format and check the complete docs tree, including the previously excluded docs/api files.
  • Enable MkDocs admonitions and use the issue's example in the contributor guide.
  • Update the formatter documentation and regenerate the lockfile with the repository's documented Poetry 2.1.2.

Plain mdformat changes both MkDocs admonitions and configured mkdocstrings directives in ways that break their structure. With mdformat-mkdocs, the same regression fixture is byte-for-byte unchanged.

Validation

  • poetry check --lock

  • mdformat README.md docs --check

  • Exact pinned pre-commit run mdformat --all-files

  • mkdocs build --clean (existing Griffe/link warnings remain)

  • Generated HTML contains the expected rendered admonition and API documentation

  • git diff --check

  • Full Python test suite (the locked tensorflow-io-gcs-filesystem==0.37.1 has no compatible Windows wheel; Linux CI is the authoritative run)

  • Appropriate changes to documentation are included in the PR

@s2t2

s2t2 commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Hi @hugosmoreira thanks for working on this. Let me know when its ready for review.

Also if there are any screenshots you can add of the locally-built docs site, that will be helpful for acceptance testing.

@hugosmoreira

Copy link
Copy Markdown
Contributor Author

Thanks! This is ready for review. I rebuilt the documentation site from the current PR head and confirmed that the MkDocs admonition and generated API reference render correctly. I’ve attached screenshots of both views.

sbsim-pr-176-admonition sbsim-pr-176-api-reference

@hugosmoreira
hugosmoreira marked this pull request as ready for review August 17, 2026 16:29

@s2t2 s2t2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@hugosmoreira thanks for taking this on!

This PR looks generally good to me.

Could you please reply to the two minor comments I left?

Then we can merge.

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is there a reason we are pinning to very specific versions rather than the general v4? was there an issue with v4?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question. There was no functional issue with v4. The initial commit used actions/checkout@v4 and actions/setup-python@v4, but the repository security scan reported zizmor/unpinned-uses for both and stated that a full commit hash was required by its blanket policy. The pinned commits are still v4; using full SHAs makes the references immutable and allowed the mandatory scan to pass. I therefore kept the SHA pins.

Comment thread .pre-commit-config.yaml Outdated
# See: https://mdformat.readthedocs.io/en/stable/users/installation_and_usage.html#usage-as-a-pre-commit-hook
- repo: https://github.com/hukkin/mdformat
rev: 0.7.22
- repo: https://github.com/executablebooks/mdformat

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I noticed that executablebooks owned repo redirects / resolves to the hukkin owned repo.

Is there a reason this needs to change or would we want to change back to the original hukkin repo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. GitHub resolves executablebooks/mdformat to the canonical hukkin/mdformat repository, and both URLs resolve tag 1.0.0 to the same commit. The URL change was unnecessary, so I restored https://github.com/hukkin/mdformat in signed commit 27dc976 while keeping rev 1.0.0 and mdformat-mkdocs==5.3.0. The exact pre-commit hook passed on all Markdown files and the MkDocs build completed successfully.

@s2t2
s2t2 merged commit aa9acdd into google:copybara_push Aug 21, 2026
13 of 14 checks passed
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.

Re-evaluate Usage of mdformat (Enable and Disable via Comments)

2 participants