-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow customizing the alert type to admonitions directive mappi…
…ng via the plugin options
- Loading branch information
1 parent
1b395d1
commit 6605a88
Showing
8 changed files
with
162 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import type { DirectiveName } from "./directive-name.enum.js"; | ||
import type { GithubAlertType } from "./github-alert.type.js"; | ||
|
||
export type AlertTypeMapping = Record<GithubAlertType, DirectiveName | string>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { AlertTypeMapping } from "./alert-type-mapping.type.js"; | ||
import { DirectiveName } from "./directive-name.enum.js"; | ||
import { GithubAlertType } from "./github-alert.type.js"; | ||
|
||
export const DEFAULT_MAPPING: AlertTypeMapping = { | ||
[GithubAlertType.NOTE]: DirectiveName.NOTE, | ||
[GithubAlertType.TIP]: DirectiveName.TIP, | ||
[GithubAlertType.WARNING]: DirectiveName.WARNING, | ||
[GithubAlertType.IMPORTANT]: DirectiveName.INFO, | ||
[GithubAlertType.CAUTION]: DirectiveName.DANGER, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export enum DirectiveName { | ||
NOTE = "note", | ||
TIP = "tip", | ||
WARNING = "warning", | ||
INFO = "info", | ||
DANGER = "danger", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
export type { AlertTypeMapping } from "./alert-type-mapping.type.js"; | ||
export { DEFAULT_MAPPING } from "./default-mapping.const.js"; | ||
export { DirectiveName } from "./directive-name.enum.js"; | ||
export { GithubAlertType } from "./github-alert.type.js"; | ||
export type { Options } from "./options.type.js"; | ||
export { remarkGithubAdmonitionsToDirectives as default } from "./plugin.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { AlertTypeMapping } from "./alert-type-mapping.type.js"; | ||
|
||
export type Options = { | ||
mapping?: AlertTypeMapping; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters