Custom api visitor

To extract api methods using a custom rule, use the visitor prop in docs.yml and the visitor code:

- path: public-methods.md
  title: Public Methods
  glob: src/**/*.js
  visitor: path/to/visitor/myApiVisitor.js
// myApiVisitor.js

function createApiVisitor(enter) {
  return {
    Decorator(path) {
      if (isPublicApiDecorator(path.node)) {
        enter(path.parentPath);
      }
    },
  };
}

function createApiClassMethod(nodeFromVisitor) {
  // return ast of a cleaned up method with JSDoc and empty body
}

module.exports = {
  createApiVisitor,
  createApiClassMethod,
};

Custom visitor example:

Read more about visitors: