feat(rehype): Conditionally expand code tabs in .md with {mdExpandTabs}#17877
feat(rehype): Conditionally expand code tabs in .md with {mdExpandTabs}#17877s1gr1d wants to merge 4 commits into
.md with {mdExpandTabs}#17877Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
sergical
left a comment
There was a problem hiding this comment.
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?
|
That's a valid concern. We could either put the comment above the snippet with "Other code snippet variations (not listed): ..." or we just remove the line again 🤔 |
|
@s1gr1d i actually think having all options be rendered in the markdown helps the agent have the right context, idk if im not thinking about edgecases where it really becomes a context issue, but having all of it available for agent to decide how to proceed vs just knowing that other options exist without knowing how to get them might be more optimal, curious what you think! |
DESCRIBE YOUR PR
Improvement of #17745
The generated
.mdfiles 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}:{mdExpandTabs}vs. when to let tabs collapseExample 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.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes: