Skip to content

docs: add social cards and cut the two pages that repeated themselves - #517

Closed
shenxianpeng wants to merge 2 commits into
mainfrom
docs/social-cards-and-content-cleanup
Closed

docs: add social cards and cut the two pages that repeated themselves#517
shenxianpeng wants to merge 2 commits into
mainfrom
docs/social-cards-and-content-cleanup

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Aug 3, 2026

Copy link
Copy Markdown
Member

Two follow-ups from #515.

Social cards

Sharing a documentation link produced a bare URL with no preview image. The social plugin now renders one card per page, and each page carries the og:image tag pointing at it.

Verified locally rather than assumed — 17 cards generated, at the size the platforms expect:

site/assets/images/social/rules.png   1200x630   95% #2c9ccd, 3% white
<meta property="og:image" content="https://docs.commit-check.com/assets/images/social/rules.png" />

Deploy previews skip the cards. Nobody shares a preview link for its preview image, and skipping them keeps those builds fast and free of the system cairo dependency that rendering needs:

default            17 cards, og:image present
SOCIAL_CARDS=false  0 cards, build still succeeds

The GitHub Pages job installs libcairo2 explicitly. cairosvg dlopens it at runtime rather than bundling it, and I could not verify whether the runner image already carries it — so the workflow no longer depends on that being true.

The two leftover pages

Both were carried over from the Sphinx site converted but not rewritten, and both had since been overtaken by the pages written around them.

example.md — 374 → 191 lines. It opened with "Running as GitHub Action" and "Running as pre-commit hook", which now have guides of their own that go considerably further. Removed. What remains is what its navigation entry already called it: recipes for invoking the CLI — checking a message from the repository, a file or stdin; branch, committer and force-push checks; pointing at a different config; and the output formats a script actually reaches for.

The jq example was checked against real output, not written from memory — my first attempt used select(.passed | not), and the field is status:

$ commit-check -m --format json | jq -r '.checks[] | select(.status == "fail") | .rule_id'
CC001

what-is-new.md — 365 → 76 lines. It re-explained every feature a second time, next to a changelog that already recorded them and guides that now document them properly. Every section had somewhere better to point: AI attribution to its guide and CC013, force push to CC301, inherit_from to the organization guide, 2.0.0 to the migration page. It is now an index — what changed, why it mattered, and a link — with the changelog remaining the full record.

Testing

$ mkdocs build --strict     # zero warnings, both card modes
$ pytest tests/ -q
460 passed

Cross-page anchors used by the rewritten pages were checked against the rendered HTML (example/#blocking-force-pushes, example/#output-for-scripts-and-ci) rather than assumed to exist.

The one failing test, test_load_config_file_permission_error, reproduces on main and is unrelated: it uses os.chmod(0o000), which does not restrict root.

Summary by CodeRabbit

  • Documentation

    • Replaced the usage guide with a concise command-line recipes reference covering common commands, output formats, scripting, configuration, and hook guidance.
    • Simplified release highlights for versions 2.11.0 through 2.0.0, with focused examples and links to detailed documentation.
    • Added support for social preview cards on documentation pages.
  • Chores

    • Improved documentation build reliability and excluded local cache directories from version control.

Sharing a documentation link produced a bare URL with no preview image. The
social plugin now renders one card per page — the page title on the brand
blue, at the 1200x630 the platforms expect — and the pages carry the og:image
tag that points at it.

Deploy previews skip the cards. Nobody shares a preview link for its preview
image, and skipping them keeps those builds fast and clear of the system cairo
dependency that rendering needs.

Rewrite the two pages left over from the Sphinx site, both of which had been
overtaken by the pages written around them.

"Usage examples" opened with sections on running the checks as a GitHub Action
and as a pre-commit hook — both of which now have guides of their own that go
further. Removed, and what remains is what the page is for and what its
navigation entry already called it: recipes for invoking the CLI. The
scripting section now covers the output formats a script actually reaches for,
and the jq example was checked against real output rather than written from
memory.

"What's New" re-explained every feature a second time, next to a changelog
that already recorded them and guides that now document them properly. It is
now an index: what changed, why it mattered, and a link to the page that
covers it. 365 lines to 76.
@shenxianpeng
shenxianpeng requested a review from a team as a code owner August 3, 2026 22:24
@netlify

netlify Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploy Preview for commit-check ready!

Name Link
🔨 Latest commit fe8bc74
🔍 Latest deploy log https://app.netlify.com/projects/commit-check/deploys/6a7116f302018800084e311b
😎 Deploy Preview https://deploy-preview-517--commit-check.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@shenxianpeng, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 989093ed-0201-45bb-b382-8eb377f00afd

📥 Commits

Reviewing files that changed from the base of the PR and between 532e370 and fe8bc74.

📒 Files selected for processing (2)
  • docs/example.md
  • docs/what-is-new.md
📝 Walkthrough

Walkthrough

The documentation now provides command-line recipes and concise release highlights. MkDocs social card generation is configured with imaging support, CI Cairo installation, and disabled Netlify preview builds. Cache directories are ignored.

Changes

Documentation updates

Layer / File(s) Summary
Command-line recipes
docs/example.md
The guide now documents validation commands, hooks, output modes, scripting, and JSON parsing.
Release highlights
docs/what-is-new.md
Release notes for versions 2.11.0 through 2.0.0 are now concise and link to detailed documentation.
Social card build configuration
mkdocs.yml, pyproject.toml, .github/workflows/main.yml, netlify.toml, .gitignore
MkDocs social cards use imaging dependencies and Cairo support. Netlify preview builds disable card generation, and .cache/ is ignored.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: enhancement

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: adding social cards and reducing duplicated documentation.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/social-cards-and-content-cleanup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.43%. Comparing base (6751073) to head (fe8bc74).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #517      +/-   ##
==========================================
+ Coverage   97.34%   97.43%   +0.08%     
==========================================
  Files          12       12              
  Lines        1207     1207              
==========================================
+ Hits         1175     1176       +1     
+ Misses         32       31       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/example.md`:
- Around line 173-179: Update the range-check script around the `git rev-list`
loop to execute and validate `git rev-list -n "${1:-10}" HEAD` before iteration,
exiting nonzero if it fails so invalid ranges or non-Git directories cannot
succeed. Iterate over the validated revision output, and enable `pipefail` if
required so failures from the `git log | commit-check` pipeline affect the final
status.

In `@docs/what-is-new.md`:
- Around line 23-37: Add a 2.8.0 release entry to docs/what-is-new.md between
the existing 2.9.0 and earlier release sections, using the established
version-heading style and a concise highlight sourced from the v2.8.0 entry in
docs/changelog.md. Include a link to the changelog consistent with the
surrounding release highlights.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f12f49c4-e9f5-4bce-bb08-99f99f7b8985

📥 Commits

Reviewing files that changed from the base of the PR and between 6751073 and 532e370.

📒 Files selected for processing (7)
  • .github/workflows/main.yml
  • .gitignore
  • docs/example.md
  • docs/what-is-new.md
  • mkdocs.yml
  • netlify.toml
  • pyproject.toml

Comment thread docs/example.md Outdated
Comment thread docs/what-is-new.md
The check-recent.sh recipe expanded git rev-list inside the for loop, so a
failure produced an empty list and the script exited 0: run outside a
repository, or against an unreadable revision, it reported success without
checking anything. Resolve the revisions first and exit on failure.

Add the missing 2.8.0 entry: it introduced message_pattern and dropped
Python 3.9, which is the kind of change the highlights page exists for.
@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@codspeed-hq

codspeed-hq Bot commented Aug 3, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by ×12

⚡ 1 improved benchmark
✅ 402 untouched benchmarks
⏩ 116 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
test_empty_message_passes 28 ms 2.3 ms ×12

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing docs/social-cards-and-content-cleanup (fe8bc74) with main (6751073)

Open in CodSpeed

Footnotes

  1. 116 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@shenxianpeng
shenxianpeng deleted the docs/social-cards-and-content-cleanup branch August 4, 2026 07:01
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.

1 participant