Skip to content

Commit 29aff85

Browse files
authored
chore(mdx): revert containerSynatx unknown types error (#2764)
1 parent 5ef6849 commit 29aff85

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

packages/core/src/node/mdx/remarkPlugins/containerSyntax.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,17 @@ Line 2 with [link](http://example.com).
333333
expect(result).toMatchSnapshot();
334334
});
335335

336-
test('error when container type is unknown', async () => {
337-
await expect(
338-
process(`
339-
:::Tip
340-
This is a tip.
341-
:::
342-
`),
343-
).rejects.toThrow(
344-
'[remarkContainerSyntax] Unknown container directive type "Tip". Supported types: tip, note, warning, caution, danger, info, details',
345-
);
346-
});
336+
// test('error when container type is unknown', async () => {
337+
// await expect(
338+
// process(`
339+
// :::Tip
340+
// This is a tip.
341+
// :::
342+
// `),
343+
// ).rejects.toThrow(
344+
// '[remarkContainerSyntax] Unknown container directive type "Tip". Supported types: tip, note, warning, caution, danger, info, details',
345+
// );
346+
// });
347347

348348
test('empty blockquote', async () => {
349349
const result = await process(`

packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const TITLE_REGEX_IN_MD = /{\s*title=["']?(.+)}\s*/;
4242
export const TITLE_REGEX_IN_MDX = /\s*title=["']?(.+)\s*/;
4343

4444
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
45-
const ERROR_PREFIX = '[remarkContainerSyntax]';
45+
// const ERROR_PREFIX = '[remarkContainerSyntax]';
4646

4747
export type DirectiveType = (typeof DIRECTIVE_TYPES)[number];
4848

@@ -376,10 +376,11 @@ export const remarkContainerSyntax: Plugin<[], Root> = () => {
376376
return;
377377
}
378378
unknownTypes.add(type);
379-
const supportedTypes = DIRECTIVE_TYPES.join(', ');
380-
throw new Error(
381-
`${ERROR_PREFIX} Unknown container directive type "${type}". Supported types: ${supportedTypes}`,
382-
);
379+
// FIXME: add panic after remark-directive
380+
// const supportedTypes = DIRECTIVE_TYPES.join(', ');
381+
// logger.warn(
382+
// `${ERROR_PREFIX} Unknown container directive type "${type}". Supported types: ${supportedTypes}`,
383+
// );
383384
};
384385

385386
return tree => {

0 commit comments

Comments
 (0)