This content originally appeared on DEV Community and was authored by ZHZL-m
1 -> Overview
DevEco Studio allows you to use the Generate ArkTSDoc function to quickly generate reference documents for information that needs to be exposed, such as variables, methods, interfaces, and classes in code files.
illustrate
Currently, you can generate ArkTSDoc files from .ets/.ts/.js/.md files in your project or directory.
The variables, methods, interfaces, and classes exported in the file will generate the corresponding ArkTSDoc documents, and the objects that are not exported cannot be generated.
If you choose to export ArkTSDoc documents to the project/directory as a whole, the generated ArkTSDoc document directory is the same as the original directory structure.
2-> ArkTSDoc generation steps
In the menu bar, select Tools > Generate ArkTSDoc… Go to the ArkTSDoc generation page.
Set the scope of generating ArkTSDoc, you can select the entire project, a module or directory, or a single file for export. Specify the storage path of the exported ArkTSDoc in the Output directory.
- If you select the Open generated documentation in browser option, the corresponding page will be automatically opened to view the generated documentation after the ArkTSDoc is generated. After the configuration is complete, click Generate to start scanning and generating the ArkTSDoc file.
The document directory on the left side of the generated ArkTSDoc is the same as the original project directory, and you can click on the right to jump to the document location of a variable, method, interface or class contained in the current file.
- If you do not check the Open generated documentation in browser, after generating ArkTSDoc, a prompt box will pop up in the lower right corner of DevEco Studio, you can click Go to Folder to jump to the generated ArkTSDoc folder, and open the index.html file in the folder with a browser to view the ArkTSDoc document.
3 -> Generate an example of an effect
Annotation format requirements: Currently, only the “/** */” document annotation format is supported. JSDoc standard tags such as param and custom tags such as myTag can be used to generate corresponding documents.
/**
* Prints "log" logs.
*
* @param { string } message - Text to print.
* @myTag
* @since 11
*/
/**
* Defines the demo class
*
* @since 11
*/
export class Demo {
/**
* Prints "log" logs.
*
* @param { string } message - Text to print.
* @myTag
* @since 11
*/
static log(message: string): void {
}
}
ArkTSDoc document generation result:
This content originally appeared on DEV Community and was authored by ZHZL-m