Docusaurus: [v2] custom configuration for remark-admonitions does not work

Created on 23 Mar 2020  路  4Comments  路  Source: facebook/docusaurus

馃悰 Bug Report

custom configuration for remark-admonitions does not work.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

// docusaurus.config.js
module.exports = {
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        docs: {
          // options for remark-admonitions
          admonitions: {
            customTypes: {
              kk: {
                keyword: 'kk',
                svg:
                  '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"/></svg>'
              },
            }
          },
        },
      },
    ],
  ],
};

adding these lines in md file:

:::kk

test custom admonitions.

:::

Expected behavior

custom admonition can render correctly

Actual Behavior

Your Environment

  • Docusaurus version used: 2.0.0-alpha.48
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): chrome 80.0.3987.132 (Official Build) (64-bit) nodejs v12.14.1
  • Operating system and version (desktop or mobile): macOS10.15.2
bug v2

Most helpful comment

@lex111 PR is up 馃槃

All 4 comments

cc @elviswolcott

It looks like the root of the problem is that the plugin and options tuple was being flattened by concat
https://github.com/facebook/docusaurus/blob/08616997dad3fcc567026f8beed8c8b986371f73/packages/docusaurus-preset-classic/src/index.js#L20-L25
resulting in something like

{ remarkPlugins: [plugin, config] }

instead of

{ remarkPlugins: [ [plugin, config] ] }

@elviswolcott could you please fix this?

@lex111 PR is up 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

slorber picture slorber  路  24Comments

yangshun picture yangshun  路  61Comments

maximousblk picture maximousblk  路  23Comments

KoenCa picture KoenCa  路  25Comments

taylorreece picture taylorreece  路  28Comments