Skip to content

Open-source status page, incident response and uptime monitoring

fix(docs): clean up TOC labels and stop sideways scrolling (#2619)

Harsh Kumar7f52f656e1e5
diff --git a/apps/web/src/content/docs-toc.tsx b/apps/web/src/content/docs-toc.tsx
index f9a4642f6..d2b744fe0 100644
--- a/apps/web/src/content/docs-toc.tsx
+++ b/apps/web/src/content/docs-toc.tsx
@@ -60,7 +60,7 @@ export function TableOfContents({ items }: { items: TocItem[] }) {
<a
href={`#${item.slug}`}
className={cn(
- "ease text-muted-foreground hover:bg-muted hover:text-foreground block py-2 transition-colors duration-150 motion-reduce:transition-none",
+ "ease text-muted-foreground hover:bg-muted hover:text-foreground block py-2 break-words transition-colors duration-150 motion-reduce:transition-none",
item.depth === 2 ? "pl-2" : "pl-4",
active === item.slug && "bg-muted text-foreground",
)}
diff --git a/apps/web/src/content/toc.ts b/apps/web/src/content/toc.ts
index 36fdaaa36..1d3b78929 100644
--- a/apps/web/src/content/toc.ts
+++ b/apps/web/src/content/toc.ts
@@ -5,7 +5,8 @@ export type TocItem = { depth: 2 | 3; text: string; slug: string };
// Extract h2/h3 headings from raw MDX for the table of contents. Slugs are
// produced with the same `slugify` that `createHeading` uses at render time, so
// the TOC links resolve to the real heading ids. Fenced code blocks are skipped
-// so `## comment` lines inside code don't leak into the TOC.
+// so `## comment` lines inside code don't leak into the TOC. Inline-code
+// backticks are dropped to match the label `createHeading` renders.
export function extractHeadings(source: string): TocItem[] {
const items: TocItem[] = [];
let inFence = false;
@@ -22,7 +23,7 @@ export function extractHeadings(source: string): TocItem[] {
if (!heading) continue;
const depth = heading[1].length as 2 | 3;
- const text = heading[2].trim();
+ const text = heading[2].trim().replace(/`/g, "");
items.push({ depth, text, slug: slugify(text) });
}