Code Monkey home page Code Monkey logo

doccy's Introduction

Doccy

Build Status

$ npm install -g doccy

Automatic generation of documentation READMEs.

(Still very much under development).

Example

You can see a full example of generated documentation in the docs folder.

Given a test file:


/*
 * @object thing
 * @description a module of things
 */
var thing = {
    /*
     * @name foo
     * @description a cool function
     * @param x does something
     * @returns a number
     */
    foo: function(x) {
        return 42;
    }
}

Running:

$ doccy test.js -o docs

Will create docs/test.md that looks like so:

## `thing`

_a module of things_

### `foo`

_a cool function_

Parameters:

- `x`: does something

**Returns:** a number

If you'd like a full example, the Doccy documentation is generated from Doccy itself.

CLI Globbing

Rather than specify each file individually, the more common use of Doccy's small CLI tool is to pass in a glob:

$ doccy "src/*.js"

Will create a Markdown documentation file for each JS file within the src directory. By default doccy will put these into a docs folder, that it will create if needed, but you can specify the output directory with the -o flag:

$ doccy "src/*.js" -o documentation

Supported Keys

Order is not important, and things within [] are optional.

  • @name function_name
  • @description function_description
  • @param name [{Type}] description
  • @returns description
  • @object name - denotes a "containing" object (see above example, which is much clearer)

TODO

  • allow options for changing Markdown formatting
  • add more keys
  • make a Grunt plugin
  • document programmatical usage

Contributors

Thanks to the following people for their help :)

### Contributing

Please follow the existing style of code - recommend using EditorConfig to help you out with this.

To generate documentation, run npm run doccy.

Changelog

0.0.5

  • added type support to @param

0.0.4

  • added CLI tool for globbing support

0.0.3

  • added object key for denoting a "containing" object

0.0.2

  • added description key

0.0.1

  • initial release

doccy's People

Contributors

jackfranklin avatar jonathan-fielding avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

doccy's Issues

[Question] What's the motivation behind doccy?

Is it simply to provide a solution that creates markdown docs from .JS source? Or are you looking to do things differently from existing solutions because you have alternative ideas.

Jsdoc 3 appears to be the most obvious solution for generating docs from source comments. But it generates HTML.

But, it looks like you could write a plugin and build off of jsdoc's parsing functionality. This means you get the benefits of the parsing as well as getting to use a well understood set of tags e.g. @object is a new one and slightly ambiguous.

I really like the idea of getting simple .md output from a docing tool. It would be easy to then integrate with a site e.g. a Jekyll one. But I'd like to be able to use jsdoc 3 tags.

How to support Markdown templating

It's possible that some may not like Doccy's default Markdown for formatting, and we should make it possible to change this.

I'm envisaging some JSON file that looks something like:

{
  "param": "- `{{name}}` (`{{type}}`): {{description}",
}

But that might become unwieldy quickly...

Grunt Plugin

Would be useful - got a few projects that use Grunt I'd like to document.

@Jonic you were going to make a start on this? :)

Parameters not being parsed

Hi

I tried this

ssm.browserResize = function(localBrowserWidth){
        /*
     * @name ssm.browserResize
     * @description a cool function
     * @param localBrowserWidth: Provides the method with the browser width scoped to this method
     */
        browserResize(localBrowserWidth)
    };

and the output was

### `ssm`

_a cool function_

I was expecting my method name to be returned allong with the parameter it accepts

Also this would be my preferred way of documenting as this is the public version of my method, i dont want to have to wrap my public reference in a method.

 /*
     * @name ssm.browserResize
     * @description a cool function
     * @param localBrowserWidth: Provides the method with the browser width scoped to this method
     */
    ssm.browserResize = browserResize;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.