Created
January 23, 2022 10:06
-
-
Save Kinjalrk2k/d47601ce91c27815cbc9e1971637e7ac to your computer and use it in GitHub Desktop.
JsDoc to Markdown with folder structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const jsdoc2md = require("jsdoc-to-markdown"); | |
const fs = require("fs"); | |
const path = require("path"); | |
// const dirs = fs.readdirSync(path.resolve(".")); | |
// console.log(dirs); | |
const glob = require("glob"); | |
glob("**/*.js", { ignore: "node_modules/*/**" }, async (err, files) => { | |
console.log(files); | |
await Promise.all( | |
files.map(async (file) => { | |
const output = await jsdoc2md.render({ files: file }); | |
console.log(path.dirname(file)); | |
fs.mkdirSync(`docs/jsdoc/${path.dirname(file)}`, { recursive: true }); | |
fs.writeFileSync(`docs/jsdoc/${file}.md`, output, { flag: "a+" }); | |
}) | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment