Skip to content

Docusaurus config is confusing: const config vs module.exports  #8925

@thadguidry

Description

@thadguidry

Have you read the Contributing Guidelines on issues?

Description

One of the most frustrating parts in the docs is when you install and get Docusaurus running, but cannot find how to properly configure 2 or more themes. The examples always use module.exports = { } but yet the default shipping config of Docusaurus uses an object with simply config. So when someone wants to simply add let's say Mermaid theme for their markdown pages, it's super confusing how to simply add Mermaid as a theme into the docs, or blog sections.

I would love to improve the docs, but need the answer before I can contribute.
I wanted to do something as easy as this:

module.exports = {
  config,
  themes: ['@docusaurus/theme-mermaid'],
}

but of course that syntax isn't respected.

I did add the other config parts into the preset-classic ThemeConfig section

      // MERMAID CONFIG //
      markdown: {
        mermaid: true,
      },

      mermaid: {
        options: {
          maxTextSize: 50,
        }
      }
      // END OF MERMAID CONFIG //

but of course the pages do not show mermaid styling, but only the raw codeblock text of the mermaid graph.
I suspected I needed the mermaid theme still to be added, but on the preset-classic, not sure where or how.
In general, how to use the default installation to add or use 2 themes. Because module.exports = config is not easily understood other than it's a Config type.

Self-service

  • I'd be willing to address this documentation request myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationThe issue is related to the documentation of Docusaurus

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions