Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat(docs): adopt shared inline code defaults in docs and kb (#51982)

Danny Whitea649e69e07f4
diff --git a/apps/docs/features/ui/CodeBlock/CodeBlock.client.tsx b/apps/docs/features/ui/CodeBlock/CodeBlock.client.tsx
index 91d1080dc99..c407f0c6223 100644
--- a/apps/docs/features/ui/CodeBlock/CodeBlock.client.tsx
+++ b/apps/docs/features/ui/CodeBlock/CodeBlock.client.tsx
@@ -135,7 +135,7 @@ export function AnnotatedSpan({
function Annotation({ annotation }: { annotation: CodeAnnotation }) {
const { text, docs, tags } = annotation
return (
- <div className="flex flex-col gap-2">
+ <div data-code-style="plain" className="flex flex-col gap-2">
<code className={cn('block bg-200 p-2', (docs || tags) && 'border-b border-default')}>
{text}
</code>
diff --git a/apps/docs/features/ui/PromptPanel.tsx b/apps/docs/features/ui/PromptPanel.tsx
index 3920c8494fe..3f1500d0313 100644
--- a/apps/docs/features/ui/PromptPanel.tsx
+++ b/apps/docs/features/ui/PromptPanel.tsx
@@ -227,11 +227,7 @@ function PromptMarkdown({ children }: { children: string }) {
/** Inline code chip for prompt bodies; opts out of the text shimmer. */
function PromptCode({ children }: { children?: ReactNode }) {
- return (
- <code className="shimmer-none rounded bg-surface-200 px-1 py-0.5 font-mono text-xs text-foreground">
- {children}
- </code>
- )
+ return <code className="shimmer-none">{children}</code>
}
const MARKDOWN_COMPONENTS = { code: PromptCode }
diff --git a/apps/docs/generator/legacy.ts b/apps/docs/generator/legacy.ts
index bc248b769a3..49d9165e26e 100644
--- a/apps/docs/generator/legacy.ts
+++ b/apps/docs/generator/legacy.ts
@@ -11,6 +11,7 @@
import * as fs from 'fs'
import * as yaml from 'js-yaml'
import { uniqBy } from 'lodash-es'
+
import { flattenSections } from '../lib/helpers'
import Example from './legacy/components/Example'
import Page from './legacy/components/Page'
diff --git a/apps/docs/styles/globals.css b/apps/docs/styles/globals.css
index 82d4d622f81..bcbb3437aa6 100644
--- a/apps/docs/styles/globals.css
+++ b/apps/docs/styles/globals.css
@@ -1,4 +1,5 @@
@import 'config/tailwind.config.css';
+@import 'config/inline-code.css';
@import './code-block.css';
@import './reference.css';
@import './loading-beam.css';
@@ -148,7 +149,7 @@ h6:not(.font-mono),
white-space: pre-line;
}
-.prose :where(p, a, code, pre):not(:where([class~='not-prose'], [class~='not-prose'] *)),
+.prose :where(p, a, pre):not(:where([class~='not-prose'], [class~='not-prose'] *)),
.prose :where(ol > li):not(:where([class~='not-prose'], [class~='not-prose'] *))::marker {
font-weight: inherit;
}
@@ -220,13 +221,6 @@ pre[class*='language-'] {
}
}
-.method-list-item-validation {
- code {
- @apply text-xs bg-control rounded-sm;
- padding: 1px 6px;
- }
-}
-
.method-list-group {
@apply p-0 m-0 list-none border-b;
}
@@ -284,20 +278,11 @@ pre[class*='language-'] {
}
}
-/* format <code> inside <p> */
h2 code,
h3 code,
h4 code {
word-break: keep-all !important;
white-space: nowrap !important;
- padding: 0.1rem 0.35rem !important;
-
- &:before {
- display: none;
- }
- &::after {
- display: none;
- }
}
article p strong {
@@ -309,15 +294,6 @@ a:has(code) {
box-shadow: none !important;
}
-/* fix code line wrapping */
-/* need to set this to happen from medium onwards, otherwise the would cause horizontal scroll */
-article p code {
- &::before,
- &::after {
- display: none !important;
- }
-}
-
.short-inline-codeblock {
word-wrap: break-word;
@media screen and (min-width: 769px) {
@@ -373,15 +349,7 @@ th code {
* First column (e.g. variable names): wrap at word boundaries, not mid-token.
*/
.prose :where(td:first-child) code {
- @apply break-words whitespace-normal;
-}
-
-/*
- * Other columns: prevents very long code lines (checksums, URLs, etc.) from
- * breaking table widths.
- */
-.prose :where(td:not(:first-child)) code {
- @apply break-all;
+ @apply break-normal break-words whitespace-normal;
}
.prose table td:first-child,
diff --git a/apps/kb/src/styles/globals.css b/apps/kb/src/styles/globals.css
index e8ddbff7e51..18b886db6fc 100644
--- a/apps/kb/src/styles/globals.css
+++ b/apps/kb/src/styles/globals.css
@@ -1,4 +1,5 @@
@import 'config/tailwind.config.css';
+@import 'config/inline-code.css';
@import './utilities.css';
@import './keyframes.css';