Skip to content

Sync code group selection #2954

@re-ovo

Description

@re-ovo

Is your feature request related to a problem? Please describe.

In many cases, developers will provide code groups for multiple programming languages at the same time. I hope that after the user switches one, other code groups can automatically follow, and it is best to be persistent.

#2773, a solution is proposed here, but I don't think it's good enough

  1. Only supports tab, but code group needs it more
  2. This is a very commonly used feature, I think it should be officially supported, not by a plugin

Describe the solution you'd like

::: code-group

```js [config.js] :js <-- key
const config = {
// ...
}

export default config
```

```ts [config.ts] :ts
import type { UserConfig } from 'vitepress'

const config: UserConfig = {
// ...
}

export default config
```

:::

Describe alternatives you've considered

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    stalethemeRelated to the theme

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions