Skip to content

[Feature]: Custom admonitions #2550

@omonk

Description

@omonk

What problem does this feature solve?

Doc sites using docusaurus or other frameworks may have custom admonitions throughout 100s of files. Allowing them to migrate their admonitions without having to update copy would bolster migration.

https://docusaurus.io/docs/markdown-features/admonitions#customizing-admonitions

What does the proposed API look like?

Example config

themeConfig: {
  admonitions: {
    extensions: ['branded-warning'],
    uiComponents: [path.join(__dirname, 'components', 'CustomAdmonition.tsx')]
  },
},
const CustomAdmonition = ({ level, children }: { level: string }) => {
   if(level === "branded-warning") {
       return <BrandedWarningAdmonition>{children}</BrandedWarningAdmonition>
   }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions