Skip to content

Commit

Permalink
fix!: map GitHub 'IMPORTANT' admonition to docusaurus 'info' admoniti…
Browse files Browse the repository at this point in the history
…on (fixes #6) (#7)
  • Loading branch information
LuudJanssen authored Sep 5, 2024
2 parents a5ba898 + 4126c1d commit 7a3cc30
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
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

0 comments on commit 7a3cc30

Please sign in to comment.