JSPM

docusaurus-plugin-react-docgen

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q56704F
  • License MIT

A small plugin that integrates react-docgen with docusaurus 2.x

Package Exports

  • docusaurus-plugin-react-docgen
  • docusaurus-plugin-react-docgen/dist/cjs/index.js
  • docusaurus-plugin-react-docgen/dist/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (docusaurus-plugin-react-docgen) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Docusaurus Plugin react-docgen

A Docusaurus 2.x plugin that help generate and consume auto-generated docs from react-docgen.

Installation

Grab from NPM and install along with react-docgen:

npm i docusaurus-plugin-react-docgen react-docgen # or
yarn add docusaurus-plugin-react-docgen react-docgen

Usage

Inside your docusaurus.config.js add to the plugins field and configure with the src option with full glob support 👍

module.exports = {
  plugins: [
    [
      'docusaurus-plugin-react-docgen',
      {
        // pass in a single string or an array of strings
        src: ['path/to/**/*.tsx', '!path/to/**/*test.*'],
        route: {
          path: '/docs/api',
          component: require.resolve('./src/components/MyDataHandler.js'),
          exact: true,
        },
      },
    ],
  ],
};

Any pattern supported by fast-glob is allowed here (including negations)

Options

Name Type Required Description
src string | string[] Yes Tell react-docgen where to ook for source files. Use relative, absolute, and/or globbing syntax
global boolean No Store results so they're globally accessible in docusaurus
route RouteConfig No Makes docgen results accessible at the specified URL. Note modules cannot be overridden.
docgen docgen config No Pass custom resolvers and handlers to react-docgen
parserOptions babel parser options No Pass custom options to @babel/parser
babel docgen options No Pass specific options to @babel/parse that aids in resolving the correct babel config file