esdoc / esdoc-plugins

MIT License
139 stars 74 forks source link

esdoc-publish-markdown-plugin - config missing #11

Open objectkit opened 7 years ago

objectkit commented 7 years ago

Hi! I think this plugin will come in handy for GitBook integration. However, it is not configurable at the moment. I have provided the same options to esdoc-standard-plugin and esdoc-publish-markdown-plugin. The standard plugin works, but the markdown plugin includes private properties

.esdoc.json

{
    "source": "./src/main/js",
    "destination": "./docs",
    "plugins": [
        {
            "name": "esdoc-standard-plugin"
        ,   "option": {
                "accessor": {
                    "access": ["public"]
                ,   "autoPrivate": true
                }
            }
        }
    ,
        {
            "name": "esdoc-publish-markdown-plugin"
        ,   "option": {
                "accessor": {
                    "access": ["public"]
                ,   "autoPrivate": true
                }
            }
        }
    ]
}

mock source file

import { Model } from "app/mvc/model/Model"
import { View } from "app/mvc/view/View"

export class Controller {

    /**
     * Create a new Controller.
     *
     * @param {Model} [model=new Model] A Model
     * @param {View} [view=new View] A View
     * @constructor
     * @see {@link Controller#setModel}
     * @see {@link Controller#setView}
     */
    constructor (model = new Model, view = new View) {
        console.info(new.target.name)
        this.setModel(model)
        this.setView(view)
    }

    /**
     * Set the Controller Model
     * @param {Model} model A model
     * @return {void}
     * @see {@link Controller#getModel}
     */
    setModel (model) {
        console.info(`Controller#setModel(View):void`)
        model.setController(this)
        /** @private */
        this._model = model
    }

    /**
     * Get the Controller Model
     * @return {Model}
     * @see {@link Controller#setModel}
     */
    getModel () {
        return this._model
    }

    /**
     * Set the Controller View
     * @param {View} view A View
     * @return {void}
     * @see {@link Controller#getView}
     */
    setView (view) {
        console.info(`Controller#setView(View):void`)
        view.setController(this)
        /** @private */
        this._view = view
    }

    /**
     * Get the Controller View.
     * @return {View}
     * @see {@link Controller#setView}
     */
    getView () {
        return this._view
    }
}

Output from esdoc-publish-markdown-plugin:

Controller

constructor(model: Model, view: View)

Create a new Controller.

_model: *

_view: *

setModel(model: Model): void

Set the Controller Model

Name Type Attribute Description
model Model A model

getModel(): Model

Get the Controller Model

Name Type Attribute Description

setView(view: View): void

Set the Controller View

Name Type Attribute Description
view View A View

getView(): View

Get the Controller View.

Name Type Attribute Description

I'm surprised that _model:* and _view:* were included as option.accessor.autoPrivate was set to true.

I can see that this plugin is POC, but its a good one!

It would be great if

        {
            "name": "esdoc-publish-markdown-plugin"
        ,   "option": {
                "accessor": {
                    "access": ["public"]
                ,   "autoPrivate": true
                }
            ,  "template": "./src/manual/template/publish-template.md"
            }
        }

What do you think?