Skip to content

ferdodo/typedoc-plugin-include-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typedoc-plugin-include-example

Npm package npm GitHub Bundle size npm npm

Include code examples in your typedoc documentations with powerful bracket syntax for line selection.

Installation

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

Usage

Write your example in a *.example.ts file.

// greet.example.ts

import { greet } from "./greet.js";
greet(); // Prints greetings

Add the @includeExample tag to the actual code.

// greet.ts

/**
 * Says hello !
 *
 * @includeExample
 */
export function greet() {
  console.log("Hello there.");
}

Then generate your documentation using typedoc using this plugin.

$ npx typedoc --plugin typedoc-plugin-include-example

Line Selection

Control which lines to include with bracket syntax:

/**
 * @includeExample greet.example.ts                 // Include entire file
 * @includeExample greet.example.ts[5]              // Include line 5 only
 * @includeExample greet.example.ts[2:8]            // Include lines 2-8
 * @includeExample greet.example.ts[2:5,10,15:20]   // Multiple selections
 */

Features

See the Documentation for full usage including advanced bracket syntax, exclusions, negative indexing, and troubleshooting.

Links

About

Typedoc plugin to include files as example

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •