Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/core/src/node/mdx/remarkPlugins/containerSyntax.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(`
Expand Down
11 changes: 6 additions & 5 deletions packages/core/src/node/mdx/remarkPlugins/containerSyntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,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];

Expand Down Expand Up @@ -376,10 +376,11 @@ export const remarkContainerSyntax: Plugin<[], Root> = () => {
return;
}
unknownTypes.add(type);
const supportedTypes = DIRECTIVE_TYPES.join(', ');
throw new Error(
`${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 => {
Expand Down
Loading