saicaca / fuwari

✨A static blog template built with Astro.
https://fuwari.vercel.app
MIT License
1.36k stars 314 forks source link

On adding admonitions [Pre-PR] #64

Closed Fabrizz closed 6 months ago

Fabrizz commented 6 months ago

hi, I love your theme, Im creating a pull request to add admonitions. image

I have some questions regarding color and translations:

First colors, should I use fixed color and them apply the hue to them so the correlate with the theme more? Should the colors be fixed for light/dark themes?

Now translations; As this is a markdown module, its declared inside astro.config: (Plugin: remark-blockquote-admonitions) The plugin looks for [!WARNING], [!NOTE], etc. labels, this works great, but if the site is in another lenguaje, the displayed title is still WARNING, NOTE, etc. The plugin provides a config option to change the display string based on the label found, but I cannot access the i18n ts file from the astro.config.mjs right?

  /* export default defineConfig({ */
  markdown: {
    remarkPlugins: [
      remarkMath,
      remarkReadingTime,
      [
        remarkBlockcuoteAdmonitions,
        {
          classNameMaps: {
            block: str => [str.toLowerCase(), 'admonitions'],
            title: ['admonitions-title'],
          },
          dataMaps: {
            block: data => {
              return { ...data, hName: 'blockquote' }
            },
            title: data => {
              return data
            },
          },
        },
      ],
    ],
  rehypePlugins: [ 
     ...

I have this running in my site, I will fork the project and create a pull request

Currently the colors are just fixed:

https://github.com/saicaca/fuwari/assets/65259076/0c495b4e-e3a1-4c3f-9da5-ef0e9f512327

Fabrizz commented 6 months ago

Created the PR.