Take docs files from multiple folders to build Docusaurus

36 views Asked by At

I have a quite big solution that I would like to generate documentation for. I decided to use Docusaurus, because it is open-source and seems very easy to use.

How ever I came to a problem where I don't know how to proceed.

I would like to document some features that are scattered between different folder. Let's say I'd like to have a user-manual documentation.

My solution looks like so:

├───docusaurus
└───src
    └───Features
        ├───Feature1
        │   ├───code
        │   └───docs
        │       └───user-manual
        ├───Feature2
        │   ├───code
        │   └───docs
        │       └───user-manual
        └───Feature3
            ├───code
            └───docs
                └───user-manual

I would like to take all documentation files from all of my Features folders inside user-manual documentation subfolder.

I tried to write a plugin with wildcard path property, but it does not work:

...
  plugins: [
    [
      "@docusaurus/plugin-content-docs",
      {
        id: "user-manual",
        path: "**/src/Features/**/docs/user-manual",
        routeBasePath: "user-manual",
        sidebarPath: require.resolve("./sidebars.js"),
      },
    ],
],
...

The second approach was to specify path at root and then leverage the include property, which also didn't work out:

...
  plugins: [
    [
      "@docusaurus/plugin-content-docs",
      {
        id: "user-manual",
        path: "**",
        include: "/src/Features/**/docs/user-manual"
        routeBasePath: "user-manual",
        sidebarPath: require.resolve("./sidebars.js"),
      },
    ],
],
...

This approach throws me an error Docs version "current" has no docs! At least one doc should exist at "..". even though I have a Intro.md file in the root of my solution.

Is there any way to include multiple folders to a single content docs configuration?

0

There are 0 answers