Skip to content

Commit 7a3cc30

Browse files
authored
fix!: map GitHub 'IMPORTANT' admonition to docusaurus 'info' admonition (fixes #6) (#7)
2 parents a5ba898 + 4126c1d commit 7a3cc30

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

src/map-github-alert-type-to-directive-name.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function mapGithubAlertTypeToDirectiveName(
1414
return "warning";
1515

1616
case GithubAlertType.IMPORTANT:
17-
return "warning";
17+
return "info";
1818

1919
case GithubAlertType.CAUTION:
2020
return "danger";

src/plugin.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,46 @@ describe("remark-github-admonitions-to-directives", () => {
3232
`);
3333
});
3434

35+
it("should convert a tip admonition to a tip directive", async () => {
36+
const result = await process(`> [!TIP]`);
37+
38+
expect(result).toMatchInlineSnapshot(`
39+
":::tip
40+
:::
41+
"
42+
`);
43+
});
44+
45+
it("should convert a important admonition to an info directive", async () => {
46+
const result = await process(`> [!IMPORTANT]`);
47+
48+
expect(result).toMatchInlineSnapshot(`
49+
":::info
50+
:::
51+
"
52+
`);
53+
});
54+
55+
it("should convert a warning admonition to a warning directive", async () => {
56+
const result = await process(`> [!WARNING]`);
57+
58+
expect(result).toMatchInlineSnapshot(`
59+
":::warning
60+
:::
61+
"
62+
`);
63+
});
64+
65+
it("should convert a caution admonition to a danger directive", async () => {
66+
const result = await process(`> [!CAUTION]`);
67+
68+
expect(result).toMatchInlineSnapshot(`
69+
":::danger
70+
:::
71+
"
72+
`);
73+
});
74+
3575
it("should handle nested content", async () => {
3676
const result = await process(`> [!NOTE]
3777
> test

0 commit comments

Comments
 (0)