You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+180-9Lines changed: 180 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,21 +14,192 @@ npm run dev
14
14
15
15
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
16
16
17
-
## Learn More
17
+
## Usage
18
18
19
-
To learn more about Next.js, take a look at the following resources:
19
+
The documentation generator extracts comments from the code to generate structured documentation in **PDF** or **Markdown** format.
20
20
21
-
-[Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
22
-
-[Learn Next.js](https://nextjs.org/learn-pages-router) - an interactive Next.js tutorial.
21
+
### Comment Format
23
22
24
-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
23
+
For a comment to be recognized and included in the documentation, it must follow one of these formats:
25
24
26
-
## Deploy on Vercel
25
+
-**Single-line comments:**
26
+
```js
27
+
//Doc: This function retrieves user data.
28
+
// Doc: This function retrieves user data.
29
+
//doc: This function retrieves user data.
30
+
// doc: This function retrieves user data.
31
+
```
27
32
28
-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33
+
-**Multi-line comments:**
34
+
```js
35
+
/*Doc: This function retrieves user data. */
36
+
/* Doc: This function retrieves user data. */
37
+
/*doc: This function retrieves user data. */
38
+
/* doc: This function retrieves user data. */
39
+
```
29
40
30
-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/pages/building-your-application/deploying) for more details.
41
+
### Function Association
42
+
43
+
To associate a comment with a specific function, it must be placed **immediately before the function declaration**. Example:
44
+
45
+
```js
46
+
//Doc: This function retrieves user data from the database.
47
+
functiongetUserData() {
48
+
// Function logic here
49
+
}
50
+
```
51
+
52
+
### Supported Projects
53
+
54
+
Currently, this feature is only available for **JavaScript** projects. Support for additional languages may be added in future updates.
55
+
56
+
## Description
57
+
The automatic documentation generator is a tool that allows the creation and export of technical documentation in **PDF** or **Markdown** format for a project using the code and its comments with the help of **Jspdf** and **File-saver**.
A button that generates the documentation using the **DocumentationGenerator** function. At least one file must be selected, the project must have a name, and at least one output format must be chosen.
119
+
120
+
### Folder Selection Button
121
+
A button that calls **FolderSelector, FilesArray,** and **FilesArraySelection** functions to select a folder from the disk and update the table.
122
+
123
+
### File Selection Button
124
+
A button that calls **FilesSelector, FilesArray,** and **FilesArraySelection** functions to select one or more files from the disk and update the table.
125
+
126
+
### Output Format Checkbox
127
+
Allows the selection of output format (**PDF** or **Markdown**) using two checkboxes. Updates the **formats dictionary** and the **boolean values** of the checkboxes.
128
+
129
+
### File Table
130
+
Displays the file names and extensions to verify the correct detection of all selected files.
131
+
132
+
### Project Name Input Field
133
+
Retrieves the project name from the text input field to update it in **formData**. The input is stored in the **projectName** variable.
134
+
135
+
### Extension Name Text Field
136
+
Retrieves the names of extensions to analyze and updates the **formData** and the file table.
137
+
138
+
### Help Button
139
+
A component that displays a button to help users understand how the generator works.
140
+
141
+

142
+
143
+
## Functions
144
+
145
+
### FolderSelector()
146
+
Allows selection of the folder to analyze using **showDirectoryPicker**. Uses the **GetAllFiles** function to recursively retrieve files from subfolders. Returns an **array of files** in **filehandle** format.
147
+
148
+
### FilesSelector()
149
+
Allows selection of one or more files to analyze using **showOpenFilePicker**. Returns an **array of files** in **filehandle** format.
Takes an array of files and an **extensions string** as input. The function converts the extensions into an array and returns a call to the **FilterFiles** function.
153
+
154
+
### FilterFiles(array files, array extensions)
155
+
Takes the **file array** and **extensions array** as input to return an array of files containing the targeted extensions using **ToArrayExtensions**.
156
+
157
+
### ToArrayExtensions(string extensionsName)
158
+
Takes extensions **separated by commas** as a string and converts them into an array.
159
+
160
+
### OutputNameFilePDF(string projectName)
161
+
Takes the **project name** as input to return the output file name with **.pdf**.
162
+
163
+
### OutputNameFileMarkdown(string projectName)
164
+
Takes the **project name** as input to return the output file name with **.md**.
165
+
166
+
### OutputTitlePDF(string projectName)
167
+
Takes the **project name** as input to rewrite it as the title at the beginning of the **PDF output** file using the **jspdf** library in the format **"Documentation of projectName"**.
168
+
169
+
### OutputTitleMarkdown(string projectName)
170
+
Takes the **project name** as input to rewrite it as the title at the beginning of the **Markdown output** file in the format **"# Documentation of projectName"**.
Takes the **PDF and Markdown checkbox booleans** as input to create a **dictionary (array)** that will be used in **DocGenerator**. It also checks that at least **one of the two checkboxes is checked**.
174
+
175
+
### FileParsing(formData, rows)
176
+
Takes all the **data and sorted rows** as input to analyze the extension and choose the correct syntax for extracting comments and function names. It also generates a **dictionary** with the **file name, function names, and associated comments**.
Takes the **title, Markdown file name,** and **sorted file array** as input to generate the documentation in **Markdown format**.
183
+
184
+
### DocumentationGenerator(formData, rows)
185
+
Takes the **entire form data and sorted rows** as input to generate the output files by reusing the functions listed above (**FileParsing, OutputTitlePDF, OutputNameFilePDF, WritePDF, OutputTitleMarkdown, OutputNameFileMarkdown, WriteMarkdown**).
186
+
187
+

188
+
189
+
## Examples
190
+
191
+
Example documentation files generated by this project are available in the **examples** folder.
0 commit comments