From c967ea5b4a9cf850c162fa27a2a6ea2e1587c2dd Mon Sep 17 00:00:00 2001 From: Andrea Mazzucchelli <60042277+andrmaz@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:28:58 +0200 Subject: [PATCH] fix(theme): `` should render properly without heading/icon (#10080) --- .../src/theme/Admonition/Layout/index.tsx | 2 +- .../_pages tests/markdown-tests-mdx.mdx | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/docusaurus-theme-classic/src/theme/Admonition/Layout/index.tsx b/packages/docusaurus-theme-classic/src/theme/Admonition/Layout/index.tsx index 7bdda31bc386..eafe0400c626 100644 --- a/packages/docusaurus-theme-classic/src/theme/Admonition/Layout/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Admonition/Layout/index.tsx @@ -50,7 +50,7 @@ export default function AdmonitionLayout(props: Props): JSX.Element { const {type, icon, title, children, className} = props; return ( - + {title || icon ? : null} {children} ); diff --git a/website/_dogfooding/_pages tests/markdown-tests-mdx.mdx b/website/_dogfooding/_pages tests/markdown-tests-mdx.mdx index feaf146f059d..b54eef02ac59 100644 --- a/website/_dogfooding/_pages tests/markdown-tests-mdx.mdx +++ b/website/_dogfooding/_pages tests/markdown-tests-mdx.mdx @@ -333,6 +333,20 @@ test :::: +```mdx-code-block +import Admonition from '@theme/Admonition'; + +export function AdmonitionWithoutHeading(props) { + return ( + + Admonition content without heading + + ); +} +``` + + + ## Linking This is a test page to see if Docusaurus Markdown features are working properly