typedoc-plugin-include-example

1.2.0 • Public • Published

The typedoc-plugin-include-example plugin allows TypeDoc users to include code examples from external files directly into their documentation.

Installation

npm install typedoc-plugin-include-example --save-dev

Usage

  1. 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() {
  // ...
}

@includeExample can also take in line numbers to include a specific range of lines from the file:

/**
 * This is a sample function of how to include lines 1-5 and 10 from `path/to/your/example.ts`
 *
 * @includeExample path/to/your/example.ts:1-5,10
 */
function myFunction() {
  // ...
}
  1. When generating documentation with TypeDoc, make sure to include the plugin:
typedoc --plugin typedoc-plugin-include-example

License

MIT

Package Sidebar

Install

npm i typedoc-plugin-include-example

Weekly Downloads

126

Version

1.2.0

License

none

Unpacked Size

157 kB

Total Files

31

Last publish

Collaborators

  • ferdodo