incentro-dc / remark-github-admonitions-to-directives

A Remark plugin that transforms Github style alerts to admonitions directives.
https://www.npmjs.com/remark-github-admonitions-to-directives
MIT License
18 stars 3 forks source link

Mismatch of GitHub flavored 'IMPORTANT' alert to docusaurus admonition #6

Closed johnmcase closed 2 weeks ago

johnmcase commented 2 weeks ago

I think there is a mis-mapping of the mapping of the GitHub IMPORTANT alert. It appears to be mapping to the :::warning docusaurus admonition.

Consider the following Markdown in a docusaurus site with the remark-github-admonitions-to-directives plugin installed:

> [!NOTE]
> This is a GH flavored `NOTE`

:::note
This is a Docusaurus Admonition `note`
:::

> [!TIP]
> This is a GH flavored `TIP`

:::tip
This is a Docusaurus Admonition `tip`
:::

> [!IMPORTANT]
> This is a GH flavored `IMPORTANT`

:::info
This is a Docusaurus Admonition `info`
:::

> [!WARNING]
> This is a GH flavored `WARNING`

:::warning
This is a Docusaurus Admonition `warning`
:::

> [!CAUTION]
> This is a GH flavored `CAUTION`

:::danger
This is a Docusaurus Admonition `danger`
:::

The above code produces the following output:

image

I believe it should map to the :::info admonition.

LuudJanssen commented 2 weeks ago

Hi @johnmcase, I think you're right.

My reasoning was that "important" sounds a lot more invasive than "info", so that's why I mapped it to a "warning". I think my reasoning was wrong, and it makes much more sense if all GitHub admonition types map to a unique admonition directive.

I'm releasing this as a v2. If anyone disagrees with this change, please let me know and we could perhaps turn this into a setting.

damianstasik commented 1 week ago

@LuudJanssen would you accept a PR that would allow customizing the mapping? My use case doesn't involve Docusaurus so it would be great to have 1:1 mapping with GitHub's naming.

LuudJanssen commented 1 week ago

Hi @damianstasik, yes I would! Did you already think about what this would look like? Like in what form would you pass the mapping to the plugin?