Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Code blocks in Ask AI answers rendered as unstyled, low-contrast text: the
copy button overlapped the first line and long lines wrapped mid-URL.
DocSearch renders fenced blocks through its own marked renderer as:
<div class="DocSearch-CodeSnippet">
<button class="DocSearch-CodeSnippet-CopyButton">...</button>
<pre><code class="language-tsx">...</code></pre>
</div>
@docsearch/css ships no styling for that <pre>/<code> at all - only
`position: relative` on the wrapper plus the copy button chrome - so the
snippet inherited whatever the surrounding answer styles happened to set.
Snippets now match the site's own code blocks (theme/_prism-code.scss):
`--general-black-light` surface, `--inline-code-font`, `--general-gray` text,
horizontal scroll instead of wrapping, and top padding that clears the copy
button. Applied globally rather than scoped to a container so it covers both
the search modal and the Ask AI sidepanel.
Two things worth noting:
- The existing sidepanel rules force `code { color: #373739 !important }` in
light mode, which is unreadable on the dark snippet surface. The snippet
`code` colour is therefore set with matching specificity and !important,
scoped under both sidepanel colour modes.
- DocSearch does not syntax highlight. The marked renderer only emits a
`language-*` class, with no Prism/highlight.js pass, so this change covers
contrast, typography and layout - not token colours.
Also folds in the DocSearch CSS from PR #3052 (branch `ai-fixes`), which
overlaps this branch: `.DocSearch-Button` margin/transition, and
`.DocSearch-Container` z-index to lift the modal above the fixed navbar. Kept
in _doc-search.scss rather than a separate src/theme/SearchBar/styles.css so
all DocSearch styling stays in one place.
Not copied from #3052: its `:root` `--docsearch-primary-color` /
`--docsearch-text-color` pair. This file already overrides both per colour
mode, and has those exact two lines commented out on purpose at the top;
re-adding them at `:root` would leak a purple primary to DocSearch surfaces
rendered outside `.DocSearch`. Its blanket `.DocSearch-Button-Key
{ padding: 0 }` is included but is largely inert, since
`.DocSearch-Button-Key:first-child` in custom.scss sets padding with
!important.
3bf1004 to
929562b
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 929562b. Configure here.
| window.clearInterval(poll) | ||
| submit(input) | ||
| } | ||
| }, OPTION_CATCH_UP_POLL_MS) |
There was a problem hiding this comment.
Duplicate Ask AI submits on Enter
Medium Severity
Each intercepted Enter starts a new poll without canceling one already in flight, so a second Enter before the Ask AI option catches up replays submit more than once. Cleanup also leaves those intervals running, so a late replay can still fire after the listener is removed.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 929562b. Configure here.


Docusaurus doesn't by default support the agentStudio from Algolia. Using LiteLLM for us requires us to switch to agentStudio and use our custom integration. This PR swizzles out the component to make that parameter supported and working.
Note
Medium Risk
Ask AI changes add a global fetch patch and keyboard handling when an assistant ID is set; impact is limited to search/AI UX, not auth or data storage.
Overview
This PR wires Algolia DocSearch Ask AI to Agent Studio (needed for the LiteLLM-backed assistant) instead of relying on Docusaurus config alone, which cannot pass the
agentStudioflag because Joi validation rejects unknown keys.Configuration: The hardcoded
askAi.assistantIdis removed;ALGOLIA_ASSISTANT_IDfrom the environment optionally enablesthemeConfig.algolia.askAi. A swizzledSearchBarmergesagentStudio: trueinto Ask AI props at runtime, andRootpasses the same flag toDocSearchSidepaneland mounts the sidepanel only when an assistant ID is present.Runtime fixes: New
installAskAiWorkarounds()patches Agent Studio–specific DocSearch v4 issues: an Enter-key guard so Ask AI submits the query the user typed (not a stale highlighted option), and a scopedfetchinterceptor that blocks spurious auto-resubmits that Agent Studio rejects with 422.Tooling:
globals.d.tsadds a Docusaurus type reference so thetsc-filespre-commit hook type-checks staged theme files reliably.Reviewed by Cursor Bugbot for commit 929562b. Bugbot is set up for automated code reviews on this repo. Configure here.