Skip to content

feat(rehype): Conditionally expand code tabs in .md with {mdExpandTabs}#17877

Open
s1gr1d wants to merge 4 commits into
masterfrom
sig/copy-page-all-snippets-conditional
Open

feat(rehype): Conditionally expand code tabs in .md with {mdExpandTabs}#17877
s1gr1d wants to merge 4 commits into
masterfrom
sig/copy-page-all-snippets-conditional

Conversation

@s1gr1d
Copy link
Copy Markdown
Member

@s1gr1d s1gr1d commented May 26, 2026

DESCRIBE YOUR PR

Improvement of #17745

The generated .md files are mostly consumed by LLMs. Expanding every tab group floods context with trivial variations (npm/yarn/pnpm, ESM/CJS) that any LLM can infer from a single example.

This PR makes tab expansion opt-in via {mdExpandTabs}:

  • Default: only the first tab is included, with an "Also available for: yarn, pnpm" note listing the other tabs for completeness
  • Opt-in: adding {mdExpandTabs} to any code fence in a group expands all tabs (for cases like Swift/ObjC, different runtime setup flows, client/server splits)
  • Skill update: technical-docs now documents when to use {mdExpandTabs} vs. when to let tabs collapse

Example page: https://sentry-docs-git-sig-copy-page-all-snippets-conditional.sentry.dev/platforms/javascript/guides/hono.md

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

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

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment May 26, 2026 2:12pm
sentry-docs Ready Ready Preview, Comment May 26, 2026 2:12pm

Request Review

Copy link
Copy Markdown
Member

@sergical sergical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is that some pages use tabs as completely different approaches and if the llm knows that it's available, it doesn't mean it knows how to do it. example https://sentry-docs-git-sig-copy-page-all-snippets-conditional.sentry.dev/platforms/javascript/guides/nextjs.md

escaped` typescript
import * as Sentry from "@sentry/nextjs";

Sentry.init({
  dsn: "___PUBLIC_DSN___",

  // Adds request headers and IP for users
  sendDefaultPii: true,
  // ___PRODUCT_OPTION_START___ performance
  tracesSampleRate: process.env.NODE_ENV === "development" ? 1.0 : 0.1,
  // ___PRODUCT_OPTION_END___ performance
  // ___PRODUCT_OPTION_START___ session-replay
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,
  // ___PRODUCT_OPTION_END___ session-replay
  // ___PRODUCT_OPTION_START___ logs
  enableLogs: true,
  // ___PRODUCT_OPTION_END___ logs
  integrations: [
    // ___PRODUCT_OPTION_START___ session-replay
    Sentry.replayIntegration(),
    // ___PRODUCT_OPTION_END___ session-replay
  ],
});
end escaped `

*Also available for: Server, Edge*

also the fact that it's after the block might be confusing to llms since it could be thinking it's related to what's next vs what's before?

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