From a37f8dac6fa6fabbd87c3cad53b437c1aeddd79f Mon Sep 17 00:00:00 2001 From: SoonIter Date: Fri, 14 Nov 2025 16:19:25 +0800 Subject: [PATCH 1/3] chore: switch containerSynatx error to warn --- .../mdx/remarkPlugins/containerSyntax.test.ts | 22 +++++++++---------- .../node/mdx/remarkPlugins/containerSyntax.ts | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/core/src/node/mdx/remarkPlugins/containerSyntax.test.ts b/packages/core/src/node/mdx/remarkPlugins/containerSyntax.test.ts index 884a54635..db6150eb8 100644 --- a/packages/core/src/node/mdx/remarkPlugins/containerSyntax.test.ts +++ b/packages/core/src/node/mdx/remarkPlugins/containerSyntax.test.ts @@ -333,17 +333,17 @@ Line 2 with [link](http://example.com). expect(result).toMatchSnapshot(); }); - test('error when container type is unknown', async () => { - await expect( - process(` -:::Tip -This is a tip. -::: -`), - ).rejects.toThrow( - '[remarkContainerSyntax] Unknown container directive type "Tip". Supported types: tip, note, warning, caution, danger, info, details', - ); - }); + // test('error when container type is unknown', async () => { + // await expect( + // process(` + // :::Tip + // This is a tip. + // ::: + // `), + // ).rejects.toThrow( + // '[remarkContainerSyntax] Unknown container directive type "Tip". Supported types: tip, note, warning, caution, danger, info, details', + // ); + // }); test('empty blockquote', async () => { const result = await process(` diff --git a/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts b/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts index be5bb0bd9..d88a57ea3 100644 --- a/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts +++ b/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts @@ -13,6 +13,7 @@ */ /// +import { logger } from '@rsbuild/core'; import type { BlockContent, Literal, @@ -377,7 +378,7 @@ export const remarkContainerSyntax: Plugin<[], Root> = () => { } unknownTypes.add(type); const supportedTypes = DIRECTIVE_TYPES.join(', '); - throw new Error( + logger.warn( `${ERROR_PREFIX} Unknown container directive type "${type}". Supported types: ${supportedTypes}`, ); }; From 98eaa899731e8e0a632cbb4e5e492b8a92288e5e Mon Sep 17 00:00:00 2001 From: SoonIter Date: Fri, 14 Nov 2025 16:21:25 +0800 Subject: [PATCH 2/3] chore: udpate --- .../core/src/node/mdx/remarkPlugins/containerSyntax.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts b/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts index d88a57ea3..9db95ea2a 100644 --- a/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts +++ b/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts @@ -377,10 +377,11 @@ export const remarkContainerSyntax: Plugin<[], Root> = () => { return; } unknownTypes.add(type); - const supportedTypes = DIRECTIVE_TYPES.join(', '); - logger.warn( - `${ERROR_PREFIX} Unknown container directive type "${type}". Supported types: ${supportedTypes}`, - ); + // FIXME: add panic after remark-directive + // const supportedTypes = DIRECTIVE_TYPES.join(', '); + // logger.warn( + // `${ERROR_PREFIX} Unknown container directive type "${type}". Supported types: ${supportedTypes}`, + // ); }; return tree => { From 9acbaf8f422f06044875374a55f95a83ca46fdd2 Mon Sep 17 00:00:00 2001 From: SoonIter Date: Fri, 14 Nov 2025 16:21:45 +0800 Subject: [PATCH 3/3] chore: udpate --- packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts b/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts index 9db95ea2a..d41509850 100644 --- a/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts +++ b/packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts @@ -13,7 +13,6 @@ */ /// -import { logger } from '@rsbuild/core'; import type { BlockContent, Literal, @@ -43,7 +42,7 @@ export const TITLE_REGEX_IN_MD = /{\s*title=["']?(.+)}\s*/; export const TITLE_REGEX_IN_MDX = /\s*title=["']?(.+)\s*/; const CALLOUT_COMPONENT = '$$$callout$$$'; // in md, we can not add import statement, so we use a special component name to avoid conflict with user components -const ERROR_PREFIX = '[remarkContainerSyntax]'; +// const ERROR_PREFIX = '[remarkContainerSyntax]'; export type DirectiveType = (typeof DIRECTIVE_TYPES)[number];