UNPKG

vue-docgen-cli

Version:

Generate documentation markdown files from VueJs components using the vue-docgen-api.

35 lines (34 loc) 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("./utils"); const formatBindings = bindings => { if (!bindings) { return ''; } return bindings .map(binding => { const { name, description, type } = binding; if (!type) { return ''; } return `**${name}** \`${type.name === 'union' && type.elements ? type.elements.map(({ name: insideName }) => insideName).join(', ') : type.name}\` - ${description}`; }) .join('\n'); }; exports.default = (slots, opt = {}) => { return ` ${opt.isSubComponent || opt.hasSubComponents ? '#' : ''}## Slots | Name | Description | Bindings | | ------------- | ------------ | -------- | ${slots .map(slot => { const { description, bindings, name } = slot; const readableBindings = bindings ? `${formatBindings(bindings)}` : ''; return `| ${(0, utils_1.mdclean)(name)} | ${(0, utils_1.mdclean)(description || '')} | ${(0, utils_1.mdclean)(readableBindings)} |`; // replace returns by <br> to allow them in a table cell }) .join('\n')} `; }; //# sourceMappingURL=slots.js.map