docs/README.md
We use the jsdoc tool to create API documentation.
What does the documentation consist of:
location: docs/apidocs_static
This is where static documentation is stored in the jsdoc format.
Descriptions of API methods are located in .cpp,.h files where the implementation of the methods is located.
The description is in jsdoc format (see https://jsdoc.app), but the first line should indicate that this is APIDOC documentation.
Like api.log., api.interactive....
/** APIDOC
* Write messages to log and console
* @namespace log
*/
LogApi::LogApi(api::IApiEngine* e)
: ApiObject(e)
{
}
There must be the @namespace tag with the namespace name
/** APIDOC
* Class representing a lyric.
* @class Lyric
* @hideconstructor
*/
class Lyric : public EngravingItem
{
...
There must be the @class tag with the class name
If the type cannot be created in js using the new operator,
then we need to add the @hideconstructor tag
/** APIDOC
* Show information message
* @method
* @param {String} title Title
* @param {String} text Message
*/
void InteractiveApi::info(const QString& contentTitle, const QString& text)
{
There must be the @method tag
/** APIDOC @property {number} - count of lyrics */
int Score::lyricCount() const
There must be the @property tag, the description should be in one line
/** APIDOC
* Question buttons
* @enum
*/
enum Button {
...
};
There must be the @enum tag
When generating documentation, we first extract this documentation from the cpp files.
location: snapshots
To be able to view the documentation for each version, we generate snapshots of the documentation for each version and place them in the appropriate folder, for example: snapshots/4.5, snapshots/4.6
location: index.html - this is the entry point for https://musescore.github.io
After generating a snapshot for a new version, we need to add a link to it in this index.html, like others.
location: tools/jsdoc
List of tools:
jsdoccpp files. It extracts documentation and stores it in temporary, fake js files so that jsdoc can process them.jsdocjsdoc installThis tool requires node.js and npm to be installed to work. To run scripts on Windows, use GitBash.
The generated documentation is placed in a temporary dir gen_apidoc.
When developing a new version of an application, adding new APIs or changing current ones, or for those that don't have documentation, we need to write documentation, just like any other change in the repository.
After releasing a new version of the application, we need to generate a snapshot of the API documentation for it.
Process:
bash ./tools/jsdoc/jsdoc_install.shbash ./tools/jsdoc/jsdoc_run.sh./tools/jsdoc/gen_apidoc/./tools/jsdoc/gen_apidoc/ to musescore.github.io/snapshots/x.xmusescore.github.io/index.html