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: docs/developers/documentation.md
+19-5Lines changed: 19 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,23 +14,25 @@ Run the command `poetry install` in the root directory of jsPsych to install `mk
14
14
15
15
## Generating plugin documentation
16
16
17
-
Plugin documentation can be automatically generated from the JSDoc comments in plugin source files. The generator extracts:
17
+
Plugin documentation can be automatically generated from the JSDoc comments in plugin source files and examples in the `/examples` folder. The generator extracts:
18
18
19
19
- Plugin description from the class JSDoc comment
20
20
- Parameter information from the `info.parameters` object
21
21
- Data field information from the `info.data` object
22
-
- Example file references from the `examples/` directory
22
+
- Individual trial configurations from the example files in `/examples`
23
+
24
+
The generator converts examples into the documentation format with interactive Code/Demo tabs, eliminating the need to maintain separate example sets.
23
25
24
26
To generate documentation for a single plugin:
25
27
26
28
```bash
27
29
npm run generate-plugin-docs -- html-button-response
28
30
```
29
31
30
-
To generate documentation for all plugins:
32
+
To generate documentation for all plugins with demo HTML files:
31
33
32
34
```bash
33
-
npm run generate-plugin-docs -- --all --output docs/plugins
35
+
npm run generate-plugin-docs -- --all --output docs/plugins --demos-output docs/demos
34
36
```
35
37
36
38
To see all available options:
@@ -39,7 +41,19 @@ To see all available options:
39
41
npm run generate-plugin-docs -- --help
40
42
```
41
43
42
-
The generated documentation follows the same format as the existing plugin docs, including parameters tables, data generated tables, and install instructions.
44
+
Options:
45
+
46
+
-`--output, -o`: Directory for generated markdown files
47
+
-`--demos-output, -d`: Directory for generated demo HTML files
48
+
-`--all`: Generate docs for all plugins
49
+
-`--list`: List all available plugins
50
+
51
+
The generated documentation follows the same format as the existing plugin docs, including:
52
+
53
+
- Parameters tables
54
+
- Data generated tables
55
+
- Install instructions
56
+
- Examples with Code/Demo tabs that embed interactive demos
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
472
+
}
473
+
</script>
474
+
</html>
475
+
`;
476
+
}
477
+
478
+
/**
479
+
* Generates the examples section markdown with Code/Demo tabs.
// Fallback to simple link if no trials could be extracted
470
683
markdown+=`\n## Examples\n\n`;
471
684
markdown+=`See example file${examples.length>1 ? "s" : ""} in the [examples folder](https://github.com/jspsych/jsPsych/tree/main/examples) for usage demonstrations.\n`;
472
685
}
@@ -479,6 +692,8 @@ ${generateInstallSection(pluginName, version || "latest")}
0 commit comments