vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
11.48k stars 1.86k forks source link

feat(containers-plugin): Being able to add custom containers #3591

Open brenoepics opened 2 months ago

brenoepics commented 2 months ago

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

Currently, you can change the label but you cannot add new containers for new colors and/or icons. Containers Plugin

Describe the solution you'd like

Adding custom containers to ContainerOptions, then users could add it in DefineConfig / DefineConfigWithTheme

//containers.ts
export interface ContainerOptions {
  infoLabel?: string
  noteLabel?: string
  tipLabel?: string
  warningLabel?: string
  dangerLabel?: string
  detailsLabel?: string
  importantLabel?: string
  cautionLabel?: string
  customContainers?: ...
}

// config.ts
export default defineConfig({
  // ...
  markdown: {
    container: {
      tipLabel: '...',
      warningLabel: '...',
      dangerLabel: '...',
      infoLabel: '...',
      detailsLabel: '...',
      customContainers: [ ... ]
    }
  }
  // ...
})

Describe alternatives you've considered

Disabling GitHub Flavored Markdown-It plugin and registering again with custom alerts.

Additional context

No response

Validations

dragomano commented 2 weeks ago

I'd also like to be able to translate all these containers on sites with multiple languages.