evaera/moonwave

Admonitions show different text in the Docs and API sections

ambergamefam opened this issue · 4 comments

My docs site is showing "DANGER" on any pages beginning with /docs/, and showing "WARNING" on pages beginning with /api/

image image

in both cases, the source code is using a :::warning admonition:

:::warning
Dec is still a work in progress and does not currently have a full release!
Please avoiding Dec in production-bound projects, as the library is not fully
tested, and the API may be subject to change
:::

https://github.com/AmberGraceSoftware/Dec/blob/7a1dc283045fdf59dc07c7fb38556b92a87d5e77/src/init.luau?plain=1#L49
https://github.com/AmberGraceSoftware/Dec/blob/7a1dc283045fdf59dc07c7fb38556b92a87d5e77/docs/intro.md?plain=1#L7

I am using a fair bit of custom CSS on this site, but I don't think that would cause the issue here.

evaera commented

The pages under the Docs section are completely controlled by Docusaurus and so if there is a problem with their admonitions it is outside of our control. As it seems like the correct text should be "Warning", and that is what is displayed in the API section, I'm going to go ahead and close this issue

The pages under the Docs section are completely controlled by Docusaurus and so if there is a problem with their admonitions it is outside of our control. As it seems like the correct text should be "Warning", and that is what is displayed in the API section, I'm going to go ahead and close this issue

Gotcha. Looks like :::danger is the supported admonition keyword here. Just got confused since Moonwave was highlighting it red anyways.

Looks like changing the keywords requires editing the config file.
https://docusaurus.io/docs/markdown-features/admonitions#customizing-parsing-behavior

Is there currently a way to override values in the generated docusaurus.config.js without routing it through the TOML file first? Or is that not yet a thing with Moonwave? I don't think I can specify things like numeric keys or special keys like "@docusaurus/preset-classic" from the moonwave.toml file

evaera commented

Any options under the [docusaurus] key will be passed along to the Docusaurus config. TOML allows you to specify numerical keys with the array syntax.

Any options under the [docusaurus] key will be passed along to the Docusaurus config. TOML allows you to specify numerical keys with the array syntax.

That only works for one-dimensional arrays.
This schema calls for a multidimensional array, the inner array having mixed types (string and object)

module.exports = {
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        docs: {
          admonitions: {
            tag: ':::',
            keywords: ['note', 'tip', 'info', 'caution', 'danger'],
          },
        },
      },
    ],
  ],
};

Is there any way to override in JSON format, or is it sandboxed to TOML currently? I don't believe TOML supports nested arrays or mixed types in an array like that.