-
Notifications
You must be signed in to change notification settings - Fork 0
/
docgen.config.js
39 lines (35 loc) · 1.2 KB
/
docgen.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const path = require("path");
function component(
renderedUsage, // props, events, methods and slots documentation rendered
doc, // the object returned by vue-docgen-api
config, // the local config, useful to know the context
fileName, // the name of the current file in the doc (to explain how to import it)
requiresMd, // a list of all the documentation files
// attached to the component documented. It includes documentation of subcomponents
{ isSubComponent, hasSubComponents }
) {
// are we documenting
const { displayName, description, docsBlocks } = doc;
return `
# ${displayName}
${docsBlocks ? docsBlocks.join("n") : ""}
${description ? `> ${description}` : ""}
${renderedUsage.props}
${renderedUsage.methods}
${renderedUsage.events}
${renderedUsage.slots}
`;
}
module.exports = {
componentsRoot: "src/lib/components",
components: "**/[A-Z]**.@(js|vue)",
outDir: "./src/docs/content/components",
defaultExamples: false,
getDestFile: (file, config) => {
const finalFileName = file.substring(file.indexOf("/") + 1).replace(/\.vue$/, ".md");
return path.join(config.outDir, finalFileName);
},
templates: {
component,
},
};