Skip to content

fix(docs-theme): wrap long inline code on API pages - #420

Merged
nickvigilante merged 1 commit into
mainfrom
vigilante/api-inline-code-wrap
Dec 4, 2026
Merged

nickvigilante merged 1 commit into
mainfrom
vigilante/api-inline-code-wrap

Conversation

@nickvigilante

Copy link
Copy Markdown
Collaborator

Merge order

Independent. It touches only packages/docs-theme/src/brand.css and its test, so it can merge before or after any other open PR.

Summary

Inline code in the REST API reference had two faults. Long values, such as the filter syntax in the chats q parameter, ran past the edge of their card. A value that wrapped, such as » pull_request_draft in a response schema table, drew its border only on the first and last fragments, so it looked like two separate boxes.

Design or Fix

A new rule on .coder-api-page :not(pre) > code sets overflow-wrap: anywhere, so a long value breaks inside its cell, and box-decoration-break: clone, so each wrapped line keeps its own padding and border. The existing chip colours, border and radius are untouched, so the prefers-contrast: more border from the existing tokens still applies. Nothing is added to the page chrome, so layout shift is unchanged, and there are no asset URLs. The rule is scoped to API pages because the issue shows the problem only there.

QA

Open each page in Firefox and Chrome. Neither Firefox nor the preview was checked by me, so mark the Firefox steps as unverified until you have looked.

  1. Open the Chats list-chats page (link below) and scroll to the q parameter in the query parameters. Narrow the window to about 600 px wide. Every inline code chip, including the long status:<waiting|running|...> one, stays inside the card, with no horizontal scrolling and nothing running under the sidebar.
  2. On the same page, scroll to the response schema table and find a row whose name wraps onto two lines at that width (for example » pull_request_draft). The chip shows a complete rounded border around each line, not an open edge where the line breaks.
  3. Widen the window to full size. Short chips look as they did before.
  4. Switch the site to More contrast from the contrast control and repeat step 2. The chip edges are still drawn on every line.

Pages to compare

What to check Production Preview
Long inline code in the q parameter stays in its card https://coder.com/docs/reference/api/chats/list-chats/ https://docs-engine-git-vigilante-api-inline-code-wrap-coder.vercel.app/reference/api/chats/list-chats/
Wrapped names in the response schema table keep a full border https://coder.com/docs/reference/api/chats/list-chats/#responseschema https://docs-engine-git-vigilante-api-inline-code-wrap-coder.vercel.app/reference/api/chats/list-chats/#responseschema

The preview alias always serves the latest deploy of this PR and needs a Vercel login. The preview host above is my best guess at the alias, so use the link from the docs preview status if it differs.

Testing

A new test in packages/docs-theme/scripts/brand.test.mjs parses brand.css with postcss and asserts both declarations. It failed against the old CSS (overflow-wrap was undefined) and passes now. All 39 @coder/docs-theme tests pass, and that package's lint (Oxfmt and Stylelint) is clean. I did not render an API page in a browser: the fixture corpus has no API page, so the visual result is unverified here.

Upstream

No. This is our own CSS for how Coder's theme styles fumadocs-openapi output, not a bug in fumadocs-ui or fumadocs-core.

Linear: https://linear.app/codercom/issue/DOCS-1740/fix-inline-code-styling-and-wrapping-in-api-docs


🤖 Built with AI assistance.

…r per line

Long values such as a search query's filter syntax ran past the card edge, and a value that wrapped drew a border only on its first and last fragments, leaving a split box. Inline code on an API page now breaks anywhere and clones its padding and border onto every line.

Assisted-by: AI
@vercel

vercel Bot commented Nov 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
coder-docs Skipped Skipped Nov 30, 2026 6:53pm UTC

Request Review

@nickvigilante
nickvigilante marked this pull request as ready for review December 4, 2026 19:11
@nickvigilante
nickvigilante requested a review from a team as a code owner December 4, 2026 19:11

@Jesswinters Jesswinters 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.

LGTM!

@nickvigilante
nickvigilante merged commit e507ba6 into main Dec 4, 2026
36 of 38 checks passed
@nickvigilante
nickvigilante deleted the vigilante/api-inline-code-wrap branch December 4, 2026 19:15

This branch is waiting to be deployed

1 inactive and 1 waiting deployments
docs-preview — 617b365f Waiting Nov 30, 2026 by nickvigilante via preview / deploy preview #139
Preview — 617b365f Deployed Nov 30, 2026 by vercel[bot]
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.

2 participants