chrismwilliams / astro-theme-cactus

A simple Astro theme. Use it to create your blog or website.
https://astro-cactus.chriswilliams.dev/
MIT License
866 stars 132 forks source link

Adding admonitions #285

Closed Fabrizz closed 2 weeks ago

Fabrizz commented 1 month ago

Hey I was thinking in adding admonition support to this astro theme, the question is how would you like the markdown to be? Some projects like using

<tip>This is a tip<tip/>

<admonition type="tip">This is a tip<admonition/>

```ad-tip
This is a tip


There are some packages that will do this but customizing the output to add for example the admonition icon like Github does:
> [!TIP]
> Optional information to help a user be more successful.

> [!WARNING]  
> Critical content demanding immediate user attention due to potential risks.

Here I done it for https://github.com/saicaca/fuwari/pull/77, I discovered this project as I was doing that PR.
chrismwilliams commented 3 weeks ago

Hi @Fabrizz,

thanks for opening this as I was going to do this a while ago but forgot to pin it on my board. I think the best option would be to follow Astro's example in Starlight, basically your second example, as users may be more familiar with the syntax.

Let me know if you need any help.

Fabrizz commented 3 weeks ago

Great, I'm going to write it as an internal Rehype component. It could be a mdx component tho

chrismwilliams commented 3 weeks ago

Yeah a rehype plugin would be great. Having a quick look again I'm not sure why they include components as well as ::: - triple colons, but I'll let you decide which syntax route to take

chrismwilliams commented 2 weeks ago

Closed #291