Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: map GitHub 'IMPORTANT' admonition to docusaurus 'info' admonition (fixes #6) #7

Merged
merged 2 commits into from
Sep 5, 2024
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
2 changes: 1 addition & 1 deletion src/map-github-alert-type-to-directive-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function mapGithubAlertTypeToDirectiveName(
return "warning";

case GithubAlertType.IMPORTANT:
return "warning";
return "info";

case GithubAlertType.CAUTION:
return "danger";
Expand Down
40 changes: 40 additions & 0 deletions src/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,46 @@ describe("remark-github-admonitions-to-directives", () => {
`);
});

it("should convert a tip admonition to a tip directive", async () => {
const result = await process(`> [!TIP]`);

expect(result).toMatchInlineSnapshot(`
":::tip
:::
"
`);
});

it("should convert a important admonition to an info directive", async () => {
const result = await process(`> [!IMPORTANT]`);

expect(result).toMatchInlineSnapshot(`
":::info
:::
"
`);
});

it("should convert a warning admonition to a warning directive", async () => {
const result = await process(`> [!WARNING]`);

expect(result).toMatchInlineSnapshot(`
":::warning
:::
"
`);
});

it("should convert a caution admonition to a danger directive", async () => {
const result = await process(`> [!CAUTION]`);

expect(result).toMatchInlineSnapshot(`
":::danger
:::
"
`);
});

it("should handle nested content", async () => {
const result = await process(`> [!NOTE]
> test
Expand Down