1.1.0 • Published 4 years ago

gatsby-source-yuidoc v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

gatsby-source-yuidoc

Description

A gatsby source plugin for Yuidoc

It will set Yuidoc data into graphql nodes.

You can find all the annotations in the YUIDoc Syntax Reference page

Dependencies (optional)

How to install and init

  • yarn add | npm install gatsby-source-yuidoc
  • In gatsby-config.js:
    {
     plugins: [
       {
         resolve: `gatsby-source-yuidoc`,
         options: {
           paths: [path.resolve(__dirname, `/path`)],
           exclude: path.resolve(__dirname, `/path/to_exclude`),
         },
       },
     ],
    }
## Available options and their default values 
Options used in [YUIDoc Class](https://yui.github.io/yuidoc/api/classes/YUIDoc.html#property_OPTIONS)
merged with plugin options:

| Option        | Definition                                                                   | Default value |
|---------------|------------------------------------------------------------------------------|---------------|
| baseUrl       | If provided, will generate an url for each node                              | ``            |
| allowNoParent | If false, the plugin will not create nodes without parents, except DocModule | true          |

```javascript
{
    quiet: false,
    writeJSON: true,
    outdir: path.join(process.cwd(), 'out'),
    extension: '.js',
    exclude: '.DS_Store,.svn,CVS,.git,build_rollup_tmp,build_tmp,node_modules',
    norecurse: false,
    version: '0.1.0',
    paths: [],
    themedir: path.join(__dirname, 'themes', 'default'),
    syntaxtype: 'js',
    baseUrl: `/documentation`,
    allowNoParent: true,
}

Nodes

This plugin will generate nodes described in types.js:

  • DocModule
  • DocClass
  • DocMethod

Relations

ParentChildren
/DocModule
DocModuleDocClass
DocClassDocMethod

Url

Each node has a generated url if the config baseUrl is provided

NodeUrl
DocModule`${baseUrl}/${DocModule.name}/`
DocClass`${baseUrl}/${DocModule.name}/${DocClass.name}/`
DocMethod`${baseUrl}/${DocModule.name}/${DocClass.name}/#${DocMethod.name}`

How to query for data

query MyDoc {
  allDocModule {
    nodes {
      name
      childrenDocClass {
        name
        childrenDocMethod {
          name
        }
      }
    }
  }
}

How to run tests

lint: yarn lint

How to contribute

If you'd like to contribute any changes simply fork the project on Github and send a pull request.

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago