Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 07:15 UTC
fix(docs): center single-word OG image titles (#5110)
## Summary Docs OG cards with single-word titles (for example **Firewall**, the card in DES-3273) rendered noticeably right of center. Cause: Satori's `textWrap: 'balance'` binary-searches for the narrowest box that keeps the same line count. Text with no break opportunity never wraps, so the measured box shrinks to about half the drawn glyph width. Flex centering then centers the undersized box, pushing the visible word right. Multi-word titles were unaffected, which is why the shift looked inconsistent. Related to [DES-3273](https://linear.app/composio/issue/DES-3273/review-and-correct-visual-alignment-of-the-docs-og-image) Designated PR reviewer: [@jkomyno](mailto:alberto@composio.dev). ## Changes - `docs/app/api/og/route.tsx`: apply `textWrap: 'balance'` to titles and descriptions only when the text contains whitespace. Multi-line titles and descriptions keep balanced lines; removing balancing entirely left orphans such as a lone `on` on the Firewall subtitle. - `docs/tests/static/og-image.test.ts`: regression test that renders the route and measures title glyph bounds for `Firewall`, `Introduction`, and `Tool Router`. - `docs/README.md`: note the Satori caveat and a preview URL. Visible title center offset from the 1200px canvas midpoint: | Card | Before | After | |---|---:|---:| | Firewall (dark, with subtitle) | +62px | -2px | | Introduction | +94px | -5px | | Authentication | +110px | -10px | | Tool Router (multi-word) | -3px | -3px | Small residual offsets come from glyph side bearings, not layout. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactor/Chore - [ ] Documentation - [ ] Breaking change ## How Has This Been Tested? From `docs/`: - `bun test tests/static/og-image.test.ts`: 9 pass. The new test fails against `next` (`Firewall` 62.5px off-center) and passes with this change. - `bun test tests/static/`: 791 pass, 0 fail. One earlier run had a `semantic-parity` failure unrelated to OG rendering; it passed on rerun unchanged. - `bun run lint`: exit 0 (existing warnings only). - `bun run types:check`: passes. - Rendered the Firewall card and a two-line light card through the route and inspected them: title centered, subtitles still balanced across two lines. Preview locally: `/api/og?title=Firewall&description=Block+tool+calls+and+tool+results+you+don%27t+want+your+agent+to+act+on` ## Checklist - [ ] I have read the Code of Conduct and this PR adheres to it - [ ] I have read and understand every line of this diff, including any LLM-generated code - [x] Any third-party docs links or promotional content follow the [third-party links policy](https://github.com/ComposioHQ/composio/blob/next/CONTRIBUTING.md#third-party-links-in-docs) - [x] I ran linters/tests locally and they passed - [x] I updated documentation as needed - [x] I added tests or explain why not applicable - [ ] I added a changeset if this change affects published packages (docs-only; not needed)
No changes.