Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Generate .md files for a whole project #255

shtlrs started this conversation in General
Discussion options

Suppose we have a src folder that contains multiple subfolders ( random architecture) and all the files have a .ts extension

Is it possible to generate all the .md files for those .ts only by specifying the path to a specific folder ?

For example:

src
│
└───apiWrappers
│ │
│ └───company
│ └─── companyAPIWrapper.ts
│ 
└───models
 │ customfield
 │ 
 └───properties
 | └───customFieldproperties.ts
 └───model.ts

when we run the command ( if it exists)
We will have the following:

src
│
└───apiWrappers
│ │
│ └───company
│ └───companyAPIWrapper.md
│ 
└───models
 │ customfield
 │ 
 └───properties
 | └───customFieldproperties.md
 └───model.md

And all the links & references will be of course made along.

You must be logged in to vote

Replies: 5 comments

Comment options

Hi, you can use the jsdoc2md API to create your preferred output file and folder structure.. see here for an example custom script..

You must be logged in to vote
0 replies
Comment options

That was not really my question.
Thanks anyway

You must be logged in to vote
0 replies
Comment options

Is it possible to generate all the .md files for those .ts only by specifying the path to a specific folder ?

Yes, it's possible - you can write a script that takes a folder path as input and writes output files to your required locations.. let me know if you have any other questions.

You must be logged in to vote
0 replies
Comment options

Is it possible to generate all the .md files for those .ts only by specifying the path to a specific folder ?

Yes, it's possible - you can write a script that takes a folder path as input and writes output files to your required locations.. let me know if you have any other questions.

Is there a documentation where it says how to make it generate those files according to the same paths of the input folder ?
So if we have a src folder, it'll generate the .md files in the docs folder while keeping the same folder structure.

Because I can't seem to find the part where it does that?

You must be logged in to vote
0 replies
Comment options

how to make it generate those files according to the same paths of the input folder

that's a specialised output file structure opinion that is not built into jsdoc2md (or jsdoc).. Currently, jsdoc2md takes file names as input and returns a string (an output string generated by customisable handlebars templates)..

You would need to write a custom script and control the output file structure yourself, something like this maybe?

/* assuming you have created the `dirs` directory structure already */
for (const dir of dirs) {
 for (const file of dir.files) {
 const output = await jsdoc2md.render({ files: file.name })
 /* define your output file structure logic here, e.g. */
 await fs.writeFile(`docs/${dir.name}/${file.name}.md`, output)
 }
}
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants
Converted from issue

This discussion was converted from issue #254 on September 28, 2021 18:28.

AltStyle によって変換されたページ (->オリジナル) /