The typedoc-plugin-include-example
plugin allows TypeDoc users to include code examples from external files directly into their documentation.
npm install typedoc-plugin-include-example --save-dev
- In your TypeScript comments, add the
@includeExample
directive followed by the path of the file you wish to include:
/**
* This is a sample function.
*
* @includeExample path/to/your/example.ts
*/
function myFunction() {
// ...
}
- When generating documentation with TypeDoc, make sure to include the plugin:
typedoc --plugin typedoc-plugin-include-example
MIT