rehype-github-alerts: rehype plugin to mimick github alerts #157
Replies: 3 comments 6 replies
-
Although I disagree with the implementation GitHub chose, I definitely think it makes sense to support this in rehype-github. But is it considered stable yet or is it still an experimental feature? An interesting note is that the Also no line break (trailing spaces in your example) is needed. > \[!NOTE]
> I'm a note :wave: Note I'm a note 👋 |
Beta Was this translation helpful? Give feedback.
-
Thanks For sharing @chrisweb!
Looks pretty good some ideas and commentary
|
Beta Was this translation helpful? Give feedback.
-
I released rehype-github-alerts v2, it fixes a bug, includes a test suite and add support for the two new alerts tip and caution |
Beta Was this translation helpful? Give feedback.
-
Since github announced a new alerts feature in the community discussions, I have followed the thread and wanted to have a similar feature for my dev blog project
I first searched for plugin and found similar packages, for example:
... so if you want a remark plugin to do the job you have plenty to chose from, but I did not find one for rehype
Why a rehype plugin? Well in my search I had found this remark ticket in which @wooorm suggested that it would be best to implement such a feature in rehype, this is why I chose to do a rehype and not a remark plugin
I then decided to start working on it and today I finally released the first version of my plugin, it is called rehype-github-alerts and is now available on npm
If you use this plugin, you can add alerts into your markdown (same syntax as on github) like so:
And then remark will turn the markdown into html and finally the plugin will transform the html blockquotes into alerts, that hopefully look like this:
Note
I'm a note 👋
Important
I'm important
Warning
I'm a warning
I posted about the plugin here as I hope it will be useful to more devs then just me and hope the plugin will not break the web, feedback, bug reports and contributions are of course welcome 😃
Beta Was this translation helpful? Give feedback.
All reactions