Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

compodoc

compodoc11.4kMITdeprecated0.0.41

Compodoc has moved to @compodoc/compodoc

The missing documentation tool for your Angular application

angular2, angular, documentation, components, module, graph, dependencies, markdown

readme

Compodoc: The missing documentation tool for your Angular application
Build Status Build Status Codecov npm badge npm dependencies npm devDependencies MIT badge

The missing documentation tool for your Angular application

Compodoc: The missing documentation tool for your Angular application

Features


  • Clean, simple design — With Compodoc, the main endpoints are on the left side of your documentation, and all the content on the right side

  • Beautiful themes — 7 themes are available from famous documentation tools like Gitbook, Read the Docs or projects like Vagrant, Laravel, Postmark and Stripe.

  • Search — Compodoc include a powerful search engine (lunr.js) for easily finding your information

  • Automatic table of contents - API table of contents is generated using elements found during files parsing

  • Open-source and on npm - Use it directly in your project using npm and one script, that's it !

  • A local tool - No server needed, no sources uploaded online

  • JSDoc light support - Support of @param, @returns, @link and @example tags

  • Documentation coverage - Get the documentation coverage report of your project

  • Angular-CLI friendly - Compodoc support out of the box Angular-CLI projects

Live Demo

Demo : documentation generated for TodoMVC Angular Compodoc demo project

Static Demo

Using SoundCloud API client / Angular2 project and default theme (gitbook)

README page Overview page
screenshot-1 screenshot-2
Modules page Single module page
screenshot-3 screenshot-4
Component page Source code tab
screenshot-5 screenshot-6
Search page Coverage report
screenshot-7 screenshot-8

Why this tool ?

Because we doesn't find our needs on existing tools. We want to have a single place where there is :

  • api documentation of code
  • component(s), directive(s), pipe(s), ... documentation
  • general documentation (*.md files)

Why not a SPA for outputed documentation ?

KISS principle or shortly "Keep it simple". We think static html files are simpler than another SPA inside an "SPA documentation".

Who's using Compodoc ?

These are some that we know of. Want your project listed here ? Drop us a line.

Table of Contents

Node.js versions

Compodoc is tested with only LTS versions : v6.9.4 & v4.7.1

Angular-CLI

Compodoc supports last Angular-CLI version : 1.0.0-beta-26

Just run Compodoc in a fresh or existing project.

Getting Started with compodoc

Install

Install from npm :

npm install -g compodoc

Usage

$ compodoc --help

Usage: compodoc <src> [options]

Options:

  -h, --help                         output usage information
  -V, --version                      output the version number
  -p, --tsconfig [config]            A tsconfig.json file
  -d, --output [folder]              Where to store the generated documentation
  -y, --extTheme [file]              External styling theme
  -n, --name [name]                  Title documentation
  -a, --assetsFolder [folder]        External assets folder to copy in generated documentation folder
  -o, --open                         Open the generated documentation
  -t, --silent                       In silent mode, log messages aren't logged in the console
  -s, --serve                        Serve generated documentation (default http://localhost:8080/)
  -r, --port [port]                  Change default serving port
  --theme [theme]                    Choose one of available themes, default is 'gitbook' (laravel, original, postmark, readthedocs, stripe, vagrant)
  --hideGenerator                    Do not print the Compodoc link at the bottom of the page
  --disableSourceCode                Do not add source code tab
  --disableGraph                     Disable rendering of the dependency graph
  --disableCoverage                  Do not add the documentation coverage report
  --disablePrivateOrInternalSupport  Do not show private or @internal in generated documentation

Local installation

npm install --save-dev compodoc

Define a script task for it in your package.json :

"scripts": {
  "compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.json"
}

and run it like a normal npm script :

npm run compodoc

Themes

Default (gitbook) Laravel
theme-gitbook theme-laravel
Readthedocs Stripe
theme-readthedocs theme-stripe
Vagrant Postmark
theme-vagrant theme-postmark
Original
theme-original

Common use cases

Render documentation

Documentation is generated in default output folder, then run your HTTP server in that folder.

compodoc -p src/tsconfig.json

Render documentation while providing source folder

compodoc src -p src/tsconfig.json

Serve generated documentation with compodoc

Documentation was generated in default output folder or a specific one, the local HTTP server is launched at http://localhost:8080

compodoc -s

or

compodoc -s -d ./doc

Render documentation, and serve it with compodoc

Documentation is generated in default output folder, and a local HTTP server is available at http://localhost:8080

compodoc -p src/tsconfig.json -s

Styling the documentation

compodoc -p src/tsconfig.json -y your_theme_styles/

Inside your folder you need to provide at least a style.css file with these 5 imports as below.

@import "./reset.css";
@import "./bootstrap.min.css";
@import "./bootstrap-card.css";
@import "./font-awesome.min.css";
@import "./compodoc.css";

Compodoc use bootstrap 3.3.7. You can customize Compodoc easily.

bootswatch.com can be a good starting point. If you want to override the default theme, just provide a bootstrap.min.css file, and it will override the default one.

└── your_theme_styles/
    ├── style.css // the main css file with default imports
    └── bootstrap.min.css // your bootstrap theme

Documentation of each component

A comment description in xxx.component.ts file, between JSDoc comments can be a little short.

Compodoc search for a default README.md file inside the root folder of each component, and add it inside a tab in the component page.

└── my-component/
    ├── my.component.ts
    ├── my.component.spec.ts
    ├── my.component.scss|css
    ├── my.component.html
    └── README.md

The live demo as a component documented in that way : TodoMVC Angular Compodoc demo / todo component

Remark for comments

Compodoc use Typescript AST parser and it's internal APIs, so the comments have to be JSDoc comments :

/**
 * Supported comment
 */

These ones are not supported :

/*
 * unsupported comment
 */

/*
  unsupported comment
 */

// unsupported comment

Currently Compodoc only support these JSDoc tags :

  • @param <param name>
  • @returns
  • @example
  • @link
/**
 * @param {string} target  The target to process see {@link Todo}
 *
 * @example
 * This is a good example
 * processTarget('yo')
 *
 * @returns      The processed target number
 */
function processTarget(target:string):number;

For @link you can use this three syntax like JSDoc:

  • for an internal reference
{@link Todo}
[Todo]{@link Todo}
{@link Todo|TodoClass}
  • for an external link
[Google]{@link http://www.google.com}
{@link http://www.apple.com|Apple}
{@link https://github.com GitHub}

For giving an example on directives, components and pipes decorators, use @example or markdown :

/**
 * Shows all events on a given day. Example usage:
 *
 *
  • <mwl-calendar-day-view
  • [viewDate]="viewDate"
  • [events]="events">
  • </mwl-calendar-day-view>
  • */
 /**
  * Shows all events on a given day. Example usage:
  *
  * @example
  * <mwl-calendar-day-view
  *  [viewDate]="viewDate"
  *  [events]="events">;
  * </mwl-calendar-day-view>
  */

Remark for routes

Follow the style guide and provide a const of type 'Routes' :

const APP_ROUTES: Routes = [
    { path: 'about', component: AboutComponent },
    { path: '', component: HomeComponent}
];

...

RouterModule.forRoot(APP_ROUTES)

Syntax highlighting in markdown files

Compodoc use Marked for markdown parsing and compiling to html. highlight.js has been added for supporting syntax highlighting.

Just use a normal code block in your markdown with correct language : Github help

The integrated languages are : json, bash, javascript, markdown, html, typescript

Excluding files

For excluding files from the documentation, simply use the exports property of tsconfig.json file.

Roadmap

  • <input disabled="" type="checkbox"> handle external markdown files as "functional" documentation
  • <input disabled="" type="checkbox"> watch/recompile feature while serving documentation
  • <input disabled="" type="checkbox"> support for Angular 1.5+ projects written in Typescript
  • <input checked="" disabled="" type="checkbox"> documentation coverage
  • <input checked="" disabled="" type="checkbox"> routes
  • <input checked="" disabled="" type="checkbox"> classes
  • <input checked="" disabled="" type="checkbox"> module(s) page(s) with comments
  • <input checked="" disabled="" type="checkbox"> component(s) page(s) with comments, API, class
  • <input checked="" disabled="" type="checkbox"> directives
  • <input checked="" disabled="" type="checkbox"> injectables
  • <input checked="" disabled="" type="checkbox"> interfaces
  • <input checked="" disabled="" type="checkbox"> pipes

Extensions

Gulp

There is a plugin available to run Compodoc with Gulp. You can find it on NPM:
https://www.npmjs.com/package/gulp-compodoc

JHispter

There is a JHipster module available to run Compodoc with JHipster. You can find it on NPM:
https://www.npmjs.com/package/generator-jhipster-compodoc

Contributing

Want to file a bug, contribute some code, or improve documentation? Excellent !

Read up on our guidelines for contributing.

Contributors

vogloblinsky |daniele-zurico|mattlewis92| :---: |:---: |:---: |:---: |:---: |:---: | vogloblinsky |daniele-zurico|mattlewis92

Resources

Inspired by stuff from angular2-dependencies-graph, ng-bootstrap

Logo designed using Book vector designed by Freepik

License

Everything in this repo is MIT License unless otherwise specified.

MIT © 2016 - Vincent Ogloblinsky

changelog

0.0.41 (2017-02-10)

Bug Fixes

  • app: remove TypeScript dependency for JSDoc tags (3a30eb7)
  • app: jsdoc tag example for component decorator (786aea2), closes #100, #90
  • app: UnhandledPromiseRejectionWarning (e9fdea5), closes #100, #103

Features

  • app @example for pipe, component and directive decorators (706322d)

0.0.40 (2017-02-08)

Bug Fixes

  • app: ts.getJSDocTags availability (b3af872), closes #104, #105
  • app: exclude part of the project from documentation generation (a7374a9), closes #102

0.0.39 (2017-02-06)

Bug Fixes

  • app: Private methods and properties are skipped / align to typedoc (8490983), closes #99
  • app: @link does not seem to be getting parsed for properties (d1fd592), closes #98
  • app: support indexable object (cceb933), closes #97
  • app: Support @internal in the module level as well (750cd63), closes #87
  • app: miscellaneous support | variables and functions (d758840), closes #55
  • app: remove base html tag, file:// support (0e5227d), closes #47 #35

Features

  • app: move to @compodoc/ngd (311facb)
  • app: disablePrivateOrInternalSupport flag (294d4e2)

Breaking changes

  • base tag removed. The documentation can now be opened directly with a browser.

0.0.38 (2017-01-27)

Bug Fixes

  • app: ngd call for output path with spaces (37fe0a6), closes #44
  • app: class constructor test (54b7c8e), closes #95
  • app: test if constructor available (bd1cb92)

0.0.37 (2017-01-26)

Features

  • app: extend directive documentation (1637178), closes #91
  • app: Support for @example from JSDoc (51cd282), closes #90
  • app: Support for @link from JSDoc (f05b7e7), closes #92
  • app: include constructor method in docs (ddd00dc), closes #94

0.0.36 (2017-01-23)

Bug Fixes

  • app: differentiate static members from instance members (c8460eb), closes #88

  • app: modules menu items shows even if no modules (af72453), closes #89

  • app: Image should resize to fit viewport (2b24237), closes #83

  • app: @input without type (0f92ca4)

  • app: file parsed doesn't exist (eda183d)

  • app: interface keys sorting with [key: string]: string; (4e4c5cd)

  • app: component output type issue with NewExpression (4e49d22)

  • app: parsing .d.ts (e38b571)

0.0.35 (2017-01-20)

Bug Fixes

  • app: multi-line in description and code hightlight in jsdocs params (816027e), closes #79 #77 #76

  • app: coverage report breaks (462cf95), closes #65 #80

  • app: dont link to files excluded via tsconfig (3063f10), closes #59

Features

  • app: show component output $event type (fa894f0), closes #60

0.0.34 (2017-01-19)

Bug Fixes

  • app: nvm or nodejs / windows support (0512c899), closes #44

Features

  • app: support external assets folder (90ba24d), closes #71

0.0.33 (2017-01-17)

Bug Fixes

  • app: handle path with spaces for ngd call (8037285), closes #44
  • app: nvm-windows path issue (7ac7373), closes #65
  • app: disable highlightjs line-numbers on bash code blocks (96a6ff4), closes #64
  • app: Cannot read property 'configuration' of undefined during external theme copy (2127408), closes #69

Features

0.0.32 (2017-01-12)

Bug Fix

  • app: src argument handling (14550f3), closes #63

0.0.31 (2017-01-11)

Bug Fixes

  • app: private properties in constructors (2222446), closes #61
  • app: functionSignature with Angular APIs (58316dd)

Features

  • app: link to Angular types (0b33f74), closes #57

0.0.30 (2017-01-10)

Bug Fixes

  • app: exclude internal members from generated documentation (fc795c8)
  • app: passing src and ngd error (c0cfb2f)

Features

  • app: add an option to disable the graph (927ed12)
  • app: Link to others types (10f72f7), closes #58
  • app: support TS shorthand for properties defined in constructor (2965762), closes #56

0.0.29 (2017-01-07)

Bug Fixes

  • app: handlebars breaking comments and highlightjs (1347b74), closes #49
  • app: Syntax highlighting issue with tabs (54edaa0), closes #50

Features

  • cli: Source folder option handling (c3e86c6), closes #48

0.0.28 (2017-01-03)

Bug Fixes

0.0.27 (2017-01-03)

Bug Fixes

  • app: graph generation with path with spaces (e833251), closes #43, #44

0.0.26 (2016-12-31)

Bug Fixes

0.0.25 (2016-12-31)

Features

  • app: source code tab (8824e75)
  • app: toggle buttons for menu (4037259)

0.0.24 (2016-12-28)

Bug Fixes

  • dependencies: handle @injectable and @component at the same time for metadata (f4d5ce8), closes #41

Features

  • app: library mode support, for gulp-compodoc (5a65d87)

0.0.23 (2016-12-15)

Bug Fixes

  • dependencies: multiple class declarations in one file (fbc0d7b), closes #37

Features

  • doc: details for supported comments (86851ca), closes #36

0.0.22 (2016-12-12)

Bug Fixes

  • routes: support for multiple components for same route (5782415), closes #33

Features

  • routes: extend routes page : empty path, pathMatch (4474973)

0.0.21 (2016-12-12)

Bug Fixes

  • app: es6 object.assign support (6c25f59)

0.0.20 (2016-12-12)

Features

  • search: search bar (3e3c8d0)
  • app: add interfaces management (896f233)

0.0.19 (2016-12-08)

Bug Fixes

  • menu: scroll to active link (1c1ef1f), closes #27
  • menu: simple routes or modules entry active class (ec81568)
  • dependencies: don't stop on routes parsing errors (cef716b), closes #26
  • app: default serving port flag (ea5ec23), closes #29

0.0.18 (2016-12-05)

Features

0.0.17 (2016-12-01)

Bug Fixes

  • chore: update supported version to Node.js 7+ (8a8e0f6), closes #18

0.0.16 (2016-11-29)

Bug Fixes

  • app: support old Node.js versions using babel (8b9139c), closes #25

Features

  • app: delete top navbar, prepare for next design release (9c1d7c2)

0.0.15 (2016-11-16)

Bug Fixes

  • overview: blocks alignment (6738c22)
  • parsing: class methods issue (05316cb)
  • parsing: don't create ts program for each child on a file, 300% boost ! (9f754cd)

0.0.14 (2016-11-15)

Bug Fixes

  • dependencies: display uncommented functions or variables (a9b47c2), closes #21

Features

  • app: syntax highlighting for markdowns files (c4800a7), closes #19

0.0.13 (2016-11-15)

Features

  • app: support of one README.md file for each component (f1c626d), closes #10

0.0.12 (2016-11-13)

Features

  • app: provide external styling theme file (3e4f98c), closes #9

0.0.11 (2016-11-13)

Bug Fixes

  • dependencies: windows file path issue (2567f87), closes #14

0.0.10 (2016-11-12)

Bug Fixes

  • app: logo is overlaying menu (71aad4b), closes #13

0.0.9 (2016-11-12)

Bug Fixes

  • app: exclude by default node_modules folder (69b1e4d), closes #11
  • app: handle ; after function in class (eb7c7e1), closes #12

Features

  • app: add nyc and codecovfeat (775875b)
  • routes: display redirectTo (e7448e7)
  • app: display error for routes parsing (69a52d7)

0.0.8 (2016-11-11)

Bug Fixes

  • app: isGlobal npm context test (3ddc9ce)

0.0.7 (2016-11-11)

Bug Fixes

  • app: local call of ngd, even compodoc installed globally or locally (8393fc0), closes #5
  • app: local/global call of ngd (b9163a7)
  • app: handle -s -d and -p correctly (dc0b388), closes #6

Features

  • app: rename file flag to tsconfig flag, details for base flag (3b21bc0)
  • app: specify Node.js version (c394caf)

Breaking changes

  • -f flag is now -p flag. More similar to tsc flags.

0.0.6 (2016-11-10)

Bug Fixes

  • app: handlebars not in the dependencies list (38aa0d6d)

0.0.5 (2016-11-09)

Bug Fixes

0.0.4 (2016-11-08)

Bug Fixes

Features

0.0.3 (2016-11-08)

Bug Fixes

  • app: title argument (4b37cf2)
  • app: css for menu, scroll bounce, mobile main height (839a49a)

Features

  • app: simple classes support (35f2cc5)

0.0.2 (2016-11-07)

Bug Fixes

  • modules: link to each module page (5673341)
  • module: exclude Angular2 modules, WIP... (0bc5dff3)
  • deps: cleaning (c817d4d)

Features

  • app: details on local server while serving (0bc5dff)
  • app: display elapsed time for generation (14c5bfd)
  • html-engine: put main page in cache (d2a9937)
  • app: silent mode (005e64b)
  • app: update screenshots (c33b729)
  • app: vectorised logo (5de613b)
  • app: mobile menu (b7ab594)

0.0.1 (2016-11-07)

Initial release

Features

Support of :

  • components
  • modules
  • directives
  • pipes
  • injectables